Compare commits

..

364 Commits

Author SHA1 Message Date
Riccardo Elitropi a1113ad94c EgtMachKernel :
- Aggiunta funzione per tasche passanti per volumi esterni al grezzo.
- migliorata la gestione dei lati aperti piccoli ( da testare )
- migliorie varie .
2024-03-13 11:23:07 +01:00
Riccardo Elitropi c321205086 EgtMachKernel :
- migliore svuotature.
2024-03-12 13:37:00 +01:00
Riccardo Elitropi 33f969a254 Merge commit '839639fcc85a0ff8799a6e2fc8e8778ad8772066' into Svuotature_LeadIn/Out 2024-03-04 13:26:55 +01:00
Riccardo Elitropi aad600faca EgtMachKernel :
- aggiunta svuotatura ottimizzata a spirale
- correzioni varie.
2024-03-04 13:26:39 +01:00
Riccardo Elitropi caee6ccb83 EgtMachKernel :
- migliorata gestione Archi
- migliorata gestioni lati aperti e gestione delle operazioni booleane tra regioni piane
- migliorie varie.
2024-03-01 17:51:23 +01:00
Dario Sassi 839639fcc8 EgtMachKernel :
- eliminate alcune variabili non usate.
2024-02-27 18:36:32 +01:00
Dario Sassi c3729befbb EgtMachKernel :
- modifiche e correzioni per flag di fine passata (301) in fresatura con lama a ZigZag e OneWay.
2024-02-27 10:36:52 +01:00
Dario Sassi a79d9c9fe8 EgtMachKernel :
- piccola correzione a fresature con attacco/uscita a scivolo.
2024-02-26 18:06:22 +01:00
Riccardo Elitropi 0980e10c33 Merge commit 'd3b281a858c34a3f760c5afd925417b421b1a6d6' into Svuotature_LeadIn/Out 2024-02-26 16:10:46 +01:00
Riccardo Elitropi 85258fe4c4 EgtMachKernel :
- migliorata gestione lati aperti e scelta ordine degli Offset.
- migliorie generali.
2024-02-26 16:08:59 +01:00
Dario Sassi d3b281a858 EgtMachKernel :
- migliorata fresatura di lato con lama con più passaggi (ZigZag e OneWay) con note utente
      SideElev anche negativa per avere controllo MaxMat con Step
      TrimExt=nClosedStmId per definire superficie chiusa con cui estendere/trimmare il percorso di lavoro.
2024-02-26 15:15:07 +01:00
Dario Sassi 37d0b8f552 EgtMachKernel :
- in Milling corretto calcolo punto inizio attacco nel caso percorso invertito per ZigZag o similare.
2024-02-22 16:59:14 +01:00
Riccardo Elitropi ecc2c66fac Merge commit '737124b0bd167e644bb1c0131e675f515cbecb1f' into Svuotature_LeadIn/Out 2024-02-22 09:48:25 +01:00
Riccardo Elitropi 97a0aed32c EgtMachKernel :
- piccola miglioria.
2024-02-22 09:48:05 +01:00
Dario Sassi 737124b0bd EgtMachKernel :
- modifiche per configurazione canonica robot da ZYY-ZYZ a ZYY-XYX.
2024-02-20 10:52:23 +01:00
Dario Sassi 09bdd4852d EgtMachKernel :
- corretto controllo catena cinematica in assenza di assi lineari (eliminato anche possibile crash).
2024-02-19 17:16:14 +01:00
Dario Sassi 1d3c722fd3 EgtMachKernel 2.6b4 :
- in simulazione aggiunti eventi Init e Exit a cui possono rispondere le funzioni lua OnSimulInit e OnSimulExit.
2024-02-19 14:54:50 +01:00
Dario Sassi 3ca2db72e9 EgtMachKernel 2.6b3 :
- adattamenti per modifiche a funzioni di Collision Detection.
2024-02-16 08:47:33 +01:00
Riccardo Elitropi c23c975275 Merge commit '028a5b7bbaab65b2d1111aeb67560a6ea01e0f39' into Svuotature_LeadIn/Out 2024-02-13 12:26:04 +01:00
Riccardo Elitropi b9e0c6e7e3 EgtMachKernel :
- implementazione Dijkstra per percorsi di ritorno.
2024-02-13 12:25:28 +01:00
Dario Sassi 028a5b7bba EgtMachKernel :
- aggiunta gestione macchine di tipo Robot, le altre sono ora definite di tipo Center.
2024-02-13 11:45:05 +01:00
Riccardo Elitropi dd28529753 Merge commit '1179ad7e84b5d7bca253c3219b8ba01e10082a08' into Svuotature_LeadIn/Out 2024-02-09 08:01:06 +01:00
Riccardo Elitropi 9d471f4647 EgtMachKernel :
- migliorie sui lati aperti.
2024-02-05 12:08:47 +01:00
Dario Sassi 1179ad7e84 EgtMachKernel 2.6b1 :
- migliorato controlli su testa e suo attrezzaggio per MultipleDrill.
2024-02-02 16:20:05 +01:00
Riccardo Elitropi 6c8d1931f3 EgtMachKernel :
- aggiunta gestione parametri ( Lati Aperti e Offset ottimizzati).
2024-02-02 13:00:37 +01:00
Riccardo Elitropi 7f8798a159 EgtMachKernel :
- migliorie selezione lati aperti.
- migliorie percorsi di ritorno.
2024-02-02 11:47:47 +01:00
Riccardo Elitropi 443fac5f0f EgtMachKernel :
- semplificazione curve con archi.
2024-02-01 13:23:43 +01:00
Riccardo Elitropi 84fc7b0dc3 EgtMachKernel :
- codice di prova per VRONI
- entrate Spiral - ZigZag.
2024-01-31 13:22:23 +01:00
Riccardo Elitropi 4f64b1efc2 EgtMachKernel :
- Entrate Helix e ZigZag ( codice di prova).
2024-01-30 13:30:18 +01:00
Riccardo Elitropi 9c09f30f08 Merge commit 'd8c5fe0ea751afacaf031f6029b0ce07b22b1547' into Svuotature_LeadIn/Out 2024-01-30 11:08:49 +01:00
Riccardo Elitropi e10f917bab EgtMachKernel :
- caricamento codice per Merge.
2024-01-30 11:05:08 +01:00
Dario Sassi d8c5fe0ea7 EgtMachkernel :
- ora vengono restituiti ThDiam e ThLength anche per le mortasatrici/seghe a catena (ovviamente vanno considerati nella direzione dell'utensile).
2024-01-29 19:54:17 +01:00
Dario Sassi a21be79df8 EgtMachKernel 2.6a2 :
- modificato controllo parametri in LuaEmtMoveAxes per evitare crash in R64
- piccole migliorie.
2024-01-25 08:35:26 +01:00
Riccardo Elitropi 073c5f737e EgtMachKernel :
- migliorie Tagli e Proeizioni
- percorsi di ritorno con Bisettori.
2024-01-22 13:04:13 +01:00
Riccardo Elitropi d57198ac19 EgtMachKernel :
- percorsi di ritorno con Vroni smussati ( algoritmo Douglas-Peucker).
2024-01-19 13:35:19 +01:00
Riccardo Elitropi ea20040495 Merge commit 'd66cc479364215ad5a542e0b9051d399e0b3c0d1' into Svuotature_LeadIn/Out 2024-01-19 11:48:20 +01:00
Riccardo Elitropi 6adad38ffa EgtMachKernel :
- migliorie lati aperti
- aggiunta messaggi errore.
2024-01-18 13:06:31 +01:00
Riccardo Elitropi bac737ee53 EgtMachKernel :
- Aggiunta caso speciale per Tool non cilindrici.
2024-01-18 09:18:37 +01:00
Riccardo Elitropi 4ae515befd EgtMachKernel :
- LeadIn/Out tool non cilindrici.
2024-01-17 13:20:51 +01:00
Dario Sassi d66cc47936 EgtMachKernel :
- aggiunta funzione ChangeMachGroupName di MachMgr.
2024-01-16 19:44:30 +01:00
Dario Sassi cd2315af46 EgtMachKernel 2.6a1 :
- ricompilazione con cambio versione.
2024-01-16 15:50:38 +01:00
Riccardo Elitropi 58b119c68f EgtMachKernel :
- LeadIn/Out tool non cilindrici, casi ottimizzati a trapezio.
2024-01-16 13:32:56 +01:00
Dario Sassi 204d63b7c9 EgtMachKernel :
- modifiche per gestione teste multiple in foratura con modalità fissa, singola o multipla.
2024-01-16 09:35:21 +01:00
Dario Sassi 5a5b48326f EgtMachKernel :
- in foratura con testa multiuscite senza assi rotanti tolta necessità di presenza Asse Ausiliario.
2024-01-15 17:21:54 +01:00
Dario Sassi bd448babd9 EgtMachKernel 2.5l6 :
- aggiunta gestione script opzionale OnSpecialTestCollisionAvoid per avere un test custom di verifica collisione nei movimenti link tra le lavorazioni.
2024-01-15 15:06:50 +01:00
Riccardo Elitropi 28e76415ed EgtMachKernel :
- LeadIn/Out Spiral per tool non cilindrici.
2024-01-15 13:36:53 +01:00
Riccardo Elitropi c163fe503e EgtMachKernel :
- Test per entrate/Uscite con tool non cilindrici.
- Proiezioni facce chiuse con tool non cilindrici.
2024-01-15 11:12:08 +01:00
Riccardo Elitropi c928a50243 EgtMachKernel :
- prima prova con tool non cilindrici, proiezioni.
2024-01-12 13:38:23 +01:00
Riccardo Elitropi ac8feb7a17 EgtMachKernel :
- utilizzo della funzione limite per LeadIn/Out.
2024-01-11 17:57:23 +01:00
Riccardo Elitropi 8ae1d4cdc2 EgtMachKernel :
- LeadIn/Out VORONOI e Dijkstra per casi ottimizzati a Spirale.
- migliorie sui percotrsi di ritorno.
2024-01-10 18:28:17 +01:00
Riccardo Elitropi d684f6fb82 EgtMachKernel :
- LeadIn/Out con VORONI e Dijkstra ( cammini minimi).
2024-01-09 18:48:31 +01:00
Riccardo Elitropi 0cbf148bb6 EgtMachKernel :
- primo Test LeadIn/Out con VRONI.
2024-01-08 13:23:43 +01:00
Dario Sassi 73ba4eb93a EgtMachKernel :
- allo script di aggiornamento utensili custom ora viene passata anche la SPEED (per permettere di sistemare il senso di rotazione indicato)
- nelle fresature in approccio e retrazione aggiunta gestione extra tra lunghezza di lavoro e lunghezza totale.
2024-01-06 15:47:57 +01:00
Dario Sassi 268fa05cc0 EgtMachKernel 2.5l5 :
- correzioni per forature semplici con rinvii
- correzioni per forature con aggregato da sotto.
2024-01-05 19:09:39 +01:00
Riccardo Elitropi ee9a446cc0 EgtMachKernel :
- Primo calcolo di LeadIn/Out.
2024-01-05 13:30:07 +01:00
Riccardo Elitropi 2e1d893d5d EgtMachKernel :
- Gestione LeadIn/Out ( inizio stesura funzioni).
2024-01-04 13:00:55 +01:00
Riccardo Elitropi cdfa857c02 Merge commit 'b7eee50e55973024da5fc7d80020ee7daacf64d2' into Svuotature_LeadIn/Out 2024-01-04 09:37:36 +01:00
Riccardo Elitropi b7eee50e55 EgtMachKernel :
- modifica funzione lati aperti.
2024-01-04 09:35:51 +01:00
Riccardo Elitropi 3cda97534e EgtMachKernel :
-piccola modifica.
2024-01-04 09:35:14 +01:00
Riccardo Elitropi 5975b00def EgtMachKernel :
- implementazione CalcRegionElevation.
2024-01-04 09:33:47 +01:00
Riccardo Elitropi d845442ebd Merge commit 'b5ef9ae6dc7564e172af1a7558348e60b5da6a0f' into svuotature 2024-01-03 09:32:55 +01:00
Dario Sassi b5ef9ae6dc EgtMachKernel :
- aggiunto nuovo calcolo elevazione per un segmento dati gli estremi
- in fresatura migliorato approccio e retrazione per lame e frese che non lavorano di testa e non considerate fuori completamente dal pezzo.
2024-01-02 16:00:59 +01:00
Dario Sassi fcaf15cbe1 EgtMachKernel :
- in generazione CN e stima si imposta fase a 1 prima dell'inizio e al termine
- in simulazione aggiunta gestione errore in evento OnToolSelect.
2023-12-29 13:08:21 +01:00
Riccardo Elitropi 511d1c0aef EgtMachKernel :
- primo codice per Lead In/out.
2023-12-22 13:12:32 +01:00
Riccardo Elitropi 4c25e19753 EgtMachKernel :
- migliorie codice.
2023-12-22 11:59:17 +01:00
Dario Sassi ab84757a80 EgtMachKernel 2.5l4 :
- piccole migliorie e correzioni a forature multiple con aggregato.
2023-12-20 17:37:34 +01:00
Dario Sassi 0fab073568 Merge remote-tracking branch 'origin/Drilling' 2023-12-20 08:22:21 +01:00
Dario Sassi 4d29452c2d EgtMachKernel :
- in fresatura aggiunta gestione movimento compensazione raggio utensile in ingressi e uscite lineari e tangenti anche senza correzione raggio fresa in macchina.
2023-12-19 16:47:43 +01:00
Riccardo Elitropi f8de95a6b6 EgtMachKernel :
- adattamento funzione VerifyPathFromBottom e GeneratePocketingPv.
2023-12-19 11:45:10 +01:00
Riccardo Elitropi 2c1cd101b2 EgtMachKernel :
- Aggiunta funzione che svuota le parti non svuotate di una lavorazione precedente.
2023-12-19 11:01:39 +01:00
Riccardo Elitropi f5a94ee0dd EgtMachKernel :
- lavorazione precedente. Primo test.
2023-12-18 13:10:38 +01:00
Dario Sassi 1bcff0eb79 EgtMachKernel :
- in svuotatura cambiato calcolo elevazione.
2023-12-18 09:31:31 +01:00
Riccardo Elitropi 790660e549 EgtMachKernel :
- rimozione funzioni non necessarie e pulizia codice.
2023-12-18 09:08:15 +01:00
Dario Sassi 52bcc69023 EgtMachKernel 2.5l3 :
- in fresature migliorato calcolo di retrazione orizzontale quando quasi sotto il pezzo con utensile lama o fresa notip.
2023-12-15 19:57:55 +01:00
Riccardo Elitropi d60cec01ef EgtMachKernel :
- primo codice di Test Volumi di svuotatura.
2023-12-15 19:31:11 +01:00
Dario Sassi 18ccead437 EgtMachKernel 2.5l2 :
- rimossa costante non più utilizzata.
2023-12-11 10:28:31 +01:00
Dario Sassi d49f198720 EgtMachKernel :
- ulteriori migliorie nel calcolo dell'elevazione.
2023-12-07 11:00:26 +01:00
Dario Sassi 368721dcaa EgtMachKernel 2.5l1 :
- elevation ora viene calcolato più precisamente tramite Collision Avoid.
2023-12-01 16:51:48 +01:00
Riccardo Elitropi 9267f902ae EgtMachKernel :
merge con Master.
2023-11-29 12:41:34 +01:00
Riccardo Elitropi 4558f5d842 Merge commit 'c8c8d9e2a52041f2b511b5a4d9325945733f0a22' into svuotature 2023-11-29 12:27:32 +01:00
Riccardo Elitropi a404881759 EgtMachKernel :
- migliorata gestione Chunk per OneWay.
2023-11-29 12:19:06 +01:00
Dario Sassi c8c8d9e2a5 EgtMachKernel :
- preparazione nuova gestione calcolo elevazioni.
2023-11-28 09:39:06 +01:00
Dario Sassi d5c39485ea EgtMachKernel 2.5k3 :
- aggiunta la possibilità di forzare sempre la visualizzazione del versore fresa negli oggetti CamData
- le funzioni lua EmtAddRapidStart, EmtAddRapidMove, EmtAddLinearMove e EmtAddArcMove ora hanno un parametro opzionale in più per forzare la visualizzazione della direzione utensile
- agli script per Lavorazioni Generiche ora sono passati parecchi dati geometrici e non dell'utensile utilizzato
- in visualizzazione dei percorsi in Doppio ora si tiene conto anche del parametro opzionale DeltaZ.
2023-11-22 20:31:38 +01:00
Dario Sassi e14c8eb8b3 EgtMachKernel 2.5k2 :
- correzioni a CalculateClPathAxesValues per lavorazioni 5 assi in continuo.
2023-11-16 18:59:46 +01:00
Riccardo Elitropi 77cd16a5b6 EgtMachKernel :
- volumi di pocketing .
2023-11-15 13:17:43 +01:00
Riccardo Elitropi c89683cc0e EgtmachKernel :
- primo codice per ricavare Volume di Pocketing.
2023-11-14 13:26:09 +01:00
Riccardo Elitropi cc50f573bc EgtMachKernel :
modifica funzione GetCurves.
2023-11-13 13:29:58 +01:00
Riccardo Elitropi c13dba8c9f EgtMachKernel :
- codice senza considerare il volume di svuotatura.
2023-11-13 08:15:21 +01:00
Riccardo Elitropi c8cd417dac EgtMachKernel :
- migliorie codice con test reali.
2023-11-09 17:11:39 +01:00
Riccardo Elitropi ce704bdcbc EgtMachKernel :
- migliorato codice OneWay.
2023-11-08 13:40:49 +01:00
Riccardo Elitropi 7ca922c9b6 EgtMachKernel :
- codice per casi ottimizzati ZigZag.
2023-11-07 17:46:49 +01:00
Riccardo Elitropi 4d02f573d2 EgtMachKernel :
- codice di test migliorato per casi ottimizzati a spirale.
2023-11-06 18:34:10 +01:00
Dario Sassi d5638e192c EgtMachKernel :
- corretta GetDistanceFromRawSide per sapere quanto una posizione è all'interno del grezzo (sbagliava se posizione sul bordo e direzione di fuga tangente al bordo).
2023-11-06 11:10:41 +01:00
Dario Sassi 85cdb84a5a EgtMachKernel :
- corretto crash in simulazione con posizione Tc vuota dovuto a modifiche commit precedente.
2023-11-06 09:33:17 +01:00
Dario Sassi 63a71db7ff EgtMachKernel :
- modifiche per gestire aggregati di utensili su tool changer.
2023-11-06 08:49:27 +01:00
Riccardo Elitropi 0dfc9a38da EgtMachKernel :
- primo codice di test da migliorare per Trapezi SpiralIn/Out.
2023-11-03 18:17:26 +01:00
Dario Sassi aa369739c9 EgtMachKernel 2.5k1 :
- ricompilazione con cambio versione.
2023-11-03 17:24:28 +01:00
Riccardo Elitropi 4ed4445d09 EgtMachKernel :
- Prime idee per ottimizzazioni.
2023-11-02 17:57:28 +01:00
Dario Sassi d19dfc5f8f EgtMachKernel 2.5j5 :
- migliorato calcolo approcci di fresature e svuotature
- in fresatura e svuotatura ora attacchi elica, zigzag e inseguimento partono 2mm sopra il materiale
- in fresatura migliorato passaggio ad inseguimento tra uno step e il successivo.
2023-11-01 19:21:28 +01:00
Riccardo Elitropi 072b47590e EgtMachKernel :
- casi ottimizzati Trapezi ( Codice non testato).
2023-10-31 16:43:04 +01:00
Riccardo Elitropi 31980fb85f EgtMachKernel :
- primo codice di prova per ottimizzazioni su step con geometrie uguali ( SpiralIn/Out/ZigZag).
2023-10-30 11:47:17 +01:00
Dario Sassi d874e30288 EgtMachKernel 2.5j4 :
- aggiunte a interfaccia di MachMgr le funzioni GetClEntAxesVal, GetToolSetupPosInCurrSetup e GetAllCurrAxesName.
2023-10-28 18:13:56 +02:00
Dario Sassi 4047b8385e EgtMachKernel :
- aggiunto messaggio di log nel caso di utensile non caricato perchè l'insieme tavola-testa non ha tre assi lineari.
2023-10-24 11:52:23 +02:00
Dario Sassi 63e95ab2fe EgtMachKernel 2.5j3 :
- migliorata simulazione con assi principali che non fanno movimento mentre lo fanno gli ausiliari (per controllo collisioni)
- la funzione EmtMoveAxes base per SimulMoveAxes ora gestisce fino a 10 assi in contemporanea.
2023-10-22 15:58:36 +02:00
Dario Sassi 93a5bd72c7 EgtMachKernel 2.5j2 :
- in creazione disegno utensile si nascondono eventuali Carter se è per visualizzazione in gestione DB utensili
- in OnToolData per generazione aggiunto parametro tipo utensile EMT.TTYPE
- in simulazione si lancia UpdateCurrSetup solo al primo avvio.
2023-10-16 16:10:24 +02:00
Riccardo Elitropi f51b05da5b EgtMachKernel :
- entrate rese coerenti tra i vari step ( SpiralIn/Out)
- rimozione del ricalcolo dei percorsi nel caso di geometria uguale tra gli step (SpiralIn/Out).
2023-10-11 13:17:34 +02:00
Riccardo Elitropi 46868459ae Merge commit 'b3a1ee8e6cbe1ea0c56e64133c96300e3f22bf89' into svuotature 2023-10-10 11:15:54 +02:00
Riccardo Elitropi ac85a09ff2 EgtMachKernel :
- migliorie per entrate.
2023-10-10 11:04:59 +02:00
Dario Sassi b3a1ee8e6c EgtMachKernel 2.5j1 :
- ricompilazione con cambio versione.
2023-10-09 13:02:22 +02:00
Dario Sassi 562e8342c3 EgtMachKernel 2.5i6 :
- in fresatura e svuotatura modificati approcci e retrazioni per macchine con TiltingTable (TURN) per stare più lontani dal materiale.
2023-09-27 21:11:18 +02:00
Dario Sassi 8c821750ba EgtMachKernel 2.5i5 :
- ricompilazione a 64bit con Enable Enhanced Instruction Set = Not Set.
2023-09-21 15:26:02 +02:00
Riccardo Elitropi 4ed01598a5 EgtMachKernel :
- controllo validità superfici e coerenza con le normali.
2023-09-18 13:17:24 +02:00
Dario Sassi 6669fdc7a9 EgtMachKernel :
- migliorato log di virtual  milling in simulazione.
2023-09-18 08:15:19 +02:00
Riccardo Elitropi ec91d76869 EgtMachKernel :
- migliorie proeiezioni e gesitoni lati aperti.
2023-09-15 13:06:31 +02:00
Dario Sassi e2043a7e3a EgtMachKerenl :
- piccole migliorie a simulazione (aumento velocità in rapidi e log).
2023-09-14 17:25:44 +02:00
Riccardo Elitropi cee893f4ca EgtMachKernel :
- migliorie varie.
2023-09-13 13:20:55 +02:00
Riccardo Elitropi 4e23dbe156 EgtMachKernel :
- migliorie gestioni lati aperti in adattamento a TriMesh
- inizio risoluzione problemi per lati aperti dentro al grezzo.
2023-09-12 17:35:31 +02:00
Riccardo Elitropi 944473df2e EgtMachKernel :
- migliorie gestioni lati aperti con isole chiuse molto vicine.
- migliorie generali e pulizia codice.
2023-09-11 13:31:23 +02:00
Dario Sassi f92cec9d3d EgtMachKernel 2.5i1 :
- aggiunta visualizzazione geometria di lavorazione in doppio per Drill, Pocketing e Milling
- a OnSetHead passata anche variabile globale EMC.USERNOTES con note utente dell'utensile
- in Simulazione corretto richiamo impostazione virtual milling su utensili con raggio maggiore del massimo gambo ammesso dal portautensile.
2023-09-11 10:47:42 +02:00
Riccardo Elitropi efde63ba64 EgtMachKernel :
- migliorie approssimazione curve e FlatRegions.
2023-09-08 13:41:35 +02:00
Riccardo Elitropi 09cddcf9ac EgtMachKernel :
- migliorie approssimazione sulle curve
- casi ottimizzati ZigZag con isole.
2023-09-07 13:08:34 +02:00
Riccardo Elitropi 7dcf367d48 EgtMachKernel :
- pulizia codice.
2023-09-06 09:48:03 +02:00
Riccardo Elitropi 5562a0f20c Merge commit 'f30f028b171a931f82cd15e95b4bea832a33c540' into svuotature 2023-09-06 09:47:26 +02:00
Riccardo Elitropi 05fb2ad32b EgtMachKernel :
- prova per svuotatura King e Sella.
2023-09-05 15:24:39 +02:00
Dario Sassi f30f028b17 EgtMachKernel 2.5h3 :
- aggiunta possibilità di copiare un gruppo di lavoro.
2023-08-27 18:30:01 +02:00
Riccardo Elitropi e146e1b6da EgtMachKernel :
- prime prove svuotatura King.
2023-08-25 13:33:24 +02:00
Dario Sassi 1adcb2991c EgtMachKernel :
- in SurfFinishing possibilità di invertire anche percorso di lavorazione a ZigZag.
2023-08-25 10:42:53 +02:00
Riccardo Elitropi 701fcbdd34 EgtMachKernel :
- piccole migliorie.
2023-08-23 12:45:09 +02:00
Riccardo Elitropi 44aef02ca1 EgtMachKernel :
- prime prove per extra steps.
2023-08-22 13:57:43 +02:00
Riccardo Elitropi 01d3e7baa9 EgtMachKernel:
- modifiche proiezioni con scalatura.
2023-08-21 13:32:56 +02:00
Dario Sassi 285e0ce910 EgtMachKernel 2.5h2 :
- aggiunta definizione EMC.VER con versione della dll a OnSetTable, OnSetHead e OnVerifyProtectedAreas
- alla modifica di posizione o direzione di un asse si sistema anche la geometria per la simulazione
- alla modifica della posizione di una uscita si sistema anche la geometria per la simulazione
- corretto carico uscite di una testa per direzioni poco discoste da quelle canoniche non correttamente assegnate.
2023-08-19 11:53:38 +02:00
Riccardo Elitropi 98aac3154c EgtMachKernel :
- migliorie tagli di superifici per svuotature.
2023-08-17 17:13:31 +02:00
Riccardo Elitropi a839a29dce EgtMachKernel :
- adattamento svuotatura a Trimesh.
2023-08-10 13:14:44 +02:00
Riccardo Elitropi c58926bb5c EgtMachKernel :
- codice di prova. Adattamento superficie di svuotatura a Trimesh iniziale.
2023-08-04 13:40:35 +02:00
Riccardo Elitropi ea36a0b8a1 EgtMachKernel :
- Test codice.
2023-08-03 13:12:53 +02:00
Dario Sassi 652aa35aaa EgtMachKernel 2.5h1 :
- alla info di testa ZMAXONROT aggiunto parametro opzionale (3°) che indica lo spessore dei pezzi oltre il quale applicare la prescrizione.
2023-08-02 20:02:50 +02:00
Riccardo Elitropi c7070e5f2f EgtMachKernel :
- pulizia del codice.
2023-08-02 13:10:25 +02:00
Riccardo Elitropi a5007038b8 Merge commit '2b5aacc160c24afa2dc9ca348e57a204992c5880' into svuotature 2023-08-01 11:36:59 +02:00
Riccardo Elitropi ff8e875290 EgtMachKernel :
- migliorata la regione di incidenza per lati aperti
- controllo pulizia dei lati aperti con angoli piccoli.
2023-08-01 11:35:38 +02:00
Riccardo Elitropi d7a5f4aa72 EgtMachKernel :
- migliorati casi ottimizzati trapezi e ZigZag con 0 lati aperti.
2023-07-28 17:02:29 +02:00
DarioS 2b5aacc160 EgtMachKernel 2.5g3 :
- corretta fresatura zigzag con attacco con componente in direzione utensile (poteva risultare movimento nullo con conseguente erore)
- modificato controllo indeterminazione angoli su primo asse rotante per gestire correttamente macchina Multiax C1522 con rinvio da sotto.
2023-07-27 09:31:59 +02:00
Riccardo Elitropi 7cd3925e4c EgtMachKernel :
- merge con master.
2023-07-26 13:13:27 +02:00
Riccardo Elitropi 25f141fbf0 Merge commit '1097f2a19f77801d64fe615ec214a3cba214c818' into svuotature 2023-07-26 11:58:33 +02:00
Riccardo Elitropi ed677dfec6 EgtMachKernel :
- migliorie varie.
2023-07-26 11:45:43 +02:00
Riccardo Elitropi 61d5029db9 EgtMachKernel :
- migliorate le proeizioni.
2023-07-24 13:27:17 +02:00
DarioS 1097f2a19f EgtMachKernel :
- semplificazioni con utilizzo di ConvertCurveToComposite.
2023-07-21 15:12:35 +02:00
DarioS 8c1b61b6b8 EgtMachKernel 2.5g2 :
- prima di fare il calcolo degli assi nell'update delle lavorazioni si cancellano le entità di tipo CLIMB, RISE e HOME che potrebbero dare errori come extra-corse e che in ogni caso verrebbero cancellate e ricalcolate subito dopo con la funzione AdjustStartEndMovements.
2023-07-20 20:43:33 +02:00
Riccardo Elitropi 4cd354c85a EgtMachKernel :
- primo prototipo funzione di ricerca dei falsi lati aperti.
2023-07-19 13:44:41 +02:00
DarioS 80363af1f6 EgtMachKernel :
- piccola miglioria stilistica.
2023-07-19 09:54:12 +02:00
Riccardo Elitropi 0fd0b12445 EgtMachKernel :
- modifiche lati aperti e Offset sulle curve omogenee.
2023-07-18 13:33:39 +02:00
Riccardo Elitropi 2a3a9fefe3 EgtMachKernel :
- finti lati aperti.
2023-07-17 13:42:53 +02:00
Riccardo Elitropi 1fef9786ac EgtMachKernel :
- Intersezioni e proiezioni, gestione dei nuovi lati aperti.
2023-07-11 16:29:48 +02:00
Riccardo Elitropi 6d8848ec46 EgtMachKernel :
- Migliorie proiezioni.
2023-07-10 13:19:42 +02:00
DarioS 9b5adeaeb3 EgtMachKernel :
- i movimenti in rapido sono disegnati tratteggiati.
2023-07-10 11:17:59 +02:00
DarioS 01854f30ed EgtMachKernel 2.5g1 :
- in svuotatura corretta gestione forzatura contorni chiusi (Open=0 in UserNotes della lavorazione) con i casi ottimizzati.
2023-07-07 17:08:56 +02:00
Riccardo Elitropi 2616d97d0a EgtMachKernel :
- migliorie proiezioni con grezzi con lati curvi.
2023-07-07 13:43:50 +02:00
Riccardo Elitropi 3fa4e64cc2 EgtMachKernel :
- modifiche lati aperti e proiezioni.
2023-07-06 13:13:41 +02:00
Riccardo Elitropi 648ca06815 EgtMachKernel :
- semplificazione proiezione grezzo.
2023-07-05 13:31:21 +02:00
Riccardo Elitropi 638d252b38 EgtMachKernel :
- migliorie sui lati aperti.
2023-07-04 13:37:55 +02:00
Riccardo Elitropi cd2a7cc921 EgtMachKernel :
- Merge con Master.
2023-07-03 13:35:53 +02:00
Riccardo Elitropi 919ca81c43 Merge commit 'cdb35b4c38c4b3ca65f90c061aa46d4db1f9506f' into svuotature 2023-07-03 13:34:24 +02:00
Riccardo Elitropi 6935bec958 EgtMachKernel :
- migliorie proiezioni grezzo con isole aperte e contorni chiusi.
2023-06-30 13:29:59 +02:00
DarioS cdb35b4c38 EgtMachKernel 2.5f3 :
- dove possibile e sicuro sostituiti dynamic_cast con static_cast.
2023-06-30 11:51:03 +02:00
Riccardo Elitropi 8e52fd584a EgtMachKernel :
- migliorie proiezioni.
2023-06-29 13:14:54 +02:00
Riccardo Elitropi f69de493d6 EgtMachKernel :
- prima versione aggiornata per proiezioni ( temporaneo).
2023-06-28 13:26:34 +02:00
Riccardo Elitropi e04805a99a EgtMachKernel :
- migliorie codice proiezione con grezzo.
2023-06-27 13:43:26 +02:00
Riccardo Elitropi ccac200e41 EgtMachKernel :
- conservazione temp prop in Operation per curve.
- migliorie intersezioni trimesh con piano.
2023-06-26 13:36:36 +02:00
Riccardo Elitropi 2c501206b2 EgtMachKernel :
- minimizzati i percorsi di estensione sui lati aperti con archi
- controlli su regioni svuotate in precedenza.
2023-06-23 13:39:52 +02:00
Riccardo Elitropi 297bc0c86d EgtMachKernel :
- Aggiunta funzioni di distanza dal grezzo in Operation.
2023-06-23 09:33:39 +02:00
Riccardo Elitropi fac69a1d65 EgtMachKernel :
- merge file mancanti.
2023-06-23 09:19:28 +02:00
Riccardo Elitropi 4711734998 EgtMachKernel :
- merge con master.
2023-06-23 09:05:29 +02:00
Riccardo Elitropi e04a05831e Revert "Merge commit '994658da167a7ac3f607f4b535a65febe8f308d1' into svuotature"
This reverts commit e96f467b56, reversing
changes made to ec1ee961be.
2023-06-23 08:38:57 +02:00
Riccardo Elitropi e96f467b56 Merge commit '994658da167a7ac3f607f4b535a65febe8f308d1' into svuotature 2023-06-23 08:20:50 +02:00
Riccardo Elitropi ec1ee961be EgtMachKernel :
- migliorie archi lati aperti.
2023-06-22 13:14:35 +02:00
Riccardo Elitropi ca74fa6794 EgtMachKernel :
- migliorie.
2023-06-21 13:23:32 +02:00
Riccardo Elitropi 8242146446 EgtMachKernel :
- migliorie unione sui lati aperti.
2023-06-20 13:29:13 +02:00
DarioS 994658da16 EgtMachKernel :
- in simulazione aggiunta gestione collisione anche con poliedri.
2023-06-19 08:12:03 +02:00
Riccardo Elitropi 4e2df90961 EgtMachKernel :
- Isole aperte generate da lati aperti
- migliorie alle approssimazioni degli archi.
2023-06-16 13:45:33 +02:00
DarioS 135c0bda51 EgtMachKernel 2.5f2 :
- correzione in fresatura per approccio con lame/frese notip.
2023-06-14 15:05:46 +02:00
Riccardo Elitropi 3393ea8325 EgtMachKernel :
- prima prova di taglio con grezzo a disco.
2023-06-14 11:35:13 +02:00
Riccardo Elitropi 1060a10491 EgtMachKernel :
- test codice per Isole aperte ed intersezioni grezzo con esse
- migliorie alle curve.
2023-06-13 14:33:25 +02:00
DarioS d927848815 EgtMachKernel :
- in milling corretto approccio/retrazione di frese che non lavorano di testa.
2023-06-09 16:05:28 +02:00
Riccardo Elitropi d46f94f8da EgtMachKernel :
- prima prova per isole con lati aperti e gestione angoli piccoli.
2023-06-09 13:47:04 +02:00
DarioS 7b91c17cb3 EgtMachKernel :
- nell'interpretazione degli assi rotanti bloccati e degli angoli suggeriti dal token asse si toglie eventuale '=' finale che non può essere gestito nelle note utente della lavorazione.
2023-06-08 10:16:57 +02:00
DarioS 3851bdcecb EgtMachKernel 2.5f1 :
- in svuotature modificata gestione lati aperti, ora vengono lavorati con affondo laterali pari al passo di lato.
2023-06-08 08:17:54 +02:00
Riccardo Elitropi 3dcba13efc EgtMachKernel :
- merge con master.
2023-06-05 08:36:59 +02:00
Riccardo Elitropi e4983d5276 Merge commit 'df86ffdee340b33c359d7e6b57598a70c1a1c006' into svuotature 2023-06-05 08:33:45 +02:00
Riccardo Elitropi d2965af836 Merge commit 'df86ffdee340b33c359d7e6b57598a70c1a1c006' into Drilling 2023-06-05 08:27:00 +02:00
Riccardo Elitropi fee74d47f8 EgtMachKernel :
- migliorie varie in pocketing.
2023-06-05 08:25:31 +02:00
DarioS df86ffdee3 EgtMachKernel :
- migliorato controllo gestione chiave di rete.
2023-05-30 10:29:13 +02:00
DarioS 05a6f56cfe EgtMachKernel 2.5e5 :
- in fresatura modifiche a retrazione di frese NoTip e lame per allontanarsi quanto necessario dal pezzo in tutti i casi.
2023-05-29 15:53:50 +02:00
DarioS 8f7fdc3a80 EgtMachKernel 2.5e4 :
- negli angoli macchina suggeriti ora si tiene conto di Invert e di Offset (quindi per l'utente sono i valori che vede in simulazione e sul CN).
2023-05-26 08:43:48 +02:00
DarioS 90dbb068a9 EgtMachKernel 2.5e3 :
- correzzioni a svuotature ottimizzate per attacchi e sucite sui lati aperti (distanze).
2023-05-20 12:04:46 +02:00
DarioS 577143d176 EgtMachKernel 2.5e2 :
- correzione a Disposizione per gestire correttamente errori in casi senza testa equivalente.
2023-05-18 18:34:34 +02:00
Riccardo Elitropi 37f4e0982f EgtMachKernel :
- merge con master.
2023-05-11 11:50:21 +02:00
Riccardo Elitropi fb5e01881d Merge commit 'c6aa83ccd5c3d5819773872b6dbdbb6617517c4b' into svuotature 2023-05-11 11:40:21 +02:00
Riccardo Elitropi a5096facc7 EgtMachKernel :
- Feed ( test)
- Svuotatura con pocketing precedente
- correzioni varie.
2023-05-11 11:31:00 +02:00
DarioS c6aa83ccd5 EgtMachKernel 2.5e1 :
- ricompilazione per aggiornamento lua.
2023-05-03 09:46:50 +02:00
DarioS 9e12f9d3b6 EgtMachKernel :
- corretto Virtual Milling in Simulazione per frese che non lavorano di testa ma che si muovono con un piccolo angolo verso il basso (max 5deg).
2023-04-18 09:47:45 +02:00
DarioS fc6af5de55 EgtMachKernel :
- in svuotature con utensili che non possono lavorare di testa aggiunto controllo che effettivamente gli ingressi siano fatti a spirale o zigzag
- aggiunti controlli su Set di Frame3d con due versori per verificare non siano allineati.
2023-04-18 08:00:55 +02:00
DarioS 8afece4a6c EgtMachKernel :
- corretto errore visualizzazione Versori di oggetti CamData quando allineati
- nel calcolo angoli alzata tolleranza direzione richiesta allineata a direzione singolare a 0.001deg (tramite GetRotation con tolleranza SIN_EPS_ANG_SMALL).
2023-04-17 09:32:20 +02:00
DarioS dc3ed5ea0a EgtMachKernel :
- correzione in fresature a ZigZag per passaggio da uno step al successivo.
2023-04-14 10:00:04 +02:00
Riccardo Elitropi dbe11e6343 EgtMachKernel :
- prima versione per Feed ( da migliorare) .
2023-04-12 13:28:45 +02:00
DarioS 27a23bcdaa EgtMachKernel 2.5d3 :
- ricompilazione con cambio versione.
2023-04-11 19:38:44 +02:00
DarioS 7d554efe60 EgtMachKernel 2.5d2 :
- in taglio con lama modificato riconsocimento Fsta e Fend ora devono essere del tipo "Key=F,PuRed;" .
2023-04-06 18:03:24 +02:00
DarioS 075c0f4e95 EgtMachKernel :
- in svuotatura aggiunta gestione minima sicurezza su ingresso da lato aperto tramite nota "OpenMinSafe=Val" in Note utente.
2023-04-04 12:58:27 +02:00
DarioS 6378dddcdf EgtMachKernel 2.5d1 :
- eliminata la necessità di testa dummy per disposizioni con comandi StartAux o EndAux e senza movimenti diretti.
2023-04-03 08:50:46 +02:00
Riccardo Elitropi ed4a9ec745 EgtMachKernel :
- primo prototipo per funzione Feed.
2023-03-31 17:08:38 +02:00
Riccardo Elitropi 25b940927e EgtMachKernel :
- ottimizzazioni offset per centroidi e medial Axis
- ottimizzazione percorsi di medial Axis ( raccordi con centroidi ).
2023-03-30 18:01:05 +02:00
Riccardo Elitropi 0911f167b1 EgtMachKernel :
- Ottimizzazioni numero Offset per spirali.
2023-03-29 18:12:06 +02:00
Riccardo Elitropi 766e6a208d EgtMachKernel :
- correzione circonferenze per percorsi sui centroidi.
2023-03-28 17:34:17 +02:00
Riccardo Elitropi 9b0b1fe9d4 EgtMachKernel :
- merge con master.
2023-03-28 17:24:54 +02:00
Riccardo Elitropi 4d676c1f3b Merge commit '025eea9c0f0d77443110bc2fc19c3a2e6ee89c45' into svuotature 2023-03-28 15:56:27 +02:00
Riccardo Elitropi 3d5398f877 EgtMachKernel :
- prima versione svuotature ( isole, intersezioni e proiezioni grezzo, entrate ).
2023-03-28 15:47:32 +02:00
DarioS 025eea9c0f EgtMachKernel :
- aggiustamenti per PtrOwner nuova funzione Set.
2023-03-27 20:42:33 +02:00
DarioS 4b93557efe EgtMachKernel 2.5c2 :
- nelle lavorazioni all'aggiornamento utensile si prendono i dati opportuni anche dall'attrezzaggio corrente.
2023-03-23 19:08:44 +01:00
DarioS 04cf5a69a8 EgtMachKernel :
- migliorata gestione approcci/retrazione in fresature di utensili che non lavorano di testa
- corretta gestione passaggio da aperto a chiuso (curve a J) in svuotature.
- corretta gestione angolo di fianco in tagli con lama con variazioni di Z sulla linea da seguire.
2023-03-20 08:29:18 +01:00
DarioS 7d819a9500 EgtMachKernel :
- modifiche a fresature per approcci e retrazioni di lame e frese che non lavorano di testa
- in simulatore migliorati controlli per frese che non lavorano di testa.
2023-03-13 08:14:28 +01:00
DarioS a0da9d4e7d EgtMachKernel 2.5c1 :
- cambiato nome parametro a Operation::GetExtraZ per renderlo piùsignificativo.
2023-03-05 20:27:02 +01:00
DarioS dd960cb8a4 EgtMachKernel :
- modifiche in svuotature per gestione di lati aperti concatenati con rientranze.
2023-03-01 13:16:47 +01:00
DarioS 44af4a5bf4 EgtMachKernel 2.5b6 :
- ricompilazione con cambio versione.
2023-02-27 08:18:32 +01:00
DarioS 8ac85f6754 EgtMachKernel :
- in fresatura e svuotatura corretto calcolo direzione di approccio per testa da sopra con aggregato da sotto in presenza di geometria che esce dal grezzo.
2023-02-23 17:04:14 +01:00
DarioS e3cfe48da3 EgtMachKernel 2.5b5 :
- correzione in ApproxWithArcsIfUseful di Operation (non riconosceva i percorsi piani su piani diversi da XY).
2023-02-23 15:33:12 +01:00
DarioS 068e99df97 EgtMachKernel 2.5b4 :
- ricompilazione con cambio versione.
2023-02-20 09:17:12 +01:00
DarioS e3121ff553 EgtMachKernel 2.5b3 :
- modifiche quote approccio e retrazione
2023-02-17 12:08:10 +01:00
Riccardo Elitropi 0e8c41192d EgtMachKernel :
- Fori con più tools.
2023-02-16 15:11:47 +01:00
Riccardo Elitropi 38d63633c2 EgtMachKernel :
- Svuotature con intersezioni grezzo ( temp ).
2023-02-16 14:53:53 +01:00
Riccardo Elitropi 14b433d206 Merge commit '15931dc3046a4928e6d943e812a7e893befd9daa' into svuotature 2023-02-16 14:50:49 +01:00
DarioS 15931dc304 EgtMachKernel 2.5b2 :
- nel calcolo spostamenti in disposizioni (movimenti di pezzi con ventose) è ora possibile fare rotazioni non minime pur di stare nelle corse.
2023-02-10 16:28:00 +01:00
DarioS c97cc00cdc EgtMachKernel 2.5b1 :
- modifiche per gestione gambo utensile in calcolo MaxDepth e in disegno dello stesso.
2023-02-09 10:39:27 +01:00
DarioS 8b0bbe4ab0 EgtMachKernel 2.5a4 :
- corretto controllo e modifica approcci e retrazioni lame in milling.
2023-01-31 19:53:35 +01:00
DarioS 4f264ee64e EgtMachKernel 2.5a3 :
- correzione calcolo assi rotanti nel caso indeterminato con corsa asse che non comprende lo zero.
2023-01-26 10:07:05 +01:00
DarioS 4e8953e864 EgtMachKernel :
- ritorno a stato pre svuotature con isole.
2023-01-23 17:26:31 +01:00
Riccardo Elitropi bca5dbb6dd Merge remote-tracking branch 'origin/master' 2023-01-23 08:14:14 +01:00
Riccardo Elitropi e009429d93 EgtmachKernel:
- svuotature con isole ( Spiral In, Out, ZigZag, OneWay)
- piccola modifica funzione GetDistanceFromRawBottom.
2023-01-23 08:12:27 +01:00
DarioS c3fa0bad11 EgtMachKernel :
- correzione di Operation::CalculateAxesValues per ricalcolo assi rotanti con testa 4 assi.
2023-01-18 11:20:01 +01:00
DarioS b2dacc0cef EgtMachKernel :
- aggiunto flag bToolOn a EmtAddCollisionObjEx per dichiarare che è utensile in lavoro (necessario quando si usano più utensili contemporaneamente).
2023-01-18 08:43:12 +01:00
DarioS 4af09db198 EgtMachKernel :
- miglioria alla funzione EmtMoveAxes per gestire anche rappresentazioni simboliche delle feed (con interi negativi).
2023-01-17 18:19:49 +01:00
DarioS 1507f18b88 EgtMachKernel :
- aggiunta gestione Vmill a EmtMoveAxes.
2023-01-17 16:30:23 +01:00
DarioS abbc7ee12b EgtMachKernel 2.5a2 :
- in simulazione corretta gestione collisione rilevata durante ToolDeselect che non deve far saltare le successive operazioni
- aggiunta funzione lua EmtMoveAxes per consentire movimento assi in simulazione da esterno.
2023-01-17 11:33:37 +01:00
DarioS 3375e316bd EgtMachKernel :
- nella scelta angoli quando delta dal precedente vale +/-180 si privilegia 180.
2023-01-10 08:38:06 +01:00
DarioS 961fce5aa4 EgtMachKernel :
- corretto errore in assegnazione versione 2.5a1 di R32
- reso più stabile ingresso in tasche con lati aperti.
2023-01-09 10:15:52 +01:00
DarioS e076e09ab3 EgtMachKernel 2.5a1 :
- ricompilazione con cambio versione.
2023-01-03 08:55:51 +01:00
DarioS e5a072c896 EgtMachKernel 2.4l4 :
- modifiche per virtual milling con più utensili in simulazione.
2022-12-28 19:40:24 +01:00
DarioS f0b00ea95e EgtMachKernel :
- in fresature ammesso step negativo con utensili che lavorano di lato( frese non di testa e lame).
2022-12-22 15:17:50 +01:00
DarioS 3ef50b6a90 EgtMachKernel 2.4l3 :
- modifiche a fesature per spostare punto di attacco su percorsi chiusi (sovrapposizione > 0.001 e allungamento attacco diventa spostamento inizio).
2022-12-21 09:44:49 +01:00
DarioS 992249f687 EgtMachKernel :
- modifiche estetiche.
2022-12-12 07:57:52 +01:00
DarioS dfa857c533 EgtMachKernel 2.4l2 :
- ottimizzazione movimenti tra passate di lavorazione fresatura a step di tipo OneWay.
2022-12-08 18:52:40 +01:00
DarioS 84455e27db EgtMachKernel :
- in milling con fresa capovolta rispetto alla faccia tolto spessore utensile da calcoli (ha significato solo per la forma dell'utensile e non per il punto di lavoro).
2022-12-07 15:53:57 +01:00
DarioS 748845e4a8 EgtMachKernel 2.4l1 :
- ricompilazione con cambio versione.
2022-12-05 08:13:23 +01:00
DarioS 1c78841664 EgtMachkernel :
- in fresature sistemazione approcci/retrazioni per macchine con TiltingTable.
2022-11-30 09:51:34 +01:00
DarioS 4d19a52590 EgtMachKernel 2.4k4 :
- migliorato calcolo elevazione in fresature con utensili di grosso diametro.
2022-11-29 09:04:59 +01:00
DarioS caf2176a3c EgtMachKernel 2.4k3 :
- aggiunto ricalcolo di AuxDir (se necessario) dopo modifiche di SpecialMoveZup.
2022-11-09 13:14:22 +01:00
DarioS 7f1e0ac8d8 EgtMachKernel 2.4k2 :
- migliorati log in Apply e Update di disposizioni e lavorazioni
- aggiunta funzione GetName a Operation.
2022-11-07 16:37:34 +01:00
DarioS 4f22c9c578 EgtMachKernel 2.4k1 :
- migliorati messaggi di log su Apply lavorazioni.
2022-11-03 15:52:26 +01:00
DarioS b4fba50c15 EgtMachKernel 2.4j3 :
- in tutte le lavorazioni ora Apply esegue sempre Update (aggiornamento assi macchina e collegamento con operazione precedente) anche se non è necessario il ricalcolo della lavorazione.
2022-10-27 11:06:22 +02:00
DarioS b6b0432721 EgtMachKernel :
- modifiche per calcolo approccio/retrazione in fresatura per macchine con tavola tilting o similare.
2022-10-20 10:21:28 +02:00
SaraP 877215969e EgtMachKernel 2.4j2 :
- in Pocketing correzioni per svuotatura a zigzag ottimizzata.
2022-10-19 11:26:30 +02:00
DarioS f70218a432 EgtMachKernel 2.4j1 :
- aggiunta possibilità di definire direzione principale di approccio per rinvio da sotto con massima deviazione angolare di 95deg.
2022-10-14 10:47:40 +02:00
DarioS b47a32c628 EgtMachKernel 2.4i6 :
- corretta GetMachines di MachMgr per evitare di inserire in lista due volte la stessa macchina.
2022-10-04 11:12:55 +02:00
DarioS 677a8466dd EgtMachKernel 2.4i5 :
- aggiunta gestione flag MaxDeltaR2OnFirst su testa per disabilitare controllo massimo delta su secondo asse rotante all'inizio di una lavorazione.
2022-10-03 08:56:46 +02:00
DarioS f8f23ed713 EgtMachKerenel :
- per simulazione AXESMASK portato a MASK come in generazione.
2022-09-26 07:45:45 +02:00
DarioS ff6aae071a EgtMachKernel 2.4i :
- aggiunta gestione offset assi per visualizzazione
- correzioni in Milling e Pocketing per approcci e retrazioni con TiltingTab (comprende asse rotante tipo ralla).
2022-09-24 18:53:47 +02:00
DarioS dffc7ec956 EgtMachKernel 2.4i3 :
- in lavorazione WaterJet aggiunta gestione ponticelli.
2022-09-20 07:50:41 +02:00
DarioS b5d15e4a11 EgtMachKernel 2.4h2 :
- aggiunta gestione più direttori di base per le macchine (in MachMgr::Init sono tutti nella stessa stringa separati da "|")
- aggiunta funzione GetMachines di MachMgr per restituire elenco nome/direttorio di tutte le macchine trovate
- sistemazioni varie per le modifiche sopra indicate.
2022-09-13 08:15:14 +02:00
DarioS cf6c628876 EgtMachKernel :
- modifiche per permettere assi lineari controversi con assi principali XYZ.
2022-08-29 07:24:34 +02:00
DarioS 6399c41598 EgtMachKernel 2.4h2 :
- correzioni e migliorie a VerifyPathFromBottom di Milling e Pocketing.
2022-08-24 17:39:47 +02:00
DarioS 49854f8045 EgtMachKernel :
- modifiche a svuotatura per regressione nella gestione del caso slot con ingresso e uscita aperti di larghezza pari al diametro utensile.
2022-08-17 19:20:18 +02:00
DarioS c5c0503018 EgtMachKernel :
- correzioni in mortasatura quando inclinata per calcolo massimo affondamento.
2022-08-08 18:16:00 +02:00
SaraP ee513969fa EgtMachKernel :
- correzioni per svuotatura a spirale ottimizzata.
2022-08-08 17:44:25 +02:00
SaraP 22933e6f3d EgtMachKernel 2.4h1 :
- corretto caso di pulizia angoli per svuotatura a spirale ottimizzata.
2022-08-08 12:02:56 +02:00
DarioS 5cde54467a EgtMachKernel :
- in mortasatura sistemato calcolo affondamento quando inclinata rispetto al movimento
- corretto calcolo spessore da associare a curva derivata da contorno superficie con TOOL_PAR_SLANT.
2022-08-05 07:25:45 +02:00
DarioS 6b3343a98e EgtMachKernel 2.4g7 :
- in Mortising si considerano concatenabili lati di facce con delta angolare non oltre 31 gradi (prima il limite era di 46).
2022-08-04 19:58:05 +02:00
DarioS 4d158ec9fd EgtMachKernel 2.4g6 :
- in Mortising plunge corretta gestione affondamento.
2022-08-01 12:30:20 +02:00
DarioS d48b1c969e EgtMachKernel 2.4g5 :
- corretto calcolo elevazione in forature.
2022-07-29 15:12:44 +02:00
DarioS 3e33be0552 EgtMachKernel 2.4g4 :
- modifica a ApproxWithArcsIfUseful per evitare problemi con percorsi piani su piani diversi da XY.
2022-07-21 07:02:04 +02:00
DarioS 0ec3726fc6 EgtMachKernel 2.4g3 :
- altra correzione per asse rotante con corsa nulla.
2022-07-15 07:40:16 +02:00
DarioS 91005b36ba EgtMachKernel 2.4g2 :
- correzione calcolo angolo di asse rotante con corsa nulla.
2022-07-13 18:29:36 +02:00
DarioS 8f224a6b61 EgtMachkernel :
- in lavorazione Mortising calcolo degli step con più tolleranza.
2022-07-05 08:54:30 +02:00
DarioS 0e38ae1f66 EgtMachKernel 2.4g1 :
- modifiche a forature per gestione precisa MaxElev.
2022-07-04 11:02:46 +02:00
DarioS 2142ebda4e EgtMachKernel 2.4f5 :
- in svuotature corretta gestione casi speciali che falliscono e rimandano al caso standard.
2022-06-29 16:07:19 +02:00
DarioS 16a283e1bc EgtMachKernel :
- modifiche varie per plunge di Mortising.
2022-06-19 11:07:07 +02:00
SaraP ddc91c60e9 EgtMachKernel :
- aggiunta lavorazione a tuffo su tutto il percorso in mortasatura.
2022-06-17 17:55:47 +02:00
DarioS d61450cf20 EgtMachKernel 2.4f4 :
- aggiunta lavorazione a tuffo (su inizio o fine) in mortasatura
- aggiunta Distanza (per mortasatrici) a dati utensili.
2022-06-17 07:39:24 +02:00
DarioS 2db7bcaefa EgtMachKernel :
- in fresatura OneWay più passate l'affondamento alla successiva è ora con feed di attacco.
2022-06-13 07:57:35 +02:00
DarioS f674c50f89 EgtMachKernel 2.4f3 :
- migliorata gestione parametri porta-utensile in DB utensili.
2022-06-10 11:55:28 +02:00
DarioS 7ab0f5c4a2 EgtMachKernel 2.4f2 :
- modifiche a fresature per caso con tavola tilting/asse a ralla
- corretta in simulazione gestione errore collisione.
2022-06-08 11:41:32 +02:00
DarioS 83c399215d EgtMachKernel 2.4f1 :
- alle macro di disegno utensile si passa anche TipFeed per sapere se taglia in testa.
2022-06-06 07:03:10 +02:00
SaraP 7b0258205f EgtMachKernel 2.4e8 :
- nelle svuotature a zigzag agguinto nuovo caso ottimizzato con 3 lati chiusi.
2022-05-31 11:52:59 +02:00
DarioS f901adadab EgtMachKernel 2.4e7 :
- in WaterJet possibilità di definire inizio lavoraziona anche tramite coordinate punto vicino in note utente (START=x,y,z).
2022-05-31 00:31:03 +02:00
DarioS cdbc4bfb63 EgtMachKernel :
- aggiunta gestione quota di base del tool holder ( se negativa indica spazio libero su testa).
2022-05-29 16:40:26 +02:00
DarioS bc7a89856d EgtMachKernel :
- modifiche a svuotature SpiralIn per ingresso su lato aperto da considerare fuori grezzo anche se dentro (da OpenOutRaw=1 in Note Utente).
2022-05-27 09:12:10 +02:00
DarioS de2539388c EgtMachKernel :
- corretta gestione ventose utilizzate e rimosse.
2022-05-26 10:57:58 +02:00
SaraP a0f655a767 EgtMachKernel :
- piccola correzione svuotature ottimizzate.
2022-05-25 09:48:01 +02:00
DarioS a1a4c85024 EgtMachKernel 2.4e6 :
- correzione calcolo lunghezza attacchi/uscite di svuotature ottimizzate.
2022-05-25 08:35:12 +02:00
DarioS 8a780e6fc7 EgtMachKernel 2.4e5 :
- aggiunti dati EMT.MOVEID e EMT.MOVEIND ai parametri passati agli script di movimento in Generazione e Stima.
2022-05-20 15:56:08 +02:00
DarioS 9bb22b11bd EgtMachKernel 2.4e4 :
- piccole migliorie nell'approccio e retrazione delle svuotature.
2022-05-19 08:37:05 +02:00
DarioS 156f0f8ef8 EgtMachKernel 2.4e3 :
- modifiche per prima versione chiave di rete.
2022-05-17 08:26:38 +02:00
DarioS 88912bf524 EgtMachKernel :
- aggiunta gestione lunghezza ingombro portautensile negativa per indicare spazio libero sulla testa.
2022-05-16 18:35:15 +02:00
DarioS a677bb991f EgtMachKernel 2.4e2 :
- corretta GetPartDirFromAngles per asse rotante di testa speciale (ralla).
2022-05-14 12:11:40 +02:00
DarioS b7bfccdfeb EgtMachKernel :
- in svuotature ZigZag consentite con utensili che non lavorano di testa se iniziano dall'esterno (quindi anche ottimizzate).
2022-05-05 00:00:56 +02:00
DarioS 5869f8ab01 EgtMachKernel 2.4e1 :
- ricompilazione con cambio versione.
2022-05-04 08:07:32 +02:00
DarioS a4fa53a7e9 EgtMachKernel 2.4d4 :
- ricompilate versioni a 32bit con v141_xp (VisualStudio 2017 C++ per XP).
2022-04-24 17:09:39 +02:00
DarioS dc0b055480 EgtMachKernel :
- migliorie su approcci eretrazioni di fresature con lame.
2022-04-22 08:53:59 +02:00
DarioS 6bb714e581 EgtMachKernel 2.4d2 :
- modifiche per gestire macchina con asse rotante tipo ralla che porta due assi lineari ad esso perpendicolare (terzo lineare diretto come ralla).
2022-04-19 11:24:41 +02:00
SaraP 33090bc9e0 EgtMachKernel 2.4d1 :
- in Pocketing corretti errori nella svuotatura a spirale ottimizzata.
2022-04-15 10:48:27 +02:00
DarioS c18b4deef2 EgtMachKernel 2.4c2 :
- modifica a simulatore per gestire correttamente gli assi ausiliari dipendenti da assi principali.
2022-03-22 08:25:41 +01:00
DarioS d3922eb897 EgtMachKernel :
- migliorata gestione approcci e retrazioni in fresature con lame.
2022-03-20 18:51:56 +01:00
SaraP d8f72d02f7 EgtMachKernel 2.4c1 :
- in svuotatura a spirale ottimizzata per trapezoidi aggiunta rimozione di materiale residuo negli angoli.
2022-03-16 09:26:21 +01:00
DarioS b059fe9486 EgtMachKernel 2.4b8 :
- migliorata gestione direzione utensile da lavorazione faccia in parallelo.
2022-03-08 11:19:52 +01:00
DarioS b82cdd0bc7 EgtMachKernel :
- corretto link tra lavorazioni quando HomeZ standard non va bene ma serve GetExtraZ
- disabilitate svuotature a spirale ottimizzate per problemi quando ci sono tre lati aperti
- sistemate maiuscole/minuscole nei nomi dei file inclusi.
2022-02-26 17:53:11 +01:00
SaraP d18b15f209 EgtMachKernel :
- in Pocketing correzione per svuotature a spirale ottimizzate.
2022-02-25 17:29:14 +01:00
SaraP a4b462d6ab EgtMachKernel 2.4b7 :
- in Pocketing aggiunta svuotatura a spirale ottimizzata nel caso di trapezoidi.
2022-02-25 12:51:05 +01:00
DarioS 869b9e0ebe EgtMachKernel 2.4b6 :
- in taglio con lama quando si prende il percorso da superficie si limita la deviazione angolare a 16.1 gradi
- in fresatura la direzione utensile parallela da parte di contorno superficie si calcola nel punto medio (per favorire il lato lungo).
2022-02-23 10:51:54 +01:00
DarioS 0905ebebc7 EgtMachKernel 2.4b5 :
- migliorato CalcOffset di WaterJet.
2022-02-20 19:32:19 +01:00
DarioS d66fdb0e5e EgtMachKernel :
- corretto collegamento tra lavorazioni per problemi macchine tipo PF con pezzi alti.
2022-02-17 22:25:55 +01:00
DarioS 516679bc3b EgtMachKernel :
- modifica calcolo miglior lato aperto per svuotatura SpiralIn.
2022-02-17 16:23:46 +01:00
DarioS 0074ab9003 EgtMachKernel :
- migliorie in Pocketing per zigzag ottimizzato.
2022-02-17 14:41:40 +01:00
DarioS b0cb253299 EgtMachKernel 2.4b4 :
- altre correzioni su svuotature a zigzag ottimizzate.
2022-02-15 19:13:05 +01:00
SaraP 9ef40618f9 EgtMachKernel :
- rimozione aree residue nelle svuotature a zigzag ottimizzate
- altre modifiche per le svuotature a zigzag ottimizzate.
2022-02-15 13:10:55 +01:00
DarioS 360d116eab EgtMachKernel 2.4b3 :
- altre modifiche a svuotature zigzag ottimizzate.
2022-02-15 08:20:11 +01:00
DarioS ea0ab12521 EgtMachKernel :
- altre modifiche alle svuotature ZigZag ottimizzate.
2022-02-14 17:46:24 +01:00
DarioS 78d717cb39 EgtMachKernel :
- modifiche a Pocketing per svuotature a ZigZag ottimizzate.
2022-02-14 12:56:09 +01:00
DarioS bdb7234fbb EgtMachKernel 2.4b2 :
- corretto salvataggio lavorazioni con nuovi parametri opzionali da non salvare se coincidono con default.
2022-02-09 09:50:28 +01:00
SaraP 170d3f7638 EgtMachKernel :
- in Pocketing corretti attacchi e raccordi per lucidature con epicicli.
2022-02-08 14:42:55 +01:00
DarioS 75669fdfc0 EgtMachKernel :
- in Pocketing corretto salvataggio parametri opzionali.
2022-02-06 17:24:13 +01:00
DarioS c47095e52b EgtMachKernel :
- sistemata gestione nuovi parametri per svuotature con epicicli di lucidatura.
2022-02-04 18:31:35 +01:00
SaraP 9edecc23c3 EgtMachKernel 2.4b1 :
- in Pocketing aggiunto percorso a spirale con epicicli per lucidatura.
2022-02-01 10:25:19 +01:00
DarioS ca1aa4c9ac EgtMachKernel 2.4a4 :
- aggiunti massimi e minimi di posizioni e assi anche a gruppi CL e suoi sottogruppi di Disposizioni
- si esegue la scrittura di questi estremi per lavorazioni e disposizioni solo quando definiti.
2022-01-31 18:43:17 +01:00
DarioS 798e0bcb70 EgtMachKernel 2.4a3 :
- corretto controllo attacchi di svuotature con utensili che non lavorano di testa.
2022-01-17 16:27:02 +01:00
DarioS 9ceb1759b5 EgtMachKernel :
- in Sawing su tratti lineari aumentato ingombro lama per calcolo elevazione.
2022-01-14 18:56:38 +01:00
DarioS a5c8d50c55 EgtMachKernel :
- piccole modifiche estetiche.
2022-01-14 16:45:07 +01:00
DarioS c59164f0fb EgtMachKernel :
- migliorato calcolo PreView di tagli di lama lineari inclinati.
2022-01-10 09:41:47 +01:00
DarioS 25473ff787 EgtMachKernel :
- inserita opzione in compilazioni 64bit per evitare Warning su verifica riferimenti non nulli.
2022-01-09 15:50:55 +01:00
DarioS 0c8fec9146 EgtMachKernel 2.4a2 :
- ricompilazione con cambio versione.
2022-01-07 10:02:37 +01:00
DarioS 6df3b2dace EgtMachKernel 2.4a1 :
- ricompilazione per cambio versione.
2022-01-04 08:08:55 +01:00
DarioS 339c0260f8 EgtMachKernel 2.3l3 :
- sicurezza minima di collisione ridotta a 5 mm nelle verifiche dei link.
2021-12-29 20:39:07 +01:00
DarioS 46d433296b EgtMachKernel 2.3l2 :
- in simulazione aggiunta gestione assi linkati ad altri assi.
2021-12-28 08:39:00 +01:00
DarioS 7ee1253b3c EgtMachKernel :
- eliminato prototipo inutile.
2021-12-17 09:00:13 +01:00
DarioS f535ed5a9b EgtMachKernel :
- correzione in import lavorazioni.
2021-12-12 10:37:43 +01:00
DarioS 25c382aa71 EgtMachKernel :
- aggiunte in interfaccia funzioni per export/import lavorazioni
- modifiche varie in export/import utensili e lavorazioni.
2021-12-08 16:43:32 +01:00
SaraP 75b4601ecc EgtMachKernel :
- aggiunte funzioni per esportazione e importazione lavorazioni.
2021-12-07 17:35:23 +01:00
SaraP a136631c94 EgtMachKernel 2.3l1 :
- in Pocketing aggiunto caso ottimizzato per svuotature a zigzag.
2021-12-07 11:47:48 +01:00
DarioS 8483c1609a EgtMachKernel 2.3k3 :
- ricompilazione per cambio versione.
2021-11-27 12:08:35 +01:00
DarioS 17c7be3a56 EgtMachKernel 2.3k2 :
- nella gestione link tra lavorazioni aggiunta possibilità di utilizzo script OnSpecialGetMaxZ che determina la Zmassima raggiungibile nel collegamento in funzione delle posizioni testa iniziale e finale.
2021-11-22 11:10:03 +01:00
DarioS cfb2fea0bd EgtMachKernel 2.3k1 :
- modifiche a Mortising per ricalcolo elevazione su attacco uscita indipendente da MaxElev.
2021-11-15 09:53:18 +01:00
DarioS ac17810065 EgtMachKernel 2.3j8 :
- aggiunta funzione lua EmtGetAllLinkedRawParts
- corretto calcolo GetPointUnderRaw.
2021-11-02 08:21:07 +01:00
DarioS 543afd4c7a EgtMachKernel 2.3j6 :
- adattamenti per modifiche a GeomKernel.
2021-10-24 18:10:31 +02:00
DarioS 73ce1f1018 EgtMachKernel 2.3j5 :
- aggiunta funzione EmtModifyHeadAuxDirection
- corretto scambio parametri attacco/uscita in fresatura cquando percorso invertito
- assi bloccati ora impostabili da lavorazione con nome asse oppure con suo token.
2021-10-14 11:07:49 +02:00
DarioS 23c0e1c8d5 EgtMachKernel 2.3j4 :
- in fresatura corretta gestione elevazione di attacco e uscita con OneWay.
2021-10-10 20:04:54 +02:00
DarioS 8e64f0ad00 EgtMachKernel 2.3j3 :
- in svuotature con lati aperti corretta elevazione attacco con testa da sotto.
2021-10-07 06:54:49 +02:00
DarioS 5a8fb790b0 EgtMachKernel 2.3j2 :
- corretto aggiornamento disegni utensili e dimensioni portautensili.
2021-10-05 20:19:21 +02:00
DarioS fa6928c593 EgtMachKernel :
- in Svuotature Oneway corretto errore con contorno esterno circonferenza.
2021-10-05 11:42:03 +02:00
DarioS 52a26ceb52 EgtMachKernel 2.3j1 :
- corretto controlli attacchi/uscite lame in fresature con testa da sotto.
2021-10-04 09:15:29 +02:00
DarioS bb8b6b9fc1 EgtMachKernel :
- aggiustamento per nuovo parametro richiesto da ISurfTriMesh::GetSilhouette.
2021-09-26 16:29:34 +02:00
DarioS 7b90e2b152 EgtMachKernel 2.3i7 :
- in fresature aggiunto Attacco Tang+Perp e Uscita Perp+Tang.
2021-09-25 12:50:10 +02:00
DarioS 5c6ad44bb5 EgtMachKernel 2.3i6 :
- aggiunta gestione anima per lame (CORE in SysNotes).
2021-09-16 12:44:41 +02:00
DarioS af688d4fb7 EgtMachKernel 2.3i5 :
- a MachMgr e sua interfaccia IMachMgr aggiunta funzione ChangeTable.
2021-09-13 15:50:39 +02:00
DarioS 01cb04ac96 EgtMachKernel 2.3i4 :
- migliorato controllo risalita tra percorsi di lavorazione e migliorata assegnazione Flag2 (se 1 allora a MaxZ).
2021-09-09 15:49:08 +02:00
DarioS 0c3ad1ebe5 EgtMachKernel 2.3i3 :
- corretta recente modifica per calcolo Zsafe in link tra lavorazioni.
2021-09-07 18:44:54 +02:00
DarioS 7b3a544c9f EgtMachKernel 2.3i2 :
- modifiche alla verifica Z sicura per link tra lavorazioni.
2021-09-07 18:04:02 +02:00
DarioS b3a13a94bb EgtMachKernel 2.3i1 :
- link tra lavorazioni con maggiori sicurezze
- corretta gestione svuotature da sotto con testa da sotto.
2021-09-06 10:24:14 +02:00
DarioS 8318dcc2a8 EgtMachKernel :
- nella lavorazione di Finitura Superfici è ora specificare quali superfici considerare (se non si specificano sono considerate tutte).
2021-08-29 19:31:35 +02:00
DarioS b18c309344 EgtMachKernel 2.3h2 :
- correzioni a Milling per lavorazioni con fresa inclinata rispetto ad un percorso piano.
2021-08-25 15:06:01 +02:00
85 changed files with 21521 additions and 4492 deletions
+21 -16
View File
@@ -17,9 +17,11 @@
#include "Axis.h"
#include "MachConst.h"
#include "/EgtDev/Include/EGkGdbConst.h"
#include "/EgtDev/Include/EGkGeoVector3d.h"
#include "/EgtDev/Include/EGkUserObjFactory.h"
#include "/EgtDev/Include/EGkStringUtils3d.h"
#include "/EgtDev/Include/EGkUiUnits.h"
#include "/EgtDev/Include/EgtNumUtils.h"
using namespace std ;
@@ -46,6 +48,7 @@ Axis::Clone( void) const
pAx->m_sName = m_sName ;
pAx->m_sToken = m_sToken ;
pAx->m_bInvert = m_bInvert ;
pAx->m_dOffset = m_dOffset ;
pAx->m_nType = m_nType ;
pAx->m_ptPos = m_ptPos ;
pAx->m_vtDir = m_vtDir ;
@@ -109,19 +112,20 @@ Axis::GetGeomDB( void) const
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
Axis::Axis( void)
: m_nOwnerId( GDB_ID_NULL), m_pGeomDB( nullptr),
: m_nOwnerId( GDB_ID_NULL), m_pGeomDB( nullptr), m_bInvert( false), m_dOffset( 0),
m_nType( MCH_AT_NONE), m_Stroke( {{0,0}}), m_dHomeVal( 0), m_dCurrVal( 0)
{
}
//----------------------------------------------------------------------------
bool
Axis::Set( const string& sName, const string& sToken, bool bInvert, int nType,
const Point3d& ptPos, const Vector3d& vtDir, const STROKE& Stroke, double dHome)
Axis::Set( const string& sName, const string& sToken, bool bInvert, double dOffset,
int nType, const Point3d& ptPos, const Vector3d& vtDir, const STROKE& Stroke, double dHome)
{
m_sName = sName ;
m_sToken = sToken ;
m_bInvert = bInvert ;
m_dOffset = dOffset ;
m_nType = nType ;
m_ptPos = ptPos ;
m_vtDir = vtDir ;
@@ -135,9 +139,8 @@ Axis::Set( const string& sName, const string& sToken, bool bInvert, int nType,
bool
Axis::Modify( const Point3d& ptPos, double dAxisMaxAdjust)
{
// Verifico che lo spostamento non superi il massimo ammesso
Vector3d vtDelta = ptPos - m_ptPos ;
Vector3d vtDeltaPerp = vtDelta - ( vtDelta * m_vtDir) * m_vtDir ;
// Verifico che lo spostamento perpendicolare alla sua direzione non superi il massimo ammesso
Vector3d vtDeltaPerp = OrthoCompo( ptPos - m_ptPos, m_vtDir) ;
if ( vtDeltaPerp.Len() > dAxisMaxAdjust) {
string sOut = " Modify Axis " + m_sName + " Position (" + ToString( ptPos) + ") failed" ;
LOG_ERROR( GetEMkLogger(), sOut.c_str()) ;
@@ -145,6 +148,11 @@ Axis::Modify( const Point3d& ptPos, double dAxisMaxAdjust)
}
// Assegno la nuova posizione
m_ptPos = ptPos ;
// Sistemo la geometria dell'asse
int nV = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, m_sName) ;
IGeoVector3d* pGV = GetGeoVector3d( m_pGeomDB->GetGeoObj( nV)) ;
if ( pGV != nullptr)
pGV->ChangeBase( m_ptPos) ;
return true ;
}
@@ -162,6 +170,11 @@ Axis::Modify( const Vector3d& vtDir, double dAxisMaxRotAdj)
}
// Assegno la nuova direzione
m_vtDir = vtDirN ;
// Sistemo la geometria dell'asse
int nV = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, m_sName) ;
IGeoVector3d* pGV = GetGeoVector3d( m_pGeomDB->GetGeoObj( nV)) ;
if ( pGV != nullptr)
pGV->ChangeVector( m_vtDir) ;
return true ;
}
@@ -170,10 +183,7 @@ bool
Axis::Modify( const STROKE& Stroke)
{
m_Stroke = Stroke ;
if ( m_dHomeVal < m_Stroke.Min)
m_dHomeVal = m_Stroke.Min ;
else if ( m_dHomeVal > m_Stroke.Max)
m_dHomeVal = m_Stroke.Max ;
m_dHomeVal = Clamp( m_dHomeVal, m_Stroke.Min, m_Stroke.Max) ;
return true ;
}
@@ -181,12 +191,7 @@ Axis::Modify( const STROKE& Stroke)
bool
Axis::Modify( double dHome)
{
if ( dHome < m_Stroke.Min)
m_dHomeVal = m_Stroke.Min ;
else if ( dHome > m_Stroke.Max)
m_dHomeVal = m_Stroke.Max ;
else
m_dHomeVal = dHome ;
m_dHomeVal = Clamp( dHome, m_Stroke.Min, m_Stroke.Max) ;
return true ;
}
+7 -4
View File
@@ -1,7 +1,7 @@
//----------------------------------------------------------------------------
// EgalTech 2015-2015
// EgalTech 2015-2022
//----------------------------------------------------------------------------
// File : Axis.h Data : 24.05.15 Versione : 1.6e7
// File : Axis.h Data : 21.09.22 Versione : 2.4i
// Contenuto : Dichiarazione della classe Axis.
//
//
@@ -30,8 +30,8 @@ class Axis : public IUserObj
public :
Axis( void) ;
bool Set( const std::string& sName, const std::string& sToken, bool bInvert, int nType,
const Point3d& ptPos, const Vector3d& vtDir, const STROKE& Stroke, double dHome) ;
bool Set( const std::string& sName, const std::string& sToken, bool bInvert, double dOffset,
int nType, const Point3d& ptPos, const Vector3d& vtDir, const STROKE& Stroke, double dHome) ;
bool Modify( const Point3d& ptPos, double dAxisMaxAdjust) ;
bool Modify( const Vector3d& vtDir, double dAxisMaxRotAdj) ;
bool Modify( const STROKE& Stroke) ;
@@ -44,6 +44,8 @@ class Axis : public IUserObj
{ return m_sToken ; }
bool GetInvert( void) const
{ return m_bInvert ; }
double GetOffset( void) const
{ return m_dOffset ; }
int GetType( void) const
{ return m_nType ; }
const Point3d& GetPos( void) const
@@ -63,6 +65,7 @@ class Axis : public IUserObj
std::string m_sName ;
std::string m_sToken ;
bool m_bInvert ;
double m_dOffset ;
int m_nType ;
Point3d m_ptPos ;
Vector3d m_vtDir ;
+29 -8
View File
@@ -1,13 +1,14 @@
//----------------------------------------------------------------------------
// EgalTech 2015-2016
// EgalTech 2015-2023
//----------------------------------------------------------------------------
// File : CamData.cpp Data : 24.02.16 Versione : 1.6n8
// File : CamData.cpp Data : 22.11.23 Versione : 2.5k3
// Contenuto : Implementazione informazioni Cam di ogni movimento.
//
//
//
// Modifiche : 10.06.15 DS Creazione modulo.
// 24.02.16 DS Versione 2 (aggiunti m_nMove e m_ptCen).
// 22.11.23 DS Aggiunto flag ToolShow (forza in ogni caso la visualizzazione della direzione utensile).
//
//----------------------------------------------------------------------------
@@ -53,7 +54,9 @@ static int CAM_PARAM_V7 = 22 ;
static string CAM_ORIGFEED = "OrFeed" ;
static int CAM_PARAM_V8 = 23 ;
static string CAM_FLAG2 = "Flg2" ;
static int CAM_TOTPARAM =CAM_PARAM_V8 ;
static int CAM_PARAM_V9 = 24 ;
static string CAM_TOOLSHOW = "TSh" ;
static int CAM_TOTPARAM = CAM_PARAM_V9 ;
//----------------------------------------------------------------------------
@@ -79,6 +82,7 @@ CamData::Clone( void) const
pCam->m_pGeomDB = nullptr ;
pCam->m_nMove = m_nMove ;
pCam->m_nCorre = m_nCorre ;
pCam->m_bToolShow = m_bToolShow ;
pCam->m_vtTool = m_vtTool ;
pCam->m_vtCorr = m_vtCorr ;
pCam->m_vtAux = m_vtAux ;
@@ -139,6 +143,7 @@ CamData::Dump( string& sOut, bool bMM, const char* szNewLine) const
sOut += CAM_AXND + "=" + ToString( m_vtMachN) + szNewLine ;
sOut += CAM_NDLT + "=" + ToString( m_dDeltaN) + szNewLine ;
sOut += CAM_BDIR + "=" + ToString( m_vtBackAux) + szNewLine ;
sOut += CAM_TOOLSHOW + "=" + ToString( m_bToolShow) + szNewLine ;
return true ;
}
@@ -149,6 +154,8 @@ CamData::SetOwner( int nId, IGeomDB* pGDB)
{
m_nOwnerId = nId ;
m_pGeomDB = pGDB ;
if ( m_pGeomDB != nullptr)
m_pGeomDB->SetStipple( m_nOwnerId, ( m_nMove == 0 ? 3 : 0), 0x8C8C) ;
return ( m_nOwnerId != GDB_ID_NULL && m_pGeomDB != nullptr) ;
}
@@ -203,6 +210,8 @@ CamData::Save( int nBaseId, STRVECTOR& vString) const
vString[++k] = CAM_ORIGFEED + "=" + ToString( m_dOrigFeed) ;
// parametri aggiunti V8
vString[++k] = CAM_FLAG2 + "=" + ToString( m_nFlag2) ;
// parametri aggiunti V9
vString[++k] = CAM_TOOLSHOW + "=" + ToString( m_bToolShow) ;
}
catch( ...) {
return false ;
@@ -295,6 +304,14 @@ CamData::Load( const STRVECTOR& vString, int nBaseGdbId)
else {
m_nFlag2 = 0 ;
}
// parametri aggiunti V9
if ( int( vString.size()) >= CAM_PARAM_V9) {
if ( ! GetVal( vString[++k], CAM_TOOLSHOW, m_bToolShow))
return false ;
}
else {
m_bToolShow = false ;
}
return true ;
}
@@ -311,7 +328,7 @@ CamData::GetDrawPolyLines( POLYLINELIST& lstPL) const
PolyLine& PL = lstPL.back() ;
// dimensioni
const double TLEN = 40 ;
const double ALEN = 4 ;
const double ALEN = 1 ;
// inserisco disegno nella polilinea
PL.AddUPoint( 0, m_ptEnd) ;
Point3d ptTip = m_ptEnd + m_vtTool * TLEN ;
@@ -333,6 +350,9 @@ CamData::GetDrawPolyLines( POLYLINELIST& lstPL) const
ptP6.ToGlob( frF) ;
PL.AddUPoint( 6, ptP6) ;
PL.AddUPoint( 6, ptTip) ;
// da visualizzare sempre se richiesto
if ( m_bToolShow)
PL.SetTempProp( 1) ;
}
// se vettore correzione non nullo
if ( ! m_vtCorr.IsSmall()) {
@@ -342,14 +362,14 @@ CamData::GetDrawPolyLines( POLYLINELIST& lstPL) const
PolyLine& PL = lstPL.back() ;
// dimensioni
const double CLEN = 20 ;
const double ALEN = 2 ;
const double ALEN = 1 ;
// inserisco disegno nella polilinea
PL.AddUPoint( 0, m_ptEnd) ;
Point3d ptTip = m_ptEnd + m_vtCorr * CLEN ;
PL.AddUPoint( 1, ptTip) ;
// aggiungo simil-freccia
Frame3d frF ;
if ( m_vtTool. IsSmall())
if ( m_vtTool. IsSmall() || AreSameOrOppositeVectorApprox( m_vtTool, m_vtCorr))
frF.Set( ptTip, m_vtCorr) ;
else
frF.Set( ptTip, m_vtCorr, m_vtTool) ;
@@ -371,14 +391,14 @@ CamData::GetDrawPolyLines( POLYLINELIST& lstPL) const
PolyLine& PL = lstPL.back() ;
// dimensioni
const double CLEN = 20 ;
const double ALEN = 2 ;
const double ALEN = 1 ;
// inserisco disegno nella polilinea
PL.AddUPoint( 0, m_ptEnd) ;
Point3d ptTip = m_ptEnd + m_vtAux * CLEN ;
PL.AddUPoint( 1, ptTip) ;
// aggiungo simil-freccia
Frame3d frF ;
if ( m_vtTool. IsSmall())
if ( m_vtTool. IsSmall() || AreSameOrOppositeVectorApprox( m_vtTool, m_vtAux))
frF.Set( ptTip, m_vtAux) ;
else
frF.Set( ptTip, m_vtAux, m_vtTool) ;
@@ -546,6 +566,7 @@ CamData::CamData( void)
m_pGeomDB = nullptr ;
m_nMove = 0 ;
m_nCorre = 0 ;
m_bToolShow = false ;
m_dAngCen = 0 ;
m_dDeltaN = 0 ;
m_dFeed = 0 ;
+10 -5
View File
@@ -68,11 +68,13 @@ class CamData : public IUserObj
bool SetAxesAngCen( double dAngCen) ;
bool SetAxesNormDir( const Vector3d& vtDir) ;
bool SetBackAuxDir( const Vector3d& vtDir) ;
const int GetMoveType( void) const
bool SetToolShow( bool bShow)
{ m_bToolShow = bShow ; return true ; }
int GetMoveType( void) const
{ return m_nMove ; }
const bool IsLine( void) const
bool IsLine( void) const
{ return ( m_nMove == 0 || m_nMove == 1) ; }
const bool IsArc( void) const
bool IsArc( void) const
{ return ( m_nMove == 2 || m_nMove == 3) ; }
const Vector3d& GetToolDir( void) const
{ return m_vtTool ; }
@@ -108,14 +110,16 @@ class CamData : public IUserObj
{ return m_vMachAxes ; }
const Point3d& GetAxesCen( void) const
{ return m_ptMachCen ; }
const double GetAxesRad( void) const
double GetAxesRad( void) const
{ return m_dMachRad ; }
const double GetAxesAngCen( void) const
double GetAxesAngCen( void) const
{ return m_dMachAngCen ; }
const Vector3d& GetAxesNormDir( void) const
{ return m_vtMachN ; }
const Vector3d& GetBackAuxDir( void) const
{ return m_vtBackAux ; }
bool GetToolShow( void) const
{ return m_bToolShow ; }
public :
enum { AS_NONE = 0,
@@ -139,6 +143,7 @@ class CamData : public IUserObj
IGeomDB* m_pGeomDB ;
int m_nMove ; // tipo movimento (0=rapido, 1=lineare, 2=arco CW, 3=arco CCW)
int m_nCorre ; // tipo correzione (0, 41, 42, 141, 142, 40)
bool m_bToolShow ; // flag per forzare la visualizzazione della direzione utensile in ogni caso
Vector3d m_vtTool ; // versore fresa
Vector3d m_vtCorr ; // versore correzione
Vector3d m_vtAux ; // versore ausiliario
+37 -13
View File
@@ -504,8 +504,14 @@ Chiseling::Apply( bool bRecalc, bool bPostApply)
// verifico se necessario continuare nell'aggiornamento
if ( ! bRecalc && ! bToolChanged &&
( m_nStatus == MCH_ST_OK || ( ! bPostApply && m_nStatus == MCH_ST_NO_POSTAPPL))) {
// confermo i percorsi di lavorazione
m_nChisels = nCurrChisels ;
LOG_DBG_INFO( GetEMkLogger(), "Chiseling 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 ;
@@ -570,6 +576,8 @@ Chiseling::Apply( bool bRecalc, bool bPostApply)
// dichiaro successiva da aggiornare
UpdateFollowingOperationsStatus( MCH_ST_OTH_MODIF) ;
LOG_DBG_INFO( GetEMkLogger(), "Chiseling apply done") ;
return true ;
}
@@ -587,15 +595,11 @@ Chiseling::Update( bool bPostApply)
return true ;
}
// elimino le entità CLIMB, RISE e HOME della lavorazione, potrebbero falsare i calcoli degli assi (in ogni casi vengono riaggiunte dopo)
RemoveClimbRiseHome() ;
// imposto eventuale asse bloccato da lavorazione
if ( ! m_Params.m_sBlockedAxis.empty()) {
string sAxis, sVal ;
Split( m_Params.m_sBlockedAxis, "=", true, sAxis, sVal) ;
double dVal = 0 ;
FromString( sVal, dVal) ;
m_pMchMgr->ClearRotAxisBlock() ;
m_pMchMgr->SetRotAxisBlock( sAxis, dVal) ;
}
SetBlockedRotAxis( m_Params.m_sBlockedAxis) ;
// calcolo gli assi macchina
string sHint = ExtractHint( m_Params.m_sUserNotes) ;
@@ -767,11 +771,31 @@ Chiseling::UpdateToolData( bool* pbChanged)
const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ;
if ( pTdata == nullptr)
return false ;
// verifico se sono diversi (ad esclusione del nome)
m_TParams.m_sName = pTdata->m_sName ;
bool bChanged = ! SameTool( m_TParams, *pTdata) ;
// 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 Chiseling : tool name changed (" +
@@ -1012,8 +1036,8 @@ Chiseling::GetCurves( SelData Id, ICURVEPLIST& lstPC)
for ( int nC = nCstart ; nC < nCend ; ++ nC) {
// recupero i contorni del chunk
for ( int nL = 0 ; nL < pReg->GetLoopCount( nC) ; ++ nL) {
PtrOwner<ICurveComposite> pCrvCompo( CreateCurveComposite()) ;
if ( IsNull( pCrvCompo) || ! pCrvCompo->AddCurve( pReg->GetLoop( nC, nL)))
PtrOwner<ICurveComposite> pCrvCompo ;
if ( ! pCrvCompo.Set( ConvertCurveToComposite( pReg->GetLoop( nC, nL))))
return false ;
// assegno l'estrusione dalla normale alla regione
pCrvCompo->SetExtrusion( vtN) ;
+6 -2
View File
@@ -71,6 +71,10 @@ struct ChiselingData : public MachiningData
//----------------------------------------------------------------------------
inline const ChiselingData* GetChiselingData( const MachiningData* pMdata)
{ return (dynamic_cast<const ChiselingData*>( pMdata)) ; }
{ if ( pMdata == nullptr || pMdata->GetType() != MT_CHISELING)
return nullptr ;
return ( static_cast<const ChiselingData*>( pMdata)) ; }
inline ChiselingData* GetChiselingData( MachiningData* pMdata)
{ return (dynamic_cast<ChiselingData*>( pMdata)) ; }
{ if ( pMdata == nullptr || pMdata->GetType() != MT_CHISELING)
return nullptr ;
return ( static_cast<ChiselingData*>( pMdata)) ; }
+34 -5
View File
@@ -86,6 +86,8 @@ Disposition::Clone( void) const
// eseguo copia dei dati
if ( pDisp != nullptr) {
try { pDisp->m_sTabName = m_sTabName ;
pDisp->m_pMchMgr = m_pMchMgr ;
pDisp->m_nPhase = m_nPhase ;
pDisp->m_ptRef1 = m_ptRef1 ;
pDisp->m_b3Area1 = m_b3Area1 ;
pDisp->m_dAreaOffset = m_dAreaOffset ;
@@ -306,7 +308,7 @@ Disposition::Load( const STRVECTOR& vString, int nBaseGdbId)
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
Disposition::Disposition( void)
: m_bTabOk( false), m_nExit( 0), m_nStatus( MCH_ST_TO_VERIFY), m_nShifts( 0), m_bSomeByHand( false), m_dAreaOffset({{0,0,0,0}})
: m_bTabOk( false), m_dAreaOffset({{0,0,0,0}}), m_nExit( 0), m_nStatus( MCH_ST_TO_VERIFY), m_nShifts( 0), m_bSomeByHand( false)
{
}
@@ -1205,6 +1207,23 @@ Disposition::InsertMoveInfoInList( int nRawId, int nType, const Point3d& ptP, in
return true ;
}
//----------------------------------------------------------------------------
bool
Disposition::UpdateRawPartId( int nRawId, int nNewRawId)
{
// aggiorno i movimenti registrati per questo grezzo
while ( true) {
auto iIter = find_if( m_vMvrData.begin(), m_vMvrData.end(),
[ nRawId]( const MoveRawData& Mrv)
{ return ( Mrv.nRawId == nRawId) ; }) ;
if ( iIter == m_vMvrData.end())
break ;
else
iIter->nRawId = nNewRawId ;
}
return true ;
}
//----------------------------------------------------------------------------
bool
Disposition::RemoveRawPart( int nRawId)
@@ -1294,6 +1313,7 @@ Disposition::SpecialApply( bool bRecalc)
static const string ON_SPECIAL_APPLY = "OnSpecialApplyDisposition" ;
if ( ! pMch->LuaExistsFunction( ON_SPECIAL_APPLY)) {
m_nStatus = MCH_ST_OK ;
LOG_DBG_INFO( GetEMkLogger(), "Disposition special apply not provided") ;
return true ;
}
@@ -1304,7 +1324,7 @@ Disposition::SpecialApply( bool bRecalc)
m_nShifts = nCurrShifts ;
m_bSomeByHand = bCurrSomeByHand ;
m_sTcPos = sCurrTcPos ;
LOG_DBG_INFO( GetEMkLogger(), "Disposition postapply skipped : status already ok") ;
LOG_DBG_INFO( GetEMkLogger(), "Disposition special apply skipped : status already ok") ;
return true ;
}
m_nStatus = MCH_ST_TO_VERIFY ;
@@ -1352,7 +1372,8 @@ Disposition::SpecialApply( bool bRecalc)
bOk = bOk && pMch->LuaResetGlobVar( EMC_VAR) ;
// segnalo errori ed esco
if ( ! bOk || nErr > 0) {
m_nShifts = - 1 ;
if ( m_nShifts != -1)
m_nShifts = -2 ;
string sOut = sMsg ;
if ( IsEmptyOrSpaces( sOut))
sOut = " Error in " + ON_SPECIAL_APPLY + " (" + ToString( nErr) + ")" ;
@@ -1367,6 +1388,10 @@ Disposition::SpecialApply( bool bRecalc)
m_pMchMgr->SetWarning( 2053, sOut) ;
}
// assegno ingombri dei vari percorsi di lavorazione e della lavorazione nel suo complesso
nClId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_CL) ;
CalcAndSetBBox( nClId) ;
// eseguo aggiornamento assi macchina e collegamento con operazione precedente
if ( ! SpecialUpdate())
return false ;
@@ -1374,6 +1399,7 @@ Disposition::SpecialApply( bool bRecalc)
// aggiorno stato
m_nStatus = MCH_ST_OK ;
LOG_DBG_INFO( GetEMkLogger(), "Disposition special apply ok") ;
return true ;
}
@@ -1387,12 +1413,12 @@ Disposition::SpecialUpdate( void)
// se disposizione vuota, esco
if ( m_nShifts <= 0) {
if ( m_nShifts < 0)
if ( m_nShifts == -2)
m_pMchMgr->SetWarning( 2052, "Warning in Disposition : No shifts") ;
return true ;
}
// calcolo assi macchina
if ( ! CalculateAxesValues( "")) {
if ( ! CalculateAxesValues( "", false)) {
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
if ( sInfo.empty())
m_pMchMgr->SetLastError( 2007, "Error in Disposition : axes values not calculable") ;
@@ -1409,6 +1435,9 @@ Disposition::SpecialUpdate( void)
m_pMchMgr->SetLastError( 2010, "Error in Disposition : link outstroke ") ;
return false ;
}
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
CalcAndSetAxesBBox() ;
return true ;
}
+10 -7
View File
@@ -56,14 +56,14 @@ class Disposition : public Operation
{ 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_DISP ; }
bool IsEmpty( void) const override
{ return ( m_nShifts == 0) ; }
int GetType( void) const override
{ return OPER_DISP ; }
bool IsEmpty( void) const override
{ return ( m_nShifts == 0) ; }
bool UpdateStatus( int nModif) override
{ m_nStatus |= nModif ; return true ; }
{ m_nStatus |= nModif ; return true ; }
protected : // Operation
const std::string& GetToolName( void) const override ;
@@ -71,7 +71,7 @@ class Disposition : public Operation
int GetExitNbr( void) const override ;
const std::string& GetToolTcPos( void) const override ;
int GetSolCh( void) const override
{ return 0 ; }
{ return 0 ; }
bool NeedPrevHome( void) const override ;
public :
@@ -102,6 +102,7 @@ class Disposition : public Operation
bool MoveRawPart( int nRawId, const Vector3d& vtMove) ;
bool RotateRawPart( int nRawId, const Vector3d& vtAx, double dAngRotDeg) ;
bool ApplyRotationToRawPart( int nRawId, double dAngCDeg, double dAngADeg, double dAngC1Deg, bool bAddToList = true) ;
bool UpdateRawPartId( int nRawId, int nNewRawId) ;
bool RemoveRawPart( int nRawId) ;
bool GetFixtureData( int nInd, std::string& sName, int& nId, Point3d& ptPos,
double& dAngDeg, double& dMov) const ;
@@ -111,6 +112,8 @@ class Disposition : public Operation
bool GetToolData( std::string& sName, std::string& sHead, int& nExit, std::string& sTcPos) const ;
bool GetSomeByHand( void) const
{ return m_bSomeByHand ; }
bool IsWithTool( void)
{ return ( m_nShifts != -1) ;}
private :
bool InsertMoveInfoInList( int nRawId, int nType, const Point3d& ptP, int nFlag) ;
+1
View File
@@ -21,3 +21,4 @@
std::string GetEMkVer( void) ;
ILogger* GetEMkLogger( void) ;
const std::string& GetEMkKey( void) ;
bool GetEMkNetHwKey( void) ;
+678 -41
View File
@@ -1,13 +1,14 @@
//----------------------------------------------------------------------------
// EgalTech 2015-2015
// EgalTech 2015-2023
//----------------------------------------------------------------------------
// File : Drilling.cpp Data : 21.05.15 Versione : 1.6e7
// File : Drilling.cpp Data : 20.12.23 Versione : 2.5l47
// Contenuto : Implementazione gestione forature.
//
// Note : Questa lavorazione è sempre espressa nel riferimento globale.
//
// Modifiche : 21.05.15 DS Creazione modulo.
//
// 20.12.23 RE Forature multiple con aggregati.
//
//
//----------------------------------------------------------------------------
@@ -19,6 +20,7 @@
#include "OperationConst.h"
#include "/EgtDev/Include/EXeCmdLogOff.h"
#include "/EgtDev/Include/EGkGeoPoint3d.h"
#include "/EgtDev/Include/EGkGeoVector3d.h"
#include "/EgtDev/Include/EGkCurveLine.h"
#include "/EgtDev/Include/EGkCurveArc.h"
#include "/EgtDev/Include/EGkCurveComposite.h"
@@ -27,6 +29,7 @@
#include "/EgtDev/Include/EGkUserObjFactory.h"
#include "/EgtDev/Include/EGnStringKeyVal.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
#include "/EgtDev/Include/EGkGeoFrame3d.h"
using namespace std ;
@@ -45,6 +48,9 @@ using namespace std ;
// 2112 = "Error in Drilling : link outstroke xx"
// 2113 = "Error in Drilling : post apply not calculable"
// 2114 = "Error in Drilling : blind hole not reversible"
// 2115 = "Error in Drilling : Mirror for Double calculation failed"
// 2116 = "Error in Drilling : multi drilling head without valid tools"
// 2117 = "Error in Drilling : incorrect multi drilling head"
// 2151 = "Warning in Drilling : Skipped entity (xx)"
// 2152 = "Warning in Drilling : No machinable path"
// 2153 = "Warning in Drilling : Tool name changed (xx)"
@@ -68,6 +74,39 @@ struct Hole
: nOriId( GDB_ID_NULL), ptIni(), vtDir(), dDiam( 0), dThick( 0), dLen( 0), bBlind( true) {}
} ;
struct MHDrill {
int nInd_id_hole ; // indice foro
Vector3d vtAux ; // vettore ausiliario per tale foratura
} ;
struct HoleInfo {
Hole hole ; // foro
bool bDrill = false ; // se alla fine verrà lavorato
bool bTempDrill = false ; // per test maschera (se durante un test viene lavorato o no)
int nTempTool = -1 ; // per test maschera ( indice utensile che lo lavora durante un test)
bool bSkipToAngle = false ; // nel caso di più assi rotanti, se foro già lavorato con testa orientata
bool bForToolM = false ; // se tool main lavorerà questo foro
int nIndHoleToolM = -1 ; // indice del foro che lo svuoterà inserendo il primo tool in esso
INTVECTOR vToolHole ; // vettore di indici dei fori ai quali inserire l'ultim punta per lavorare il foro corrente
INTVECTOR vIndTools ; // vettore dei tool associati ad ogni lavorazione in vToolHole (ordinati)
VCT3DVECTOR vVtAux ; // vettore dei vtAux ausiliari del tool principale per lavorare questo foro (ordinati)
int nIndTool = -1 ; // indice del tool che alla fine lavorerà il foro
Vector3d vtAux ; // vettore ausiliario del tool principale che permette al tool principale di lavorare questo foro
Point3d ptBtn ; // punto interno alla base del foro
int nIndInSelVector = 0 ; // indice nel vettore m_vId (id fori selezionati)
} ;
struct ToolInfo
{
const ToolData* pTool ; // puntatore per utensile (nullo se utensile non presente)
Point3d ptToolTip ; // punto finale del tool (per ptBtn del foro)
ToolInfo( void)
: pTool( nullptr) {}
ToolInfo( const ToolData* pT)
: pTool( pT) {}
} ;
//----------------------------------------------------------------------------
USEROBJ_REGISTER( GetOperationClass( OPER_DRILLING), Drilling) ;
@@ -95,6 +134,7 @@ Drilling::Clone( void) const
pDri->m_nStatus = m_nStatus ;
pDri->m_nDrillings = m_nDrillings ;
pDri->m_bTiltingTab = m_bTiltingTab ;
pDri->m_vtTiltingAx = m_vtTiltingAx ;
pDri->m_bAboveHead = m_bAboveHead ;
pDri->m_bAggrBottom = m_bAggrBottom ;
}
@@ -450,16 +490,16 @@ Drilling::SetGeometry( const SELVECTOR& vIds)
// se lavorazione standard
if ( m_Params.m_nSubType == DRI_SUB_STD) {
// recupero il valore di tolleranza sul diametro
double dDiamTol = m_pMchMgr->GetCurrMachiningsMgr()->GetHoleDiamToler() ;
//double dDiamTol = m_pMchMgr->GetCurrMachiningsMgr()->GetHoleDiamToler() ;
// verifico che gli identificativi rappresentino dei fori con il corretto diametro
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) || !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 ;
//}
// posso aggiungere alla lista
m_vId.push_back( vIds[i]) ;
}
@@ -513,7 +553,7 @@ Drilling::Preview( bool bRecalc)
// se lavorazione standard
if ( m_Params.m_nSubType == DRI_SUB_STD)
return StdandardProcess( bRecalc, nPvId, GDB_ID_NULL) ;
return StandardProcess( bRecalc, nPvId, GDB_ID_NULL) ;
// se altrimenti lavorazione lungo curve
else if ( m_Params.m_nSubType == DRI_SUB_ALONG_CURVE)
return AlongCurveProcess( bRecalc, nPvId, GDB_ID_NULL) ;
@@ -544,8 +584,14 @@ Drilling::Apply( bool bRecalc, bool bPostApply)
// verifico se necessario continuare nell'aggiornamento
if ( ! bRecalc && ! bToolChanged &&
( m_nStatus == MCH_ST_OK || ( ! bPostApply && m_nStatus == MCH_ST_NO_POSTAPPL))) {
// confermo i percorsi di lavorazione
m_nDrillings = nCurrDrillings ;
LOG_DBG_INFO( GetEMkLogger(), "Drilling 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 ;
@@ -563,9 +609,22 @@ Drilling::Apply( bool bRecalc, bool bPostApply)
else
m_pGeomDB->EmptyGroup( nClId) ;
// elimino eventuale gruppo geometria simmetrica per lavorazione in doppio
int nDblId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_DBL) ;
if ( nDblId != GDB_ID_NULL) {
m_pGeomDB->Erase( nDblId) ;
nDblId = GDB_ID_NULL ;
}
// 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( 2322, "Error in Milling : Tool loading failed") ;
return false ;
}
// se lavorazione standard
if ( m_Params.m_nSubType == DRI_SUB_STD) {
if ( ! StdandardProcess( bRecalc, GDB_ID_NULL, nClId))
if ( ! StandardProcess( bRecalc, GDB_ID_NULL, nClId))
return false ;
}
// se altrimenti lavorazione lungo curve
@@ -583,12 +642,20 @@ Drilling::Apply( bool bRecalc, bool bPostApply)
// eseguo aggiornamento assi macchina e collegamento con operazione precedente
if ( ! Update( bPostApply))
return false ;
// se lavorazione in doppio, aggiungo geometria della parte simmetrica
if ( ! CalcMirrorByDouble( nClId, m_Params.m_sUserNotes)) {
m_pMchMgr->SetLastError( 2115, "Error in Drilling : Mirror for Double calculation failed") ;
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(), "Drilling apply done") ;
return true ;
}
@@ -606,15 +673,11 @@ Drilling::Update( bool bPostApply)
return true ;
}
// elimino le entità CLIMB, RISE e HOME della lavorazione, potrebbero falsare i calcoli degli assi (in ogni casi vengono riaggiunte dopo)
RemoveClimbRiseHome() ;
// imposto eventuale asse bloccato da lavorazione
if ( ! m_Params.m_sBlockedAxis.empty()) {
string sAxis, sVal ;
Split( m_Params.m_sBlockedAxis, "=", true, sAxis, sVal) ;
double dVal = 0 ;
FromString( sVal, dVal) ;
m_pMchMgr->ClearRotAxisBlock() ;
m_pMchMgr->SetRotAxisBlock( sAxis, dVal) ;
}
SetBlockedRotAxis( m_Params.m_sBlockedAxis) ;
// calcolo gli assi macchina
string sHint = ExtractHint( m_Params.m_sUserNotes) ;
@@ -657,12 +720,71 @@ Drilling::Update( bool bPostApply)
//----------------------------------------------------------------------------
bool
Drilling::StdandardProcess( bool bRecalc, int nPvId, int nClId)
Drilling::VerifyMultiParallelFixedDrills( void)
{
// se aggregato da sotto, sicuramente con una sola punta
bool bAggrBottom = IsAggrBottom( m_TParams.m_sHead) ;
if ( bAggrBottom)
return false ;
// se una sola uscita, inutile continuare
int nExitCnt = m_pMchMgr->GetCurrMachine()->GetHeadExitCount( m_TParams.m_sHead) ;
if ( nExitCnt == 1)
return false ;
// verifico che le uscite siano fisse
int nSelectType = m_pMchMgr->GetCurrMachine()->GetHeadSelectType( m_TParams.m_sHead) ;
if ( nSelectType != MCH_SLT_FIXEDEXITS)
return false ;
// recupero la direzione dell'utensile principale
Point3d ptMainExit ; Vector3d vtMainTool, vtMainAux ;
m_pMchMgr->GetCurrMachine()->GetHeadExitPosDirAux( m_TParams.m_sHead, m_TParams.m_nExit, ptMainExit, vtMainTool, vtMainAux) ;
// verifico ci sia almeno un'altra uscita attrezzata parallela a quella principale
for ( int nT = 0 ; nT < nExitCnt ; ++ nT) {
if ( nT + 1 == m_TParams.m_nExit)
continue ;
string sToolName ;
if ( m_pMchMgr->GetLoadedTool( m_TParams.m_sHead, nT + 1, sToolName) && ! sToolName.empty()) {
Point3d ptExit ; Vector3d vtTool, vtAux ;
if ( m_pMchMgr->GetCurrMachine()->GetHeadExitPosDirAux(m_TParams.m_sHead, nT + 1, ptExit, vtTool, vtAux) &&
AreSameVectorApprox( vtTool, vtMainTool))
return true ;
}
}
// non è stato trovato niente
return false ;
}
// elaboro i singoli fori
int i = 0 ;
for ( const auto& vId : m_vId) {
//----------------------------------------------------------------------------
bool
Drilling::StandardProcess( bool bRecalc, int nPvId, int nClId)
{
// se ho almeno un'altra punta fissa parallela alla principale ...
if ( VerifyMultiParallelFixedDrills()) {
TABMHDRILL tabDrills ;
double dMHOff = 0 ;
if ( ! MultiHeadDrilling( m_vId, nClId, tabDrills, dMHOff))
return false ;
if ( tabDrills.empty())
return true ;
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))
return false ;
// creo la regione di ingombro del foro
int nDriId = m_pGeomDB->GetFirstInGroup( m_pGeomDB->GetLastGroupInGroup( nPvId)) ;
GenerateHoleRegionPv( nDriId, 1, nPvId) ;
}
// se richiesta lavorazione
if ( nClId != GDB_ID_NULL) {
if ( ! GenerateHoleCl( i, m_vId[tabDrills[i][0].nInd_id_hole], MCH_PATH, nClId, dMHOff, tabDrills[i][0].vtAux))
return false ;
}
}
return true ;
}
// ... altrimenti elaboro i singoli fori
for ( int i = 0 ; i < int( m_vId.size()) ; ++ i) {
const auto& vId = m_vId[i] ;
// se richiesto preview
if ( nPvId != GDB_ID_NULL) {
if ( ! GenerateHolePv( i, vId, MCH_PATH, nPvId))
@@ -676,13 +798,503 @@ Drilling::StdandardProcess( bool bRecalc, int nPvId, int nClId)
if ( ! GenerateHoleCl( i, vId, MCH_PATH, nClId))
return false ;
}
// incremento indice
++ i ;
}
return true ;
}
//----------------------------------------------------------------------------
bool
Drilling::MultiHeadDrilling( const SELVECTOR& vId, int nClId, TABMHDRILL& tabDrills, double& dMHOff, bool bOrd)
{
// controllo parametri
tabDrills.clear() ;
if ( vId.empty())
return true ;
// gestore degli utensili
ToolsMgr* pTMgr = m_pMchMgr->GetCurrToolsMgr() ;
if ( pTMgr == nullptr)
return false ;
// recupero il nome della testa e il numero di uscite
string sHead ;
m_pMchMgr->GetCurrMachine()->GetCurrHead( sHead) ;
int nExitCnt = m_pMchMgr->GetCurrMachine()->GetHeadExitCount( sHead) ;
// Recupero i dati degli utensili montati sulla testa
int nMainToolInd = -1 ;
VECTORTOOL vTools ; vTools.reserve( nExitCnt) ;
// ricavo gli utensili presenti sulle uscite
for ( int nT = 0 ; nT < nExitCnt ; ++ nT) {
string sToolName ;
if ( ! m_pMchMgr->GetLoadedTool( sHead, nT + 1, sToolName) || sToolName.empty()) {
// non c'è utensile
vTools.emplace_back( nullptr) ;
continue ;
}
// se presente e valido
const ToolData* pTdata = pTMgr->GetTool( sToolName) ;
vTools.emplace_back( pTdata) ;
// imposto il tool di riferimento come il tool m_TParams
if ( pTdata->m_Uuid == m_TParams.m_Uuid)
nMainToolInd = nT ;
}
// se non ho utensili attivi o validi, errore
if ( nMainToolInd == -1 || vTools.empty()) {
m_pMchMgr->SetLastError( 2116, "Error in Drilling : multi drilling head without valid tools") ;
return false ;
}
// recupero i dati dell'uscita dell'utensile principale
Vector3d vtTool, vtAux ;
Point3d ptExit ;
m_pMchMgr->GetCurrMachine()->GetHeadExitPosDirAux( sHead, nMainToolInd + 1, ptExit, vtTool, vtAux) ;
vTools[nMainToolInd].ptToolTip = ptExit - vtTool * vTools[nMainToolInd].pTool->m_dLen ;
if ( vtAux.IsSmall() && m_pMchMgr->GetCurrMachine()->GetCurrRotAxes() == 0)
vtAux = FromUprightOrtho( vtTool) ;
if ( vtTool.IsSmall() || vtAux.IsSmall()) {
m_pMchMgr->SetLastError( 2117, "Error in Drilling : incorrect multi drilling head") ;
return false ;
}
// carico gli altri dati della testa con le sue uscite
for ( int nT = 0 ; nT < nExitCnt ; ++ nT) {
// se utensile principale, salto al successivo
if ( nT == nMainToolInd)
continue ;
// se non attrezzato, salto al successivo
if ( vTools[nT].pTool == nullptr)
continue ;
// recupero i dati dell'uscita
Point3d ptExit ;
Vector3d vtCurrDir, vtCurrAux ;
m_pMchMgr->GetCurrMachine()->GetHeadExitPosDirAux( sHead, nT + 1, ptExit, vtCurrDir, vtCurrAux) ;
// controllo abbia la stessa direzione del principale, altrimenti disattrezzo
if ( ! AreSameVectorApprox( vtCurrDir, vtTool)) {
vTools[nT].pTool = nullptr ;
continue ;
}
// assegno tip utensile
vTools[nT].ptToolTip = ptExit - vtCurrDir * vTools[nT].pTool->m_dLen ;
}
// Recupero le geometrie dei fori
bool bSomeHoleOk = false ;
VECTORHOLE vHoles( vId.size()) ;
for ( int h = 0 ; h < ( int)vId.size() ; ++ h) {
Hole hole ;
if ( ! GetHoleData( m_vId[h], hole)) {
string sInfo = "Warning in Drilling : Skipped entity " + ToString( m_vId[h]) ;
m_pMchMgr->SetWarning( 2151, sInfo) ;
continue ;
}
// se richiesta inversione e foro passante, provvedo
if ( m_Params.m_bInvert) {
if ( hole.bBlind) {
m_pMchMgr->SetLastError( 2114, "Error in Drilling : blind hole not reversible") ;
return false ;
}
else {
hole.ptIni -= hole.vtDir * hole.dThick ;
hole.vtDir.Invert() ;
}
}
// se lavorazione del foro non arriva al suo fondo, lo considero cieco
if ( hole.dLen < hole.dThick - 10 * EPS_SMALL)
hole.bBlind = true ;
vHoles[h].hole = hole ;
vHoles[h].nIndInSelVector = h ;
bSomeHoleOk = true ;
}
if ( ! bSomeHoleOk)
return true ;
// calcolo la corrispondenza tra utensili e fori
if ( ! CalcMask( vHoles, vTools, nMainToolInd, vtTool, vtAux))
return false ;
// i fori con dimensione 0 del vettore vToolHole non possono essere lavorati
int nNoDrillHoles = 0 ;
for ( int i = 0 ; i < ( int)vHoles.size() ; ++ i) {
if ( vHoles[i].vToolHole.empty())
++ nNoDrillHoles ;
}
// resetto le variabili di controllo di lavorazione temporanea per tutti i fori
for ( int k = 0 ; k < ( int)vHoles.size() ; ++k)
vHoles[k].bTempDrill = false ;
// numero di fori lavorati
int nOkHole = 0 ;
// se c'è un solo foro va sicuramente bene
if ( vHoles.size() == 1 && ! vHoles[0].vVtAux.empty()) {
vHoles[0].bForToolM = true ;
vHoles[0].nIndTool = nMainToolInd ;
vHoles[0].nIndHoleToolM = 0 ;
vHoles[0].vtAux = vHoles[0].vVtAux[0] ;
}
// decido in quali fori inserire il tool principale
for ( int nCheck = 1 ; nCheck < ( int)vHoles.size() && nOkHole < ( int)vHoles.size() - nNoDrillHoles ; ++ nCheck) {
for ( int i = 0 ; i < ( int)vHoles.size() ; ++i) {
// prendo tutti i fori con vToolHope di lunghezza nCheck non già lavorati
if ( vHoles[i].vToolHole.size() == nCheck && ! vHoles[i].bDrill) {
vHoles[vHoles[i].vToolHole[0]].bForToolM = true ;
vHoles[vHoles[i].vToolHole[0]].nIndTool = nMainToolInd ;
vHoles[vHoles[i].vToolHole[0]].nIndHoleToolM = vHoles[i].vToolHole[0] ;
vHoles[vHoles[i].vToolHole[0]].vtAux = vHoles[i].vVtAux[0] ;
for ( int k = 0 ; k < ( int)vHoles.size() ; ++k) {
for ( int l = 0 ; l < ( int)vHoles[k].vToolHole.size() ; ++l) {
if ( vHoles[k].vToolHole[l] == vHoles[i].vToolHole[0] && ! vHoles[k].bDrill) {
vHoles[k].bDrill = true ;
vHoles[k].nIndTool = vHoles[k].vIndTools[0] ;
vHoles[k].nIndHoleToolM = vHoles[vHoles[i].vToolHole[0]].nIndHoleToolM ;
vHoles[k].vtAux = vHoles[k].vVtAux[l] ;
++ nOkHole ;
break ;
}
}
}
}
}
}
// calcolo la massima differenza di lunghezza tra il primo tool e gli altri ( così l'elevazione finale rimane compatibile)
double dRefLen = vTools[nMainToolInd].pTool->m_dTLen ;
double dOffMax = 0 ;
for ( int nT = 0 ; nT < ( int)vTools.size() && nNoDrillHoles != (int)vHoles.size() ; ++ nT) {
if ( vTools[nT].pTool == nullptr || nT == nMainToolInd)
continue ;
if ( vTools[nT].pTool->m_dTLen > dRefLen + dOffMax) {
dOffMax = vTools[nT].pTool->m_dTLen - dRefLen ;
}
}
dMHOff = dOffMax ;
// riempio la maschera
VCT3DVECTOR vVtA ;
for ( int i = 0 ; i < ( int)vHoles.size() && nNoDrillHoles != ( int)vHoles.size() ; ++ i) {
if ( ! vHoles[i].bForToolM)
continue ;
// per tutti i fori che vengono svuotati da un tool t-esimo conto quanti versori A diversi tra loro trovo
for ( int j = 0 ; j < ( int)vHoles.size() ; ++j) {
if ( vHoles[j].nIndHoleToolM != i)
continue ;
if ( vVtA.empty())
vVtA.push_back( vHoles[j].vtAux) ;
else {
bool bPush = true ;
for ( int v = 0 ; v < ( int)vVtA.size() ; ++ v) {
if ( AreSameVectorApprox( vHoles[j].vtAux, vVtA[v])) {
bPush = false ;
break ;
}
}
if ( bPush)
vVtA.push_back( vHoles[j].vtAux) ;
}
}
for ( int v = 0 ; v < ( int)vVtA.size() ; ++ v) {
vector<MHDrill> vRowDrill ;
MHDrill FirstMHDrill ;
FirstMHDrill.nInd_id_hole = i ;
FirstMHDrill.vtAux = vVtA[v] ;
vRowDrill.push_back( FirstMHDrill) ;
tabDrills.push_back( vRowDrill) ;
}
vVtA.clear() ;
}
// se non trovo corrispondenze ...
if ( tabDrills.empty())
return true ;
// se devo riordinare
if ( bOrd) {
struct Order {
int nInd_id_hole ;
Point3d ptIni ;
} ;
vector<Order> vOrder ;
for ( int i = 0 ; i < ( int)tabDrills.size() ; ++ i) {
Order newOrder ;
newOrder.nInd_id_hole = tabDrills[i][0].nInd_id_hole ;
newOrder.ptIni = vHoles[tabDrills[i][0].nInd_id_hole].hole.ptIni ;
vOrder.push_back( newOrder) ;
}
// prendo come riferimento il punto del primo foro selezionato dall'utente
Point3d ptRef = vOrder[0].ptIni ;
double dMinDist = INFINITO ;
int nIndexSwitch = -1 ;
for ( int i = 0 ; i < ( int)vOrder.size() - 1 ; ++ i) {
for ( int j = i + 1 ; j < ( int)vOrder.size() ; ++ j) {
Point3d ptS = vOrder[j].ptIni ;
if ( Dist( ptS, ptRef) < dMinDist) {
dMinDist = Dist( ptS, ptRef) ;
nIndexSwitch = j ;
}
}
if ( nIndexSwitch != i + 1) {
vector<MHDrill> VHelp = tabDrills[nIndexSwitch] ;
tabDrills[nIndexSwitch] = tabDrills[i + 1] ;
tabDrills[i + 1] = VHelp ;
}
ptRef = vOrder[i + 1].ptIni ;
dMinDist = INFINITO ;
}
}
return true ;
}
//----------------------------------------------------------------------------
bool
Drilling::CalcMask( VECTORHOLE& vHoles, const VECTORTOOL& vTools, int nIndMT, const Vector3d& vtTool, const Vector3d& vtAux)
{
// controllo dei parametri
if ( vHoles.empty() || vTools.empty())
return false ;
// recupero il valore di tolleranza sul diametro
double dDiamToler = m_pMchMgr->GetCurrMachiningsMgr()->GetHoleDiamToler() ;
int nExitCnt = ( int)vTools.size() ;
int nNullTools = 0 ;
for ( int i = 0 ; i < ( int)vTools.size() ; ++ i) {
if ( vTools[i].pTool == nullptr)
++ nNullTools ;
}
// in ogni foro i-esimo inserisco il Tool principale
for ( int i = 0 ; i < ( int)vHoles.size() ; ++ i) {
// resetto le veriabili di controllo di svuotatura temporanea per tutti i fori
for ( int k = 0 ; k < ( int)vHoles.size() ; ++ k) {
vHoles[k].bTempDrill = false ;
vHoles[k].nTempTool = -1 ;
}
// verifica validità del foro i-esimo per il Tool principale
Hole Hole_i = vHoles[i].hole ;
if ( ! MultiHeadVerifyHole( Hole_i, vTools[nIndMT].pTool, dDiamToler, m_vId[vHoles[i].nIndInSelVector]))
continue ;
int nStat ;
DBLVECTOR vAng1, vAng2 ;
// angoli per allineare T del tool principale con vtDir del foro i-esimo
if ( ! m_pMchMgr->GetCalcAngles( Hole_i.vtDir, V_NULL, nStat, vAng1, vAng2))
continue ;
Vector3d vtTnew ;
// check che T sia allineato con vtDir
if ( ! m_pMchMgr->GetCalcToolDirFromAngles( vAng1, vtTnew) || ! AreSameVectorApprox( vtTnew, Hole_i.vtDir))
continue ;
Vector3d vtAnew ;
// nuova configurazione del versore A ottenuta
if ( ! m_pMchMgr->GetCalcAuxDirFromAngles( vAng1, vtAnew))
continue ;
if ( vtAnew.IsSmall() && m_pMchMgr->GetCurrMachine()->GetCurrRotAxes() == 0)
vtAnew = vtAux ;
// creo un nuovo sistema di riferimento centrato nel Tool principale
Frame3d frMT ;
frMT.Set( vTools[nIndMT].ptToolTip, vtTool, vtAux) ;
if ( ! frMT.IsValid())
return false ;
// creo un frame nel foro i-esimo orientato come il frame sul tool principale ( origine nella base interna del foro)
Frame3d frHMT ;
frHMT.Set( Hole_i.ptIni - Hole_i.vtDir * Hole_i.dLen, vtTnew, vtAnew) ;
if ( ! frHMT.IsValid())
return false ;
// numero di svuotature inserendo il Tool principale nel foro i-esimo
int nDrills = 1 ;
// setto le variabili temporanee per il foro i-esimo
vHoles[i].bTempDrill = true ;
vHoles[i].nTempTool = nIndMT ;
// controllo la compatibilità tra le geometrie dei Tool e dei fori
CheckOtherHolesWithTools( vHoles, vTools, nIndMT, i, Hole_i, frMT, frHMT, dDiamToler, nDrills) ;
// controllo quanti fori sono riuscito a svuotare e setto i loro parametri di foratura
if ( nDrills == nExitCnt - nNullTools) { // se ho svuotato il numero corretto di fori ...
for ( int d = 0 ; d < ( int)vHoles.size() ; ++ d) {
if ( vHoles[d].bTempDrill) {
vHoles[d].vToolHole.push_back( i) ; // indice del foro per il tool principale
vHoles[d].vIndTools.push_back( vHoles[d].nTempTool) ; // indice del tool che svuota questo foro
vHoles[d].vVtAux.push_back( frHMT.VersX()) ; // versore ausiliario A del tool principale
}
}
}
else {
for ( int d = 0 ; d < ( int)vHoles.size() ; ++ d)
if ( vHoles[d].bTempDrill)
vHoles[d].bTempDrill = false ;
}
// se la testa può ruotare
if ( nStat < 0) {
// inizio a scorrere tutti i tools
for ( int t = 0 ; t < ( int)vTools.size() ; ++ t) {
if ( vTools[t].pTool == nullptr || t == nIndMT)
continue ;
// cerco se ho un foro j-esimo adatto per quella punta
for ( int j = 0 ; j < ( int)vHoles.size() ; ++ j) {
Hole Hole_j = vHoles[j].hole ;
if ( i == j ||
vHoles[j].bSkipToAngle ||
! AreSameVectorApprox( Hole_j.vtDir, Hole_i.vtDir) ||
! MultiHeadVerifyHole( Hole_j, vTools[t].pTool, dDiamToler, m_vId[vHoles[j].nIndInSelVector]))
continue ;
// resetto le veriabili di controllo di svuotatura temporanea per tutti i fori
for ( int k = 0 ; k < ( int)vHoles.size() ; ++ k) {
vHoles[k].bTempDrill = false ;
vHoles[k].nTempTool = -1 ;
}
Vector3d vtRefT = vTools[t].ptToolTip - vTools[nIndMT].ptToolTip ;
Vector3d vtRefH = Hole_j.ptIni - Hole_j.vtDir * Hole_j.dLen -
( Hole_i.ptIni - Hole_i.vtDir * Hole_i.dLen) ;
// se le distanze sono compatibili
if ( abs( vtRefH.Len() - vtRefT.Len()) < EPS_SMALL) {
// rioriento il frame sul foro i-esimo
Point3d ptHj = Hole_j.ptIni - Hole_j.vtDir * Hole_j.dLen ;
ptHj.ToLoc( frHMT) ;
Vector3d vtProjB( ptHj.x, ptHj.y, 0) ;
Point3d ptTt = vTools[t].ptToolTip ;
ptTt.ToLoc( frMT) ;
Vector3d vtProjA( ptTt.x, ptTt.y, 0) ;
double dAngle ; vtProjA.GetAngle( vtProjB, dAngle) ;
frHMT.Rotate( frHMT.Orig(), frHMT.VersZ(), dAngle) ;
nDrills = 1 ; // foratura nel foro i-esimo e j-esimo
CheckOtherHolesWithTools( vHoles, vTools, nIndMT, i, Hole_i, frMT, frHMT, dDiamToler, nDrills) ;
// setto le variabili temporanee per il foro i-esimo
vHoles[i].bTempDrill = true ;
vHoles[i].nTempTool = nIndMT ;
// controllo quanti fori sono riuscito a svuotare in questo nuovo sistema di riferimento
if ( nDrills == nExitCnt - nNullTools) {
for ( int d = 0 ; d < ( int)vHoles.size() ; ++ d) {
if ( vHoles[d].bTempDrill) {
vHoles[d].vToolHole.push_back( i) ; // indice del foro per il tool principale
vHoles[d].vIndTools.push_back( vHoles[d].nTempTool) ; // indice del tool che svuota questo foro
vHoles[d].vVtAux.push_back( frHMT.VersX()) ; // versore ausiliario del tool principale
vHoles[d].bSkipToAngle = true ;
}
}
}
else {
for ( int d = 0 ; d < ( int)vHoles.size() ; ++ d)
if ( vHoles[d].bTempDrill)
vHoles[d].bTempDrill = false ;
}
}
}
}
}
}
return true ;
}
//----------------------------------------------------------------------------
bool
Drilling::CheckOtherHolesWithTools( VECTORHOLE& vHoles, const VECTORTOOL& vTools, int nIndTM, int nIndHTM, Hole holeICP,
const Frame3d& frMT, const Frame3d& frHMT, double dDiamToler, int& nDrills)
{
// controllo parametri
if ( vHoles.empty() || vTools.empty())
return true ;
if ( nIndTM < 0 || nIndTM >= ( int)vTools.size() ||
nIndHTM < 0 || nIndHTM >= ( int)vHoles.size() ||
! frMT.IsValid() || ! frHMT.IsValid() ||
nDrills < 0 || nDrills > max( ( int)vHoles.size(), ( int)vTools.size()))
return false ;
// definisco il punto dove cade il tool principale
Hole holeTM = holeICP ; // copia del foro i-esimo
// ciclo su tutti i tools
for ( int t = 0 ; t < ( int)vTools.size() ; ++ t) {
if ( vTools[t].pTool == nullptr || t == nIndTM)
continue ;
// esprimo il punto finale del tool t-esimo nel sistema di riferimento del Tool principale
Point3d ptETt = vTools[t].ptToolTip ;
ptETt.ToLoc( frMT) ;
// cerco se ho un foro j-esimo adatto per quella punta
for ( int j = 0 ; j < ( int)vHoles.size() ; ++ j) {
Hole Hole_j = vHoles[j].hole ; // copia del foro j-esimo
// controllo che il foro j-esimo non sia l'i-esimo, che non sia stato già precedentemente svuotato da un altro tool t'-esimo ...
// ... che vtDir del foro i-esimo coincida con vtDir del foro j-esimo e che il tool t-esimo sia compatibile con il foro j-esimo
if ( nIndHTM == j ||
vHoles[j].bTempDrill ||
! AreSameVectorApprox( Hole_j.vtDir, holeTM.vtDir) ||
! MultiHeadVerifyHole( Hole_j, vTools[t].pTool, dDiamToler, m_vId[vHoles[j].nIndInSelVector]))
continue ;
// esprimo il foro j-esimo nel sistema di riferimento del Tool principale centrato nel foro i-esimo
Point3d ptHj = Hole_j.ptIni - Hole_j.vtDir * Hole_j.dLen ;
ptHj.ToLoc( frHMT) ;
// controllo la compatibilità
if ( AreSamePointApprox( ptHj, ptETt)) {
// un foro in più lavorato
++ nDrills ;
// aggiorno le variabili temporanee
vHoles[j].bTempDrill = true ;
vHoles[j].nTempTool = t ;
// non controllo gli altri vertici per la punta t-esima
break ;
}
}
}
return true ;
}
//----------------------------------------------------------------------------
bool
Drilling::MultiHeadVerifyHole( Hole& hole, const ToolData* Tool, double dDiamToler, SelData Id)
{
// verifico che il diamtro del tool sia compatibile con quello del foro
if ( ! VerifyDiameter( hole.dDiam, Tool->m_dDiam, dDiamToler))
return false ;
// imposto elevazione da lunghezza foro con possibilità di sovrascrittura da info
double dElev = hole.dLen ;
double dMaxElev ;
if ( FromString( ExtractInfo( m_Params.m_sUserNotes, "MaxElev="), dMaxElev) && dElev > dMaxElev) {
dElev = dMaxElev ;
hole.ptIni += hole.vtDir * ( dElev - hole.dLen) ;
hole.dLen = dElev ;
}
// limito lunghezza foro a massima lavorazione della punta
double dAddLen = ( hole.bBlind ? 0 : m_Params.m_dThroughAddLen) ;
if ( ( dElev + dAddLen) > Tool->m_dMaxMat + EPS_SMALL) {
hole.dLen = Tool->m_dMaxMat + max( hole.dLen - dElev, 0.) ;
hole.bBlind = true ;
}
if ( ! VerifyHoleFromBottom( hole, Id))
return false ;
return true ;
}
//----------------------------------------------------------------------------
bool
Drilling::AlongCurveProcess( bool bRecalc, int nPvId, int nClId)
@@ -975,12 +1587,12 @@ Drilling::GenerateHolePv( int nInd, const SelData& nCircId, const string& sPName
PtrOwner<ICurveArc> pCrvArc( CreateCurveArc()) ;
if ( IsNull( pCrvArc) || ! pCrvArc->Set( hole.ptIni, hole.vtDir, 0.5 * m_TParams.m_dDiam))
return false ;
// assegno il versore estrusione e lo spessore
// assegno il versore estrusione e lo spessore
pCrvArc->SetExtrusion( hole.vtDir) ;
pCrvArc->SetThickness( - hole.dLen) ;
// inserisco nel DB
int nDriId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nPathId, Release( pCrvArc)) ;
// assegno nome e colore
// assegno nome e colore
m_pGeomDB->SetName( nDriId, MCH_PV_CUT) ;
m_pGeomDB->SetMaterial( nDriId, LIME) ;
// aggiorno numero forature
@@ -990,7 +1602,7 @@ Drilling::GenerateHolePv( int nInd, const SelData& nCircId, const string& sPName
//----------------------------------------------------------------------------
bool
Drilling::GenerateHoleCl( int nInd, const SelData& nCircId, const string& sPName, int nClId)
Drilling::GenerateHoleCl( int nInd, const SelData& nCircId, const string& sPName, int nClId, double dMHOff, Vector3d vtA)
{
// creo gruppo per geometria di lavorazione del foro
int nPathId = m_pGeomDB->AddGroup( GDB_ID_NULL, nClId, Frame3d()) ;
@@ -1026,8 +1638,11 @@ Drilling::GenerateHoleCl( int nInd, const SelData& nCircId, const string& sPName
// imposto elevazione da lunghezza foro con possibilità di sovrascrittura da info
double dElev = hole.dLen ;
double dMaxElev ;
if ( FromString( ExtractInfo( m_Params.m_sUserNotes, "MaxElev="), dMaxElev) && dElev > dMaxElev)
if ( FromString( ExtractInfo( m_Params.m_sUserNotes, "MaxElev="), dMaxElev) && dElev > dMaxElev) {
dElev = dMaxElev ;
hole.ptIni += hole.vtDir * ( dElev - hole.dLen) ;
hole.dLen = dElev ;
}
// limito lunghezza foro a massima lavorazione della punta
double dAddLen = ( hole.bBlind ? 0 : m_Params.m_dThroughAddLen) ;
if ( ( dElev + dAddLen) > m_TParams.m_dMaxMat + EPS_SMALL) {
@@ -1038,7 +1653,7 @@ Drilling::GenerateHoleCl( int nInd, const SelData& nCircId, const string& sPName
}
// verifico se tavola basculante
bool bTiltTab = false ;
m_bTiltingTab = ( m_pMchMgr->GetCurrMachine()->GetCurrTableIsTilting( bTiltTab) && bTiltTab) ;
m_bTiltingTab = ( m_pMchMgr->GetCurrMachine()->GetCurrTableIsTilting( bTiltTab, m_vtTiltingAx) && bTiltTab) ;
// verifico se testa da sopra (Z+)
m_bAboveHead = m_pMchMgr->GetHeadAbove( m_TParams.m_sHead) ;
// verifiche per foro verso il basso
@@ -1055,7 +1670,7 @@ Drilling::GenerateHoleCl( int nInd, const SelData& nCircId, const string& sPName
// foro normale
if ( m_Params.m_dStep < EPS_SMALL ||
m_Params.m_dStep > hole.dLen - EPS_SMALL) {
if ( DoStandardDrilling( hole, nCircId, nPathId)) {
if ( DoStandardDrilling( hole, nCircId, nPathId, dMHOff, vtA)) {
// aggiorno numero forature
++ m_nDrillings ;
}
@@ -1300,11 +1915,31 @@ Drilling::UpdateToolData( bool* pbChanged)
const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ;
if ( pTdata == nullptr)
return false ;
// verifico se sono diversi (ad esclusione del nome)
m_TParams.m_sName = pTdata->m_sName ;
bool bChanged = ! SameTool( m_TParams, *pTdata) ;
// 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 Drilling : tool name changed (" +
@@ -1439,7 +2074,7 @@ Drilling::VerifyHoleFromBottom( const Hole& hole, SelData Id)
// calcolo la distanza minima del punto dal contorno del grezzo
double dDist ;
Vector3d vtDir ;
if ( ! GetMinDistanceFromRawSide( m_nPhase, hole.ptIni, 0, dDist, vtDir) || dDist > m_AggrBottom.dDMax) {
if ( ! GetMinDistanceFromRawSide( m_nPhase, hole.ptIni, 0, m_AggrBottom.vtMDir, MCH_AGB_DELTAMAX_MDIR, dDist, vtDir) || dDist > m_AggrBottom.dDMax) {
string sOut = "Error in Drilling : Entity " + ToString( Id) + " skipped because too far from part sides" ;
m_pMchMgr->SetLastError( 2107, sOut) ;
return false ;
@@ -1453,7 +2088,7 @@ Drilling::VerifyHoleFromBottom( const Hole& hole, SelData Id)
//----------------------------------------------------------------------------
bool
Drilling::DoStandardDrilling( const Hole& hole, SelData Id, int nPathId)
Drilling::DoStandardDrilling( const Hole& hole, SelData Id, int nPathId, double dMHOff, Vector3d vtA)
{
// aggiusto alcuni parametri del ciclo di foratura
double dStartSlowLen = abs( m_Params.m_dStartSlowLen) ;
@@ -1472,7 +2107,7 @@ Drilling::DoStandardDrilling( const Hole& hole, SelData Id, int nPathId)
bool bEndSlow = ( dEndSlowLen > EPS_SMALL) ;
// determino l'elevazione
double dElev = 0 ;
GetElevation( m_nPhase, hole.ptIni, hole.vtDir, dElev) ;
GetElevation( m_nPhase, hole.ptIni, hole.vtDir, m_TParams.m_dDiam / 2, hole.vtDir, dElev) ;
// determino alcune caratteristiche dell'utensile
double dTExtrLen = max( 0.0, m_TParams.m_dTLen - m_TParams.m_dLen) ;
// imposto dati comuni
@@ -1483,7 +2118,7 @@ Drilling::DoStandardDrilling( const Hole& hole, SelData Id, int nPathId)
double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
double dSafeAggrBottZ = m_pMchMgr->GetCurrMachiningsMgr()->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) ;
@@ -1510,6 +2145,8 @@ Drilling::DoStandardDrilling( const Hole& hole, SelData Id, int nPathId)
return false ;
}
else {
if( ! vtA.IsSmall())
SetAuxDir( vtA) ;
if ( AddRapidStart( ptP1) == GDB_ID_NULL)
return false ;
}
@@ -1601,7 +2238,7 @@ Drilling::DoPeckDrilling( const Hole& hole, SelData Id, int nPathId)
bool bEndSlow = ( dEndSlowLen > EPS_SMALL) ;
// determino l'elevazione
double dElev = 0 ;
GetElevation( m_nPhase, hole.ptIni, hole.vtDir, dElev) ;
GetElevation( m_nPhase, hole.ptIni, hole.vtDir, m_TParams.m_dDiam / 2, hole.vtDir, dElev) ;
// determino alcune caratteristiche dell'utensile
double dTExtrLen = max( 0.0, m_TParams.m_dTLen - m_TParams.m_dLen) ;
// imposto dati comuni
+16 -3
View File
@@ -19,7 +19,13 @@
#include "MachiningConst.h"
struct Hole ;
struct MHDrill ;
struct HoleInfo ;
struct ToolInfo ;
class ICurve ;
typedef std::vector<std::vector<MHDrill>> TABMHDRILL ;
typedef std::vector<HoleInfo> VECTORHOLE ;
typedef std::vector<ToolInfo> VECTORTOOL ;
//----------------------------------------------------------------------------
class Drilling : public Machining
@@ -68,18 +74,24 @@ class Drilling : public Machining
private :
bool GetHoleData( SelData Id, Hole& hole) ;
bool StdandardProcess( bool bRecalc, int nPvId, int nClId) ;
bool StandardProcess( bool bRecalc, int nPvId, int nClId) ;
bool AlongCurveProcess( bool bRecalc, int nPvId, int nClId) ;
bool Chain( int nGrpDestId) ;
ICurve* GetCurve( SelData Id) ;
bool ProcessPath( int nPathId, int nPvId, int nClId) ;
bool GenerateHolePv( int nInd, const SelData& nCircId, const std::string& sPName, int nPvId) ;
bool GenerateHoleCl( int nInd, const SelData& nCircId, const std::string& sPName, int nClId) ;
bool GenerateHoleCl( int nInd, const SelData& nCircId, const std::string& sPName, int nClId, double dMHOff = .0, Vector3d vtAux = V_NULL) ;
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) ;
bool DoStandardDrilling( const Hole& hole, SelData Id, int nPathId, double nMHOff, Vector3d vtA) ;
bool DoPeckDrilling( const Hole& hole, SelData Id, int nPathId) ;
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,
const Frame3d& frHTM, const Frame3d& frHMTOP, double dDiamToler, int& nDrills) ;
bool MultiHeadVerifyHole( Hole& hole, const ToolData* Tool, double dDiamToler, SelData Id) ;
bool VerifyMultiParallelFixedDrills( void) ;
private :
double GetSpeed() const
@@ -100,6 +112,7 @@ class Drilling : public Machining
int m_nStatus ; // stato di aggiornamento della lavorazione
int m_nDrillings ; // numero di fori generati
bool m_bTiltingTab ; // flag utilizzo tavola basculante
Vector3d m_vtTiltingAx ; // versore direzione eventuale asse basculante
bool m_bAboveHead ; // flag utilizzo testa da sopra
bool m_bAggrBottom ; // flag di utilizzo dell'aggregato da sotto
Vector3d m_vtAggrBottom ; // vettore direzione ausiliaria aggregato da sotto
+6 -2
View File
@@ -75,6 +75,10 @@ struct DrillingData : public MachiningData
//----------------------------------------------------------------------------
inline const DrillingData* GetDrillingData( const MachiningData* pMdata)
{ return (dynamic_cast<const DrillingData*>( pMdata)) ; }
{ if ( pMdata == nullptr || pMdata->GetType() != MT_DRILLING)
return nullptr ;
return ( static_cast<const DrillingData*>( pMdata)) ; }
inline DrillingData* GetDrillingData( MachiningData* pMdata)
{ return (dynamic_cast<DrillingData*>( pMdata)) ; }
{ if ( pMdata == nullptr || pMdata->GetType() != MT_DRILLING)
return nullptr ;
return ( static_cast<DrillingData*>( pMdata)) ; }
+15
View File
@@ -98,6 +98,7 @@ GetEMkLogger( void)
//-----------------------------------------------------------------------------
static std::string s_sKey ;
static bool s_bNetHwKey = false ;
//-----------------------------------------------------------------------------
void
@@ -106,9 +107,23 @@ SetEMkKey( const std::string& sKey)
s_sKey = sKey ;
}
//-----------------------------------------------------------------------------
void
SetEMkNetHwKey( bool bNetHwKey)
{
s_bNetHwKey = bNetHwKey ;
}
//-----------------------------------------------------------------------------
const std::string&
GetEMkKey( void)
{
return s_sKey ;
}
//-----------------------------------------------------------------------------
bool
GetEMkNetHwKey( void)
{
return s_bNetHwKey ;
}
BIN
View File
Binary file not shown.
+10 -6
View File
@@ -21,13 +21,13 @@
<PropertyGroup Label="Globals">
<ProjectGuid>{0BD58222-92F3-48B2-B656-4497D1956874}</ProjectGuid>
<RootNamespace>EgtMachKernel</RootNamespace>
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0.20348.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v120_xp</PlatformToolset>
<PlatformToolset>v141_xp</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
@@ -39,7 +39,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v120_xp</PlatformToolset>
<PlatformToolset>v141_xp</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
@@ -100,11 +100,12 @@
<Optimization>Disabled</Optimization>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<PreprocessorDefinitions>WIN32;_WINDOWS;I_AM_EMK;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_WINDOWS;I_AM_EMK;_VRONI;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>false</MinimalRebuild>
<OpenMPSupport>true</OpenMPSupport>
<OpenMPSupport>false</OpenMPSupport>
<PrecompiledHeader>Use</PrecompiledHeader>
<CompileAs>CompileAsCpp</CompileAs>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
@@ -132,6 +133,7 @@ copy $(TargetPath) \EgtProg\DllD32</Command>
<PrecompiledHeader>Use</PrecompiledHeader>
<CompileAs>CompileAsCpp</CompileAs>
<LanguageStandard>stdcpp17</LanguageStandard>
<AdditionalOptions>-Wno-tautological-undefined-compare</AdditionalOptions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
@@ -165,6 +167,7 @@ copy $(TargetPath) \EgtProg\DllD64</Command>
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
<WholeProgramOptimization>false</WholeProgramOptimization>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
<GenerateDebugInformation>false</GenerateDebugInformation>
@@ -192,7 +195,7 @@ copy $(TargetPath) \EgtProg\Dll32</Command>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<PreprocessorDefinitions>WIN32;_WINDOWS;I_AM_EMK;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<EnableEnhancedInstructionSet>AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
<EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
<OpenMPSupport>false</OpenMPSupport>
<PrecompiledHeader>Use</PrecompiledHeader>
<CompileAs>CompileAsCpp</CompileAs>
@@ -200,6 +203,7 @@ copy $(TargetPath) \EgtProg\Dll32</Command>
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
<WholeProgramOptimization>false</WholeProgramOptimization>
<LanguageStandard>stdcpp17</LanguageStandard>
<AdditionalOptions>-Wno-tautological-undefined-compare</AdditionalOptions>
</ClCompile>
<Link>
<GenerateDebugInformation>false</GenerateDebugInformation>
+3
View File
@@ -124,6 +124,9 @@ Exit::Modify( const Point3d& ptPos, double dExitMaxAdjust)
}
// Assegno la nuova posizione
m_ptPos = ptPos ;
// Sistemo la geometria dell'uscita
if ( ! vtDelta.IsZero())
m_pGeomDB->Translate( m_nOwnerId, vtDelta) ;
return true ;
}
+69 -12
View File
@@ -20,7 +20,7 @@
#include "/EgtDev/Include/EGkCurveLine.h"
#include "/EgtDev/Include/EGkCurveArc.h"
#include "/EgtDev/Include/EGkCurveComposite.h"
#include "/EgtDev/Include/EgkArcSpecial.h"
#include "/EgtDev/Include/EGkArcSpecial.h"
#include "/EgtDev/Include/EGkSfrCreate.h"
#include "/EgtDev/Include/EGkSurfTriMesh.h"
#include "/EgtDev/Include/EGkUserObjFactory.h"
@@ -55,6 +55,17 @@ static const string EVAR_STARTPOS = ".STARTPOS" ; // IN (num) quota di inizio l
static const string EVAR_OFFSR = ".OFFSR" ; // IN (num) offset radiale
static const string EVAR_OFFSL = ".OFFSL" ; // IN (num) offset longitudinale
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
@@ -481,6 +492,17 @@ GenMachining::Preview( bool bRecalc)
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_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()) ;
@@ -527,8 +549,14 @@ GenMachining::Apply( bool bRecalc, bool bPostApply)
// verifico se necessario continuare nell'aggiornamento
if ( ! bRecalc && ! bToolChanged &&
( m_nStatus == MCH_ST_OK || ( ! bPostApply && m_nStatus == MCH_ST_NO_POSTAPPL))) {
// confermo i percorsi di lavorazione
m_nMills = nCurrMills ;
LOG_DBG_INFO( GetEMkLogger(), "GenMachining 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 ;
@@ -578,6 +606,17 @@ GenMachining::Apply( bool bRecalc, bool bPostApply)
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_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()) ;
@@ -611,6 +650,8 @@ GenMachining::Apply( bool bRecalc, bool bPostApply)
// dichiaro successiva da aggiornare
UpdateFollowingOperationsStatus( MCH_ST_OTH_MODIF) ;
LOG_DBG_INFO( GetEMkLogger(), "GenMachining apply done") ;
return true ;
}
@@ -628,15 +669,11 @@ GenMachining::Update( bool bPostApply)
return true ;
}
// elimino le entità CLIMB, RISE e HOME della lavorazione, potrebbero falsare i calcoli degli assi (in ogni casi vengono riaggiunte dopo)
RemoveClimbRiseHome() ;
// imposto eventuale asse bloccato da lavorazione
if ( ! m_Params.m_sBlockedAxis.empty()) {
string sAxis, sVal ;
Split( m_Params.m_sBlockedAxis, "=", true, sAxis, sVal) ;
double dVal = 0 ;
FromString( sVal, dVal) ;
m_pMchMgr->ClearRotAxisBlock() ;
m_pMchMgr->SetRotAxisBlock( sAxis, dVal) ;
}
SetBlockedRotAxis( m_Params.m_sBlockedAxis) ;
// calcolo gli assi macchina
string sHint = ExtractHint( m_Params.m_sUserNotes) ;
@@ -805,11 +842,31 @@ GenMachining::UpdateToolData( bool* pbChanged)
const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ;
if ( pTdata == nullptr)
return false ;
// verifico se sono diversi (ad esclusione del nome)
m_TParams.m_sName = pTdata->m_sName ;
bool bChanged = ! SameTool( m_TParams, *pTdata) ;
// 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 GenMachining : tool name changed (" +
+6 -2
View File
@@ -67,6 +67,10 @@ struct GenMachiningData : public MachiningData
//----------------------------------------------------------------------------
inline const GenMachiningData* GetGenMachiningData( const MachiningData* pMdata)
{ return (dynamic_cast<const GenMachiningData*>( pMdata)) ; }
{ if ( pMdata == nullptr || pMdata->GetType() != MT_GENMACHINING)
return nullptr ;
return ( static_cast<const GenMachiningData*>( pMdata)) ; }
inline GenMachiningData* GetGenMachiningData( MachiningData* pMdata)
{ return (dynamic_cast<GenMachiningData*>( pMdata)) ; }
{ if ( pMdata == nullptr || pMdata->GetType() != MT_GENMACHINING)
return nullptr ;
return ( static_cast<GenMachiningData*>( pMdata)) ; }
+29 -4
View File
@@ -19,6 +19,7 @@
#include "OutputConst.h"
#include "/EgtDev/Include/EMkDllMain.h"
#include "/EgtDev/Include/EGnFileUtils.h"
#include "/EgtDev/Include/EGnGetKeyData.h"
using namespace std ;
@@ -46,12 +47,31 @@ Generator::Init( MachMgr* pMchMgr)
bool
Generator::Run( const string& sCncFile, const string& sInfo)
{
// verifico sia abilitato dalla licenza
// Controllo della licenza
unsigned int nOpt1, nOpt2 ;
int nOptExpDays ;
int nRet = GetKeyOptions( GetEMkKey(), KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV,
nOpt1, nOpt2, nOptExpDays) ;
if ( nRet == KEY_OK && ( nOpt1 & KEYOPT_EMK_NC_OFF) == 0) {
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) ;
// Verifica della abilitazione
bool bMinTime = false ;
if ( nOptExpDays >= GetMinDay())
bMinTime = true ;
bool bCurrTime = false ;
if ( nOptExpDays >= GetCurrDay())
bCurrTime = true ;
bool bKey = false ;
if ( nRet == KEY_OK)
bKey = true ;
bool bOption = false ;
if ( ( nOpt1 & KEYOPT_EMK_NC_OFF) == 0)
bOption = true ;
// Esecuzione
if ( bMinTime && bCurrTime && bKey && bOption) {
// emetto info di log
{ string sOut = "Generator Run : " + sCncFile ;
@@ -72,6 +92,11 @@ Generator::Run( const string& sCncFile, const string& sInfo)
return bOk ;
}
// cancello l'eventuale file di uscita (e anche il file errore)
EraseFile( sCncFile) ;
string sErrFile = ChangeFileExtension( sCncFile, ERR_EXT) ;
EraseFile( sErrFile) ;
// Generazione non abilitata
m_pMchMgr->SetLastError( 1000, "NC_OFF") ;
std::string sErr = "Warning on Key (MKC/NCO)" ;
+1 -1
View File
@@ -82,7 +82,7 @@ GetRotationComponent( const Vector3d& vtDir1, double dComp, const Vector3d& vtDi
double dDenom = dT0uv * dSinG ;
double dNumer = dComp - dT0w * dCosG ;
// due angoli possibili
if ( abs( dDenom) > abs( dNumer)) {
if ( abs( dDenom) > abs( dNumer) + SIN_EPS_ANG_ZERO) {
double dDeltaAngRad = acos( dNumer / dDenom) ;
dAng1Deg = ( dOffsAngRad + dDeltaAngRad) * RADTODEG ;
dAng2Deg = ( dOffsAngRad - dDeltaAngRad) * RADTODEG ;
+1
View File
@@ -19,6 +19,7 @@
//----------- Costanti per approssimazioni con polilinee o poliarchi --------
const double LIN_TOL_STD = 0.1 ;
const double LIN_TOL_MID = 0.05 ;
const double LIN_TOL_RAW = 0.5 ;
const double ANG_TOL_MAX_DEG = 90 ;
const double ANG_TOL_STD_DEG = 15 ;
const double LIN_FEA_STD = 20 ;
+21 -5
View File
@@ -1,7 +1,7 @@
//----------------------------------------------------------------------------
// EgalTech 2015-2017
// EgalTech 2015-2021
//----------------------------------------------------------------------------
// File : Head.cpp Data : 11.01.17 Versione : 1.6x6
// File : Head.cpp Data : 14.10.21 Versione : 2.3j5
// Contenuto : Oggetto testa per gruppo testa di macchina.
//
//
@@ -49,6 +49,7 @@ Head::Clone( void) const
pHead->m_vsHSet = m_vsHSet ;
pHead->m_vtADir = m_vtADir ;
pHead->m_dRot1W = m_dRot1W ;
pHead->m_bMaxDeltaR2On1 = m_bMaxDeltaR2On1 ;
pHead->m_Rot2Stroke = m_Rot2Stroke ;
pHead->m_nSolCh = m_nSolCh ;
}
@@ -102,7 +103,7 @@ Head::GetGeomDB( void) const
//----------------------------------------------------------------------------
Head::Head( void)
: m_nOwnerId( GDB_ID_NULL), m_pGeomDB( nullptr), m_nType( MCH_HT_NONE), m_nExitCount( 0),
m_dRot1W( 1), m_nSolCh( MCH_SCC_NONE)
m_nSelectType( MCH_SLT_FIXEDEXITS), m_dRot1W( 1), m_bMaxDeltaR2On1( true), m_nSolCh( MCH_SCC_NONE)
{
m_Rot2Stroke.Min = - INFINITO ;
m_Rot2Stroke.Max = INFINITO ;
@@ -110,8 +111,8 @@ Head::Head( void)
//----------------------------------------------------------------------------
bool
Head::Set( const string& sName, int nType, int nExitCount, const string& sHSet, const Vector3d& vtADir,
double dRot1W, const STROKE& Rot2Stroke, int nSolCh, const STRVECTOR& vsOthColl)
Head::Set( const string& sName, int nType, int nExitCount, const string& sHSet, int nSelectType, const Vector3d& vtADir,
double dRot1W, bool bMaxDeltaR2On1, const STROKE& Rot2Stroke, int nSolCh, const STRVECTOR& vsOthColl)
{
m_sName = sName ;
m_nType = nType ;
@@ -121,8 +122,14 @@ Head::Set( const string& sName, int nType, int nExitCount, const string& sHSet,
m_nExitCount = 1 ;
m_vsHSet.clear() ;
m_vsHSet.push_back( sHSet) ;
if ( nSelectType == MCH_SLT_FIXEDEXITS || nSelectType == MCH_SLT_ONEEXIT || nSelectType == MCH_SLT_MULTIEXITS)
m_nSelectType = nSelectType ;
else
m_nSelectType = MCH_SLT_FIXEDEXITS ;
m_vtADir = vtADir ;
m_vtADir.Normalize() ;
m_dRot1W = dRot1W ;
m_bMaxDeltaR2On1 = bMaxDeltaR2On1 ;
m_Rot2Stroke = Rot2Stroke ;
if ( IsValidHeadScc( nSolCh))
m_nSolCh = nSolCh ;
@@ -142,3 +149,12 @@ Head::AddHeadToHSet( const string& sHead)
m_vsHSet.emplace_back( sHead) ;
return true ;
}
//----------------------------------------------------------------------------
bool
Head::ModifyHeadAuxDirection( const Vector3d& vtADir)
{
m_vtADir = vtADir ;
m_vtADir.Normalize() ;
return true ;
}
+11 -4
View File
@@ -1,7 +1,7 @@
//----------------------------------------------------------------------------
// EgalTech 2015-2015
// EgalTech 2015-2021
//----------------------------------------------------------------------------
// File : Head.h Data : 25.05.15 Versione : 1.6e7
// File : Head.h Data : 14.10.21 Versione : 2.3j5
// Contenuto : Dichiarazione della classe Head.
//
//
@@ -30,10 +30,11 @@ class Head : public IUserObj
public :
Head( void) ;
bool Set( const std::string& sName, int nType, int nExitCount, const std::string& sHSet,
const Vector3d& vtADir, double dRot1W, const STROKE& Rot2Stroke, int nSolCh,
bool Set( const std::string& sName, int nType, int nExitCount, const std::string& sHSet, int nSelectType,
const Vector3d& vtADir, double dRot1W, bool bMaxDeltaR2On1, const STROKE& Rot2Stroke, int nSolCh,
const STRVECTOR& vsOthColl) ;
bool AddHeadToHSet( const std::string& sHead) ;
bool ModifyHeadAuxDirection( const Vector3d& vtADir) ;
const std::string& GetName( void) const
{ return m_sName ; }
int GetType( void) const
@@ -42,10 +43,14 @@ class Head : public IUserObj
{ return m_nExitCount ; }
const STRVECTOR& GetHSet(void) const
{ return m_vsHSet ; }
int GetSelectType( void) const
{ return m_nSelectType ; }
const Vector3d& GetADir( void) const
{ return m_vtADir ; }
double GetRot1W( void) const
{ return m_dRot1W ; }
bool GetMaxDeltaR2On1( void) const
{ return m_bMaxDeltaR2On1 ; }
const STROKE& GetRot2Stroke( void) const
{ return m_Rot2Stroke ; }
int GetSolCh( void) const
@@ -60,8 +65,10 @@ class Head : public IUserObj
int m_nType ;
int m_nExitCount ;
STRVECTOR m_vsHSet ;
int m_nSelectType ;
Vector3d m_vtADir ;
double m_dRot1W ;
bool m_bMaxDeltaR2On1 ;
STROKE m_Rot2Stroke ;
int m_nSolCh ;
STRVECTOR m_vsOtherColl ;
+2
View File
@@ -31,6 +31,8 @@ const std::string MACH_FIXT_GROUP = "Fixt" ;
const std::string MACH_SETUP_GROUP = "Setup" ;
// Gruppo dei grezzi in una macchinata
const std::string MACH_RAW_GROUP = "Raws" ;
// Gruppo dei collegamenti per waterjet in una macchinata
const std::string MACH_BRIDGES_GROUP = "Bridges" ;
// Gruppo delle operazioni in una macchinata
const std::string MACH_OPER_GROUP = "Opers" ;
// Chiave per info fase di appartenenza di una fixture
+32 -11
View File
@@ -1,7 +1,7 @@
//----------------------------------------------------------------------------
// EgalTech 2015-2021
// EgalTech 2015-2023
//----------------------------------------------------------------------------
// File : MachMgr.h Data : 24.05.21 Versione : 2.3e3
// File : MachMgr.h Data : 28.10.23 Versione : 2.5j4
// Contenuto : Dichiarazione della classe MachMgr.
//
//
@@ -10,6 +10,9 @@
// 16.05.19 DS Aggiunto parametro sToolMakersDir a Init.
// 17.08.20 DS Aggiunte GetAxisMin e GetAxisMax.
// 17.03.21 DS Aggiunte funzioni per import/export utensili.
// 21.09.22 DS Aggiunta GetAxisOffset.
// 25.08.23 DS Aggiunta CopyMachGroup.
// 28.10.23 DS Aggiunte GetClEntAxesVal e GetToolSetupPosInCurrSetup.
//
//----------------------------------------------------------------------------
@@ -51,14 +54,15 @@ struct AxisBlock {
//----------------------------------------------------------------------------
struct MachineData {
std::string sName ;
std::string sName ;
std::string sDir ;
Machine* pMachine ;
ToolsMgr* pTsMgr ;
MachiningsMgr* pMsMgr ;
MachineData( void)
: pMachine( nullptr), pTsMgr( nullptr), pMsMgr( nullptr) {}
MachineData( const std::string& sN, Machine* pM, ToolsMgr* pTM, MachiningsMgr* pMM)
{ sName = sN ; pMachine = pM ; pTsMgr = pTM ; pMsMgr = pMM ; }
MachineData( const std::string& sN, const std::string& sD, Machine* pM, ToolsMgr* pTM, MachiningsMgr* pMM)
{ sName = sN ; sDir = sD ; pMachine = pM ; pTsMgr = pTM ; pMsMgr = pMM ; }
} ;
//----------------------------------------------------------------------------
@@ -80,6 +84,7 @@ class MachMgr : public IMachMgr
std::string GetWarningString( int nInd) const override
{ if ( nInd < 0 || nInd >= int( m_Warnings.size())) return "" ; return m_Warnings[ nInd].second ; }
// Machines
bool GetMachines( STRVECTOR& vsMachineNames, STRVECTOR& vsMachineDirs) const override ;
bool SetCurrMachine( const std::string& sMachineName) override ;
bool GetCurrMachineName( std::string& sMachineName) const override ;
bool GetCurrMachineDir( std::string& sMachineDir) const override ;
@@ -92,7 +97,9 @@ class MachMgr : public IMachMgr
int GetPrevMachGroup( int nId) const override ;
bool GetMachGroupNewName( std::string& sName) const override ;
int AddMachGroup( const std::string& sName, const std::string& sMachineName) override ;
int CopyMachGroup( const std::string& sSouName, const std::string& sName) override ;
bool RemoveMachGroup( int nId) override ;
bool ChangeMachGroupName( int nId, const std::string& sNewName) override ;
std::string GetMachGroupName( int nId) const override ;
std::string GetMachGroupMachineName( int nId) const override ;
int GetMachGroupId( const std::string& sName) const override ;
@@ -144,6 +151,7 @@ class MachMgr : public IMachMgr
bool GetTableRef( int nInd, Point3d& ptPos) const override ;
bool GetTableArea( int nInd, BBox3d& b3Area) const override ;
bool GetTableAreaOffset( int nInd, BBox3d& b3AreaOffs) const override ;
bool ChangeTable( const std::string& sTable, bool bUpdateDisp) override ;
bool ShowOnlyTable( bool bVal) override ;
int AddFixture( const std::string& sName, const Point3d& ptPos, double dAngRotDeg, double dMov) override ;
bool KeepFixture( int nFxtId, int nSouPhase) override ;
@@ -199,6 +207,7 @@ class MachMgr : public IMachMgr
bool ImportSetup( const std::string& sName) override ;
bool VerifyCurrSetup( STRVECTOR& vsErrors) override ;
bool FindToolInCurrSetup( const std::string& sTool) override ;
bool GetToolSetupPosInCurrSetup( const std::string& sTool, std::string& sTcPos) override ;
bool GetToolsInCurrSetupPos( const std::string& sTcPos, STRVECTOR& vsTools) override ;
bool UpdateCurrSetup( void) override ;
bool EraseCurrSetup( void) override ;
@@ -230,6 +239,10 @@ class MachMgr : public IMachMgr
bool MdbReload( void) override ;
bool MdbSave( void) const override ;
bool MdbGetMachiningDir( std::string& sMchDir) const override ;
bool MdbExport( const STRVECTOR& vsMachiningsNames, const std::string& sOutFile) const override ;
bool MdbToBeImported( const std::string& sFile, STRVECTOR& vsMachiningsNames, INTVECTOR& vMachiningsTypes) const override ;
bool MdbImport( const std::string& sFile, const STRVECTOR& vsMachiningsToImport, const STRVECTOR& vsMachiningsNames,
STRVECTOR& vsImported) override ;
// Operations : general
int GetOperationCount( void) const override ;
int GetFirstOperation( void) const override ;
@@ -293,8 +306,9 @@ class MachMgr : public IMachMgr
bool GetMachiningEndPoint( Point3d& ptEnd) const override ;
// CL Entities Interrogations
bool GetClEntMove( int nEntId, int& nMove) const override ;
bool GetClEntFlag( int nEntId, int& nFlag) const override ;
bool GetClEntFlag( int nEntId, int& nFlag, int& nFlag2) const override ;
bool GetClEntIndex( int nEntId, int& nIndex) const override ;
bool GetClEntAxesVal( int nEntId, DBLVECTOR& vAxes) const override ;
// Simulation
bool SimInit( void) override ;
bool SimStart( bool bFirst) override ;
@@ -313,6 +327,7 @@ class MachMgr : public IMachMgr
// Machine Calc
bool SetCalcTable( const std::string& sTable) override ;
bool SetCalcTool( const std::string& sTool, const std::string& sHead, int nExit) override ;
bool GetAllCurrAxesName( STRVECTOR& vAxName) const override ;
bool SetRotAxisBlock( const std::string& sAxis, double dVal) override ;
bool GetRotAxisBlocked( int nInd, std::string& sAxis, double& dVal) const override ;
bool GetCalcTool( std::string& sTool) const override ;
@@ -346,6 +361,7 @@ class MachMgr : public IMachMgr
bool GetAxisToken( const std::string& sAxis, std::string& sToken) const override ;
bool GetAxisType( const std::string& sAxis, bool& bLinear) const override ;
bool GetAxisInvert( const std::string& sAxis, bool& bInvert) const override ;
bool GetAxisOffset( const std::string& sAxis, double& dOffset) const override ;
bool SetAxisPos( const std::string& sAxis, double dVal, double* pdNewVal = nullptr) override ;
bool GetAxisPos( const std::string& sAxis, double& dVal) const override ;
bool GetAxisMin( const std::string& sAxis, double& dMin) const override ;
@@ -421,9 +437,11 @@ class MachMgr : public IMachMgr
// MachineCalc
int GetCurrLinAxes( void) const ;
int GetCurrRotAxes( void) const ;
bool GetAllCurrAxesName( STRVECTOR& vAxName) const ;
bool GetAllCurrAxesHomePos( DBLVECTOR& vAxHomeVal) const ;
bool GetCurrAxisHomePos( int nInd, double& dHome) const ;
const Frame3d& GetCurrLinAxesFrame( void) const ;
bool GetCurrIsCenter( void) const ;
bool GetCurrIsRobot( void) const ;
bool ApplyRotAxisBlock( void) ;
void ClearRotAxisBlock( void)
{ m_vAxisBlock.clear() ; }
@@ -432,6 +450,7 @@ class MachMgr : public IMachMgr
int GetCalcHead( void) const ;
int GetCalcExit( void) const ;
double GetCalcRot1W( void) const ;
bool GetCalcMaxDeltaR2OnFirst( void) const ;
bool GetCalcPartDirFromAngles( const Vector3d& vtPart, const DBLVECTOR& vAng, Vector3d& vtDir) const ;
bool SetCalcSolCh( int nScc, bool bExact) ;
bool VerifyAngleOutstroke( int nInd, double dAng) const ;
@@ -441,9 +460,11 @@ class MachMgr : public IMachMgr
bool GetOperationNewName( std::string& sName) const ;
const ToolData* GetMachiningToolData( void) const ;
// Simulation
bool SimAddCollisionObj( int nInd, int nFrameId, int nType, const Vector3d& vtMove, double dPar1, double dPar2, double dPar3) ;
bool SimAddCollisionObj( int nInd, bool bToolOn, int nFrameId, int nType, const Vector3d& vtMove, double dPar1, double dPar2, double dPar3) ;
bool 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) ;
int SimMoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt) ;
// Machine
bool GetHeadAbove( const std::string& sHead) const ;
double GetDeltaSafeZ( const std::string& sHead) const ;
@@ -483,11 +504,11 @@ class MachMgr : public IMachMgr
bool ShowRootParts( bool bShow) ;
// Tools DataBase
bool UpdateAllToolDraws( void) const ;
bool UpdateToolDraw( const EgtUUID& UuidTool) const ;
bool UpdateToolDraw( const EgtUUID& UuidTool, double& dTHoldBase, double& dTHoldLen, double& dTHoldDiam) const ;
int UpdateStandardToolDraw( const ToolData* pTdata, int nGenCtx, int nToolCtx, bool bToSave) const ;
int UpdateCustomToolDraw( const ToolData* pTdata, int nGenCtx, int nToolCtx, bool bToSave) const ;
std::string GetToolMakerKeyFromType( int nType) const ;
std::string GetToolHolderPath( const std::string& sHeadName, int nExit, int nType) const ;
std::string GetToolHolderPath( const std::string& sHeadName, int nExit, int nType, const std::string& sUserNotes) const ;
// Operations : general
bool InitOperation( int nId) ;
// Operations : dispositions
@@ -500,7 +521,7 @@ class MachMgr : public IMachMgr
private :
int m_nContextId ; // indice contesto corrente (1-based)
IGeomDB* m_pGeomDB ; // puntatore al DB geometrico del contesto corrente
std::string m_sMachinesDir ; // direttorio delle macchine
STRVECTOR m_vMachinesBaseDir ; // direttori di base delle macchine (ordine molto importante)
std::string m_sToolMakersDir ; // direttorio dei generatori di disegni utensili standard
std::string m_sLuaLibsDir ; // direttorio delle librerie lua
std::string m_sLuaLastRequire ; // nome ultima libreria caricata
+16 -4
View File
@@ -18,7 +18,7 @@
#include "DllMain.h"
#include "/EgtDev/Include/EMkDllMain.h"
#include "/EgtDev/Include/EGnStringUtils.h"
#include "/EgtDev/Include/EgnFileUtils.h"
#include "/EgtDev/Include/EGnFileUtils.h"
#include "/EgtDev/Include/EgtKeyCodes.h"
#include "/EgtDev/Include/SELkKeyProc.h"
#include <new>
@@ -30,7 +30,7 @@ IMachMgr*
CreateMachMgr( void)
{
// verifico la chiave e le opzioni
if ( ! TestKeyForEMk( GetEMkKey(), 0, GetEMkLogger()))
if ( ! GetEMkNetHwKey() && ! TestKeyForEMk( GetEMkKey(), 0, GetEMkLogger()))
return nullptr ;
// creo il MachMgr
return static_cast<IMachMgr*> ( new(nothrow) MachMgr) ;
@@ -94,7 +94,19 @@ MachMgr::Init( const string& sMachinesDir, const string& sToolMakersDir, IGeomDB
{
m_nContextId = nContextId ;
m_pGeomDB = pGeomDB ;
m_sMachinesDir = sMachinesDir ;
STRVECTOR vsDir ;
Tokenize( sMachinesDir, "|", vsDir) ;
for ( int i = 0 ; i < int( vsDir.size()) ; ++ i) {
string sDir = vsDir[i] ;
TrimRight( sDir, " \\") ;
if ( ExistsDirectory( vsDir[i]) &&
find_if( m_vMachinesBaseDir.begin(), m_vMachinesBaseDir.end(),
[ sDir]( const string& sItem)
{ return ( EqualNoCase( sDir, sItem)) ; }) == m_vMachinesBaseDir.end()) {
m_vMachinesBaseDir.emplace_back( sDir) ;
}
}
m_sToolMakersDir = sToolMakersDir ;
m_sLuaLibsDir = sLuaLibsDir ;
m_sLuaLastRequire = sLuaLastRequire ;
@@ -103,7 +115,7 @@ MachMgr::Init( const string& sMachinesDir, const string& sToolMakersDir, IGeomDB
m_nCurrMGrpId = GDB_ID_NULL ;
m_nCurrMch = - 1 ;
m_stuMgr.Reset() ;
return ( m_nContextId > 0 && m_pGeomDB != nullptr && ExistsDirectory( m_sMachinesDir)) ;
return ( m_nContextId > 0 && m_pGeomDB != nullptr && ! m_vMachinesBaseDir.empty()) ;
}
//----------------------------------------------------------------------------
+24 -4
View File
@@ -1,7 +1,7 @@
//----------------------------------------------------------------------------
// EgalTech 2019-2019
// EgalTech 2019-2023
//----------------------------------------------------------------------------
// File : MachMgrClEntities.cpp Data : 15.10.19 Versione : 2.1j4
// File : MachMgrClEntities.cpp Data : 27.10.23 Versione : 2.5j4
// Contenuto : Implementazione interrogazione entità CL della classe MachMgr.
//
//
@@ -39,10 +39,11 @@ MachMgr::GetClEntMove( int nEntId, int& nMove) const
//----------------------------------------------------------------------------
bool
MachMgr::GetClEntFlag( int nEntId, int& nFlag) const
MachMgr::GetClEntFlag( int nEntId, int& nFlag, int& nFlag2) const
{
// default
nFlag = 0 ;
nFlag2 = 0 ;
// verifico validita GeomDB
if ( m_pGeomDB == nullptr)
return false ;
@@ -50,8 +51,9 @@ MachMgr::GetClEntFlag( int nEntId, int& nFlag) const
const CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nEntId)) ;
if ( pCamData == nullptr)
return false ;
// recupero il flag
// recupero i flag
nFlag = pCamData->GetFlag() ;
nFlag2 = pCamData->GetFlag2() ;
return true ;
}
@@ -72,3 +74,21 @@ MachMgr::GetClEntIndex( int nEntId, int& nIndex) const
nIndex = pCamData->GetIndex() ;
return true ;
}
//----------------------------------------------------------------------------
bool
MachMgr::GetClEntAxesVal( int nEntId, DBLVECTOR& vAxes) const
{
// default
vAxes.clear() ;
// verifico validita GeomDB
if ( m_pGeomDB == nullptr)
return false ;
// recupero l'oggetto CamData
const CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nEntId)) ;
if ( pCamData == nullptr)
return false ;
// recupero i valori degli assi
vAxes = pCamData->GetAxesVal() ;
return true ;
}
+59 -3
View File
@@ -15,6 +15,7 @@
#include "stdafx.h"
#include "DllMain.h"
#include "MachMgr.h"
#include "/EgtDev/Include/EGnFileUtils.h"
using namespace std ;
@@ -410,9 +411,64 @@ MachMgr::MdbSave( void) const
bool
MachMgr::MdbGetMachiningDir( string& sMchDir) const
{
string sMachineName ;
if ( ! GetCurrMachineName( sMachineName))
string sMachineDir, sMachineName ;
if ( ! GetCurrMachineDir( sMachineDir) || ! GetCurrMachineName( sMachineName))
return false ;
sMchDir = m_sMachinesDir + "\\" + sMachineName + "\\" + MACHININGS_DIR ;
sMchDir = sMachineDir + "\\" + MACHININGS_DIR ;
return true ;
}
//----------------------------------------------------------------------------
bool
MachMgr::MdbExport( const STRVECTOR& vsMachiningsNames, const string& sOutFile) const
{
if ( vsMachiningsNames.empty())
return true ;
// recupero il gestore di lavorazioni della macchina corrente
MachiningsMgr* pMsMgr = GetCurrMachiningsMgr() ;
if ( pMsMgr == nullptr)
return false ;
return pMsMgr->Export( vsMachiningsNames, sOutFile) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::MdbToBeImported( const string& sFile, STRVECTOR& vsMachiningsNames, INTVECTOR& vMachiningsTypes) const
{
if ( ! ExistsFile( sFile)) {
LOG_ERROR( GetEMkLogger(), "MdbToBeImported Error : File does not exist") ;
return false ;
}
// recupero il gestore di lavorazioni della macchina corrente
MachiningsMgr* pMsMgr = GetCurrMachiningsMgr() ;
if ( pMsMgr == nullptr)
return false ;
return pMsMgr->ToBeImported( sFile, vsMachiningsNames, vMachiningsTypes) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::MdbImport( const string& sFile, const STRVECTOR& vsMachiningsToImport, const STRVECTOR& vsMachiningsNames, STRVECTOR& vsImported)
{
if ( vsMachiningsToImport.empty())
return true ;
if ( ! ExistsFile( sFile)) {
LOG_ERROR( GetEMkLogger(), "MdbImport Error : File does not exist") ;
return false ;
}
if ( vsMachiningsToImport.size() != vsMachiningsNames.size())
return false ;
// recupero il gestore di lavorazioni della macchina corrente
MachiningsMgr* pMsMgr = GetCurrMachiningsMgr() ;
if ( pMsMgr == nullptr)
return false ;
return pMsMgr->Import( sFile, vsMachiningsToImport, vsMachiningsNames, vsImported) ;
}
+59 -23
View File
@@ -481,10 +481,10 @@ MachMgr::TdbSave( void) const
bool
MachMgr::TdbGetToolDir( string& sToolDir) const
{
string sMachineName ;
if ( ! GetCurrMachineName( sMachineName))
string sMachineDir, sMachineName ;
if ( ! GetCurrMachineDir( sMachineDir) || ! GetCurrMachineName( sMachineName))
return false ;
sToolDir = m_sMachinesDir + "\\" + sMachineName + "\\" + TOOLS_DIR ;
sToolDir = sMachineDir + "\\" + TOOLS_DIR ;
return true ;
}
@@ -492,10 +492,10 @@ MachMgr::TdbGetToolDir( string& sToolDir) const
bool
MachMgr::TdbGetToolHolderDir( string& sToolHolderDir) const
{
string sMachineName ;
if ( ! GetCurrMachineName( sMachineName))
string sMachineDir, sMachineName ;
if ( ! GetCurrMachineDir( sMachineDir) || ! GetCurrMachineName( sMachineName))
return false ;
sToolHolderDir = m_sMachinesDir + "\\" + sMachineName + "\\" + TOOLHOLDERS_DIR ;
sToolHolderDir = sMachineDir + "\\" + TOOLHOLDERS_DIR ;
return true ;
}
@@ -526,9 +526,15 @@ MachMgr::UpdateAllToolDraws( void) const
// verifico se non esiste il disegno associato
string sDraw ; pTdata->GetParam( TPA_DRAW, sDraw) ;
bool bNoDraw = ( ! sDraw.empty() && ! ExistsFile( sToolDir + "\\" + sDraw)) ;
// se modificato o senza disegno, ne lancio la creazione
if ( bModif || bNoDraw)
UpdateToolDraw( UuidTool) ;
// se modificato o senza disegno, ne lancio la creazione e aggiorno dati portautensile
if ( bModif || bNoDraw) {
double dTHoldBase = 0, dTHoldLen = 0, dTHoldDiam = 0 ;
UpdateToolDraw( UuidTool, dTHoldBase, dTHoldLen, dTHoldDiam) ;
pTsMgr->SetCurrTool( sName) ;
pTsMgr->UpdateCurrToolHolderData( dTHoldBase, dTHoldLen, dTHoldDiam) ;
pTsMgr->SaveCurrTool() ;
pTsMgr->SetCurrTool( "") ;
}
// passo al successivo
bNext = pTsMgr->GetNextTool( TF_ALL, sName, nType) ;
}
@@ -542,7 +548,7 @@ MachMgr::UpdateAllToolDraws( void) const
//----------------------------------------------------------------------------
bool
MachMgr::UpdateToolDraw( const EgtUUID& UuidTool) const
MachMgr::UpdateToolDraw( const EgtUUID& UuidTool, double& dTHoldBase, double& dTHoldLen, double& dTHoldDiam) const
{
// recupero il gestore di utensili della macchina corrente
ToolsMgr* pTsMgr = GetCurrToolsMgr() ;
@@ -581,6 +587,14 @@ MachMgr::UpdateToolDraw( const EgtUUID& UuidTool) const
// Salvo il disegno
ExeSetCurrentContext( nToolCtx) ;
bOk = bOk && ExeSaveFile( sDrawPath, GDB_SV_BIN) ;
// Recupero i dati del portautensile
int nToolId = ExeGetFirstGroupInGroup( GDB_ID_ROOT) ;
if ( ! ExeGetInfo( nToolId, TTH_BASE, dTHoldBase))
dTHoldBase = 0 ;
if ( ! ExeGetInfo( nToolId, TTH_LEN, dTHoldLen))
dTHoldLen = 0 ;
if ( ! ExeGetInfo( nToolId, TTH_DIAM, dTHoldDiam))
dTHoldDiam = 0 ;
// Ripristino il contesto originale
ExeSetCurrentContext( nGenCtx) ;
ExeDeleteContext( nToolCtx) ;
@@ -617,6 +631,8 @@ MachMgr::UpdateStandardToolDraw( const ToolData* pTdata, int nGenCtx, int nToolC
pTdata->GetParam( TPA_TOTDIAM, dTotDiam) ;
double dDist = 0 ;
pTdata->GetParam( TPA_DIST, dDist) ;
double dStemDiam = 0 ;
pTdata->GetParam( TPA_STEMDIAM, dStemDiam) ;
double dMaxMat = 0 ;
pTdata->GetParam( TPA_MAXMAT, dMaxMat) ;
double dCornRad = 0 ;
@@ -625,10 +641,18 @@ MachMgr::UpdateStandardToolDraw( const ToolData* pTdata, int nGenCtx, int nToolC
pTdata->GetParam( TPA_SIDEANG, dSideAng) ;
double dThick = 0 ;
pTdata->GetParam( TPA_THICK, dThick) ;
double dCore = 0 ;
pTdata->GetParam( TPA_CORE, dCore) ;
if ( dCore < EPS_SMALL && ( nType == TT_SAW_STD || nType == TT_SAW_FLAT))
dCore = ( dLen >= dThick ? dThick - 1 : 2 * dLen - dThick) ;
double dSpeed = 0 ;
pTdata->GetParam( TPA_SPEED, dSpeed) ;
double dTipFeed = 0 ;
pTdata->GetParam( TPA_TIPFEED, dTipFeed) ;
string sUserNotes ;
pTdata->GetParam( TPA_USERNOTES, sUserNotes) ;
// Recupero la path dell'eventuale portautensile
string sThPath = GetToolHolderPath( sHeadName, nExit, nType) ;
string sThPath = GetToolHolderPath( sHeadName, nExit, nType, sUserNotes) ;
// Carico generatore disegno utensile
string sMaker = GetPrivateProfileStringUtf8( TOOLS_SEC.c_str(), GetToolMakerKeyFromType( nType).c_str(), "", sMachIni.c_str()) ;
if ( sMaker.empty())
@@ -642,6 +666,7 @@ MachMgr::UpdateStandardToolDraw( const ToolData* pTdata, int nGenCtx, int nToolC
// Assegno i dati utensile
bool bOk = ExeLuaSetGlobIntVar( "TOOL.TYPE", nType) ;
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.SPEED", dSpeed) ;
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.TIPFEED", dTipFeed) ;
switch ( nType) {
case TT_DRILL_STD :
case TT_DRILL_LONG :
@@ -657,7 +682,7 @@ MachMgr::UpdateStandardToolDraw( const ToolData* pTdata, int nGenCtx, int nToolC
bOk = bOk && ExeLuaSetGlobStringVar( "TOOL.TOOLHOLDER", sThPath) ;
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.LEN", dLen) ;
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.DIAM", dDiam) ;
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.CORE", ( dLen >= dThick ? dThick - 1 : 2 * dLen - dThick)) ;
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.CORE", dCore) ;
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.THICK", dThick) ;
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.MAXMAT", dMaxMat) ;
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.CORNRAD", dCornRad) ;
@@ -671,6 +696,7 @@ MachMgr::UpdateStandardToolDraw( const ToolData* pTdata, int nGenCtx, int nToolC
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.LEN", dLen) ;
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.TOTDIAM", dTotDiam) ;
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.DIAM", dDiam) ;
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.STEMDIAM", dStemDiam) ;
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.MAXMAT", dMaxMat) ;
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.HEIGHT", dThick) ;
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.SIDEANG", dSideAng) ;
@@ -695,7 +721,7 @@ MachMgr::UpdateStandardToolDraw( const ToolData* pTdata, int nGenCtx, int nToolC
if ( ! ExeLuaGetGlobIntVar( "TOOL.ERR", &nErr) || nErr != 0)
return nErr ;
// Se per salvataggio
if ( bOk && bToSave) {
if ( bOk && bToSave) {
// Nascondo layer ausiliario
int nAuxId = ExeGetFirstNameInGroup( ExeGetFirstGroupInGroup( GDB_ID_ROOT), "AUX") ;
ExeSetStatus( { nAuxId}, GDB_ST_OFF) ;
@@ -705,6 +731,16 @@ MachMgr::UpdateStandardToolDraw( const ToolData* pTdata, int nGenCtx, int nToolC
ExeRotate( { nPartId}, ORIG, Z_AX, -90, RTY_GLOB) ;
}
}
// altrimenti per visualizzazione
else if ( bOk) {
// Nascondo oggetto/i Carter
int nSolidId = ExeGetFirstNameInGroup( ExeGetFirstGroupInGroup( GDB_ID_ROOT), "SOLID") ;
int nCarterId = ExeGetFirstNameInGroup( nSolidId, "Carter") ;
while ( nCarterId != GDB_ID_NULL) {
ExeSetStatus( { nCarterId}, GDB_ST_OFF) ;
nCarterId = ExeGetNextName( nCarterId, "Carter") ;
}
}
return ( bOk ? 0 : TD_INT_ERR) ;
}
@@ -724,9 +760,8 @@ MachMgr::UpdateCustomToolDraw( const ToolData* pTdata, int nGenCtx, int nToolCtx
pTdata->GetParam( TPA_DIAM, dDiam) ;
double dDist = 0 ;
pTdata->GetParam( TPA_DIST, dDist) ;
// Non più limitato alle sole frese
//if ( nType != TT_MILL_STD && nType != TT_MILL_NOTIP && nType != TT_MILL_POLISHING)
// return TD_INT_ERR ;
double dSpeed = 0 ;
pTdata->GetParam( TPA_SPEED, dSpeed) ;
// Imposto contesto per il disegno utensile
if ( ! ExeSetCurrentContext( nToolCtx))
return TD_INT_ERR ;
@@ -736,6 +771,7 @@ MachMgr::UpdateCustomToolDraw( const ToolData* pTdata, int nGenCtx, int nToolCtx
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.LEN", dLen) ;
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.DIAM", dDiam) ;
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.DIST", dDist) ;
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.SPEED", dSpeed) ;
// Eseguo aggiornamento utensile
bOk = bOk && ExeLuaCallFunction( "AdjustCustomTool") ;
// Recupero errore
@@ -774,7 +810,7 @@ MachMgr::GetToolMakerKeyFromType( int nType) const
//----------------------------------------------------------------------------
string
MachMgr::GetToolHolderPath( const string& sHeadName, int nExit, int nType) const
MachMgr::GetToolHolderPath( const string& sHeadName, int nExit, int nType, const std::string& sUserNotes) const
{
// Verifiche su testa e uscita
if ( sHeadName.empty() || nExit == 0)
@@ -821,9 +857,9 @@ MachMgr::GetToolHolderPath( const string& sHeadName, int nExit, int nType) const
sToolHolder = GetPrivateProfileStringUtf8( TOOLS_SEC.c_str(), MILLHOLDER_KEY.c_str(), "", sMachIni.c_str()) ;
}
// Verifico se sovrascritto da nota dell'utensile
string sNotes, sVal ;
if ( TdbGetCurrToolParam( TPA_USERNOTES, sNotes) &&
GetValInNotes( sNotes, "TH", sVal) &&
string sVal ;
if ( ! sUserNotes.empty() &&
GetValInNotes( sUserNotes, "TH", sVal) &&
ExistsFile( sToolHolderDir + "\\" + sVal))
sToolHolder = sVal ;
// Se non trovato ancora, esco
@@ -840,7 +876,7 @@ MachMgr::TdbExport( const STRVECTOR& vsToolsNames, const string& sOutFile) const
if ( vsToolsNames.empty())
return true ;
// recupero il gestore di utensili della macchina corrente
// recupero il gestore di utensili della macchina corrente
ToolsMgr* pTsMgr = GetCurrToolsMgr() ;
if ( pTsMgr == nullptr)
return false ;
@@ -875,7 +911,7 @@ MachMgr::TdbImport( const string& sFile, const STRVECTOR& vsToolsToImport, const
if ( vsToolsToImport.empty())
return true ;
if ( ! ExistsFile( sFile)){
if ( ! ExistsFile( sFile)) {
LOG_ERROR( GetEMkLogger(), "TdbImport Error : File does not exist") ;
return false ;
}
@@ -884,7 +920,7 @@ MachMgr::TdbImport( const string& sFile, const STRVECTOR& vsToolsToImport, const
return false ;
ToolsMgr* pTsMgr = GetCurrToolsMgr() ;
if ( pTsMgr == nullptr){
if ( pTsMgr == nullptr) {
LOG_ERROR( GetEMkLogger(), "TdbImport Error : no current ToolsMgr") ;
return false ;
}
+24 -7
View File
@@ -44,6 +44,26 @@ MachMgr::GetTable( string& sTable) const
return pDisp->GetTable( sTable) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::ChangeTable( const string& sTable, bool bUpdateDisp)
{
bool bOk = true ;
// imposto la tavola per tutte le disposizioni ( e il calcolo)
for ( int nPhase = 1 ; nPhase <= GetPhaseCount() && bOk ; ++ nPhase) {
Disposition* pDisp = ::GetDisposition( m_pGeomDB->GetUserObj( GetPhaseDisposition( nPhase))) ;
if ( pDisp != nullptr && pDisp->Init( this) && pDisp->SetTable( sTable) && pDisp->ResetAreaOffset()) {
if ( bUpdateDisp)
bOk = SetCurrPhase( nPhase, true) && bOk ;
}
else
bOk = false ;
}
SetCurrPhase( 1) ;
return bOk ;
}
//----------------------------------------------------------------------------
bool
MachMgr::GetTableRef( int nInd, Point3d& ptPos) const
@@ -273,9 +293,8 @@ MachMgr::GetFixturePhases( int nFxtId, INTVECTOR& vPhase) const
// verifica validità bloccaggio
if ( ! VerifyFixtureInGroup( nFxtId))
return false ;
// recupero le fasi in cui è presente la fixture (se manca è fase 1)
if ( ! m_pGeomDB->GetInfo( nFxtId, MACH_FXT_PHASE, vPhase) || vPhase.empty())
vPhase.emplace_back( 1) ;
// recupero le fasi in cui è presente la fixture (se manca è non usata)
m_pGeomDB->GetInfo( nFxtId, MACH_FXT_PHASE, vPhase) ;
return true ;
}
@@ -293,8 +312,7 @@ MachMgr::GetUnusedFixture( const string& sName, int nPhase) const
while ( nId != GDB_ID_NULL) {
// recupero le fasi in cui è già usato
INTVECTOR vPhase ;
if ( ! m_pGeomDB->GetInfo( nId, MACH_FXT_PHASE, vPhase) || vPhase.empty())
vPhase.emplace_back( 1) ;
m_pGeomDB->GetInfo( nId, MACH_FXT_PHASE, vPhase) ;
// se non c'è la fase corrente, è libero
if ( find( vPhase.begin(), vPhase.end(), nPhase) == vPhase.end())
return nId ;
@@ -317,8 +335,7 @@ MachMgr::IsUnusedFixture( int nId, int nPhase) const
// Verifico non sia usata nella fase indicata
// recupero le fasi in cui è già usato
INTVECTOR vPhase ;
if ( ! m_pGeomDB->GetInfo( nId, MACH_FXT_PHASE, vPhase) || vPhase.empty())
vPhase.emplace_back( 1) ;
m_pGeomDB->GetInfo( nId, MACH_FXT_PHASE, vPhase) ;
// se non c'è la fase corrente, è libero
if ( find( vPhase.begin(), vPhase.end(), nPhase) == vPhase.end())
return true ;
+80 -21
View File
@@ -182,6 +182,52 @@ MachMgr::AddMachGroup( const string& sName, const string& sMachineName)
return nNewId ;
}
//----------------------------------------------------------------------------
int
MachMgr::CopyMachGroup( const string& sSouName, const string& sName)
{
// recupero il gruppo sorgente
int nSouMGrpId = GetMachGroupId( sSouName) ;
if ( nSouMGrpId == GDB_ID_NULL)
return GDB_ID_NULL ;
// verifico esista la sua macchina
string sMachineName ;
m_pGeomDB->GetInfo( nSouMGrpId, MACH_MACHINE_KEY, sMachineName) ;
if ( sMachineName.empty() || ! LoadMachine( sMachineName))
return GDB_ID_NULL ;
// verifico nome nuovo gruppo (non deve essere vuoto e non deve esserci già un gruppo con questo nome)
if ( &sName == nullptr || sName.empty() || GetMachGroupId( sName) != GDB_ID_NULL)
return GDB_ID_NULL ;
// reset gruppo corrente
ResetCurrMachGroup() ;
// eseguo la copia del gruppo sorgente e la metto in coda
int nNewMGrpId = m_pGeomDB->Copy( nSouMGrpId, GDB_ID_NULL, m_nMachBaseId) ;
if ( nNewMGrpId == GDB_ID_NULL)
return GDB_ID_NULL ;
// assegno il nome
m_pGeomDB->SetName( nNewMGrpId, sName) ;
// converto opportunamente gli indicativi dei grezzi nelle disposizioni
int nSouRawPartId = m_pGeomDB->GetFirstGroupInGroup( m_pGeomDB->GetFirstNameInGroup( nSouMGrpId, MACH_RAW_GROUP)) ;
int nNewRawPartId = m_pGeomDB->GetFirstGroupInGroup( m_pGeomDB->GetFirstNameInGroup( nNewMGrpId, MACH_RAW_GROUP)) ;
while ( nSouRawPartId != GDB_ID_NULL && nNewRawPartId != GDB_ID_NULL) {
// ciclo sulle disposizioni del nuovo gruppo di lavoro
int nOperId = m_pGeomDB->GetFirstGroupInGroup( m_pGeomDB->GetFirstNameInGroup( nNewMGrpId, MACH_OPER_GROUP)) ;
while ( nOperId != GDB_ID_NULL) {
Disposition* pDisp = GetDisposition( m_pGeomDB->GetUserObj( nOperId)) ;
if ( pDisp != nullptr)
pDisp->UpdateRawPartId( nSouRawPartId, nNewRawPartId) ;
nOperId = m_pGeomDB->GetNextGroup( nOperId) ;
}
// passo alla coppia successiva
nSouRawPartId = m_pGeomDB->GetNextGroup( nSouRawPartId) ;
nNewRawPartId = m_pGeomDB->GetNextGroup( nNewRawPartId) ;
}
// lo rendo corrente
SetCurrMachGroup( nNewMGrpId) ;
// restituisco l'identificativo del gruppo
return nNewMGrpId ;
}
//----------------------------------------------------------------------------
bool
MachMgr::RemoveMachGroup( int nId)
@@ -222,44 +268,60 @@ MachMgr::VerifyMachGroup( int nId, MachGrp& mgData) const
// verifica della macchina
bool bMName = m_pGeomDB->GetInfo( nId, MACH_MACHINE_KEY, mgData.MGeoName) ;
// scansiono i sottogruppi
PtrOwner<IGdbIterator> pIter( CreateGdbIterator( m_pGeomDB)) ;
if ( IsNull( pIter))
return false ;
bool bSetup = false ;
bool bFixt = false ;
bool bRaw = false ;
bool bOper = false ;
bool bIter = pIter->GoToFirstGroupInGroup( nId) ;
while ( bIter) {
int nGrpId = m_pGeomDB->GetFirstGroupInGroup( nId) ;
while ( nGrpId != GDB_ID_NULL) {
string sName ;
if ( pIter->GetName( sName)) {
if ( m_pGeomDB->GetName( nGrpId, sName)) {
if ( sName == MACH_SETUP_GROUP) {
if ( ! bSetup)
mgData.SetupGroupId = pIter->GetId() ;
mgData.SetupGroupId = nGrpId ;
bSetup = true ;
}
else if ( sName == MACH_FIXT_GROUP) {
if ( ! bFixt)
mgData.FixtGroupId = pIter->GetId() ;
mgData.FixtGroupId = nGrpId ;
bFixt = true ;
}
else if ( sName == MACH_RAW_GROUP) {
if ( ! bRaw)
mgData.RawGroupId = pIter->GetId() ;
mgData.RawGroupId = nGrpId ;
bRaw = true ;
}
else if ( sName == MACH_OPER_GROUP) {
if ( ! bOper)
mgData.OperGroupId = pIter->GetId() ;
mgData.OperGroupId = nGrpId ;
bOper = true ;
}
}
// passo al successivo
bIter = pIter->GoToNextGroup() ;
nGrpId = m_pGeomDB->GetNextGroup( nGrpId) ;
}
return ( bMName && bSetup && bRaw && bOper) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::ChangeMachGroupName( int nId, const string& sNewName)
{
// verifica del gruppo base per le lavorazioni
if ( ! VerifyMachBase())
return false ;
// verifico che il gruppo ricevuto sia corretto
if ( m_pGeomDB->GetParentId( nId) != m_nMachBaseId)
return false ;
// verifico nome non vuoto e non esista già un gruppo con lo stesso nome
if ( &sNewName == nullptr || sNewName.empty() || GetMachGroupId( sNewName) != GDB_ID_NULL)
return false ;
// cambio il nome del gruppo di lavoro
if ( ! m_pGeomDB->SetName( nId, sNewName))
return false ;
return true ;
}
//----------------------------------------------------------------------------
string
MachMgr::GetMachGroupName( int nId) const
@@ -298,22 +360,19 @@ MachMgr::GetMachGroupId( const string& sName) const
{
// verifica dei parametri
if ( &sName == nullptr || sName.empty())
return false ;
return GDB_ID_NULL ;
// verifica del gruppo base per le lavorazioni
if ( ! VerifyMachBase())
return false ;
return GDB_ID_NULL ;
// recupero l'identificativo del gruppo con il nome indicato
PtrOwner<IGdbIterator> pIter( CreateGdbIterator( m_pGeomDB)) ;
if ( IsNull( pIter))
return false ;
bool bIter = pIter->GoToFirstGroupInGroup( m_nMachBaseId) ;
while( bIter) {
int nGrpId = m_pGeomDB->GetFirstGroupInGroup( m_nMachBaseId) ;
while ( nGrpId != GDB_ID_NULL) {
// verifico il nome
string sMGroupName ;
if ( pIter->GetName( sMGroupName) && EqualNoCase( sMGroupName, sName))
return pIter->GetId() ;
if ( m_pGeomDB->GetName( nGrpId, sMGroupName) && EqualNoCase( sMGroupName, sName))
return nGrpId ;
// passo al successivo
bIter = pIter->GoToNextGroup() ;
nGrpId = m_pGeomDB->GetNextGroup( nGrpId) ;
}
return GDB_ID_NULL ;
}
+112 -40
View File
@@ -19,12 +19,43 @@
#include "MachiningsMgr.h"
#include "SawingData.h"
#include "/EgtDev/Include/EGkGdbIterator.h"
#include "/EgtDev/Include/EgnStringUtils.h"
#include "/EgtDev/Include/EgnFileUtils.h"
#include "/EgtDev/Include/EGnStringUtils.h"
#include "/EgtDev/Include/EGnFileUtils.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
using namespace std ;
//----------------------------------------------------------------------------
bool
MachMgr::GetMachines( STRVECTOR& vsMachineNames, STRVECTOR& vsMachineDirs) const
{
// pulisco elenco delle macchine
vsMachineNames.clear() ;
// eseguo ricerca delle macchine nei direttori base
for ( int i = 0 ; i < int( m_vMachinesBaseDir.size()) ; ++ i) {
STRVECTOR vsDirNames ;
if ( FindAllDirectories( m_vMachinesBaseDir[i] + "\\*", vsDirNames)) {
for ( int j = 0 ; j < int( vsDirNames.size()) ; ++ j) {
// nome e direttorio della macchina
string sMachName = vsDirNames[j] ;
string sMachDir = m_vMachinesBaseDir[i] + "\\" + vsDirNames[j] ;
// verifico esista il file mlde ( o mde) della macchina
string sMachineMlde = sMachDir + "\\" + sMachName + ".Mlde" ;
string sMachineMde = sMachDir + "\\" + sMachName + ".Mde" ;
if ( ( ExistsFile( sMachineMlde) || ExistsFile( sMachineMde)) &&
find_if( vsMachineNames.begin(), vsMachineNames.end(),
[ &sMachName]( const string& sName)
{ return EqualNoCase( sName, sMachName) ; }) == vsMachineNames.end()) {
vsMachineNames.emplace_back( sMachName) ;
vsMachineDirs.emplace_back( sMachDir) ;
}
}
}
}
return true ;
}
//----------------------------------------------------------------------------
bool
MachMgr::LoadMachine( const string& sMachineName)
@@ -35,14 +66,25 @@ MachMgr::LoadMachine( const string& sMachineName)
// se macchina giŕ caricata, non devo fare alcunchč
if ( GetMachine( sMachineName) != - 1)
return true ;
// cerco il direttorio della macchina
string sMachDir ;
for ( int i = 0 ; i < int( m_vMachinesBaseDir.size()) ; ++ i) {
string sTemp = m_vMachinesBaseDir[i] + "\\" + sMachineName ;
if ( ExistsDirectory( sTemp)) {
sMachDir = sTemp ;
break ;
}
}
if ( IsEmptyOrSpaces( sMachDir))
return false ;
// verifico esista il file mlde ( o mde) della macchina
string sMachineMlde = m_sMachinesDir + "\\" + sMachineName + "\\" + sMachineName + ".Mlde" ;
string sMachineMlde = sMachDir + "\\" + sMachineName + ".Mlde" ;
if ( ! ExistsFile( sMachineMlde))
sMachineMlde = ChangeFileExtension( sMachineMlde, ".Mde") ;
if ( ! ExistsFile( sMachineMlde))
return false ;
// salvo nel vettore
m_vMachines.emplace_back( sMachineName, nullptr, nullptr, nullptr) ;
m_vMachines.emplace_back( sMachineName, sMachDir, nullptr, nullptr, nullptr) ;
return true ;
}
@@ -97,7 +139,7 @@ MachMgr::GetCurrMachineDir( string& sMachineDir) const
if ( m_nCurrMch < 0 || m_nCurrMch >= int( m_vMachines.size()))
return false ;
// assegno il direttorio
sMachineDir = m_sMachinesDir + "\\" + m_vMachines[m_nCurrMch].sName ;
sMachineDir = m_vMachines[m_nCurrMch].sDir ;
return true ;
}
@@ -126,7 +168,7 @@ MachMgr::GetCurrMachine( void) const
return nullptr ;
// creo e carico la macchina
PtrOwner<Machine> pMch( new( nothrow) Machine) ;
if ( IsNull( pMch) || ! pMch->Init( m_sMachinesDir, m_vMachines[m_nCurrMch].sName, const_cast<MachMgr*>(this)))
if ( IsNull( pMch) || ! pMch->Init( m_vMachines[m_nCurrMch].sName, m_vMachines[m_nCurrMch].sDir, const_cast<MachMgr*>(this)))
return nullptr ;
// nascondo la macchina
if ( m_pGeomDB != nullptr)
@@ -148,7 +190,7 @@ MachMgr::GetCurrToolsMgr( void) const
// se DB utensili non esiste, provo a crearlo e caricarlo
if ( m_vMachines[m_nCurrMch].pTsMgr == nullptr) {
PtrOwner<ToolsMgr> pTsMgr( new( nothrow) ToolsMgr) ;
string sToolsDir = m_sMachinesDir + "\\" + m_vMachines[m_nCurrMch].sName + "\\" + TOOLS_DIR ;
string sToolsDir = m_vMachines[m_nCurrMch].sDir + "\\" + TOOLS_DIR ;
if ( IsNull( pTsMgr) || ! pTsMgr->Load( sToolsDir, TOOLS_FILE))
return nullptr ;
// salvo nel vettore
@@ -168,7 +210,7 @@ MachMgr::GetCurrMachiningsMgr( void) const
// se DB lavorazioni non esiste, provo a crearlo e caricarlo
if ( m_vMachines[m_nCurrMch].pMsMgr == nullptr) {
PtrOwner<MachiningsMgr> pMsMgr( new( nothrow) MachiningsMgr) ;
string sMachsFile = m_sMachinesDir + "\\" + m_vMachines[m_nCurrMch].sName + "\\" + MACHININGS_DIR + "\\" + MACHININGS_FILE ;
string sMachsFile = m_vMachines[m_nCurrMch].sDir + "\\" + MACHININGS_DIR + "\\" + MACHININGS_FILE ;
if ( IsNull( pMsMgr) || ! pMsMgr->Load( sMachsFile, GetCurrToolsMgr()))
return nullptr ;
// salvo nel vettore
@@ -300,12 +342,21 @@ MachMgr::GetAxisInvert( const string& sAxis, bool& bInvert) const
return ( ( pMch != nullptr) ? pMch->GetAxisInvert( sAxis, bInvert) : false) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::GetAxisOffset( const string& sAxis, double& dOffset) const
{
Machine* pMch = GetCurrMachine() ;
// restituisco il valore di offset asse in visualizzazione
return ( ( pMch != nullptr) ? pMch->GetAxisOffset( sAxis, dOffset) : false) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::SetAxisPos( const string& sAxis, double dVal, double* pdNewVal)
{
Machine* pMch = GetCurrMachine() ;
return ( ( pMch != nullptr) ? pMch->SetAxisPos( sAxis, dVal, pdNewVal) : false) ;
return ( ( pMch != nullptr) ? pMch->SetAxisPos( sAxis, dVal, true, pdNewVal) : false) ;
}
//----------------------------------------------------------------------------
@@ -536,7 +587,15 @@ double
MachMgr::GetCalcRot1W( void) const
{
Machine* pMch = GetCurrMachine() ;
return ( ( pMch != nullptr) ? pMch->GetCurrRot1W() : false) ;
return ( ( pMch != nullptr) ? pMch->GetCurrRot1W() : 1) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::GetCalcMaxDeltaR2OnFirst( void) const
{
Machine* pMch = GetCurrMachine() ;
return ( ( pMch != nullptr) ? pMch->GetCurrMaxDeltaR2OnFirst() : true) ;
}
//----------------------------------------------------------------------------
@@ -545,12 +604,9 @@ MachMgr::GetAllTablesNames( STRVECTOR& vNames) const
{
// pulisco il vettore
vNames.clear() ;
// recupero la macchina corrente
// richiedo elenco tavole alla macchina corrente
Machine* pMch = GetCurrMachine() ;
if ( pMch == nullptr)
return false ;
// richiedo elenco tavole alla macchina
return pMch->GetAllTablesNames( vNames) ;
return ( ( pMch != nullptr) ? pMch->GetAllTablesNames( vNames) : false) ;
}
//----------------------------------------------------------------------------
@@ -559,12 +615,9 @@ MachMgr::GetAllHeadsNames( STRVECTOR& vNames) const
{
// pulisco il vettore
vNames.clear() ;
// recupero la macchina corrente
// richiedo elenco teste alla macchina corrente
Machine* pMch = GetCurrMachine() ;
if ( pMch == nullptr)
return false ;
// richiedo elenco teste alla macchina
return pMch->GetAllHeadsNames( vNames) ;
return ( ( pMch != nullptr) ? pMch->GetAllHeadsNames( vNames) : false) ;
}
//----------------------------------------------------------------------------
@@ -573,12 +626,9 @@ MachMgr::GetAllTcPosNames( STRVECTOR& vNames) const
{
// pulisco il vettore
vNames.clear() ;
// recupero la macchina corrente
// richiedo elenco posizioni cambio utensile alla macchina corrente
Machine* pMch = GetCurrMachine() ;
if ( pMch == nullptr)
return false ;
// richiedo elenco posizioni cambio utensile alla macchina
return pMch->GetAllTcPosNames( vNames) ;
return ( ( pMch != nullptr) ? pMch->GetAllTcPosNames( vNames) : false) ;
}
//----------------------------------------------------------------------------
@@ -621,6 +671,38 @@ MachMgr::GetCurrAxisHomePos( int nInd, double& dHome) const
return ( ( pMch != nullptr) ? pMch->GetCurrAxisHomePos( nInd, dHome) : false) ;
}
//----------------------------------------------------------------------------
const Frame3d&
MachMgr::GetCurrLinAxesFrame( void) const
{
Machine* pMch = GetCurrMachine() ;
if ( pMch == nullptr) {
static Frame3d frDummy ;
return frDummy ;
}
return pMch->GetCurrLinAxesFrame() ;
}
//----------------------------------------------------------------------------
bool
MachMgr::GetCurrIsCenter( void) const
{
Machine* pMch = GetCurrMachine() ;
if ( pMch == nullptr)
return false ;
return ( pMch->GetCurrKinematicChainType() == KIN_CHAIN_CENTER) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::GetCurrIsRobot( void) const
{
Machine* pMch = GetCurrMachine() ;
if ( pMch == nullptr)
return false ;
return ( pMch->GetCurrKinematicChainType() == KIN_CHAIN_ROBOT) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::GetCalcAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
@@ -682,9 +764,7 @@ bool
MachMgr::GetCalcToolDirFromAngles( const DBLVECTOR& vAng, Vector3d& vtDir) const
{
Machine* pMch = GetCurrMachine() ;
if ( pMch == nullptr)
return false ;
return pMch->GetToolDirFromAngles( vAng, vtDir) ;
return ( ( pMch != nullptr) ? pMch->GetToolDirFromAngles( vAng, vtDir) : false) ;
}
//----------------------------------------------------------------------------
@@ -692,9 +772,7 @@ bool
MachMgr::GetCalcAuxDirFromAngles( const DBLVECTOR& vAng, Vector3d& vtDir) const
{
Machine* pMch = GetCurrMachine() ;
if ( pMch == nullptr)
return false ;
return pMch->GetAuxDirFromAngles( vAng, vtDir) ;
return ( ( pMch != nullptr) ? pMch->GetAuxDirFromAngles( vAng, vtDir) : false) ;
}
//----------------------------------------------------------------------------
@@ -702,9 +780,7 @@ bool
MachMgr::GetCalcPartDirFromAngles( const Vector3d& vtPart, const DBLVECTOR& vAng, Vector3d& vtDir) const
{
Machine* pMch = GetCurrMachine() ;
if ( pMch == nullptr)
return false ;
return pMch->GetPartDirFromAngles( vtPart, vAng, vtDir) ;
return ( ( pMch != nullptr) ? pMch->GetPartDirFromAngles( vtPart, vAng, vtDir) : false) ;
}
//----------------------------------------------------------------------------
@@ -760,9 +836,7 @@ string
MachMgr::GetOutstrokeInfo( bool bMM) const
{
Machine* pMch = GetCurrMachine() ;
if ( pMch == nullptr)
return "" ;
return pMch->GetOutstrokeInfo( bMM) ;
return ( ( pMch != nullptr) ? pMch->GetOutstrokeInfo( bMM) : "") ;
}
//----------------------------------------------------------------------------
@@ -778,7 +852,5 @@ int
MachMgr::GetMachineLook( void) const
{
Machine* pMch = GetCurrMachine() ;
if ( pMch == nullptr)
return MCH_LOOK_NONE ;
return pMch->GetLook() ;
return ( ( pMch != nullptr) ? pMch->GetLook() : MCH_LOOK_NONE) ;
}
+12
View File
@@ -642,6 +642,9 @@ MachMgr::DispositionSpecialApply( int nId, bool bRecalc)
Disposition* pDisp = ::GetDisposition( m_pGeomDB->GetUserObj( nId)) ;
if ( pDisp == nullptr)
return false ;
// Eventuale log
string sOut = "DispositionSpecialApply start --> " + pDisp->GetName() ;
LOG_DBG_INFO( GetEMkLogger(), sOut.c_str()) ;
// lancio l'azione
return pDisp->SpecialApply( bRecalc) ;
}
@@ -662,6 +665,9 @@ MachMgr::DispositionSpecialUpdate( int nId)
Disposition* pDisp = ::GetDisposition( m_pGeomDB->GetUserObj( nId)) ;
if ( pDisp == nullptr)
return false ;
// Eventuale log
string sOut = "DispositionSpecialUpdate start --> " + pDisp->GetName() ;
LOG_DBG_INFO( GetEMkLogger(), sOut.c_str()) ;
// lancio l'azione
return pDisp->SpecialUpdate() ;
}
@@ -1041,6 +1047,9 @@ MachMgr::MachiningApply( bool bRecalc, bool bPostApply)
Machining* pMch = GetMachining( m_pGeomDB->GetUserObj( nCurrMchId)) ;
if ( pMch == nullptr)
return false ;
// Log
string sOut = "MachiningApply start --> " + pMch->GetName() ;
LOG_DBG_INFO( GetEMkLogger(), sOut.c_str()) ;
// imposto fase della lavorazione come temporaneamente corrente
SetTempPhase TmpPhase( this, pMch->GetPhase()) ;
// imposto visualizzazione completa della macchina come temporaneamente corrente
@@ -1069,6 +1078,9 @@ MachMgr::MachiningUpdate( bool bPostApply)
Machining* pMch = GetMachining( m_pGeomDB->GetUserObj( nCurrMchId)) ;
if ( pMch == nullptr)
return false ;
// Log
string sOut = "MachiningUpdate start --> " + pMch->GetName() ;
LOG_DBG_INFO( GetEMkLogger(), sOut.c_str()) ;
// imposto fase della lavorazione come temporaneamente corrente
SetTempPhase TmpPhase( this, pMch->GetPhase()) ;
// imposto visualizzazione completa della macchina come temporaneamente corrente
+3 -2
View File
@@ -24,7 +24,7 @@
#include "/EgtDev/Include/EGkGeoPoint3d.h"
#include "/EgtDev/Include/EGkCurveAux.h"
#include "/EgtDev/Include/EGkOffsetCurve.h"
#include "/EgtDev/Include/EgkDistPointCurve.h"
#include "/EgtDev/Include/EGkDistPointCurve.h"
#include "/EgtDev/Include/EGkSfrCreate.h"
#include "/EgtDev/Include/EGkStmStandard.h"
#include "/EgtDev/Include/EGkStmFromCurves.h"
@@ -414,7 +414,7 @@ MachMgr::AddRawPart( int nSurfId, Color cCol)
// ne calcolo la silhouette secondo Z+
POLYLINEVECTOR vPL ;
bool bSilh = false ;
if ( pStm->GetSilhouette( Z_AX, vPL) && vPL.size() > 0) {
if ( pStm->GetSilhouette( Z_AX, 10.0, vPL) && vPL.size() > 0) {
// cerco il contorno esterno
int nInd = - 1 ;
double dMaxArea = 0 ;
@@ -625,6 +625,7 @@ MachMgr::VerifyRawPartPhase( int nRawId, int nPhase) const
INTVECTOR vPhase ;
if ( ! GetRawPartPhases( nRawId, vPhase))
return false ;
// verifico presenza nella fase indicata
return ( find( vPhase.begin(), vPhase.end(), nPhase) != vPhase.end()) ;
}
+7
View File
@@ -130,6 +130,13 @@ MachMgr::FindToolInCurrSetup( const string& sTool)
return m_stuMgr.FindTool( sTool) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::GetToolSetupPosInCurrSetup( const string& sTool, string& sTcPos)
{
return m_stuMgr.GetToolSetupPos( sTool, sTcPos) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::GetToolsInCurrSetupPos( const string& sTcPos, STRVECTOR& vsTools)
+26 -4
View File
@@ -1,7 +1,7 @@
//----------------------------------------------------------------------------
// EgalTech 2015-2015
// EgalTech 2015-2023
//----------------------------------------------------------------------------
// File : MachMgrSimulation.cpp Data : 20.10.15 Versione : 1.6j2
// File : MachMgrSimulation.cpp Data : 16.01.23 Versione : 2.5a2
// Contenuto : Implementazione gestione simulazione della classe MachMgr.
//
//
@@ -150,13 +150,13 @@ MachMgr::SimExit( void)
//----------------------------------------------------------------------------
bool
MachMgr::SimAddCollisionObj( int nInd, int nFrameId, int nType, const Vector3d& vtMove, double dPar1, double dPar2, double dPar3)
MachMgr::SimAddCollisionObj( int nInd, bool bToolOn, int nFrameId, int nType, const Vector3d& vtMove, double dPar1, double dPar2, double dPar3)
{
// verifico simulatore
if ( m_pSimul == nullptr)
return false ;
// aggiungo un oggetto da verificare per la collisione con il grezzo
return m_pSimul->AddCollisionObj( nInd, nFrameId, nType, vtMove, dPar1, dPar2, dPar3) ;
return m_pSimul->AddCollisionObj( nInd, bToolOn, nFrameId, nType, vtMove, dPar1, dPar2, dPar3) ;
}
//----------------------------------------------------------------------------
@@ -180,3 +180,25 @@ MachMgr::SimOnCollision( int nCdInd, int nObjInd, int& nErr)
// lancio funzione di gestione collisione
return m_pSimul->OnCollision( nCdInd, nObjInd, nErr) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::SimSetToolForVmill( const string& sTool, const string& sHead, int nExit, 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) ;
}
//----------------------------------------------------------------------------
int
MachMgr::SimMoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt)
{
// verifico simulatore
if ( m_pSimul == nullptr)
return SIM_AXMV_RES_ERR ;
// lancio movimento assi
return m_pSimul->MoveAxes( nMoveType, vAxNaEpSt) ;
}
+116 -20
View File
@@ -1,7 +1,7 @@
//----------------------------------------------------------------------------
// EgalTech 2015-2015
// EgalTech 2015-2021
//----------------------------------------------------------------------------
// File : Machine.cpp Data : 06.05.15 Versione : 1.6e3
// File : Machine.cpp Data : 14.10.21 Versione : 2.3j5
// Contenuto : Implementazione gestione macchina.
//
//
@@ -46,11 +46,19 @@ Machine::Machine( void)
m_nCalcExitId = GDB_ID_NULL ;
m_nCalcToolId = GDB_ID_NULL ;
m_dCalcRot1W = 1 ;
m_bCalcMaxDeltaR2On1 = true ;
m_nCalcSolCh = MCH_SCC_NONE ;
m_dCalcTLen = 0 ;
m_dCalcTRad = 0 ;
m_dCalcTOvLen = 0 ;
m_dCalcTOvRad = 0 ;
m_nTabLinAxes = 0 ;
m_nTabRotAxes = 0 ;
m_nHeadLinAxes = 0 ;
m_nHeadRotAxes = 0 ;
m_nHeadSpecRotAxis = -1 ;
m_frLinAx.Reset( false) ;
m_nCalcChainType = KIN_CHAIN_NONE ;
m_nMachineLook = MCH_LOOK_NONE ;
}
@@ -86,7 +94,7 @@ Machine::Clear( void)
//----------------------------------------------------------------------------
bool
Machine::Init( const string& sMachinesDir, const string& sMachineName, MachMgr* pMchMgr)
Machine::Init( const string& sMachineName, const string& sMachineDir, MachMgr* pMchMgr)
{
// pulisco
Clear() ;
@@ -96,7 +104,7 @@ Machine::Init( const string& sMachinesDir, const string& sMachineName, MachMgr*
m_pMchMgr = pMchMgr ;
m_pGeomDB = m_pMchMgr->GetGeomDB() ;
// verifico direttorio dati macchina
m_sMachineDir = sMachinesDir + "\\" + sMachineName ;
m_sMachineDir = sMachineDir ;
if ( ! ExistsDirectory( m_sMachineDir))
return false ;
// creo il gruppo per la macchina
@@ -134,6 +142,8 @@ Machine::Init( const string& sMachinesDir, const string& sMachineName, MachMgr*
m_nMachineLook = ( bOk ? MCH_LOOK_ALL : MCH_LOOK_NONE) ;
// metto tutti gli assi in posizione home
bOk = bOk && ResetAllAxesPos() ;
// reset catena cinematica corrente
m_nCalcChainType = KIN_CHAIN_NONE ;
return bOk ;
}
@@ -280,7 +290,7 @@ Machine::AdjustTable( int nLay, const Point3d& ptRef1)
//----------------------------------------------------------------------------
bool
Machine::LoadMachineAxis( const string& sName, const string& sParent, const string& sToken, bool bInvert,
int nType, const Point3d& ptPos, const Vector3d& vtDir, const STROKE& Stroke,
double dOffset, int nType, const Point3d& ptPos, const Vector3d& vtDir, const STROKE& Stroke,
double dHome, bool bAdjustAux, const string& sGeo, const STRVECTOR& vsAux)
{
// verifico sia di tipo ammesso
@@ -321,7 +331,7 @@ Machine::LoadMachineAxis( const string& sName, const string& sParent, const stri
Axis* pAxis = new(nothrow) Axis ;
if ( pAxis == nullptr)
return false ;
pAxis->Set( sName, sToken, bInvert, nType, ptPos, vtDir, Stroke, dHome) ;
pAxis->Set( sName, sToken, bInvert, dOffset, nType, ptPos, vtDir, Stroke, dHome) ;
m_pGeomDB->SetUserObj( nLay, pAxis) ;
// verifico il vettore rappresentativo dell'asse
if ( ! AdjustAxis( nLay, sPart, sName, nType, ptPos, vtDir, bAdjustAux))
@@ -434,8 +444,16 @@ Machine::ModifyMachineAxisPosition( const string& sName, const Point3d& ptPos)
Axis* pAx = GetAxis( nAxGrp) ;
if ( pAx == nullptr)
return false ;
// se valore dell'asse non nullo, lo annullo
double dCurrVal = pAx->GetCurrVal() ;
if ( abs( dCurrVal) > EPS_ZERO)
SetAxisPos( sName, 0, false) ;
// eseguo la modifica
return pAx->Modify( ptPos, m_dAxisMaxAdjust) ;
bool bOk = pAx->Modify( ptPos, m_dAxisMaxAdjust) ;
// ripristino l'asse al valore corrente
if ( abs( dCurrVal) > EPS_ZERO)
SetAxisPos( sName, dCurrVal, false) ;
return bOk ;
}
//----------------------------------------------------------------------------
@@ -451,8 +469,16 @@ Machine::ModifyMachineAxisDirection( const string& sName, const Vector3d& vtDir)
Axis* pAx = GetAxis( nAxGrp) ;
if ( pAx == nullptr)
return false ;
// se valore dell'asse non nullo, lo annullo
double dCurrVal = pAx->GetCurrVal() ;
if ( abs( dCurrVal) > EPS_ZERO)
SetAxisPos( sName, 0, false) ;
// eseguo la modifica
return pAx->Modify( vtDir, m_dAxisMaxRotAdj) ;
bool bOk = pAx->Modify( vtDir, m_dAxisMaxRotAdj) ;
// ripristino l'asse al valore corrente
if ( abs( dCurrVal) > EPS_ZERO)
SetAxisPos( sName, dCurrVal, false) ;
return bOk ;
}
//----------------------------------------------------------------------------
@@ -493,7 +519,7 @@ Machine::ModifyMachineAxisHome( const string& sName, double dHome)
bool
Machine::LoadMachineStdHead( const string& sName, const string& sParent, const string& sHSet,
const Point3d& ptPos, const Vector3d& vtTDir, const Vector3d& vtADir,
double dRot1W, const STROKE& Rot2Stroke, int nSolCh, const STRVECTOR& vsOthColl,
double dRot1W, bool bMaxDeltaR2On1, const STROKE& Rot2Stroke, int nSolCh, const STRVECTOR& vsOthColl,
const string& sGeo, const STRVECTOR& vsAux)
{
// recupero pezzo e layer della geometria originale della testa
@@ -521,7 +547,7 @@ Machine::LoadMachineStdHead( const string& sName, const string& sParent, const s
Head* pHead = new(nothrow) Head ;
if ( pHead == nullptr)
return false ;
pHead->Set( sName, MCH_HT_STD, 1, sHSet, vtADir, dRot1W, Rot2Stroke, nSolCh, vsOthColl) ;
pHead->Set( sName, MCH_HT_STD, 1, sHSet, 0, vtADir, dRot1W, bMaxDeltaR2On1, Rot2Stroke, nSolCh, vsOthColl) ;
m_pGeomDB->SetUserObj( nLay, pHead) ;
// aggiorno la testa capostipite
if ( ! AddHeadToSet( sHSet, sName))
@@ -541,8 +567,8 @@ Machine::LoadMachineStdHead( const string& sName, const string& sParent, const s
//----------------------------------------------------------------------------
bool
Machine::LoadMachineMultiHead( const string& sName, const string& sParent, const string& sHSet,
const MUEXITVECTOR& vMuExit, const Vector3d& vtADir,
double dRot1W, const STROKE& Rot2Stroke, int nSolCh, const STRVECTOR& vsOthColl,
int nSelectType, const MUEXITVECTOR& vMuExit, const Vector3d& vtADir,
double dRot1W, bool bMaxDeltaR2On1, const STROKE& Rot2Stroke, int nSolCh, const STRVECTOR& vsOthColl,
const string& sGeo, const STRVECTOR& vsAux)
{
// recupero pezzo e layer della geometria originale della testa
@@ -570,7 +596,8 @@ Machine::LoadMachineMultiHead( const string& sName, const string& sParent, const
Head* pHead = new(nothrow) Head ;
if ( pHead == nullptr)
return false ;
pHead->Set( sName, MCH_HT_MULTI, int( vMuExit.size()), sHSet, vtADir, dRot1W, Rot2Stroke, nSolCh, vsOthColl) ;
pHead->Set( sName, MCH_HT_MULTI, int( vMuExit.size()), sHSet, nSelectType,
vtADir, dRot1W, bMaxDeltaR2On1, Rot2Stroke, nSolCh, vsOthColl) ;
m_pGeomDB->SetUserObj( nLay, pHead) ;
// aggiorno la testa capostipite
if ( ! AddHeadToSet( sHSet, sName))
@@ -589,7 +616,7 @@ Machine::LoadMachineMultiHead( const string& sName, const string& sParent, const
bool
Machine::LoadMachineSpecialHead( const string& sName, const string& sParent, const string& sHSet,
const Point3d& ptPos, const Vector3d& vtTDir, const Vector3d& vtADir,
double dRot1W, const STROKE& Rot2Stroke, int nSolCh, const STRVECTOR& vsOthColl,
double dRot1W, bool bMaxDeltaR2On1, const STROKE& Rot2Stroke, int nSolCh, const STRVECTOR& vsOthColl,
const string& sGeo, const STRVECTOR& vsAux)
{
// recupero pezzo e layer della geometria originale della testa
@@ -617,7 +644,7 @@ Machine::LoadMachineSpecialHead( const string& sName, const string& sParent, con
Head* pHead = new(nothrow) Head ;
if ( pHead == nullptr)
return false ;
pHead->Set( sName, MCH_HT_SPECIAL, 1, sHSet, vtADir, dRot1W, Rot2Stroke, nSolCh, vsOthColl) ;
pHead->Set( sName, MCH_HT_SPECIAL, 1, sHSet, 0, vtADir, dRot1W, bMaxDeltaR2On1, Rot2Stroke, nSolCh, vsOthColl) ;
m_pGeomDB->SetUserObj( nLay, pHead) ;
// aggiorno la testa capostipite
if ( ! AddHeadToSet( sHSet, sName))
@@ -636,9 +663,9 @@ Machine::LoadMachineSpecialHead( const string& sName, const string& sParent, con
//----------------------------------------------------------------------------
bool
Machine::LoadMachineTcPos( const string& sName, const string& sParent,
const Point3d& ptPos, const Vector3d& vtTDir, const Vector3d& vtADir,
const string& sGeo, const STRVECTOR& vsAux)
Machine::LoadMachineStdTcPos( const string& sName, const string& sParent,
const Point3d& ptPos, const Vector3d& vtTDir, const Vector3d& vtADir,
const string& sGeo, const STRVECTOR& vsAux)
{
// recupero pezzo e layer della geometria originale della posizione nel cambio utensile
string sPart, sLay ;
@@ -678,6 +705,48 @@ Machine::LoadMachineTcPos( const string& sName, const string& sParent,
return m_mapGroups.emplace( sName, nLay).second ;
}
//----------------------------------------------------------------------------
bool
Machine::LoadMachineMultiTcPos( const string& sName, const string& sParent,
const MUEXITVECTOR& vMuExit, const Vector3d& vtADir,
const string& sGeo, const STRVECTOR& vsAux)
{
// recupero pezzo e layer della geometria originale della posizione nel cambio utensile
string sPart, sLay ;
Split( sGeo, "/", true, sPart, sLay) ;
// cerco il gruppo nella geometria originale
int nPart = m_pGeomDB->GetFirstNameInGroup( m_nTempGroupId, sPart) ;
int nLay = m_pGeomDB->GetFirstNameInGroup( nPart, sLay) ;
if ( nLay == GDB_ID_NULL)
return false ;
// cerco il gruppo padre per spostarvelo
int nParentId = GetGroup( sParent) ;
if ( nParentId == GDB_ID_NULL ||
! m_pGeomDB->RelocateGlob( nLay, nParentId, GDB_LAST_SON))
return false ;
// sistemo lo stato di visualizzazione
m_pGeomDB->SetStatus( nLay, GDB_ST_ON) ;
// gli assegno il nome
m_pGeomDB->SetName( nLay, sName) ;
// sistemo la geometria ausiliaria
if ( ! AdjustAuxGeometry( vsAux, nLay))
return false ;
// installo e inizializzo il gestore della posizione nel cambio utensile
TcPos* pTcPos = new(nothrow) TcPos ;
if ( pTcPos == nullptr)
return false ;
pTcPos->Set( sName, vtADir) ;
m_pGeomDB->SetUserObj( nLay, pTcPos) ;
// sistemo il riferimento dell'uscita rispetto alla direzione ausiliaria
if ( ! AdjustExitFrames( nLay, vMuExit, vtADir))
return false ;
// trasformazione del riferimento di uscita in gruppo di uscita
if ( ! CreateExitGroups( nLay, vMuExit))
return false ;
// lo inserisco nel dizionario dei gruppi della macchina
return m_mapGroups.emplace( sName, nLay).second ;
}
//----------------------------------------------------------------------------
int
Machine::GetGroup( const string& sGroup) const
@@ -801,6 +870,22 @@ Machine::EnableHeadInSet( const string& sHead)
return true ;
}
//----------------------------------------------------------------------------
bool
Machine::ModifyMachineHeadAuxDirection( const string& sHead, const Vector3d& vtADir)
{
// controllo GeomDB
if ( m_pGeomDB == nullptr)
return false ;
// recupero testa
int nHeadId = GetGroup( sHead) ;
Head* pHead = GetHead( nHeadId) ;
if ( pHead == nullptr)
return false ;
// eseguo la modifica
return pHead->ModifyHeadAuxDirection( vtADir) ;
}
//----------------------------------------------------------------------------
bool
Machine::AdjustExitFrames( int nLay, const MUEXITVECTOR& vMuExit, const Vector3d& vtADir)
@@ -895,7 +980,7 @@ Machine::CreateExitGroups( int nLay, const MUEXITVECTOR& vMuExit)
return false ;
}
else {
Vector3d vtRotAx = vtTDir ^ vtDirN ; vtRotAx.Normalize() ;
Vector3d vtRotAx = vtTDir ^ vtDirN ; vtRotAx.Normalize( EPS_ZERO) ;
string sOut = " Exit " + sName + " rotation = (" + ToString( dAngRot) + "/" + ToString( vtRotAx) + ")" ;
LOG_DBG_INFO( GetEMkLogger(), sOut.c_str()) ;
vtRotAx.ToLoc( frHead) ;
@@ -953,7 +1038,11 @@ Machine::ModifyMachineExitPosition( const string& sHead, int nExit, const Point3
if ( pExit == nullptr)
return false ;
// eseguo la modifica
return pExit->Modify( ptPos, m_dExitMaxAdjust) ;
if ( ! pExit->Modify( ptPos, m_dExitMaxAdjust))
return false ;
// eventuale aggiornamento variabile lua EMC.EXITPOS con la nuova posizione
LuaSetGlobVar( "EMC.EXITPOS", ptPos) ;
return true ;
}
//----------------------------------------------------------------------------
@@ -1081,6 +1170,13 @@ Machine::IsLinkedRawPart( int nRawId) const
return ( find( m_vLinkedRawParts.begin(), m_vLinkedRawParts.end(), nRawId) != m_vLinkedRawParts.end()) ;
}
//----------------------------------------------------------------------------
const INTVECTOR&
Machine:: GetAllLinkedRawParts( void) const
{
return m_vLinkedRawParts ;
}
//----------------------------------------------------------------------------
bool
Machine::UnlinkRawPartFromGroup( int nRawPartId)
+55 -17
View File
@@ -1,7 +1,7 @@
//----------------------------------------------------------------------------
// EgalTech 2015-2015
// EgalTech 2015-2023
//----------------------------------------------------------------------------
// File : Machine.h Data : 06.05.15 Versione : 1.6e3
// File : Machine.h Data : 16.01.23 Versione : 2.5a2
// Contenuto : Dichiarazione della classe Machine.
//
//
@@ -34,7 +34,7 @@ class Machine
public :
Machine( void) ;
~Machine( void) ;
bool Init( const std::string& sMachinesDir, const std::string& sMachineName, MachMgr* pMchMgr) ;
bool Init( const std::string& sMachineName, const std::string& sMachineDir, MachMgr* pMchMgr) ;
const std::string& GetMachineName( void) const
{ return m_sName ; }
const std::string& GetMachineDir( void) const
@@ -53,6 +53,10 @@ class Machine
int GetHeadId( const std::string& sHead) const
{ int nId = GetGroup( sHead) ;
return ( IsHeadGroup( nId) ? nId : GDB_ID_NULL) ; }
int GetExitId( const std::string& sHead, int nExit) const
{ int nHeadId = GetHeadId( sHead) ;
int nId = ( m_pGeomDB != nullptr ? m_pGeomDB->GetFirstNameInGroup( nHeadId, MCH_EXIT + ToString( nExit)) : GDB_ID_NULL) ;
return ( IsExitGroup( nId) ? nId : GDB_ID_NULL) ; }
int GetTcPosId( const std::string& sTcPos) const
{ int nId = GetGroup( sTcPos) ;
return ( IsTcPosGroup( nId) ? nId : GDB_ID_NULL) ; }
@@ -63,6 +67,7 @@ class Machine
int GetHeadExitCount( const std::string& sHead) const ;
int GetHeadExitPosDirAux( const std::string& sHead, int nExit, Point3d& ptPos, Vector3d& vtDir, Vector3d& vtAux) const ;
int GetHeadSolCh( const std::string& sHead) const ;
int GetHeadSelectType(const std::string& sHead) const ;
double GetAngDeltaMinForHome( void) const
{ return m_dAngDeltaMinForHome ; }
bool LoadTool( const std::string& sHead, int nExit, const std::string& sTool) ;
@@ -75,8 +80,9 @@ class Machine
bool ResetHeadSet( const std::string& sHead) ;
bool GetAxisToken( const std::string& sAxis, std::string& sToken) const ;
bool GetAxisInvert( const std::string& sAxis, bool& bInvert) const ;
bool GetAxisOffset( const std::string& sAxis, double& dOffset) const ;
bool GetAxisType( const std::string& sAxis, bool& bLinear) const ;
bool SetAxisPos( const std::string& sAxis, double dVal, double* pdNewVal = nullptr) ;
bool SetAxisPos( const std::string& sAxis, double dVal, bool bInStroke = true, double* pdNewVal = nullptr) ;
bool GetAxisPos( const std::string& sAxis, double& dVal) const ;
bool GetAxisMin( const std::string& sAxis, double& dMin) const ;
bool GetAxisMax( const std::string& sAxis, double& dMax) const ;
@@ -90,7 +96,7 @@ class Machine
bool GetCurrTableRef1( Point3d& ptRef1) const ;
bool GetCurrTableArea1( BBox3d& b3Area1) const ;
bool GetCurrTableDeltaRef1( Vector3d& vtDelta1) const ;
bool GetCurrTableIsTilting( bool& bTilting) const ;
bool GetCurrTableIsTilting( bool& bTilting, Vector3d& vtTiltingAx) const ;
bool SetCurrTool( const std::string& sTool, const std::string& sHead, int nExit) ;
bool ResetCurrTool( void) ;
int GetCurrTool( void) const ;
@@ -100,7 +106,10 @@ class Machine
int GetCurrExit( void) const ;
bool GetCurrExit( int& nExit) const ;
bool GetCurrHeadCollGroups( INTVECTOR& vIds) const ;
double GetCurrRot1W( void) const ;
double GetCurrRot1W( void) const
{ return m_dCalcRot1W ; }
bool GetCurrMaxDeltaR2OnFirst( void) const
{ return m_bCalcMaxDeltaR2On1 ; }
std::string GetKinematicAxis( int nInd) const ;
bool BlockKinematicRotAxis( const std::string& sName, double dVal) ;
bool BlockKinematicRotAxis( int nId, double dVal) ;
@@ -117,16 +126,22 @@ class Machine
bool GetAllCurrAxesToken( STRVECTOR& vAxToken) const ;
bool GetCurrAxisMin( int nInd, double& dMin) const ;
bool GetCurrAxisMax( int nInd, double& dMax) const ;
bool GetCurrAxisOffset( int nInd, double& dOffset) const ;
bool GetCurrAxisInvert( int nInd, bool& bInvert) const ;
bool GetCurrAxisHomePos( int nInd, double& dHome) const ;
bool GetAllCurrAxesHomePos( DBLVECTOR& vAxHomeVal) const ;
const Frame3d& GetCurrLinAxesFrame( void) const
{ return m_frLinAx ; }
int GetCurrKinematicChainType( void) const
{ return m_nCalcChainType ; }
bool GetAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
int& nStat, double& dAngA1, double& dAngB1, double& dAngA2, double& dAngB2) const ;
bool GetAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
int& nStat, DBLVECTOR& vAng1, DBLVECTOR& vAng2) const ;
bool GetPositions( const Point3d& ptP, const DBLVECTOR& vAng,
int& nStat, double& dX, double& dY, double& dZ) const ;
bool GetHeadOffsetDelta( const DBLVECTOR& vAng,
double& dRecX, double& dRecY, double& dRecZ) const ;
bool GetRobotAngles( const Point3d& ptP, const Vector3d& vtDirT, const Vector3d& vtDirA,
DBLVECTOR& vAng1, DBLVECTOR& vAng2) const ;
bool GetNoseFromPositions( double dX, double dY, double dZ, const DBLVECTOR& vAng,
Point3d& ptNose) const ;
bool GetTipFromPositions( double dX, double dY, double dZ, const DBLVECTOR& vAng,
@@ -151,6 +166,7 @@ class Machine
{ return m_nMachineLook ; }
bool LinkRawPartToGroup( int nRawPartId, const std::string& sGroupName) ;
bool IsLinkedRawPart( int nRawId) const ;
const INTVECTOR& GetAllLinkedRawParts( void) const ;
bool UnlinkRawPartFromGroup( int nRawPartId) ;
bool UnlinkAllRawPartsFromGroups( void) ;
bool LinkFixtureToGroup( int nFxtId, const std::string& sGroupName) ;
@@ -183,8 +199,8 @@ class Machine
const Point3d& ptRef1, double dCoeffX, double dCoeffY, double dCoeffZ,
const std::string& sGeo, const STRVECTOR& vsAux) ;
bool AdjustTable( int nLay, const Point3d& ptRef1) ;
bool LoadMachineAxis( const std::string& sName, const std::string& sParent, const std::string& sToken,
bool bInvert, int nType, const Point3d& ptPos, const Vector3d& vtDir, const STROKE& Stroke,
bool LoadMachineAxis( const std::string& sName, const std::string& sParent, const std::string& sToken, bool bInvert,
double dOffset, int nType, const Point3d& ptPos, const Vector3d& vtDir, const STROKE& Stroke,
double dHome, bool bAdjustAux, const std::string& sGeo, const STRVECTOR& vsAux) ;
bool AdjustAxis( int nLay, const std::string& sPart, const std::string& sName,
int nType, const Point3d& ptPos, const Vector3d& vtDir, bool bAdjustAux) ;
@@ -194,19 +210,22 @@ class Machine
bool ModifyMachineAxisHome( const std::string& sName, double dHome) ;
bool LoadMachineStdHead( const std::string& sName, const std::string& sParent, const std::string& sHSet,
const Point3d& ptPos, const Vector3d& vtTDir, const Vector3d& vtADir,
double dRot1W, const STROKE& Rot2Stroke, int nSolCh, const STRVECTOR& vsOthColl,
double dRot1W, bool bMaxDeltaR2On1, const STROKE& Rot2Stroke, int nSolCh, const STRVECTOR& vsOthColl,
const std::string& sGeo, const STRVECTOR& vsAux) ;
bool LoadMachineMultiHead( const std::string& sName, const std::string& sParent, const std::string& sHSet,
const MUEXITVECTOR& vMuExit, const Vector3d& vtADir,
double dRot1W, const STROKE& Rot2Stroke, int nSolCh, const STRVECTOR& vsOthColl,
int nSelectType, const MUEXITVECTOR& vMuExit, const Vector3d& vtADir,
double dRot1W, bool bMaxDeltaR2On1, const STROKE& Rot2Stroke, int nSolCh, const STRVECTOR& vsOthColl,
const std::string& sGeo, const STRVECTOR& vsAux) ;
bool LoadMachineSpecialHead( const std::string& sName, const std::string& sParent, const std::string& sHSet,
const Point3d& ptPos, const Vector3d& vtTDir, const Vector3d& vtADir,
double dRot1W, const STROKE& Rot2Stroke, int nSolCh, const STRVECTOR& vsOthColl,
double dRot1W, bool bMaxDeltaR2On1, const STROKE& Rot2Stroke, int nSolCh, const STRVECTOR& vsOthColl,
const std::string& sGeo, const STRVECTOR& vsAux) ;
bool LoadMachineTcPos( const std::string& sName, const std::string& sParent,
const Point3d& ptPos, const Vector3d& vtTDir, const Vector3d& vtADir,
const std::string& sGeo, const STRVECTOR& vsAux) ;
bool LoadMachineStdTcPos( const std::string& sName, const std::string& sParent,
const Point3d& ptPos, const Vector3d& vtTDir, const Vector3d& vtADir,
const std::string& sGeo, const STRVECTOR& vsAux) ;
bool LoadMachineMultiTcPos( const std::string& sName, const std::string& sParent,
const MUEXITVECTOR& vMuExit, const Vector3d& vtADir,
const std::string& sGeo, const STRVECTOR& vsAux) ;
int GetGroup( const std::string& sGroup) const ;
bool IsBaseGroup( int nGroup) const ;
Axis* GetAxis( int nGroup) const ;
@@ -230,6 +249,7 @@ class Machine
const STRVECTOR& GetHSet( const std::string& sHead) const ;
bool EnableHeadInSet( const std::string& sHead) ;
bool LoadTool( Exit* pExit, const std::string& sTool) ;
bool ModifyMachineHeadAuxDirection( const std::string& sHead, const Vector3d& vtADir) ;
bool AdjustExitFrames( int nLay, const MUEXITVECTOR& vMuExit, const Vector3d& vtADir) ;
bool CreateExitGroups( int nLay, const MUEXITVECTOR& vMuExit) ;
bool ModifyMachineExitPosition( const std::string& sHead, int nExit, const Point3d& ptPos) ;
@@ -277,6 +297,7 @@ class Machine
int m_nCalcExitId ; // uscita corrente per calcoli
int m_nCalcToolId ; // utensile corrente per calcoli
double m_dCalcRot1W ; // peso del primo asse rotante per i confronti
bool m_bCalcMaxDeltaR2On1 ; // flag utilizzo controllo massimo delta secondo asse rotante su inizio lavorazione
int m_nCalcSolCh ; // criterio di scelta della soluzione
bool m_bSolChExact ; // flag per scelta soluzione da soddisfare esattamente
Point3d m_ptCalcPos ; // posizione utensile a riposo per calcoli
@@ -286,8 +307,17 @@ class Machine
double m_dCalcTRad ; // raggio utensile corrente per calcoli
double m_dCalcTOvLen ; // lunghezza di ingombro utensile corrente per calcoli
double m_dCalcTOvRad ; // raggio di ingombro utensile corrente per calcoli
int m_nTabLinAxes ; // numero assi lineari attivi di tavola per calcoli
int m_nTabRotAxes ; // numero assi rotanti attivi di tavola per calcoli
int m_nHeadLinAxes ; // numero assi lineari attivi di testa per calcoli
int m_nHeadRotAxes ; // numero assi rotanti attivi di testa per calcoli
int m_nHeadSpecRotAxis ; // indice eventuale asse rotante speciale di testa prima dei lineari di testa (-1 non esiste)
KINAXISVECTOR m_vCalcLinAx ; // vettore assi lineari attivi per calcoli
KINAXISVECTOR m_vCalcRotAx ; // vettore assi rotanti attivi per calcoli
Frame3d m_frLinAx ; // sistema di riferimento definito dagli assi lineari
int m_nCalcChainType ; // tipologia testa attiva (nulla, centro di lavoro o robot)
Point3d m_ptWristCen ; // centro del polso sferico nel riferimento testa/uscita di calcolo
Vector3d m_vtWristRef ; // direzione del polso sferico nel riferimento testa/uscita di calcolo
mutable OutStroke m_OutstrokeInfo ; // informazioni su ultima extra corsa
// stato di visualizzazione
int m_nMachineLook ; // stato di visualizzazione della macchina
@@ -306,10 +336,13 @@ class Machine
static int LuaEmtMultiHead( lua_State* L) ;
static int LuaEmtSpecialHead( lua_State* L) ;
static int LuaEmtTcPos( lua_State* L) ;
static int LuaEmtStdTcPos( lua_State* L) ;
static int LuaEmtMultiTcPos( lua_State* L) ;
static int LuaEmtModifyAxisPosition( lua_State* L) ;
static int LuaEmtModifyAxisDirection( lua_State* L) ;
static int LuaEmtModifyAxisStroke( lua_State* L) ;
static int LuaEmtModifyAxisHome( lua_State* L) ;
static int LuaEmtModifyHeadAuxDirection( lua_State* L) ;
static int LuaEmtModifyExitPosition( lua_State* L) ;
static int LuaEmtAddRapidStart( lua_State* L) ;
static int LuaEmtAddRapidMove( lua_State* L) ;
@@ -319,6 +352,7 @@ class Machine
static int LuaEmtGetAxesPos( lua_State* L) ;
static int LuaEmtGetBackAuxDir( lua_State* L) ;
static int LuaEmtLinkRawPartToGroup( lua_State* L) ;
static int LuaEmtGetAllLinkedRawParts( lua_State* L) ;
static int LuaEmtUnlinkRawPartFromGroup( lua_State* L) ;
static int LuaEmtUnlinkAllRawPartsFromGroups( lua_State* L) ;
static int LuaEmtLinkFixtureToGroup( lua_State* L) ;
@@ -335,6 +369,10 @@ class Machine
static int LuaEmtAddCollisionObjEx( lua_State* L) ;
static int LuaEmtExecCollisionCheck( lua_State* L) ;
static int LuaEmtOnCollision( lua_State* L) ;
static int LuaEmtSetToolForVmill( lua_State* L) ;
static int LuaEmtAddToolForVmill( lua_State* L) ;
static int LuaEmtMoveAxes( lua_State* L) ;
} ;
//----------------------------------------------------------------------------
+19 -5
View File
@@ -19,6 +19,7 @@
#include "/EgtDev/Include/EGkGeoVector3d.h"
#include "/EgtDev/Include/EGnStringUtils.h"
#include "/EgtDev/Include/EGnFileUtils.h"
#include "/EgtDev/Include/EgtNumUtils.h"
using namespace std ;
@@ -54,6 +55,22 @@ Machine::GetAxisInvert( const string& sAxis, bool& bInvert) const
return true ;
}
//----------------------------------------------------------------------------
bool
Machine::GetAxisOffset( const string& sAxis, double& dOffset) const
{
// controllo GeomDB
if ( m_pGeomDB == nullptr)
return false ;
// recupero il relativo gestore
Axis* pAx = GetAxis( GetGroup( sAxis)) ;
if ( pAx == nullptr)
return false ;
// recupero il valore di offset dell'asse in visualizzazione
dOffset = pAx->GetOffset() ;
return true ;
}
//----------------------------------------------------------------------------
bool
Machine::GetAxisType( const string& sAxis, bool& bLinear) const
@@ -72,7 +89,7 @@ Machine::GetAxisType( const string& sAxis, bool& bLinear) const
//----------------------------------------------------------------------------
bool
Machine::SetAxisPos( const string& sAxis, double dVal, double* pdNewVal)
Machine::SetAxisPos( const string& sAxis, double dVal, bool bInStroke, double* pdNewVal)
{
// controllo GeomDB
if ( m_pGeomDB == nullptr)
@@ -98,10 +115,7 @@ Machine::SetAxisPos( const string& sAxis, double dVal, double* pdNewVal)
Vector3d vtDir = pGV->GetVector() ;
vtDir.Normalize() ;
// limito il movimento alla corsa dell'asse
if ( dVal > Stroke.Max)
dVal = Stroke.Max ;
else if ( dVal < Stroke.Min)
dVal = Stroke.Min ;
dVal = Clamp( dVal, Stroke.Min, Stroke.Max) ;
// eseguo il movimento
if ( bLinear)
m_pGeomDB->TranslateGroup( nAxGrp, vtDir * ( dVal - dCurrVal)) ;
+467 -115
View File
@@ -24,11 +24,13 @@
#include "/EgtDev/Include/EGkGeoVector3d.h"
#include "/EgtDev/Include/EGnStringUtils.h"
#include "/EgtDev/Include/EGnFileUtils.h"
#include "/EgtDev/Include/EgtNumUtils.h"
using namespace std ;
//----------------------------------------------------------------------------
static const string EMC_VAR = "EMC" ; // tabella variabili locali per calcolo
static const string EVAR_VER = ".VER" ; // (string) versione della Dll
static const string EVAR_TABNAME = ".TABNAME" ; // (string) nome della tavola macchina
static const string EVAR_HEAD = ".HEAD" ; // (string) nome della testa
static const string EVAR_EXIT = ".EXIT" ; // (int) numero dell'uscita
@@ -37,6 +39,7 @@ static const string EVAR_TOTDIAM = ".TOTDIAM" ; // (num) diametro di in
static const string EVAR_TOTLEN = ".TOTLEN" ; // (num) lunghezza di ingombro dell'utensile
static const string EVAR_DIST = ".DIST" ; // (num) distanza dell'utensile (per seghe a catena)
static const string EVAR_EXITPOS = ".EXITPOS" ; // (point) posizione attuale dell'uscita
static const string EVAR_USERNOTES = ".USERNOTES" ; // (string) note utente dell'utensile
static const string EVAR_TCPOS = ".TCPOS" ; // (string) posizione nell'attrezzaggio
static const string EVAR_L1 = ".L1" ; // (num) valore del primo asse lineare
static const string EVAR_L2 = ".L2" ; // (num) valore del secondo asse lineare
@@ -74,6 +77,7 @@ Machine::SetCurrTable( const string& sTable)
bool bOldEMC = LuaChangeNameGlobVar( EMC_VAR, EMC_VAR_BACKUP) ;
// definisco variabili
bool bOk = LuaCreateGlobTable( EMC_VAR) ;
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_VER, GetEMkVer()) ;
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_TABNAME, sTable) ;
// chiamo funzione
bOk = bOk && LuaCallFunction( ON_SET_TABLE) ;
@@ -167,13 +171,25 @@ Machine::GetCurrTableDeltaRef1( Vector3d& vtDelta1) const
//----------------------------------------------------------------------------
bool
Machine::GetCurrTableIsTilting( bool& bTilting) const
Machine::GetCurrTableIsTilting( bool& bTilting, Vector3d& vtTiltingAx) const
{
// default
bTilting = false ;
vtTiltingAx = V_NULL ;
// verifico esistenza tavola
if ( m_nCalcTabId == GDB_ID_NULL)
return false ;
// verifico se presente flag che lo forza come tale
int nTiltingLike ;
if ( m_pGeomDB->GetInfo( m_nCalcTabId, MCH_TILTINGLIKE, nTiltingLike) && nTiltingLike != 0) {
bTilting = true ;
switch ( abs( nTiltingLike)) {
default : vtTiltingAx = X_AX ; break ;
case 2 : vtTiltingAx = Y_AX ; break ;
case 3 : vtTiltingAx = Z_AX ; break ;
}
return true ;
}
// recupero gli eventuali assi rotanti della tavola
int nTParId = m_pGeomDB->GetParentId( m_nCalcTabId) ;
if ( nTParId == GDB_ID_NULL)
@@ -186,6 +202,7 @@ Machine::GetCurrTableIsTilting( bool& bTilting) const
// verifico se asse rotante orizzontale
if ( pAx->GetType() == MCH_AT_ROTARY && abs( pAx->GetDir().z) < EPS_SMALL) {
bTilting = true ;
vtTiltingAx = pAx->GetDir() ;
return true ;
}
// risalgo lungo la catena
@@ -209,7 +226,9 @@ Machine::SetCurrTool( const string& sTool, const string& sHead, int nExit)
// recupero i dati della testa
Head* pHead = GetHead( nHeadId) ;
if ( pHead == nullptr) {
string sOut = "Missing head " + sHead + " for tool " + sTool ;
string sOutHead = ( IsEmptyOrSpaces( sHead) ? "???" : sHead) ;
string sOutTool = ( IsEmptyOrSpaces( sTool) ? "???" : sTool) ;
string sOut = "Missing head " + sOutHead + " for tool " + sOutTool ;
LOG_ERROR( GetEMkLogger(), sOut.c_str())
return false ;
}
@@ -230,6 +249,7 @@ Machine::SetCurrTool( const string& sTool, const string& sHead, int nExit)
double dTOvLen = 0 ;
double dTOvDiam = 0 ;
double dTDist = 0 ;
string sTUserNotes = "" ;
string sTcPos = "" ;
// se definito
if ( ! sTool.empty()) {
@@ -248,7 +268,8 @@ Machine::SetCurrTool( const string& sTool, const string& sHead, int nExit)
! m_pMchMgr->TdbGetCurrToolParam( TPA_LEN, dTLen) ||
! m_pMchMgr->TdbGetCurrToolParam( TPA_DIAM, dTDiam) ||
! m_pMchMgr->TdbGetCurrToolParam( TPA_TOTLEN, dTOvLen) ||
! m_pMchMgr->TdbGetCurrToolParam( TPA_TOTDIAM, dTOvDiam))
! m_pMchMgr->TdbGetCurrToolParam( TPA_TOTDIAM, dTOvDiam) ||
! m_pMchMgr->TdbGetCurrToolParam( TPA_USERNOTES, sTUserNotes))
return false ;
m_pMchMgr->TdbGetCurrToolParam( TPA_DIST, dTDist) ; // opzionale
if ( ! m_pMchMgr->GetCurrSetupMgr().GetToolSetupPos( sTool, sTcPos))
@@ -273,6 +294,7 @@ Machine::SetCurrTool( const string& sTool, const string& sHead, int nExit)
m_nCalcExitId = nExitId ;
m_nCalcToolId = nToolId ;
m_dCalcRot1W = pHead->GetRot1W() ;
m_bCalcMaxDeltaR2On1 = pHead->GetMaxDeltaR2On1() ;
m_nCalcSolCh = pHead->GetSolCh() ;
m_ptCalcPos = pExit->GetPos() ;
m_vtCalcDir = pExit->GetTDir() ;
@@ -287,6 +309,7 @@ Machine::SetCurrTool( const string& sTool, const string& sHead, int nExit)
bool bOldEMC = LuaChangeNameGlobVar( EMC_VAR, EMC_VAR_BACKUP) ;
// definisco variabili
bool bOk = LuaCreateGlobTable( EMC_VAR) ;
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_VER, GetEMkVer()) ;
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_HEAD, sHead) ;
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_EXIT, nExit) ;
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_TOOL, sTool) ;
@@ -294,6 +317,7 @@ Machine::SetCurrTool( const string& sTool, const string& sHead, int nExit)
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_TOTDIAM, dTOvDiam) ;
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_TOTLEN, dTOvLen) ;
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_DIST, dTDist) ;
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_USERNOTES, sTUserNotes) ;
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_TCPOS, sTcPos) ;
// chiamo funzione
bOk = bOk && LuaCallFunction( ON_SET_HEAD) ;
@@ -427,14 +451,6 @@ Machine::GetCurrHeadCollGroups( INTVECTOR& vIds) const
return true ;
}
//----------------------------------------------------------------------------
double
Machine::GetCurrRot1W( void) const
{
// restituisco il peso del primo asse rotante nei confronti di movimento
return m_dCalcRot1W ;
}
//----------------------------------------------------------------------------
bool
Machine::CalculateKinematicChain( void)
@@ -443,8 +459,14 @@ Machine::CalculateKinematicChain( void)
if ( m_pGeomDB == nullptr)
return false ;
// azzero tutti gli assi della catena cinematica
m_nTabLinAxes = 0 ;
m_nTabRotAxes = 0 ;
m_nHeadLinAxes = 0 ;
m_nHeadRotAxes = 0 ;
m_nHeadSpecRotAxis = -1 ;
m_vCalcLinAx.clear() ;
m_vCalcRotAx.clear() ;
m_nCalcChainType = KIN_CHAIN_NONE ;
// recupero gli assi di tavola
if ( m_nCalcTabId == GDB_ID_NULL)
return false ;
@@ -467,35 +489,107 @@ Machine::CalculateKinematicChain( void)
return false ;
nHParId = m_pGeomDB->GetParentId( nHParId) ;
}
// verifiche sugli assi lineari :
// devono essere 3
if ( m_vCalcLinAx.size() != 3)
// se non ci sono assi, né lineari né rotanti, sicuramente errore
if ( m_nTabLinAxes == 0 && m_nHeadLinAxes == 0 &&
m_nTabRotAxes == 0 && m_nHeadRotAxes == 0) {
LOG_ERROR( GetEMkLogger(), "Errors in Axes : none have been found")
return false ;
}
// se nessun asse lineare deve essere un robot (in futuro va permesso un lineare di tavola)
if ( m_nTabLinAxes == 0 && m_nHeadLinAxes == 0) {
// verifico ci siano 6 assi rotanti tutti di testa (in futuro va permesso un rotante di tavola)
if ( m_nTabRotAxes != 0 || m_nHeadRotAxes != 6) {
LOG_ERROR( GetEMkLogger(), "Robot with errors in Rotary Axes : number or type")
return false ;
}
// riordino gli assi rotanti
swap( m_vCalcRotAx[0], m_vCalcRotAx[5]) ;
swap( m_vCalcRotAx[1], m_vCalcRotAx[4]) ;
swap( m_vCalcRotAx[2], m_vCalcRotAx[3]) ;
// direzione assi rotanti deve essere Z Y Y X Y X
if ( ! m_vCalcRotAx[0].vtDir.IsZ() ||
! m_vCalcRotAx[1].vtDir.IsY() ||
! m_vCalcRotAx[2].vtDir.IsY() ||
! m_vCalcRotAx[3].vtDir.IsX() ||
! m_vCalcRotAx[4].vtDir.IsY() ||
! m_vCalcRotAx[5].vtDir.IsX()) {
LOG_ERROR( GetEMkLogger(), "Robot with errors in Rotary Axes : not ZYY-XYX")
return false ;
}
// verifico che gli ultimi 3 assi formino un polso sferico (ovvero passino per uno stesso punto)
if ( abs( m_vCalcRotAx[3].ptPos.y - m_vCalcRotAx[5].ptPos.y) > EPS_SMALL ||
abs( m_vCalcRotAx[3].ptPos.z - m_vCalcRotAx[5].ptPos.z) > EPS_SMALL ||
abs( m_vCalcRotAx[4].ptPos.z - m_vCalcRotAx[3].ptPos.z) > EPS_SMALL) {
LOG_ERROR( GetEMkLogger(), "Robot with errors in Rotary Axes : not spherical Wrist")
return false ;
}
// calcolo il centro del polso in coordinate globali (R5.x, R6.y, R5.z)
Point3d ptCenG( m_vCalcRotAx[4].ptPos.x, m_vCalcRotAx[5].ptPos.y, m_vCalcRotAx[4].ptPos.z) ;
// recupero il riferimento dell'uscita (da posizione, direzione utensile e direzione ausiliaria)
Frame3d frExit ;
if ( ! frExit.Set( m_ptCalcPos, m_vtCalcDir, m_vtCalcADir))
return false ;
// calcolo il centro del polso in locale a questo riferimento
m_ptWristCen = GetToLoc( ptCenG, frExit) ;
// calcolo la direzione di riferimento del polso in locale a questo riferimento
m_vtWristRef = GetToLoc( m_vCalcRotAx[5].vtDir, frExit) ;
// dichiaro tipo robot
m_nCalcChainType = KIN_CHAIN_ROBOT ;
return true ;
}
// verifiche sugli assi lineari :
// aggiusto gli indici di ordine sulla sua catena cinematica (1-based)
for ( int i = 0 ; i < int( m_vCalcLinAx.size()) ; ++ i) {
if ( m_vCalcLinAx[i].bHead)
m_vCalcLinAx[i].nInd += m_nHeadLinAxes + m_nHeadRotAxes + 1 ;
else
m_vCalcLinAx[i].nInd *= -1 ;
}
// devono essere 3
if ( m_vCalcLinAx.size() != 3) {
LOG_ERROR( GetEMkLogger(), "Linear Axes are not 3 in number")
return false ;
}
// devono essere ordinabili come XYZ
if ( ! m_vCalcLinAx[0].vtDir.IsXplus()) {
if ( m_vCalcLinAx[1].vtDir.IsXplus())
if ( ! m_vCalcLinAx[0].vtDir.IsX()) {
if ( m_vCalcLinAx[1].vtDir.IsX())
swap( m_vCalcLinAx[0], m_vCalcLinAx[1]) ;
else if ( m_vCalcLinAx[2].vtDir.IsXplus())
else if ( m_vCalcLinAx[2].vtDir.IsX())
swap( m_vCalcLinAx[0], m_vCalcLinAx[2]) ;
else {
LOG_ERROR( GetEMkLogger(), "Linear Axes not aligned with Global XYZ")
LOG_ERROR( GetEMkLogger(), "Linear Axes are not aligned with Global XYZ")
return false ;
}
}
if ( ! m_vCalcLinAx[1].vtDir.IsYplus()) {
if ( m_vCalcLinAx[2].vtDir.IsYplus())
if ( ! m_vCalcLinAx[1].vtDir.IsY()) {
if ( m_vCalcLinAx[2].vtDir.IsY())
swap( m_vCalcLinAx[1], m_vCalcLinAx[2]) ;
else {
LOG_ERROR( GetEMkLogger(), "Linear Axes not aligned with Global XYZ")
LOG_ERROR( GetEMkLogger(), "Linear Axes are not aligned with Global XYZ")
return false ;
}
}
if ( ! m_frLinAx.Set( ORIG, m_vCalcLinAx[0].vtDir, m_vCalcLinAx[1].vtDir, m_vCalcLinAx[2].vtDir)) {
LOG_ERROR( GetEMkLogger(), "Linear Axes are not a Rigth-handed Frame")
return false ;
}
// verifiche sugli assi rotanti :
// aggiusto gli indici di ordine sulla sua catena cinematica (1-based)
for ( int i = 0 ; i < int( m_vCalcRotAx.size()) ; ++ i) {
if ( m_vCalcRotAx[i].bHead)
m_vCalcRotAx[i].nInd += m_nHeadLinAxes + m_nHeadRotAxes + 1 ;
else
m_vCalcRotAx[i].nInd *= -1 ;
}
// se 0 o 1 va bene
if ( m_vCalcRotAx.size() <= 1)
return true ;
;
// se 2 va bene
if ( m_vCalcRotAx.size() == 2) {
else if ( m_vCalcRotAx.size() == 2) {
// se entrambi di testa devo invertirne l'ordine
if ( m_vCalcRotAx[0].bHead && m_vCalcRotAx[1].bHead)
swap( m_vCalcRotAx[0], m_vCalcRotAx[1]) ;
@@ -507,10 +601,9 @@ Machine::CalculateKinematicChain( void)
m_vCalcRotAx[1].stroke.Max = min( m_vCalcRotAx[1].stroke.Max, pHead->GetRot2Stroke().Max) ;
}
}
return true ;
}
// se 3 va bene ( uno dovrà poi avere valore assegnato)
if ( m_vCalcRotAx.size() == 3) {
else if ( m_vCalcRotAx.size() == 3) {
int n2ndHeadRotAx = - 1 ;
// se tutti e tre di testa, devo invertire il primo con il terzo
if ( m_vCalcRotAx[0].bHead && m_vCalcRotAx[1].bHead && m_vCalcRotAx[2].bHead) {
@@ -530,12 +623,51 @@ Machine::CalculateKinematicChain( void)
m_vCalcRotAx[n2ndHeadRotAx].stroke.Max = min( m_vCalcRotAx[n2ndHeadRotAx].stroke.Max, pHead->GetRot2Stroke().Max) ;
}
}
return true ;
}
// altrimenti non ancora gestito, quindi errore
LOG_ERROR( GetEMkLogger(), "Rotary Axes not manageable")
return false ;
// se più di 3
else {
// altrimenti non ancora gestito, quindi errore
LOG_ERROR( GetEMkLogger(), "Rotary Axes not manageable")
return false ;
}
// verifico esistenza eventuale asse rotante speciale di testa
if ( m_nHeadRotAxes > 0 && m_nHeadLinAxes > 0) {
// indice di posizione primo asse di testa
int nHeadFirst = 1 ;
// ricerco sui rotanti
for ( int i = 0 ; i < int( m_vCalcRotAx.size()) ; ++ i) {
// se asse di testa
if ( m_vCalcRotAx[i].bHead && m_vCalcRotAx[i].nInd <= nHeadFirst) {
// non sono ammessi due assi di questo tipo
if ( m_nHeadSpecRotAxis != -1)
return false ;
// la tavola non deve avere più di un asse lineare
if ( m_nTabLinAxes > 1)
return false ;
// se ha un asse lineare deve essere allineato con il rotante speciale
else if ( m_nTabLinAxes == 1) {
// ne recupero la direzione
Vector3d vtTabLinDir ;
for ( int j = 0 ; j < int( m_vCalcLinAx.size()) ; ++ j) {
if ( ! m_vCalcLinAx[i].bHead) {
vtTabLinDir = m_vCalcLinAx[i].vtDir ;
break ;
}
}
// la confronto con quella dell'asse rotante speciale
if ( ! AreSameOrOppositeVectorApprox( vtTabLinDir, m_vCalcRotAx[i].vtDir))
return false ;
}
// ne salvo l'indice
m_nHeadSpecRotAxis = i ;
// incremento indice di posizione posibile primo asse lineare di testa
++ nHeadFirst ;
}
}
}
// dichiaro tipo centro di lavoro
m_nCalcChainType = KIN_CHAIN_CENTER ;
return true ;
}
//----------------------------------------------------------------------------
@@ -553,11 +685,20 @@ Machine::AddKinematicAxis( bool bOnHead, int nId)
KinAxis kAx ;
kAx.nGrpId = nId ;
kAx.bLinear = ( pAx->GetType() != MCH_AT_ROTARY) ;
kAx.bHead = bOnHead ; // posizione su catena cinematica
kAx.bHead = bOnHead ; // catena cinematica di appartenenza (testa o tavola)
kAx.ptPos = pAx->GetPos() ;
kAx.vtDir = pAx->GetDir() ;
kAx.stroke = pAx->GetStroke() ;
kAx.dHomeVal = pAx->GetHomeVal() ;
// ne determino l'indice di posizione nella sua catena cinematica (assegno valore negato perchè provvisorio)
if ( kAx.bHead) {
( kAx.bLinear ? ++ m_nHeadLinAxes : ++ m_nHeadRotAxes) ;
kAx.nInd = - ( m_nHeadLinAxes + m_nHeadRotAxes) ;
}
else {
( kAx.bLinear ? ++ m_nTabLinAxes : ++ m_nTabRotAxes) ;
kAx.nInd = - ( m_nTabLinAxes + m_nTabRotAxes) ;
}
// se lineare di tavola, devo invertirlo
if ( kAx.bLinear && ! kAx.bHead)
kAx.vtDir.Invert() ;
@@ -873,8 +1014,8 @@ Machine::GetMyAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
vtAx2.Invert() ;
// calcolo secondo angolo di rotazione
nStat = GetRotationComponent( vtDirHn, dCompTSuAxR1, vtAx1, vtAx2, dAngB1, dAngB2, bDet) ;
// se indeterminato con richiesta direzione ausiliaria esatta, ricalcolo con direzione aux
if ( nStat >= 1 && ! bDet && m_bSolChExact) {
// se indeterminato, provo ricalcolo con direzione aux
if ( nStat >= 1 && ! bDet) {
// componente versore ausiliario desiderato su direzione primo asse rotante
Vector3d vtSccDir ;
if ( GetSccDir( m_nCalcSolCh, vtDirAn, vtSccDir)) {
@@ -924,7 +1065,7 @@ Machine::GetMyAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
// calcolo primo angolo di rotazione per seconda soluzione
bool bDet2 = true ;
if ( nStat == 2) {
if ( ! vtDirH2.GetRotation( vtDirTn, vtAx1, dAngA2, bDet2) )
if ( ! vtDirH2.GetRotation( vtDirTn, vtAx1, SIN_EPS_ANG_SMALL, dAngA2, bDet2))
nStat = 1 ;
else {
// se indeterminato, provo a determinarlo con la direzione ausiliaria
@@ -947,7 +1088,7 @@ Machine::GetMyAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
// calcolo primo angolo di rotazione per prima soluzione
bool bDet1 = true ;
if ( nStat >= 1) {
if ( ! vtDirH1.GetRotation( vtDirTn, vtAx1, dAngA1, bDet1) )
if ( ! vtDirH1.GetRotation( vtDirTn, vtAx1, SIN_EPS_ANG_SMALL, dAngA1, bDet1))
nStat = 0 ;
else {
// se indeterminato, provo a determinarlo con la direzione ausiliaria
@@ -992,7 +1133,7 @@ Machine::GetMyAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
}
if ( nStat >= 1) {
// se non riesco ad aggiustare, elimino
if ( ! AdjustAngleInStroke( RotAx1.stroke, dAngA1) ||
if ( ( bDet1 && ! AdjustAngleInStroke( RotAx1.stroke, dAngA1)) ||
( nNumRotAx == 2 && ! AdjustAngleInStroke( RotAx2.stroke, dAngB1))) {
-- nStat ;
// riloco eventuale soluzione rimasta
@@ -1025,26 +1166,33 @@ Machine::GetPositions( const Point3d& ptP, const DBLVECTOR& vAng,
// aggiorno punto di lavoro mediante ciclo diretto sugli assi di tavola
Point3d ptW = ptP ;
// annullo la posizione home degli assi lineari
for ( size_t i = 0 ; i < m_vCalcLinAx.size() ; ++ i) {
for ( int i = 0 ; i < int( m_vCalcLinAx.size()) ; ++ i) {
// se asse di tavola
if ( ! m_vCalcLinAx[i].bHead)
ptW.Translate( - m_vCalcLinAx[i].dHomeVal * ( - m_vCalcLinAx[i].vtDir)) ;
}
// effettuo rotazione diminuita della posizione home degli assi rotanti
for ( size_t i = 0 ; i < m_vCalcRotAx.size() ; ++ i) {
for ( int i = 0 ; i < int( m_vCalcRotAx.size()) ; ++ i) {
// se asse di tavola
if ( ! m_vCalcRotAx[i].bHead)
ptW.Rotate( m_vCalcRotAx[i].ptPos, m_vCalcRotAx[i].vtDir, vAng[i] - m_vCalcRotAx[i].dHomeVal) ;
}
// effettuo rotazione inversa per asse rotante di testa speciale
if ( m_nHeadSpecRotAxis != -1) {
if ( m_nHeadSpecRotAxis < 0 || m_nHeadSpecRotAxis >= int( m_vCalcRotAx.size()))
return false ;
int i = m_nHeadSpecRotAxis ;
ptW.Rotate( m_vCalcRotAx[i].ptPos, m_vCalcRotAx[i].vtDir, -vAng[i]) ;
}
// aggiorno posizione e direzione fresa su testa a riposo mediante ciclo inverso sugli assi di testa
Point3d ptPosH = m_ptCalcPos ;
Vector3d vtDirH = m_vtCalcDir ;
for ( size_t i = m_vCalcRotAx.size() ; i >= 1 ; -- i) {
// se asse di testa
if ( m_vCalcRotAx[i-1].bHead) {
ptPosH.Rotate( m_vCalcRotAx[i-1].ptPos, m_vCalcRotAx[i-1].vtDir, vAng[i-1]) ;
vtDirH.Rotate( m_vCalcRotAx[i-1].vtDir, vAng[i-1]) ;
for ( int i = int( m_vCalcRotAx.size()) - 1 ; i >= 0 ; -- i) {
// se asse di testa non speciale
if ( m_vCalcRotAx[i].bHead && i != m_nHeadSpecRotAxis) {
ptPosH.Rotate( m_vCalcRotAx[i].ptPos, m_vCalcRotAx[i].vtDir, vAng[i]) ;
vtDirH.Rotate( m_vCalcRotAx[i].vtDir, vAng[i]) ;
}
}
@@ -1057,56 +1205,20 @@ Machine::GetPositions( const Point3d& ptP, const DBLVECTOR& vAng,
// calcolo il recupero di lunghezza utensile
Vector3d vtDtTL = vtDirH * m_dCalcTLen ;
// calcolo le posizioni degli assi lineari
dX = ptW.x + vtDtHe.x + vtDtAx.x + vtDtTL.x ;
dY = ptW.y + vtDtHe.y + vtDtAx.y + vtDtTL.y ;
dZ = ptW.z + vtDtHe.z + vtDtAx.z + vtDtTL.z ;
// calcolo i valori degli assi lineari (posizioni)
Point3d ptPos( ptW.x + vtDtHe.x + vtDtAx.x + vtDtTL.x,
ptW.y + vtDtHe.y + vtDtAx.y + vtDtTL.y,
ptW.z + vtDtHe.z + vtDtAx.z + vtDtTL.z) ;
ptPos.ToLoc( m_frLinAx) ;
dX = ptPos.x ;
dY = ptPos.y ;
dZ = ptPos.z ;
// tutto ok
nStat = 0 ;
return true ;
}
//----------------------------------------------------------------------------
bool
Machine::GetHeadOffsetDelta( const DBLVECTOR& vAng,
double& dRecX, double& dRecY, double& dRecZ) const
{
// ovviamente tutto è espresso nel riferimento ZERO MACCHINA
// verifico che siano stati assegnati gli angoli necessari, altrimenti errore
if ( vAng.size() < m_vCalcRotAx.size())
return false ;
// aggiorno posizione e direzione fresa su testa a riposo mediante ciclo inverso sugli assi di testa
Point3d ptPosH = m_ptCalcPos ;
Vector3d vtDirH = m_vtCalcDir ;
for ( size_t i = m_vCalcRotAx.size() ; i >= 1 ; -- i) {
// se asse di testa
if ( m_vCalcRotAx[i-1].bHead) {
ptPosH.Rotate( m_vCalcRotAx[i-1].ptPos, m_vCalcRotAx[i-1].vtDir, vAng[i-1]) ;
vtDirH.Rotate( m_vCalcRotAx[i-1].vtDir, vAng[i-1]) ;
}
}
// assegno l'offset testa
Vector3d vtDtHe = ORIG - m_ptCalcPos ;
// calcolo il recupero degli assi : è l'opposto dello spostamento della posizione
Vector3d vtDtAx = m_ptCalcPos - ptPosH ;
// calcolo il recupero di lunghezza utensile
Vector3d vtDtTL = vtDirH * m_dCalcTLen ;
// calcolo le posizioni degli assi lineari
dRecX = vtDtHe.x + vtDtAx.x + vtDtTL.x ;
dRecY = vtDtHe.y + vtDtAx.y + vtDtTL.y ;
dRecZ = vtDtHe.z + vtDtAx.z + vtDtTL.z ;
// tutto ok
return true ;
}
//----------------------------------------------------------------------------
bool
Machine::GetDirection( const Vector3d& vtDir, const DBLVECTOR& vAng, Vector3d& vtNew) const
@@ -1164,19 +1276,47 @@ Machine::GetNoseFromPositions( double dX, double dY, double dZ, const DBLVECTOR&
// la posizione deve essere espressa rispetto allo ZERO MACCHINA
// è espressa nel riferimento di macchina (tiene conto delle sole traslazioni e rotazioni di testa)
// aggiorno posizione testa a riposo mediante ciclo inverso sugli assi rotanti di testa
ptNose = m_ptCalcPos ;
for ( size_t i = m_vCalcRotAx.size() ; i >= 1 ; -- i) {
// se asse di testa
if ( m_vCalcRotAx[i-1].bHead)
ptNose.Rotate( m_vCalcRotAx[i-1].ptPos, m_vCalcRotAx[i-1].vtDir, vAng[i-1]) ;
// verifico dimensione vettore angoli rispetto al numero di assi rotanti
if ( vAng.size() < m_vCalcRotAx.size())
return false ;
// se centro di lavoro
if ( m_nCalcChainType == KIN_CHAIN_CENTER) {
// aggiorno posizione testa a riposo mediante ciclo inverso sugli assi rotanti di testa
ptNose = m_ptCalcPos ;
for ( int i = int( m_vCalcRotAx.size()) - 1 ; i >= 0 ; -- i) {
// se asse di testa non speciale
if ( m_vCalcRotAx[i].bHead && i != m_nHeadSpecRotAxis)
ptNose.Rotate( m_vCalcRotAx[i].ptPos, m_vCalcRotAx[i].vtDir, vAng[i]) ;
}
// aggiorno posizione testa con assi lineari di testa
DBLVECTOR vMov( {dX, dY, dZ}) ;
for ( int i = 0 ; i < int( m_vCalcLinAx.size()) ; ++ i) {
if ( m_vCalcLinAx[i].bHead)
ptNose += m_vCalcLinAx[i].vtDir * vMov[i] ;
}
// eseguo rotazione eventuale asse rotante speciale di testa
if ( m_nHeadSpecRotAxis != -1) {
if ( m_nHeadSpecRotAxis < 0 || m_nHeadSpecRotAxis >= int( m_vCalcRotAx.size()))
return false ;
int i = m_nHeadSpecRotAxis ;
ptNose.Rotate( m_vCalcRotAx[i].ptPos, m_vCalcRotAx[i].vtDir, vAng[i]) ;
}
}
// aggiorno posizione testa con assi lineari di testa
DBLVECTOR vMov( {dX, dY, dZ}) ;
for ( size_t i = 1 ; i <= m_vCalcLinAx.size() ; ++ i) {
if ( m_vCalcLinAx[i-1].bHead)
ptNose += m_vCalcLinAx[i-1].vtDir * vMov[i-1] ;
// se robot
else if ( m_nCalcChainType == KIN_CHAIN_ROBOT) {
// aggiorno posizione testa a riposo mediante ciclo inverso sugli assi rotanti di testa
ptNose = m_ptCalcPos ;
for ( int i = int( m_vCalcRotAx.size()) - 1 ; i >= 0 ; -- i) {
// se asse di testa
if ( m_vCalcRotAx[i].bHead)
ptNose.Rotate( m_vCalcRotAx[i].ptPos, m_vCalcRotAx[i].vtDir, vAng[i]) ;
}
}
// altrimenti errore
else
return false ;
return true ;
}
@@ -1188,11 +1328,46 @@ Machine::GetTipFromPositions( double dX, double dY, double dZ, const DBLVECTOR&
// la posizione deve essere espressa rispetto allo ZERO MACCHINA
// è espressa nel riferimento di macchina (tiene conto delle sole rotazioni di testa)
// Calcoli recuperi della testa e lunghezza utensile per orientamento
double dRecX, dRecY, dRecZ ;
if ( ! GetHeadOffsetDelta( vAng, dRecX, dRecY, dRecZ))
// verifico dimensione vettore angoli rispetto al numero di assi rotanti
if ( vAng.size() < m_vCalcRotAx.size())
return false ;
// se centro di lavoro
if ( m_nCalcChainType == KIN_CHAIN_CENTER) {
// aggiorno posizione tip utensile a riposo mediante ciclo inverso sugli assi rotanti di testa
ptTip = m_ptCalcPos - m_vtCalcDir * m_dCalcTLen ;
for ( int i = int( m_vCalcRotAx.size()) - 1 ; i >= 0 ; -- i) {
// se asse di testa non speciale
if ( m_vCalcRotAx[i].bHead && i != m_nHeadSpecRotAxis)
ptTip.Rotate( m_vCalcRotAx[i].ptPos, m_vCalcRotAx[i].vtDir, vAng[i]) ;
}
// aggiorno posizione tip utensile con assi lineari di testa
DBLVECTOR vMov( {dX, dY, dZ}) ;
for ( int i = 0 ; i < int( m_vCalcLinAx.size()) ; ++ i) {
if ( m_vCalcLinAx[i].bHead)
ptTip += m_vCalcLinAx[i].vtDir * vMov[i] ;
}
// eseguo rotazione eventuale asse rotante speciale di testa
if ( m_nHeadSpecRotAxis != -1) {
if ( m_nHeadSpecRotAxis < 0 || m_nHeadSpecRotAxis >= int( m_vCalcRotAx.size()))
return false ;
int i = m_nHeadSpecRotAxis ;
ptTip.Rotate( m_vCalcRotAx[i].ptPos, m_vCalcRotAx[i].vtDir, vAng[i]) ;
}
}
// se robot
else if ( m_nCalcChainType == KIN_CHAIN_ROBOT) {
// aggiorno posizione tip utensile a riposo mediante ciclo inverso sugli assi rotanti di testa
ptTip = m_ptCalcPos - m_vtCalcDir * m_dCalcTLen ;
for ( int i = int( m_vCalcRotAx.size()) - 1 ; i >= 0 ; -- i) {
// se asse di testa
if ( m_vCalcRotAx[i].bHead)
ptTip.Rotate( m_vCalcRotAx[i].ptPos, m_vCalcRotAx[i].vtDir, vAng[i]) ;
}
}
// altrimenti errore
else
return false ;
ptTip.Set( dX - dRecX, dY - dRecY, dZ - dRecZ) ;
// Se richiesto ingombro totale o punto sotto del tip utensile
if ( bOverall || bBottom) {
@@ -1236,7 +1411,7 @@ Machine::GetAuxDirFromAngles( const DBLVECTOR& vAng, Vector3d& vtDir) const
bool
Machine::GetPartDirFromAngles( const Vector3d& vtPart, const DBLVECTOR& vAng, Vector3d& vtDir) const
{
// è espressa nel riferimento di macchina (tiene conto delle sole rotazioni di tavola)
// è espressa nel riferimento di macchina (tiene conto delle sole rotazioni di tavola e asse rotante speciale di testa)
// verifico dimensione vettore angoli rispetto al numero di assi rotanti
if ( vAng.size() < m_vCalcRotAx.size())
@@ -1252,6 +1427,14 @@ Machine::GetPartDirFromAngles( const Vector3d& vtPart, const DBLVECTOR& vAng, Ve
vtDir.Rotate( m_vCalcRotAx[i-1].vtDir, vAng[i-1]) ;
}
// eseguo rotazione inversa eventuale asse rotante speciale di testa
if ( m_nHeadSpecRotAxis != -1) {
if ( m_nHeadSpecRotAxis < 0 || m_nHeadSpecRotAxis >= int( m_vCalcRotAx.size()))
return false ;
int i = m_nHeadSpecRotAxis ;
vtDir.Rotate( m_vCalcRotAx[i].vtDir, -vAng[i]) ;
}
return true ;
}
@@ -1341,12 +1524,33 @@ Machine::VerifyScc( const Vector3d& vtDirI, const Vector3d& vtDirA, int nSolCh,
bool
Machine::AdjustAngleInStroke( const STROKE& Stroke, double& dAng) const
{
// eseguo gli aggiustamenti
while ( dAng < Stroke.Min)
dAng += ANG_FULL ;
while ( dAng > Stroke.Max)
dAng -= ANG_FULL ;
return ( dAng >= Stroke.Min && dAng <= Stroke.Max) ;
// se asse rotante vero
if ( Stroke.Max - Stroke.Min > EPS_ANG_SMALL) {
// eseguo gli aggiustamenti
while ( dAng < Stroke.Min)
dAng += ANG_FULL ;
while ( dAng > Stroke.Max)
dAng -= ANG_FULL ;
// verifico
return ( dAng >= Stroke.Min && dAng <= Stroke.Max) ;
}
// altrimenti asse rotante senza corsa
else {
// angolo di riferimento
double dStrokeMid = ( Stroke.Min + Stroke.Max) / 2 ;
// eseguo gli aggiustamenti
while ( dAng < dStrokeMid - EPS_ANG_SMALL)
dAng += ANG_FULL ;
while ( dAng > dStrokeMid + EPS_ANG_SMALL)
dAng -= ANG_FULL ;
// verifico
if ( abs( dAng - dStrokeMid) < EPS_ANG_SMALL) {
dAng = dStrokeMid ;
return true ;
}
else
return false ;
}
}
//----------------------------------------------------------------------------
@@ -1357,9 +1561,9 @@ Machine::GetNearestAngleInStroke( int nInd, double dAngRef, double& dAng) const
if ( nInd < 0 || nInd >= int( m_vCalcRotAx.size()))
return true ;
// cerco l'angolo più vicino stando nella corsa
while ( dAng - dAngRef > ANG_STRAIGHT && dAng - ANG_FULL >= m_vCalcRotAx[nInd].stroke.Min)
while ( dAng - dAngRef > ANG_STRAIGHT + EPS_ANG_ZERO && dAng - ANG_FULL >= m_vCalcRotAx[nInd].stroke.Min)
dAng -= ANG_FULL ;
while ( dAng - dAngRef < -ANG_STRAIGHT && dAng + ANG_FULL <= m_vCalcRotAx[nInd].stroke.Max)
while ( dAng - dAngRef < -ANG_STRAIGHT + EPS_ANG_ZERO && dAng + ANG_FULL <= m_vCalcRotAx[nInd].stroke.Max)
dAng += ANG_FULL ;
return ( dAng >= m_vCalcRotAx[nInd].stroke.Min &&
dAng <= m_vCalcRotAx[nInd].stroke.Max) ;
@@ -1373,10 +1577,7 @@ Machine::LimitAngleToStroke( int nInd, double& dAng) const
if ( nInd < 0 || nInd >= int( m_vCalcRotAx.size()))
return true ;
// se angolo fuori corsa, lo porto all'estremo più vicino
if ( dAng < m_vCalcRotAx[nInd].stroke.Min)
dAng = m_vCalcRotAx[nInd].stroke.Min ;
else if ( dAng > m_vCalcRotAx[nInd].stroke.Max)
dAng = m_vCalcRotAx[nInd].stroke.Max ;
dAng = Clamp( dAng, m_vCalcRotAx[nInd].stroke.Min, m_vCalcRotAx[nInd].stroke.Max) ;
return true ;
}
@@ -1471,6 +1672,7 @@ Machine::VerifyProtectedAreas( double dX, double dY, double dZ, const DBLVECTOR&
bool bOldEMC = LuaChangeNameGlobVar( EMC_VAR, EMC_VAR_BACKUP) ;
// definisco variabili
bOk = bOk && LuaCreateGlobTable( EMC_VAR) ;
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_VER, GetEMkVer()) ;
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_L1, dX) ;
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_L2, dY) ;
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_L3, dZ) ;
@@ -1719,6 +1921,52 @@ Machine::GetCurrAxisMax( int nInd, double& dMax) const
return false ;
}
//----------------------------------------------------------------------------
bool
Machine::GetCurrAxisOffset( int nInd, double& dOffset) const
{
int nLinAxes = int( m_vCalcLinAx.size()) ;
int nRotAxes = int( m_vCalcRotAx.size()) ;
if ( nInd >= 0 && nInd < nLinAxes) {
Axis* pAx = GetAxis( m_vCalcLinAx[nInd].nGrpId) ;
if ( pAx == nullptr)
return false ;
dOffset = pAx->GetOffset() ;
return true ;
}
else if ( nInd >= nLinAxes && nInd < nLinAxes + nRotAxes) {
Axis* pAx = GetAxis( m_vCalcRotAx[nInd-nLinAxes].nGrpId) ;
if ( pAx == nullptr)
return false ;
dOffset = pAx->GetOffset() ;
return true ;
}
return false ;
}
//----------------------------------------------------------------------------
bool
Machine::GetCurrAxisInvert( int nInd, bool& bInvert) const
{
int nLinAxes = int( m_vCalcLinAx.size()) ;
int nRotAxes = int( m_vCalcRotAx.size()) ;
if ( nInd >= 0 && nInd < nLinAxes) {
Axis* pAx = GetAxis( m_vCalcLinAx[nInd].nGrpId) ;
if ( pAx == nullptr)
return false ;
bInvert = pAx->GetInvert() ;
return true ;
}
else if ( nInd >= nLinAxes && nInd < nLinAxes + nRotAxes) {
Axis* pAx = GetAxis( m_vCalcRotAx[nInd-nLinAxes].nGrpId) ;
if ( pAx == nullptr)
return false ;
bInvert = pAx->GetInvert() ;
return true ;
}
return false ;
}
//----------------------------------------------------------------------------
bool
Machine::GetCurrAxisHomePos( int nInd, double& dHome) const
@@ -1766,3 +2014,107 @@ Machine::GetAllCurrAxesHomePos( DBLVECTOR& vAxHomeVal) const
}
return bOk ;
}
//----------------------------------------------------------------------------
bool
Machine::GetRobotAngles( const Point3d& ptP, const Vector3d& vtDirT, const Vector3d& vtDirA,
DBLVECTOR& vAng1, DBLVECTOR& vAng2) const
{
// pulisco il risultato
vAng1.clear() ;
vAng2.clear() ;
// riferimento utensile
Frame3d frTool ;
frTool.Set( ORIG, vtDirT, vtDirA) ;
// deduco la posizione richiesta del centro del polso
Point3d ptCen = ptP + m_ptWristCen.x * frTool.VersX() +
m_ptWristCen.y * frTool.VersY() +
( m_dCalcTLen + m_ptWristCen.z) * frTool.VersZ() ;
// deduco la direzione richiesta del centro del polso
Vector3d vtCen = m_vtWristRef.x * frTool.VersX() +
m_vtWristRef.y * frTool.VersY() +
m_vtWristRef.z * frTool.VersZ() ;
// calcolo il primo asse rotante
Vector3d vtArm = ptCen - m_vCalcRotAx[0].ptPos ;
double dAng1 ; bool bDet1 ;
if ( ! X_AX.GetRotation( vtArm, m_vCalcRotAx[0].vtDir, EPS_SMALL, dAng1, bDet1) || ! bDet1) {
LOG_ERROR( GetEMkLogger(), "Error : direction unreachable (robot)")
return false ;
}
vAng1.push_back( dAng1) ;
vAng2.push_back( dAng1) ;
// calcolo secondo e terzo asse rotante
Point3d ptR2 = m_vCalcRotAx[1].ptPos ;
ptR2.Rotate( m_vCalcRotAx[0].ptPos, m_vCalcRotAx[0].vtDir, dAng1) ;
Vector3d vtR2 = m_vCalcRotAx[1].vtDir ;
vtR2.Rotate( m_vCalcRotAx[0].vtDir, dAng1) ;
Vector3d vtR2Cen = ptCen - ( ptR2 + ( ptCen - ptR2) * vtR2 * vtR2) ;
double dDistR2Cen = vtR2Cen.Len() ;
double dDistR2R3 = m_vCalcRotAx[2].ptPos.z - m_vCalcRotAx[1].ptPos.z ;
Vector3d vtR3R5 = m_vCalcRotAx[4].ptPos - m_vCalcRotAx[2].ptPos ; vtR3R5.y = 0 ;
double dDistR3R5 = vtR3R5.Len() ;
double dAngR3R5 = atan2( vtR3R5.z, vtR3R5.x) * RADTODEG ;
double dCosB = ( dDistR2R3 * dDistR2R3 + dDistR2Cen * dDistR2Cen - dDistR3R5 * dDistR3R5) / ( 2 * dDistR2R3 * dDistR2Cen) ;
double dCosC = ( dDistR3R5 * dDistR3R5 + dDistR2Cen * dDistR2Cen - dDistR2R3 * dDistR2R3) / ( 2 * dDistR3R5 * dDistR2Cen) ;
if ( abs( dCosB) > 1 || abs( dCosC) > 1) {
LOG_ERROR( GetEMkLogger(), "Error : position unreachable (robot)")
return false ;
}
double dAngB = acos( dCosB) * RADTODEG ;
double dAng2 ; bool bDet2 ;
if ( ! Z_AX.GetRotation( vtR2Cen, vtR2, EPS_SMALL, dAng2, bDet2) || ! bDet2) {
LOG_ERROR( GetEMkLogger(), "Error : R2 not calculable (robot)")
return false ;
}
dAng2 -= dAngB ;
vAng1.push_back( dAng2) ;
vAng2.push_back( dAng2) ;
double dAngC = acos( dCosC) * RADTODEG ;
double dAng3 = dAngB + dAngC + dAngR3R5 - ANG_RIGHT ;
vAng1.push_back( dAng3) ;
vAng2.push_back( dAng3) ;
// calcolo i primi due assi rotanti del polso
Frame3d frWrist ;
frWrist.Set( m_vCalcRotAx[3].ptPos, m_vCalcRotAx[3].vtDir, m_vCalcRotAx[4].vtDir ^ m_vCalcRotAx[3].vtDir) ;
frWrist.Rotate( m_vCalcRotAx[2].ptPos, m_vCalcRotAx[2].vtDir, dAng3) ;
frWrist.Rotate( m_vCalcRotAx[1].ptPos, m_vCalcRotAx[1].vtDir, dAng2) ;
frWrist.Rotate( m_vCalcRotAx[0].ptPos, m_vCalcRotAx[0].vtDir, dAng1) ;
Vector3d vtCenL = GetToLoc( vtCen, frWrist) ;
double dAng4, dAng5 ;
vtCenL.ToSpherical( nullptr, &dAng5, &dAng4) ;
if ( dAng4 > ANG_STRAIGHT)
dAng4 -= ANG_FULL ;
if ( dAng4 > ANG_RIGHT) {
dAng4 -= ANG_STRAIGHT ;
dAng5 = -dAng5 ;
}
else if ( dAng4 < -ANG_RIGHT) {
dAng4 += ANG_STRAIGHT ;
dAng5 = -dAng5 ;
}
vAng1.push_back( dAng4) ;
vAng1.push_back( dAng5) ;
vAng2.push_back( dAng4 + ( dAng4 > EPS_ANG_ZERO ? -ANG_STRAIGHT : ANG_STRAIGHT)) ;
vAng2.push_back( -dAng5) ;
// calcolo il terzo asse rotante del polso
Vector3d vtR6 = m_vCalcRotAx[5].vtDir ;
for ( int i = 4; i >= 0 ; --i)
vtR6.Rotate( m_vCalcRotAx[i].vtDir, vAng1[i]) ;
Vector3d vtTool = m_vtCalcDir ;
for ( int i = 4; i >= 0 ; --i)
vtTool.Rotate( m_vCalcRotAx[i].vtDir, vAng1[i]) ;
double dAng6 ; bool bDet6 ;
if ( ! vtTool.GetRotation( vtDirT, vtR6, EPS_SMALL, dAng6, bDet6) || ! bDet6) {
Vector3d vtAux = m_vtCalcADir ;
for ( int i = 4; i >= 0 ; --i)
vtAux.Rotate( m_vCalcRotAx[i].vtDir, vAng1[i]) ;
if ( ! vtAux.GetRotation( vtDirA, vtR6, EPS_SMALL, dAng6, bDet6) || ! bDet6) {
LOG_ERROR( GetEMkLogger(), "Error : R6 not calculable (robot)")
return false ;
}
}
vAng1.push_back( dAng6) ;
vAng2.push_back( dAng6 + ( dAng6 > EPS_ANG_ZERO ? -ANG_STRAIGHT : ANG_STRAIGHT)) ;
return true ;
}
+14
View File
@@ -98,6 +98,18 @@ Machine::GetHeadSolCh( const string& sHead) const
return pHead->GetSolCh() ;
}
//----------------------------------------------------------------------------
int
Machine::GetHeadSelectType( const string& sHead) const
{
// recupero testa
Head* pHead = GetHead( GetGroup( sHead)) ;
if ( pHead == nullptr)
return MCH_SCC_NONE ;
// recupero tipo di selezione delle uscite della testa
return pHead->GetSelectType() ;
}
//----------------------------------------------------------------------------
bool
Machine::LoadTool( const string& sHead, int nExit, const string& sTool)
@@ -171,6 +183,8 @@ Machine::LoadTool( Exit* pExit, const string& sTool)
return false ;
// sposto eventuali info relative al porta utensile (ToolHolder) nel gruppo SOLID
double dVal ;
if ( m_pGeomDB->GetInfo( nTGrpId, TTH_BASE, dVal))
m_pGeomDB->SetInfo( nSolidId, TTH_BASE, dVal) ;
if ( m_pGeomDB->GetInfo( nTGrpId, TTH_LEN, dVal))
m_pGeomDB->SetInfo( nSolidId, TTH_LEN, dVal) ;
if ( m_pGeomDB->GetInfo( nTGrpId, TTH_DIAM, dVal))
+252 -23
View File
@@ -1,7 +1,7 @@
//----------------------------------------------------------------------------
// EgalTech 2015-2020
// EgalTech 2015-2021
//----------------------------------------------------------------------------
// File : MachineLua.cpp Data : 26.04.20 Versione : 2.2d4
// File : MachineLua.cpp Data : 14.10.21 Versione : 2.3j5
// Contenuto : Implementazione gestione macchina : funzioni Lua.
//
//
@@ -41,17 +41,21 @@ static const string FLD_AUX = "Aux" ;
static const string FLD_TOKEN = "Token" ;
static const string FLD_TYPE = "Type" ;
static const string FLD_INVERT = "Invert" ;
static const string FLD_AXIS_OFFSET = "Offset" ;
static const string FLD_REF1 = "Ref1" ;
static const string FLD_SCALE = "Scale" ;
static const string FLD_EXIT_NBR = "ExitNbr" ;
static const string FLD_POS = "Pos" ;
static const string FLD_DIR = "Dir" ;
static const string FLD_STROKE = "Stroke" ;
static const string FLD_HOME = "Home" ;
static const string FLD_ADJUSTAUX = "AdjustAux" ;
static const string FLD_HSET = "HSet" ;
static const string FLD_SEL_TYPE = "SelType" ;
static const string FLD_TDIR = "TDir" ;
static const string FLD_ADIR = "ADir" ;
static const string FLD_ROT1W = "Rot1W" ;
static const string FLD_MAXDELTAR2ON1 = "MaxDeltaR2OnFirst" ;
static const string FLD_ROT2STROKE = "Rot2Stroke" ;
static const string FLD_SOLCH = "SolCh" ;
static const string FLD_OTHCOLL = "OthColl" ;
@@ -93,8 +97,10 @@ Machine::LuaInit( const string& sMachineName)
m_LuaMgr.RegisterFunction( "EmtModifyAxisDirection", Machine::LuaEmtModifyAxisDirection) ;
m_LuaMgr.RegisterFunction( "EmtModifyAxisStroke", Machine::LuaEmtModifyAxisStroke) ;
m_LuaMgr.RegisterFunction( "EmtModifyAxisHome", Machine::LuaEmtModifyAxisHome) ;
m_LuaMgr.RegisterFunction( "EmtModifyHeadAuxDirection", Machine::LuaEmtModifyHeadAuxDirection) ;
m_LuaMgr.RegisterFunction( "EmtModifyExitPosition", Machine::LuaEmtModifyExitPosition) ;
m_LuaMgr.RegisterFunction( "EmtLinkRawPartToGroup", Machine::LuaEmtLinkRawPartToGroup) ;
m_LuaMgr.RegisterFunction( "EmtGetAllLinkedRawParts", Machine::LuaEmtGetAllLinkedRawParts) ;
m_LuaMgr.RegisterFunction( "EmtUnlinkRawPartFromGroup", Machine::LuaEmtUnlinkRawPartFromGroup) ;
m_LuaMgr.RegisterFunction( "EmtUnlinkAllRawPartsFromGroups", Machine::LuaEmtUnlinkAllRawPartsFromGroups) ;
m_LuaMgr.RegisterFunction( "EmtLinkFixtureToGroup", Machine::LuaEmtLinkFixtureToGroup) ;
@@ -128,6 +134,12 @@ Machine::LuaInit( const string& sMachineName)
m_LuaMgr.RegisterFunction( "EmtExecCollisionCheck", Machine::LuaEmtExecCollisionCheck) ;
// registro la funzione di gestione della collisione in simulazione
m_LuaMgr.RegisterFunction( "EmtOnCollision", Machine::LuaEmtOnCollision) ;
// registro la funzione di impostazione del primo utensile per virtual milling in simulazione
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 di movimento assi in simulazione
m_LuaMgr.RegisterFunction( "EmtMoveAxes", Machine::LuaEmtMoveAxes) ;
return true ;
}
@@ -488,6 +500,9 @@ Machine::LuaEmtAxis( lua_State* L)
// lettura eventuale campo 'Invert' dalla tabella (default false)
bool bInvert = false ;
LuaGetTabFieldParam( L, 1, FLD_INVERT, bInvert) ;
// lettura eventuale campo 'Offset' dalla tabella (default 0)
double dOffset = 0 ;
LuaGetTabFieldParam( L, 1, FLD_AXIS_OFFSET, dOffset) ;
// lettura campo 'Type' dalla tabella
int nType ;
LuaCheckTabFieldParam( L, 1, FLD_TYPE, nType)
@@ -523,8 +538,8 @@ Machine::LuaEmtAxis( lua_State* L)
return luaL_error( L, " Unknown Machine") ;
// carico i dati dell'asse
if ( ! m_pMchLua->LoadMachineAxis( sName, sParent, sToken, bInvert, nType, ptPos, vtDir,
Stroke, dHome, bAdjustAux, sGeo, vsAux))
if ( ! m_pMchLua->LoadMachineAxis( sName, sParent, sToken, bInvert, dOffset,
nType, ptPos, vtDir, Stroke, dHome, bAdjustAux, sGeo, vsAux))
return luaL_error( L, " Load Machine Axis failed") ;
// restituisco l'indice dell'asse
@@ -588,8 +603,11 @@ Machine::LuaEmtStdHead( lua_State* L)
// lettura eventuale campo 'Rot1W' dalla tabella (default 1)
double dRot1W = 1 ;
LuaGetTabFieldParam( L, 1, FLD_ROT1W, dRot1W) ;
// lettura eventuale campo 'MaxDeltaR2OnFirst' dalla tabella (default true)
bool bMaxDeltaR2On1 = true ;
LuaGetTabFieldParam( L, 1, FLD_MAXDELTAR2ON1, bMaxDeltaR2On1) ;
// lettura eventuale campo 'Rot2Stroke' dalla tabella
STROKE Rot2Stroke{ -INFINITO, INFINITO} ;
STROKE Rot2Stroke{{ -INFINITO, INFINITO}} ;
LuaGetTabFieldParam( L, 1, FLD_ROT2STROKE, Rot2Stroke.v) ;
// lettura eventuale campo 'SolCh' dalla tabella
int nSolCh = MCH_SCC_NONE ;
@@ -615,7 +633,7 @@ Machine::LuaEmtStdHead( lua_State* L)
// carico i dati della testa standard
if ( ! m_pMchLua->LoadMachineStdHead( sName, sParent, sHSet, ptPos, vtTDir, vtADir,
dRot1W, Rot2Stroke, nSolCh, vsOthColl, sGeo, vsAux))
dRot1W, bMaxDeltaR2On1, Rot2Stroke, nSolCh, vsOthColl, sGeo, vsAux))
return luaL_error( L, " Load Machine Standard Head failed") ;
// restituisco l'indice della testa
@@ -643,9 +661,12 @@ Machine::LuaEmtMultiHead( lua_State* L)
// lettura campo 'HSet' dalla tabella
string sHSet ;
LuaCheckTabFieldParam( L, 1, FLD_HSET, sHSet)
// lettura eventuale campo tipo di selezione ammessa per le uscite
int nSelectType = MCH_SLT_FIXEDEXITS ;
LuaGetTabFieldParam( L, 1, FLD_SEL_TYPE, nSelectType) ;
// lettura campo 'ExitNbr' dalla tabella
int nExitNbr ;
LuaCheckTabFieldParam( L, 1, "ExitNbr", nExitNbr)
LuaCheckTabFieldParam( L, 1, FLD_EXIT_NBR, nExitNbr)
// lettura campi 'PosN' e 'TDirN' per ogni uscita dalla tabella
MUEXITVECTOR vMuExit ;
vMuExit.reserve( nExitNbr) ;
@@ -660,14 +681,17 @@ Machine::LuaEmtMultiHead( lua_State* L)
// inserimento nell'array
vMuExit.emplace_back( ptPos, vtTDir) ;
}
// lettura campo 'ADir' dalla tabella
// lettura eventuale campo 'ADir' dalla tabella
Vector3d vtADir ;
LuaGetTabFieldParam( L, 1, FLD_ADIR, vtADir) ;
// lettura eventuale campo 'Rot1W' dalla tabella (default 1)
double dRot1W = 1 ;
LuaGetTabFieldParam( L, 1, FLD_ROT1W, dRot1W) ;
// lettura eventuale campo 'MaxDeltaR2OnFirst' dalla tabella (default true)
bool bMaxDeltaR2On1 = true ;
LuaGetTabFieldParam( L, 1, FLD_MAXDELTAR2ON1, bMaxDeltaR2On1) ;
// lettura eventuale campo 'Rot2Stroke' dalla tabella
STROKE Rot2Stroke{ -INFINITO, INFINITO} ;
STROKE Rot2Stroke{{ -INFINITO, INFINITO}} ;
LuaGetTabFieldParam( L, 1, FLD_ROT2STROKE, Rot2Stroke.v) ;
// lettura eventuale campo 'SolCh' dalla tabella
int nSolCh = MCH_SCC_NONE ;
@@ -692,9 +716,9 @@ Machine::LuaEmtMultiHead( lua_State* L)
return luaL_error( L, " Unknown Machine") ;
// carico i dati della testa multipla
if ( ! m_pMchLua->LoadMachineMultiHead( sName, sParent, sHSet, vMuExit, vtADir,
dRot1W, Rot2Stroke, nSolCh, vsOthColl, sGeo, vsAux))
return luaL_error( L, " Load Machine Standard Head failed") ;
if ( ! m_pMchLua->LoadMachineMultiHead( sName, sParent, sHSet, nSelectType, vMuExit, vtADir,
dRot1W, bMaxDeltaR2On1, Rot2Stroke, nSolCh, vsOthColl, sGeo, vsAux))
return luaL_error( L, " Load Machine Multi Head failed") ;
// restituisco l'indice della testa
int nHeadId = m_pMchLua->GetHeadId( sName) ;
@@ -733,8 +757,11 @@ Machine::LuaEmtSpecialHead( lua_State* L)
// lettura eventuale campo 'Rot1W' dalla tabella (default 1)
double dRot1W = 1 ;
LuaGetTabFieldParam( L, 1, FLD_ROT1W, dRot1W) ;
// lettura eventuale campo 'MaxDeltaR2OnFirst' dalla tabella (default true)
bool bMaxDeltaR2On1 = true ;
LuaGetTabFieldParam( L, 1, FLD_MAXDELTAR2ON1, bMaxDeltaR2On1) ;
// lettura eventuale campo 'Rot2Stroke' dalla tabella
STROKE Rot2Stroke{ -INFINITO, INFINITO} ;
STROKE Rot2Stroke{{ -INFINITO, INFINITO}} ;
LuaGetTabFieldParam( L, 1, FLD_ROT2STROKE, Rot2Stroke.v) ;
// lettura eventuale campo 'SolCh' dalla tabella
int nSolCh = MCH_SCC_NONE ;
@@ -760,7 +787,7 @@ Machine::LuaEmtSpecialHead( lua_State* L)
// carico i dati della testa standard
if ( ! m_pMchLua->LoadMachineSpecialHead( sName, sParent, sHSet, ptPos, vtTDir, vtADir,
dRot1W, Rot2Stroke, nSolCh, vsOthColl, sGeo, vsAux))
dRot1W, bMaxDeltaR2On1, Rot2Stroke, nSolCh, vsOthColl, sGeo, vsAux))
return luaL_error( L, " Load Machine Special Head failed") ;
// restituisco l'indice della testa
@@ -775,6 +802,26 @@ Machine::LuaEmtSpecialHead( lua_State* L)
//----------------------------------------------------------------------------
int
Machine::LuaEmtTcPos( lua_State* L)
{
// Il parametro 1 deve essere una tabella
if ( ! lua_istable( L, 1))
return luaL_error( L, " Invalid Parameter, required a table") ;
// lettura campo opzionale 'ExitNbr' dalla tabella
int nExitNbr = 1 ;
LuaGetTabFieldParam( L, 1, FLD_EXIT_NBR, nExitNbr) ;
// Procedo alla lettura a seconda del tnumero di uscite
if ( nExitNbr == 1)
return LuaEmtStdTcPos( L) ;
else if ( nExitNbr > 1)
return LuaEmtMultiTcPos( L) ;
else
return luaL_error( L, " Tc Position type unknown") ;
}
//----------------------------------------------------------------------------
int
Machine::LuaEmtStdTcPos( lua_State* L)
{
// Il parametro 1 deve essere una tabella
if ( ! lua_istable( L, 1))
@@ -811,8 +858,70 @@ Machine::LuaEmtTcPos( lua_State* L)
return luaL_error( L, " Unknown Machine") ;
// carico i dati della posizione cambio utensile
if ( ! m_pMchLua->LoadMachineTcPos( sName, sParent, ptPos, vtTDir, vtADir, sGeo, vsAux))
return luaL_error( L, " Load Machine Tc Position failed") ;
if ( ! m_pMchLua->LoadMachineStdTcPos( sName, sParent, ptPos, vtTDir, vtADir, sGeo, vsAux))
return luaL_error( L, " Load Machine Standard Tc Position failed") ;
// restituisco l'indice della posizione cambio utensile
int nTcPosId = m_pMchLua->GetTcPosId( sName) ;
if ( nTcPosId != GDB_ID_NULL)
LuaSetParam( L, nTcPosId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//----------------------------------------------------------------------------
int
Machine::LuaEmtMultiTcPos( lua_State* L)
{
// Il parametro 1 deve essere una tabella
if ( ! lua_istable( L, 1))
return luaL_error( L, " Invalid Parameter, required a table") ;
// lettura campo 'Name' dalla tabella
string sName ;
LuaCheckTabFieldParam( L, 1, FLD_NAME, sName)
// lettura campo 'Parent' dalla tabella
string sParent ;
LuaCheckTabFieldParam( L, 1, FLD_PARENT, sParent)
// lettura campo 'ExitNbr' dalla tabella
int nExitNbr ;
LuaCheckTabFieldParam( L, 1, FLD_EXIT_NBR, nExitNbr)
// lettura campi 'PosN' e 'TDirN' per ogni uscita dalla tabella
MUEXITVECTOR vMuExit ;
vMuExit.reserve( nExitNbr) ;
for ( int i = 0 ; i < nExitNbr ; ++ i) {
// lettura
string sPos = FLD_POS + ToString( i + 1) ;
Point3d ptPos ;
LuaCheckTabFieldParam( L, 1, sPos.c_str(), ptPos)
string sTDir = FLD_TDIR + ToString( i + 1) ;
Vector3d vtTDir ;
LuaCheckTabFieldParam( L, 1, sTDir.c_str(), vtTDir)
// inserimento nell'array
vMuExit.emplace_back( ptPos, vtTDir) ;
}
// lettura eventuale campo 'ADir' dalla tabella
Vector3d vtADir ;
LuaGetTabFieldParam( L, 1, FLD_ADIR, vtADir) ;
// lettura campo 'Geo' dalla tabella
string sGeo ;
LuaCheckTabFieldParam( L, 1, FLD_GEO, sGeo)
// lettura eventuale campo 'Aux' dalla tabella
STRVECTOR vsAux ;
LuaGetTabFieldParam( L, 1, FLD_AUX, vsAux) ;
LuaClearStack( L) ;
// info
string sOut = "LuaEmtTcPos : " + sName ;
LOG_DBG_INFO( GetEMkLogger(), sOut.c_str())
// verifico ci sia una macchina attiva
if ( m_pMchLua == nullptr)
return luaL_error( L, " Unknown Machine") ;
// carico i dati della posizione cambio utensile
if ( ! m_pMchLua->LoadMachineMultiTcPos( sName, sParent, vMuExit, vtADir, sGeo, vsAux))
return luaL_error( L, " Load Machine Multi Tc Position failed") ;
// restituisco l'indice della posizione cambio utensile
int nTcPosId = m_pMchLua->GetTcPosId( sName) ;
@@ -903,6 +1012,26 @@ Machine::LuaEmtModifyAxisHome( lua_State* L)
return 1 ;
}
//----------------------------------------------------------------------------
int
Machine::LuaEmtModifyHeadAuxDirection( lua_State* L)
{
// 2 parametri : sHead, vtADir
string sHead ;
LuaCheckParam( L, 1, sHead)
Vector3d vtADir ;
LuaCheckParam( L, 2, vtADir)
LuaClearStack( L) ;
// verifico ci sia una macchina attiva
if ( m_pMchLua == nullptr)
return luaL_error( L, " Unknown Machine") ;
// modifico la direzione ausiliaria della testa
bool bOk = m_pMchLua->ModifyMachineHeadAuxDirection( sHead, vtADir) ;
// assegno risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//----------------------------------------------------------------------------
int
Machine::LuaEmtModifyExitPosition( lua_State* L)
@@ -963,6 +1092,22 @@ Machine::LuaEmtUnlinkRawPartFromGroup( lua_State* L)
return 1 ;
}
//----------------------------------------------------------------------------
int
Machine::LuaEmtGetAllLinkedRawParts( lua_State* L)
{
// nessun parametro
LuaClearStack( L) ;
// verifico ci sia una macchina attiva
if ( m_pMchLua == nullptr)
return luaL_error( L, " Unknown Machine") ;
// recupero l'elenco dei grezzi agganciati ad un gruppo macchina
const INTVECTOR& vLinkedRawParts = m_pMchLua->GetAllLinkedRawParts() ;
// assegno risultato
LuaSetParam( L, vLinkedRawParts) ;
return 1 ;
}
//----------------------------------------------------------------------------
int
Machine::LuaEmtUnlinkAllRawPartsFromGroups( lua_State* L)
@@ -1150,7 +1295,7 @@ Machine::LuaEmtSetLastError( lua_State* L)
// verifico ci sia una macchina attiva
if ( m_pMchLua == nullptr)
return luaL_error( L, " Unknown Machine") ;
// assegno i dati
// imposto informazioni di errore
bool bOk = ( m_pMchLua->m_pMchMgr != nullptr && m_pMchLua->m_pMchMgr->SetLastError( nErrId, sErrDesc)) ;
string sOut = "(" + ToString( nErrId) + ") " + sErrDesc ;
// se uscita dolce
@@ -1175,7 +1320,7 @@ Machine::LuaEmtSetWarning( lua_State* L)
// verifico ci sia una macchina attiva
if ( m_pMchLua == nullptr)
return luaL_error( L, " Unknown Machine") ;
// assegno i dati
// imposto informazioni di warning
bool bOk = ( m_pMchLua->m_pMchMgr != nullptr && m_pMchLua->m_pMchMgr->SetWarning( nWarnId, sWarnDesc)) ;
// assegno risultato
LuaSetParam( L, bOk) ;
@@ -1204,7 +1349,7 @@ Machine::LuaEmtAddCollisionObj( lua_State* L)
if ( m_pMchLua == nullptr)
return luaL_error( L, " Unknown Machine") ;
// assegno i dati
bool bOk = ( m_pMchLua->m_pMchMgr != nullptr && m_pMchLua->m_pMchMgr->SimAddCollisionObj( nInd, nFrameId, nType, Vector3d(), dPar1, dPar2, dPar3)) ;
bool bOk = ( m_pMchLua->m_pMchMgr != nullptr && m_pMchLua->m_pMchMgr->SimAddCollisionObj( nInd, false, nFrameId, nType, Vector3d(), dPar1, dPar2, dPar3)) ;
// assegno risultato
LuaSetParam( L, bOk) ;
return 1 ;
@@ -1214,7 +1359,7 @@ Machine::LuaEmtAddCollisionObj( lua_State* L)
int
Machine::LuaEmtAddCollisionObjEx( lua_State* L)
{
// 7 parametri : nInd, nFrameId, nType, vtMove, dPar1, dPar2, dPar3
// 7 o 8 parametri : nInd, nFrameId, nType, vtMove, dPar1, dPar2, dPar3 [,bToolOn]
int nInd ;
LuaCheckParam( L, 1, nInd)
int nFrameId ;
@@ -1229,12 +1374,14 @@ Machine::LuaEmtAddCollisionObjEx( lua_State* L)
LuaCheckParam( L, 6, dPar2)
double dPar3 ;
LuaCheckParam( L, 7, dPar3)
bool bToolOn = false ;
LuaGetParam( L, 8, bToolOn) ;
LuaClearStack( L) ;
// verifico ci sia una macchina attiva
if ( m_pMchLua == nullptr)
return luaL_error( L, " Unknown Machine") ;
// assegno i dati
bool bOk = ( m_pMchLua->m_pMchMgr != nullptr && m_pMchLua->m_pMchMgr->SimAddCollisionObj( nInd, nFrameId, nType, vtMove, dPar1, dPar2, dPar3)) ;
bool bOk = ( m_pMchLua->m_pMchMgr != nullptr && m_pMchLua->m_pMchMgr->SimAddCollisionObj( nInd, bToolOn, nFrameId, nType, vtMove, dPar1, dPar2, dPar3)) ;
// assegno risultato
LuaSetParam( L, bOk) ;
return 1 ;
@@ -1244,7 +1391,7 @@ Machine::LuaEmtAddCollisionObjEx( lua_State* L)
int
Machine::LuaEmtExecCollisionCheck( lua_State* L)
{
// 1 parametro opzionale
// 1 parametro opzionale : [nMoveType = 0]
int nMoveType = 0 ;
LuaGetParam( L, 1, nMoveType) ;
LuaClearStack( L) ;
@@ -1274,7 +1421,7 @@ Machine::LuaEmtOnCollision( lua_State* L)
// verifico ci sia una macchina attiva
if ( m_pMchLua == nullptr)
return luaL_error( L, " Unknown Machine") ;
// eseguo la verifica di collisione (nessuna collisione -> true)
// eseguo gestione della collisione in simulazione
int nErr = 0 ;
bool bOk = ( m_pMchLua->m_pMchMgr != nullptr && m_pMchLua->m_pMchMgr->SimOnCollision( nCdInd, nObjInd, nErr)) ;
// assegno risultato
@@ -1282,3 +1429,85 @@ Machine::LuaEmtOnCollision( lua_State* L)
LuaSetParam( L, nErr) ;
return 2 ;
}
//----------------------------------------------------------------------------
int
Machine::LuaEmtSetToolForVmill( lua_State* L)
{
// 4 parametri : sTool, sHead, nExit, vVmill
string sTool ;
LuaGetParam( L, 1, sTool) ;
string sHead ;
LuaGetParam( L, 2, sHead) ;
int nExit = 0 ;
LuaGetParam( L, 3, nExit) ;
INTVECTOR vVmill ;
LuaGetParam( L, 4, vVmill) ;
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)) ;
// assegno risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//----------------------------------------------------------------------------
int
Machine::LuaEmtAddToolForVmill( lua_State* L)
{
// 4 parametri : sTool, sHead, nExit, vVmill
string sTool ;
LuaGetParam( L, 1, sTool) ;
string sHead ;
LuaGetParam( L, 2, sHead) ;
int nExit = 0 ;
LuaGetParam( L, 3, nExit) ;
INTVECTOR vVmill ;
LuaGetParam( L, 4, vVmill) ;
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)) ;
// assegno risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//----------------------------------------------------------------------------
int
Machine::LuaEmtMoveAxes( lua_State* L)
{
// 4, ..., 31 parametri : nMoveType, sAx1, dPos1, dStep1 [, sAx2, dPos2, dStep2] ... [, sAx10, dPos10, dStep10]
int nMoveType = 0 ;
LuaGetParam( L, 1, nMoveType) ;
SAMVECTOR vAxNaEpSt ;
for ( int i = 0 ; i < 10 ; ++ i) {
int nInd = 2 + 3 * i ;
string sAxN ;
double dEndN ;
double dStepN ;
if ( LuaGetParam( L, nInd, sAxN) && LuaGetParam( L, nInd + 1, dEndN) && LuaGetParam( L, nInd + 2, dStepN))
vAxNaEpSt.emplace_back( sAxN, dEndN, dStepN) ;
else
break ;
}
LuaClearStack( L) ;
// verifico ci sia una macchina attiva
if ( m_pMchLua == nullptr)
return luaL_error( L, " Unknown Machine") ;
// eseguo movimento in simulazione
int nRes = 0 ;
if ( m_pMchLua->m_pMchMgr != nullptr)
nRes = m_pMchLua->m_pMchMgr->SimMoveAxes( nMoveType, vAxNaEpSt) ;
// assegno risultato
if ( nRes == SIM_AXMV_RES_STOP)
return luaL_error( L, "STOP") ;
else
LuaSetParam( L, ( nRes == SIM_AXMV_RES_OK)) ;
return 1 ;
}
+16 -4
View File
@@ -31,7 +31,7 @@ using namespace std ;
int
Machine::LuaEmtAddRapidStart( lua_State* L)
{
// 6 parametri : nPathId, ptP, vtTool, vtCorr, vtAux, nFlag
// 6 o 7 parametri : nPathId, ptP, vtTool, vtCorr, vtAux, nFlag [, bToolShow]
int nPathId ;
LuaCheckParam( L, 1, nPathId)
Point3d ptP ;
@@ -44,6 +44,8 @@ Machine::LuaEmtAddRapidStart( lua_State* L)
LuaCheckParam( L, 5, vtAux)
int nFlag ;
LuaCheckParam( L, 6, nFlag)
bool bToolShow = false ;
LuaGetParam( L, 7, bToolShow) ;
LuaClearStack( L) ;
// verifico ci sia una macchina attiva valida
if ( m_pMchLua == nullptr ||
@@ -69,6 +71,7 @@ Machine::LuaEmtAddRapidStart( lua_State* L)
pCam->SetEndPoint( ptP) ;
pCam->SetFeed( 0) ;
pCam->SetFlag( nFlag) ;
pCam->SetToolShow( bToolShow) ;
// associo questo oggetto a quello geometrico
m_pMchLua->m_pGeomDB->SetUserObj( nId, Release( pCam)) ;
}
@@ -84,7 +87,7 @@ Machine::LuaEmtAddRapidStart( lua_State* L)
int
Machine::LuaEmtAddRapidMove( lua_State* L)
{
// 7 parametri : nPathId, ptIni, ptFin, vtTool, vtCorr, vtAux, nFlag
// 7 o 8 parametri : nPathId, ptIni, ptFin, vtTool, vtCorr, vtAux, nFlag [, bToolShow]
int nPathId ;
LuaCheckParam( L, 1, nPathId)
Point3d ptIni ;
@@ -99,6 +102,8 @@ Machine::LuaEmtAddRapidMove( lua_State* L)
LuaCheckParam( L, 6, vtAux)
int nFlag ;
LuaCheckParam( L, 7, nFlag)
bool bToolShow = false ;
LuaGetParam( L, 8, bToolShow) ;
LuaClearStack( L) ;
// verifico ci sia una macchina attiva valida
if ( m_pMchLua == nullptr ||
@@ -124,6 +129,7 @@ Machine::LuaEmtAddRapidMove( lua_State* L)
pCam->SetEndPoint( ptFin) ;
pCam->SetFeed( 0) ;
pCam->SetFlag( nFlag) ;
pCam->SetToolShow( bToolShow) ;
// associo questo oggetto a quello geometrico
m_pMchLua->m_pGeomDB->SetUserObj( nId, Release( pCam)) ;
}
@@ -139,7 +145,7 @@ Machine::LuaEmtAddRapidMove( lua_State* L)
int
Machine::LuaEmtAddLinearMove( lua_State* L)
{
// 8 parametri : nPathId, ptIni, ptFin, vtTool, vtCorr, vtAux, dFeed, nFlag
// 8 o 9 parametri : nPathId, ptIni, ptFin, vtTool, vtCorr, vtAux, dFeed, nFlag [, bToolShow]
int nPathId ;
LuaCheckParam( L, 1, nPathId)
Point3d ptIni ;
@@ -156,6 +162,8 @@ Machine::LuaEmtAddLinearMove( lua_State* L)
LuaCheckParam( L, 7, dFeed)
int nFlag ;
LuaCheckParam( L, 8, nFlag)
bool bToolShow = false ;
LuaGetParam( L, 9, bToolShow) ;
LuaClearStack( L) ;
// verifico ci sia una macchina attiva valida
if ( m_pMchLua == nullptr ||
@@ -181,6 +189,7 @@ Machine::LuaEmtAddLinearMove( lua_State* L)
pCam->SetEndPoint( ptFin) ;
pCam->SetFeed( dFeed) ;
pCam->SetFlag( nFlag) ;
pCam->SetToolShow( bToolShow) ;
// associo questo oggetto a quello geometrico
m_pMchLua->m_pGeomDB->SetUserObj( nId, Release( pCam)) ;
}
@@ -196,7 +205,7 @@ Machine::LuaEmtAddLinearMove( lua_State* L)
int
Machine::LuaEmtAddArcMove( lua_State* L)
{
// 11 parametri : nPathId, ptIni, ptFin, ptCen, dAngCen, vtN, vtTool, vtCorr, vtAux, dFeed, nFlag
// 11 o 12 parametri : nPathId, ptIni, ptFin, ptCen, dAngCen, vtN, vtTool, vtCorr, vtAux, dFeed, nFlag [, bToolShow]
int nPathId ;
LuaCheckParam( L, 1, nPathId)
Point3d ptIni ;
@@ -219,6 +228,8 @@ Machine::LuaEmtAddArcMove( lua_State* L)
LuaCheckParam( L, 10, dFeed)
int nFlag ;
LuaCheckParam( L, 11, nFlag)
bool bToolShow = false ;
LuaGetParam( L, 12, bToolShow) ;
LuaClearStack( L) ;
// verifico ci sia una macchina attiva valida
if ( m_pMchLua == nullptr ||
@@ -252,6 +263,7 @@ Machine::LuaEmtAddArcMove( lua_State* L)
pCam->SetNormDir( vtN) ;
pCam->SetFeed( dFeed) ;
pCam->SetFlag( nFlag) ;
pCam->SetToolShow( bToolShow) ;
// associo questo oggetto a quello geometrico
m_pMchLua->m_pGeomDB->SetUserObj( nId, Release( pCam)) ;
}
+27 -8
View File
@@ -1,7 +1,7 @@
//----------------------------------------------------------------------------
// EgalTech 2015-2015
// EgalTech 2015-2024
//----------------------------------------------------------------------------
// File : MachineStruConst.h Data : 25.05.15 Versione : 1.6e7
// File : MachineStruConst.h Data : 15.01.24 Versione : 2.5l6
// Contenuto : Strutture e costanti di macchina.
//
//
@@ -44,6 +44,7 @@ struct KinAxis {
int nGrpId ;
bool bLinear ;
bool bHead ;
int nInd ;
Point3d ptPos ;
Vector3d vtDir ;
STROKE stroke ;
@@ -51,7 +52,7 @@ struct KinAxis {
bool bFixed ;
double dFixVal ;
KinAxis( void)
: nGrpId( GDB_ID_NULL), bLinear( true), bHead( true), ptPos(), vtDir(), dHomeVal( 0), bFixed( false), dFixVal( 0)
: nGrpId( GDB_ID_NULL), bLinear( true), bHead( true), nInd( 0), ptPos(), vtDir(), dHomeVal( 0), bFixed( false), dFixVal( 0)
{ stroke.Min = 0 ; stroke.Max = 0 ; }
} ;
typedef std::vector<KinAxis> KINAXISVECTOR ;
@@ -87,6 +88,18 @@ enum MchHeadType { MCH_HT_NONE = 0,
MCH_HT_MULTI = 2,
MCH_HT_SPECIAL = 3} ;
//----------------------------------------------------------------------------
// Tipo di selezione ammessa per le uscite
enum MchSelType { MCH_SLT_FIXEDEXITS = 0,
MCH_SLT_ONEEXIT = 1,
MCH_SLT_MULTIEXITS = 2} ;
//----------------------------------------------------------------------------
// Tipo della catena cinematica
enum KinChainType { KIN_CHAIN_NONE = 0,
KIN_CHAIN_CENTER = 1,
KIN_CHAIN_ROBOT = 2} ;
//----------------------------------------------------------------------------
// Identificativo iniziale riferimenti di tavola
const std::string MCH_TREF = "R" ;
@@ -112,17 +125,20 @@ const std::string MCH_ZHOMEDOWN = "ZHOMEDOWN" ;
const std::string MCH_ABOVE = "ABOVE" ;
// Info di testa per una variazione alla Z di sicurezza globale
const std::string MCH_ZSAFEDELTA = "ZSAFEDELTA" ;
// Info di tavola per dichiarare che va considerata come basculante
const std::string MCH_TILTINGLIKE = "TiltingLike" ;
//----------------------------------------------------------------------------
// Dati aggregato rotante da sotto
struct AggrBottom {
int nType ;
double dDMax ;
double dEncH ;
double dEncV ;
int nType ;
double dDMax ;
double dEncH ;
double dEncV ;
Vector3d vtMDir ;
AggrBottom( void) : nType( 0), dDMax( 0), dEncH( 0), dEncV( 0) {}
void Clear( void)
{ nType = 0 ; dDMax= 0 ; dEncH = 0 ; dEncV = 0 ; }
{ nType = 0 ; dDMax= 0 ; dEncH = 0 ; dEncV = 0 ; vtMDir = V_NULL ; }
} ;
//----------------------------------------------------------------------------
@@ -134,3 +150,6 @@ const std::string MCH_AGB_DMAX = "AGB_DMAX" ;
const std::string MCH_AGB_ENCH = "AGB_ENCH" ;
// Info in rinvio rotante da sotto con ingombro verticale
const std::string MCH_AGB_ENCV = "AGB_ENCV" ;
// Info in rinvio rotante da sotto per definire la direzione di approccio preferenziale (consentito delta max di 95deg)
const std::string MCH_AGB_MDIR = "AGB_MDIR" ;
const double MCH_AGB_DELTAMAX_MDIR = cos( 95 * DEGTORAD) ;
+2 -2
View File
@@ -287,12 +287,12 @@ Machining::ToolPreview( int nEntId, int nFlag) const
Frame3d frHead ;
m_pGeomDB->GetGroupGlobFrame( nId, frHead) ;
Frame3d frRef ;
if ( vtAux.IsSmall())
if ( vtAux.IsSmall() || AreSameOrOppositeVectorApprox( vtAux, vtDir))
frRef.Set( ptOrig, vtDir) ;
else
frRef.Set( ptOrig, vtDir, vtAux) ;
Frame3d frShow ;
if ( vtBAux.IsSmall())
if ( vtBAux.IsSmall() || AreSameOrOppositeVectorApprox( vtBAux, vtTool))
frShow.Set( ptEnd + vtTool * GetToolData().m_dLen, vtTool) ;
else
frShow.Set( ptEnd + vtTool * GetToolData().m_dLen, vtTool, vtBAux) ;
+10 -1
View File
@@ -103,7 +103,11 @@ GetMachiningTitle( int nMchType)
"SawRoughing",
"SawFinishing",
"GenMachining",
"Chiseling"} ;
"Chiseling",
"SurfRoughing",
"SurfFinishing",
"Waterjetting",
"5axMachining"} ;
switch ( nMchType) {
case MT_DRILLING : return MchTitle[1] ;
case MT_SAWING : return MchTitle[2] ;
@@ -114,6 +118,11 @@ GetMachiningTitle( int nMchType)
case MT_SAWFINISHING : return MchTitle[7] ;
case MT_GENMACHINING : return MchTitle[8] ;
case MT_CHISELING : return MchTitle[9] ;
case MT_SURFROUGHING : return MchTitle[10] ;
case MT_SURFFINISHING : return MchTitle[11] ;
case MT_WATERJETTING : return MchTitle[12] ;
case MT_5AXMACHINING : return MchTitle[13] ;
}
return MchTitle[0] ;
}
+314 -20
View File
@@ -1,7 +1,7 @@
//----------------------------------------------------------------------------
// EgalTech 2015-2020
// EgalTech 2015-2022
//----------------------------------------------------------------------------
// File : MachiningsMgr.cpp Data : 09.11.20 Versione : 2.2k2
// File : MachiningsMgr.cpp Data : 04.02.22 Versione : 2.4b1
// Contenuto : Implementazione gestore database lavorazioni.
//
//
@@ -15,6 +15,7 @@
// 03.06.20 DS Agg. per nuovi parametri Tab in fresatura (MF_CURR_VER = 1009).
// 22.06.20 DS Agg. per nuovi parametri attacco tagli di lama (MF_CURR_VER = 1010).
// 09.11.20 DS Agg. per nuovi parametri tagli di lama (MF_CURR_VER = 1011).
// 04.02.22 DS Agg. per nuovi parametri svuotature con epicicli (MF_CURR_VER = 1012).
//
//----------------------------------------------------------------------------
@@ -31,7 +32,6 @@
#include "/EgtDev/Include/EGnFileUtils.h"
#include "/EgtDev/Include/EGnScanner.h"
#include "/EgtDev/Include/EGnWriter.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
#include <cassert>
#include <bitset>
@@ -42,7 +42,7 @@ const string MF_HEADER = "[HEADER]" ;
const string MF_VERSION = "VERSION" ;
const string MF_TOTAL = "TOTAL" ;
const string MF_SIZE = "SIZE" ;
const int MF_CURR_VER = 1011 ;
const int MF_CURR_VER = 1012 ;
const string MF_GENERAL = "[GENERAL]" ;
const string MF_3AXCOMP = "3AXCOMP" ;
const bool MF_CURR_3AXCOMP = false ;
@@ -189,11 +189,25 @@ MachiningsMgr::Reload( void)
// Ciclo di lettura delle lavorazioni
do {
if ( ! LoadOneMachining( TheScanner, bEnd)) {
PtrOwner<MachiningData> pMch ;
if ( LoadOneMachining( TheScanner, pMch, bEnd)) {
// salvo i dati della lavorazione
if ( ! IsNull( pMch)) {
if ( ! m_umData.emplace( pMch->m_Uuid, Get( pMch)).second ||
! m_suData.emplace( pMch->m_sName, pMch->m_Uuid).second) {
bOk = false ;
string sOut = "ReloadMachinings : Error adding machining " + pMch->m_sName ;
LOG_ERROR( GetEMkLogger(), sOut.c_str())
}
Release( pMch) ;
}
}
else {
bOk = false ;
string sOut = "ReloadMachinings : Error on line " + ToString( TheScanner.GetCurrLineNbr()) ;
LOG_ERROR( GetEMkLogger(), sOut.c_str())
}
} while ( bOk && ! bEnd) ;
// Termino lo scanner
@@ -207,7 +221,7 @@ MachiningsMgr::Reload( void)
//----------------------------------------------------------------------------
bool
MachiningsMgr::LoadHeader( Scanner& TheScanner, int& nVersion, int& nTotal, bool& bEnd)
MachiningsMgr::LoadHeader( Scanner& TheScanner, int& nVersion, int& nTotal, bool& bEnd) const
{
// leggo la prossima linea
string sLine ;
@@ -311,11 +325,12 @@ MachiningsMgr::LoadGeneral( Scanner& TheScanner, bool& bEnd)
//----------------------------------------------------------------------------
bool
MachiningsMgr::LoadOneMachining( Scanner& TheScanner, bool& bEnd)
MachiningsMgr::LoadOneMachining( Scanner& TheScanner, PtrOwner<MachiningData>& pMch, bool& bEnd) const
{
// leggo la prossima linea
string sLine ;
if ( ! TheScanner.GetLine( sLine)) {
pMch.Reset() ;
// fine file
bEnd = true ;
return true ;
@@ -324,12 +339,12 @@ MachiningsMgr::LoadOneMachining( Scanner& TheScanner, bool& bEnd)
if ( sLine.front() != '[' || sLine.back() != ']')
return false ;
Trim( sLine, "[]") ;
// separo tipo da contatore
// separo tipo da contatore
string sType, sCount ;
SplitFirst( sLine, "_", sType, sCount) ;
ToUpper( sType) ;
// alloco la lavorazione del tipo corrispondente
PtrOwner<MachiningData> pMch( MCHDATA_CREATE( MCHDATA_NAMETOTYPE( sType))) ;
pMch.Set( MCHDATA_CREATE( MCHDATA_NAMETOTYPE( sType))) ;
if ( IsNull( pMch))
return false ;
bool bOk = true ;
@@ -366,10 +381,6 @@ MachiningsMgr::LoadOneMachining( Scanner& TheScanner, bool& bEnd)
}
// verifico di aver letto tutti i campi
bOk = bOk && ( Flag.count() == nSize) ;
// salvo i dati della lavorazione
bOk = bOk && m_umData.emplace( pMch->m_Uuid, Get( pMch)).second ;
bOk = bOk && m_suData.emplace( pMch->m_sName, pMch->m_Uuid).second ;
Release( pMch) ;
return bOk ;
}
@@ -438,7 +449,7 @@ MachiningsMgr::Save( bool bCompressed) const
//----------------------------------------------------------------------------
bool
MachiningsMgr::SaveHeader( Writer& TheWriter) const
MachiningsMgr::SaveHeader( Writer& TheWriter, int nTotal) const
{
// scrivo l'intestazione
bool bOk = true ;
@@ -447,7 +458,10 @@ MachiningsMgr::SaveHeader( Writer& TheWriter) const
bOk = bOk && TheWriter.OutText( sOut) ;
sOut = MF_VERSION + "=" + ToString( m_nDbVer) ;
bOk = bOk && TheWriter.OutText( sOut) ;
sOut = MF_TOTAL + "=" + ToString( int( m_umData.size())) ;
if ( nTotal == -1)
sOut = MF_TOTAL + "=" + ToString( int( m_umData.size())) ;
else
sOut = MF_TOTAL + "=" + ToString( nTotal) ;
bOk = bOk && TheWriter.OutText( sOut) ;
return bOk ;
}
@@ -498,14 +512,20 @@ MachiningsMgr::SaveOneMachining( const EgtUUID& Uuid, int& nCounter, Writer& The
if ( iIter == m_umData.end())
return false ;
const MachiningData* pmData = iIter->second ;
// preparo la lista dei dati (quelli vuoti sono opzionali con default)
STRVECTOR vsOut ;
for ( int i = 0 ; i < pmData->GetSize() ; ++ i) {
string sOut = pmData->ToString( i) ;
if ( ! sOut.empty())
vsOut.emplace_back( sOut) ;
}
// scrivo i dati della lavorazione
string sOut = "[" + pmData->GetTitle() + "_" + ToString( ++ nCounter, 3) + "]" ;
bool bOk = TheWriter.OutText( sOut) ;
sOut = MF_SIZE + "=" + ToString( pmData->GetSize()) ;
sOut = MF_SIZE + "=" + ToString( int( vsOut.size())) ;
bOk = bOk && TheWriter.OutText( sOut) ;
for ( int i = 0 ; i < pmData->GetSize() ; ++ i) {
string sOut = pmData->ToString( i) ;
bOk = bOk && ! sOut.empty() && TheWriter.OutText( sOut) ;
for ( const auto& sOut : vsOut) {
bOk = bOk && TheWriter.OutText( sOut) ;
}
return bOk ;
}
@@ -514,7 +534,7 @@ MachiningsMgr::SaveOneMachining( const EgtUUID& Uuid, int& nCounter, Writer& The
bool
MachiningsMgr::GetMachiningNewName( string& sName) const
{
// il parametro nome deve essere valido
// il parametro nome deve essere valido
if ( &sName == nullptr)
return false ;
// se nome vuoto, assegno radice standard
@@ -1168,3 +1188,277 @@ MachiningsMgr::SetMaxDepthSafe( double dSafe)
}
return true ;
}
//----------------------------------------------------------------------------
bool
MachiningsMgr::Export( const STRVECTOR& vsMachiningsNames, const string& sOutFile, bool bCompressed) const
{
LOG_INFO( GetEMkLogger(), ( "Export Machinings " + sOutFile).c_str()) ;
// conto le lavorazioni da esportare
int nMachinings = 0 ;
for ( size_t i = 0 ; i < vsMachiningsNames.size() ; i ++) {
if ( m_suData.find( vsMachiningsNames[i]) != m_suData.end())
nMachinings ++ ;
}
// inizializzo il writer
Writer TheWriter ;
if ( ! TheWriter.Init( sOutFile, bCompressed)) {
LOG_ERROR( GetEMkLogger(), " Error Exporting Machinings on Init") ;
return false ;
}
// scrivo linea di inizio file
string sOut = "; --- " + sOutFile + " " + CurrDateTime() + " ---" ;
if ( ! TheWriter.OutText( sOut)) {
LOG_ERROR( GetEMkLogger(), " Error Exporting Machinings on Start") ;
return false ;
}
// scrivo l'intestazione
if ( ! SaveHeader( TheWriter, nMachinings)) {
LOG_ERROR( GetEMkLogger(), " Error Exporting Machinings on Header") ;
return false ;
}
// scrivo i dati generali
if ( m_nDbVer >= 1002 && ! SaveGeneral( TheWriter)) {
LOG_ERROR( GetEMkLogger(), " Error Exporting Machinings on General") ;
return false ;
}
// ciclo su tutti i nomi delle lavorazioni da esportare
int nCounter = 0 ;
for ( size_t i = 0 ; i < vsMachiningsNames.size() ; i ++) {
auto it = m_suData.find( vsMachiningsNames[i]) ;
// se la lavorazione non esiste passo alla sucessiva
if ( it == m_suData.end()) {
string sOut = " Warning Exporting Machinings : " + vsMachiningsNames[i] + " not found. Machining is ignored." ;
LOG_ERROR( GetEMkLogger(), sOut.c_str()) ;
continue ;
}
// esporto la singola lavorazione
if ( ! SaveOneMachining( it->second, nCounter, TheWriter)) {
string sOut = " Error Exporting Machining " + it->first ;
LOG_ERROR( GetEMkLogger(), sOut.c_str()) ;
return false ;
}
}
// scrivo linea di fine file
if ( ! TheWriter.OutText( "; --- End ---")) {
LOG_ERROR( GetEMkLogger(), " Error Exporting Machinings on End") ;
return false ;
}
// chiudo la scrittura
TheWriter.Close() ;
return true ;
}
//----------------------------------------------------------------------------
bool
MachiningsMgr::ToBeImported( const string& sFile, STRVECTOR& vsMachiningsNames, INTVECTOR& vMachiningsTypes) const
{
// inizializzo lo scanner
Scanner TheScanner ;
if ( ! TheScanner.Init( sFile, ";")) {
LOG_ERROR( GetEMkLogger(), "Machinings ToBeImported : Error on Init") ;
return false ;
}
// leggo l'intestazione
int nVersion = 0 ;
int nTotal = 0 ;
bool bEnd = false ;
if ( ! LoadHeader( TheScanner, nVersion, nTotal, bEnd)) {
LOG_ERROR( GetEMkLogger(), "Machinings ToBeImported : Error on Header") ;
return false ;
}
string sLine ;
if ( ! TheScanner.GetLine( sLine))
return true ; // il file è finito, esco
// parte generale
if ( sLine == MF_GENERAL) {
// scorro le linee fino ad arrivare alla sezione successiva
while ( TheScanner.GetLine( sLine)) {
if ( sLine.front() == '[' && sLine.back() == ']')
break ;
}
// se non c'è una sezione successiva esco
if ( sLine.empty())
return true ;
}
else if ( nVersion >= 1002) {
LOG_ERROR( GetEMkLogger(), "Machinings ToBeImported : General section missing") ;
return false ;
}
bool bMachiningName = false ;
bool bAdd = true ;
string sName ;
int nType = 0 ;
TheScanner.UngetLine( sLine) ;
while ( TheScanner.GetLine( sLine)) {
if ( sLine.front() == '[' && sLine.back() == ']') { // se è intestazione
// aggiungo lavorazione precedente se ok
if ( bAdd && bMachiningName && nType != 0) {
vsMachiningsNames.push_back( sName) ;
vMachiningsTypes.push_back( nType) ;
}
bMachiningName = false ;
bAdd = true ;
// salvo il tipo di lavorazione
Trim( sLine, "[]") ;
string sType, sCount ;
SplitFirst( sLine, "_", sType, sCount) ;
ToUpper( sType) ;
nType = MCHDATA_NAMETOTYPE( sType) ;
}
else {
string sKey, sVal ;
SplitFirst( sLine, "=", sKey, sVal) ;
if ( ToUpper( sKey) == "NAME") {
if ( ! bMachiningName) {
bMachiningName = true ;
sName = sVal ;
}
else // se lavorazione ha più nomi è errore, non deve essere importata
bAdd = false ;
}
}
}
// aggiungo ultima lavorazione se ok
if ( bAdd && bMachiningName && nType != 0) {
vsMachiningsNames.push_back( sName) ;
vMachiningsTypes.push_back( nType) ;
}
if ( vsMachiningsNames.size() != vMachiningsTypes.size())
return false ;
return true ;
}
//----------------------------------------------------------------------------
bool
MachiningsMgr::Import( const string& sFile, const STRVECTOR& vsMachiningsToImport, const STRVECTOR& vsMachiningsNames, STRVECTOR& vsImported)
{
LOG_INFO( GetEMkLogger(), ( "Import Machinings : " + sFile).c_str()) ;
for ( size_t i = 0 ; i < vsMachiningsNames.size() ; i ++) {
// se esiste già nel DB una lavorazione con lo stesso nome la rimuovo
if ( m_suData.find( vsMachiningsNames[i]) != m_suData.end()) {
bool bOk = RemoveMachining( vsMachiningsNames[i]) ;
if ( ! bOk) {
LOG_ERROR( GetEMkLogger(), ( " Error Importing Machinings : removing " + vsMachiningsNames[i] + " failed" ).c_str()) ;
return false ;
}
}
// verfico che il nome non sia ripetuto nella lista dei vsMachiningsNames
if ( i != vsMachiningsNames.size() - 1 &&
find( vsMachiningsNames.begin() + i + 1, vsMachiningsNames.end(), vsMachiningsNames[i]) != vsMachiningsNames.end()) {
LOG_ERROR( GetEMkLogger(), ( " Error Importing Machinings : name \"" + vsMachiningsNames[i] + "\" is already used").c_str()) ;
return false ;
}
}
// inizializzo lo scanner
Scanner TheScanner ;
if ( ! TheScanner.Init( sFile, ";")) {
LOG_ERROR( GetEMkLogger(), " Error Importing Machinings on Init") ;
return false ;
}
// leggo l'intestazione
int nVersion = 0 ;
int nTotal = 0 ;
bool bEnd ;
if ( ! LoadHeader( TheScanner, nVersion, nTotal, bEnd)) {
LOG_ERROR( GetEMkLogger(), " Error Importing Machinings on Header") ;
return false ;
}
// leggo i dati generali (da versione 1002) e li ignoro
if ( nVersion >= 1002 && ! SkipGeneral( TheScanner, bEnd)) {
LOG_ERROR( GetEMkLogger(), " Error Importing Machinings on General") ;
return false ;
}
// ciclo di lettura delle lavorazioni
while ( ! bEnd) {
PtrOwner<MachiningData> pMch ;
if ( ! LoadOneMachining( TheScanner, pMch, bEnd)) {
LOG_ERROR( GetEMkLogger(), ( " Error Importing Machinings : reading at line" + ToString( TheScanner.GetCurrLineNbr())).c_str()) ;
continue ;
}
// se non c'è lavorazione (si è alla fine), si prosegue
if ( IsNull( pMch))
continue ;
// se la lavorazione non deve essere importata proseguo con la successiva
auto it = find( vsMachiningsToImport.begin(), vsMachiningsToImport.end(), pMch->m_sName) ;
if ( it == vsMachiningsToImport.end())
continue ;
// assegno il nuovo nome
pMch->m_sName = vsMachiningsNames[ it - vsMachiningsToImport.begin()] ;
// se il suo UUID esiste già nel DB lo modifico
if ( m_umData.find( pMch->m_Uuid) != m_umData.end()) {
LOG_ERROR( GetEMkLogger(), ( " Warning Importing Machinings: " + pMch->m_sName + " UUID changed").c_str()) ;
CreateEgtUUID( pMch->m_Uuid) ;
}
// aggiungo la lavorazione
if ( ! m_umData.emplace( pMch->m_Uuid, pMch).second ||
! m_suData.emplace( pMch->m_sName, pMch->m_Uuid).second) {
LOG_ERROR( GetEMkLogger(), ( " Error Importing Machinings : failed adding " + pMch->m_sName).c_str()) ;
continue ;
}
vsImported.push_back( pMch->m_sName) ;
Release( pMch) ;
}
if ( ! vsImported.empty())
m_bModified = true ;
return true ;
}
//----------------------------------------------------------------------------
bool
MachiningsMgr::SkipGeneral( Scanner& TheScanner, bool& bEnd) const
{
// leggo la prossima linea
string sLine ;
if ( ! TheScanner.GetLine( sLine)) {
// fine file
bEnd = true ;
return true ;
}
// deve essere dati generali
if ( sLine != MF_GENERAL)
return false ;
bool bOk = true ;
// leggo le linee successive
bEnd = true ;
while ( bOk && TheScanner.GetLine( sLine)) {
// se sezione successiva
if ( sLine.front() == '[' && sLine.back() == ']') {
TheScanner.UngetLine( sLine) ;
bEnd = false ;
break ;
}
}
return bOk ;
}
+8 -3
View File
@@ -14,6 +14,7 @@
#pragma once
#include "MachiningData.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
#include <unordered_map>
#include <map>
@@ -81,13 +82,17 @@ class MachiningsMgr
bool SetMaxDepthSafe( double dSafe) ;
double GetMaxDepthSafe( void) const
{ return m_dMaxDepthSafe ; }
bool Export( const STRVECTOR& vsMachiningsNames, const std::string& sOutFile, bool bCompressed = true) const ;
bool ToBeImported( const std::string& sFile, STRVECTOR& vsMachiningsNames, INTVECTOR& vMachiningsTypes) const ;
bool Import( const std::string& sFile, const STRVECTOR& vsMachiningsToImport, const STRVECTOR& vsMachiningsNames, STRVECTOR& vsImported) ;
private :
bool Clear( bool bReset) ;
bool LoadHeader( Scanner& TheScanner, int& nVersion, int& nTotal, bool& bEnd) ;
bool LoadHeader( Scanner& TheScanner, int& nVersion, int& nTotal, bool& bEnd) const ;
bool LoadGeneral( Scanner& TheScanner, bool& bEnd) ;
bool LoadOneMachining( Scanner& TheScanner, bool& bEnd) ;
bool SaveHeader( Writer& TheWriter) const ;
bool SkipGeneral( Scanner& TheScanner, bool& bEnd) const ;
bool LoadOneMachining( Scanner& TheScanner, PtrOwner<MachiningData>& pMch, bool& bEnd) const ;
bool SaveHeader( Writer& TheWriter, int nTotal = -1) const ;
bool SaveGeneral( Writer& TheWriter) const ;
bool SaveOneMachining( const EgtUUID& Uuid, int& nCounter, Writer& TheWriter) const ;
bool VerifyCurrMachining( int nType, std::string& sName) const ;
+1724 -524
View File
File diff suppressed because it is too large Load Diff
+36 -15
View File
@@ -88,27 +88,33 @@ class Milling : public Machining
bool GenerateMillingPv( int nPathId, const ICurveComposite* pCompo) ;
bool AddStandardMilling( const ICurveComposite* pCompo, const Vector3d& vtTool,
double dDepth, double dElev, bool bSplitArcs, bool bPathTabsEnable, bool bPathOscEnable) ;
bool AddZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool,
double dDepth, double dElev, double dOkStep, bool bSplitArcs, bool bPathTabsEnable, bool bPathOscEnable) ;
bool AddOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtTool,
double dDepth, double dElev, double dOkStep, bool bSplitArcs, bool bPathTabsEnable, bool bPathOscEnable) ;
bool AddZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dElev,
double dOkStep, bool bStepUp, bool bSplitArcs, bool bPathTabsEnable, bool bPathOscEnable) ;
bool AddOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dElev,
double dOkStep, bool bStepUp, bool bSplitArcs, bool bPathTabsEnable, bool bPathOscEnable) ;
bool AddSpiralMilling( const ICurveComposite* pCompo, const Vector3d& vtTool,
double dDepth, double dElev, double dOkStep, bool bSplitArcs, bool bPathTabsEnable, bool bPathOscEnable) ;
bool AddSawZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool,
double dDepth, double dElev, double dOkStep, bool bSplitArcs) ;
bool AddSawOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtTool,
double dDepth, double dElev, double dOkStep, bool bSplitArcs) ;
bool AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
double dElev, double dAppr, bool bOutStart, bool bAboveStart) ;
bool AddSawBladeSideApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dStElev, double dAppr) ;
bool AddSawBladeSideApproach( const Point3d& ptP, const Vector3d& vtAppr, const Vector3d& vtTool,
double dSafeZ, double dSawStElev, double dStElev, double dAppr) ;
bool AddDirectApproach( const Point3d& ptP) ;
bool AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
double dElev, double dAppr, bool bAboveEnd) ;
bool AddSawBladeSideRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dEndElev, double dAppr) ;
bool CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtN,
double dStElev, bool bInvert, const ICurveComposite* pCompo, Point3d& ptP1) const ;
bool AddSawBladeSideRetract( const Point3d& ptP, const Vector3d& vtRetr, const Vector3d& vtTool,
double dSafeZ, double dSawEndElev, double dEndElev, double dAppr) ;
bool CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtTool,
double dStElev, bool bInvert, const ICurveComposite* pCompo, Point3d& ptP1, Vector3d& vtDir1) const ;
bool AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d& vtStart,
const Vector3d& vtN, bool bInvert, const ICurveComposite* pCompo, bool bSplitArcs) ;
bool AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d& vtN, double dEndElev,
bool bInvert, const ICurveComposite* pCompo, bool bSplitArcs, Point3d& ptP1) ;
const Vector3d& vtTool, double dStElev, bool bInvert, const ICurveComposite* pCompo, bool bSplitArcs) ;
bool CalcLeadOutEnd( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d& vtTool,
double dEndElev, bool bInvert, const ICurveComposite* pCompo, Point3d& ptP1) const ;
bool AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d& vtTool, double dEndElev,
bool bInvert, const ICurveComposite* pCompo, bool bSplitArcs, Point3d& ptP1, Vector3d& vtDir1) ;
bool AdjustOscillParams( const ICurve* pCrv, bool& bPathOscEnable, double& dRampLen, double& dFlatLen) ;
bool AddOscillLine( const ICurveLine* pLine, const Vector3d& vtTool, double dRampLen, double dFlatLen) ;
bool AddOscillArc( const ICurveArc* pArc, const Vector3d& vtTool, double dRampLen, double dFlatLen) ;
@@ -117,11 +123,12 @@ class Milling : public Machining
bool AddTabsLine( const ICurveLine* pLine, const Vector3d& vtTool, const DBLVECTOR& vdTabs, const TabData& tdTabs) ;
bool AddTabsArc( const ICurveArc* pArc, const Vector3d& vtTool, const DBLVECTOR& vdTabs, const TabData& tdTabs) ;
double GetRadiusForStartEndElevation( bool bExtra = true) const ;
bool GetPointOutOfRaw( const Point3d& ptP, const Vector3d& vtTool, double dElev, double dSafeZ) const ;
bool GetPointOutOfRaw( const Point3d& ptP, const Vector3d& vtTool, const Vector3d& vtCorr, double dElev, double dSafeZ) const ;
bool GetPointAboveRaw( const Point3d& ptP, const Vector3d& vtTool) const ;
bool CalcAndSetCorrAuxDir( const ICurveComposite* pCompo, double dU) ;
Vector3d CalcCorrDir( const ICurveComposite* pCompo, double dU) ;
bool CalcAndSetCorrAuxDir( const ICurveComposite* pCompo, double dU, bool bInvertSide = false) ;
Vector3d CalcCorrDir( const ICurveComposite* pCompo, double dU, bool bInvertSide = false) ;
bool CalcOffset( ICurveComposite* pCompo, double dSignOffs) ;
bool TrimExtendCurveToClosedStm( ICurveComposite* pCompo, int nCstmId, bool bInvert) ;
private :
double GetSpeed() const
@@ -143,12 +150,23 @@ class Milling : public Machining
bool IsLeadInHelixOrZigzag() const
{ int nType = GetLeadInType() ;
return ( nType == MILL_LI_ZIGZAG || nType == MILL_LI_HELIX) ; }
friend class LeadIOStatus ;
bool IsLeadInHelixOrZigzagOrGlide() const
{ int nType = GetLeadInType() ;
return ( nType == MILL_LI_ZIGZAG || nType == MILL_LI_HELIX || nType == MILL_LI_GLIDE) ; }
bool LeadInRawIsOk( void) const
{ if ( ( m_TParams.m_nType & TF_SAWBLADE) != 0)
return false ;
if ( m_TParams.m_nType != TT_MILL_NOTIP)
return true ;
return ( IsLeadInHelixOrZigzag() &&
m_Params.m_dLiTang >= 0.9 * m_TParams.m_dDiam && m_Params.m_dLiElev <= 2) ; }
friend class LeadIOStatus ;
private :
SELVECTOR m_vId ; // identificativi entità geometriche da lavorare
MillingData 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
@@ -157,10 +175,13 @@ class Milling : public Machining
double m_dAddedOverlap ; // overlap effettivamente aggiunto a percorso chiuso
int m_nHeadSolCh ; // criterio scelta soluzione impostato nella testa
bool m_bTiltingTab ; // flag utilizzo tavola basculante
Vector3d m_vtTiltingAx ; // versore direzione eventuale asse basculante
bool m_bAboveHead ; // flag utilizzo testa da sopra
bool m_bAggrBottom ; // flag utilizzo di aggregato da sotto
Vector3d m_vtAggrBottom ; // vettore direzione ausiliaria aggregato da sotto
AggrBottom m_AggrBottom ; // dati eventuale aggregato da sotto
double m_dCurrOscillLen ; // lunghezza corrente lungo il percorso per l'oscillazione
double m_dCurrTabsLen ; // lunghezza corrente lungo il percorso per tabs
bool m_bStartOutRaw ; // flag forzatura inizio fuori dal grezzo
bool m_bEndOutRaw ; // flag forzatura fine fuori dal grezzo
} ;
+3 -2
View File
@@ -574,7 +574,8 @@ MillingData::VerifyLeadInType( int nVal) const
{
return ( nVal == MILL_LI_NONE || nVal == MILL_LI_LINEAR ||
nVal == MILL_LI_TANGENT || nVal == MILL_LI_GLIDE ||
nVal == MILL_LI_ZIGZAG || nVal == MILL_LI_HELIX) ;
nVal == MILL_LI_ZIGZAG || nVal == MILL_LI_HELIX ||
nVal == MILL_LI_TG_PERP) ;
}
//----------------------------------------------------------------------------
@@ -583,7 +584,7 @@ MillingData::VerifyLeadOutType( int nVal) const
{
return ( nVal == MILL_LO_NONE || nVal == MILL_LO_LINEAR ||
nVal == MILL_LO_TANGENT || nVal == MILL_LO_GLIDE ||
nVal == MILL_LO_AS_LI) ;
nVal == MILL_LO_AS_LI || nVal == MILL_LO_PERP_TG) ;
}
//----------------------------------------------------------------------------
+6 -2
View File
@@ -110,6 +110,10 @@ struct MillingData : public MachiningData
//----------------------------------------------------------------------------
inline const MillingData* GetMillingData( const MachiningData* pMdata)
{ return (dynamic_cast<const MillingData*>( pMdata)) ; }
{ if ( pMdata == nullptr || pMdata->GetType() != MT_MILLING)
return nullptr ;
return ( static_cast<const MillingData*>( pMdata)) ; }
inline MillingData* GetMillingData( MachiningData* pMdata)
{ return (dynamic_cast<MillingData*>( pMdata)) ; }
{ if ( pMdata == nullptr || pMdata->GetType() != MT_MILLING)
return nullptr ;
return ( static_cast<MillingData*>( pMdata)) ; }
+213 -117
View File
@@ -524,8 +524,14 @@ Mortising::Apply( bool bRecalc, bool bPostApply)
// verifico se necessario continuare nell'aggiornamento
if ( ! bRecalc && ! bToolChanged &&
( m_nStatus == MCH_ST_OK || ( ! bPostApply && m_nStatus == MCH_ST_NO_POSTAPPL))) {
// confermo i percorsi di lavorazione
m_nMortises = nCurrMortises ;
LOG_DBG_INFO( GetEMkLogger(), "Mortising 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 ;
@@ -609,6 +615,8 @@ Mortising::Apply( bool bRecalc, bool bPostApply)
// dichiaro successiva da aggiornare
UpdateFollowingOperationsStatus( MCH_ST_OTH_MODIF) ;
LOG_DBG_INFO( GetEMkLogger(), "Mortising apply done") ;
return true ;
}
@@ -626,21 +634,17 @@ Mortising::Update( bool bPostApply)
return true ;
}
// elimino le entità CLIMB, RISE e HOME della lavorazione, potrebbero falsare i calcoli degli assi (in ogni casi vengono riaggiunte dopo)
RemoveClimbRiseHome() ;
// imposto eventuale asse bloccato da lavorazione
if ( ! m_Params.m_sBlockedAxis.empty()) {
string sAxis, sVal ;
Split( m_Params.m_sBlockedAxis, "=", true, sAxis, sVal) ;
double dVal = 0 ;
FromString( sVal, dVal) ;
m_pMchMgr->ClearRotAxisBlock() ;
m_pMchMgr->SetRotAxisBlock( sAxis, dVal) ;
}
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, true)) {
if ( ! CalculateAxesValues( sHint, true, true)) {
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
if ( sInfo.empty())
m_pMchMgr->SetLastError( 2507, "Error in Mortising : axes values not calculable") ;
@@ -815,11 +819,31 @@ Mortising::UpdateToolData( bool* pbChanged)
const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ;
if ( pTdata == nullptr)
return false ;
// verifico se sono diversi (ad esclusione del nome)
m_TParams.m_sName = pTdata->m_sName ;
bool bChanged = ! SameTool( m_TParams, *pTdata) ;
// 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 Mortising : tool name changed (" +
@@ -992,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) ;
AdjustCurveFromSurf( pCrvCompo, nToolDir, nFaceUse, m_TParams.m_dThick, 2) ;
// la restituisco
return Release( pCrvCompo) ;
}
@@ -1186,7 +1210,7 @@ Mortising::ProcessPath( int nPathId, int nPvId, int nClId)
{
// inclinazione della direzione utensile rispetto al movimento
Vector3d vtTg ; pCompo->GetMidDir( vtTg) ;
double dSinAng = max( ( vtTg ^ vtExtr).Len(), sin( 45 * DEGTORAD)) ;
double dSinAng = max( ( vtTg ^ vtExtr).Len(), sin( 30 * DEGTORAD)) ;
double dStartAddLen = m_Params.m_dStartAddLen / dSinAng ;
double dEndAddLen = m_Params.m_dEndAddLen / dSinAng ;
// verifico che il percorso sia abbastanza lungo
@@ -1298,8 +1322,18 @@ Mortising::ProcessPath( int nPathId, int nPvId, int nClId)
if ( FromString( ExtractInfo( m_Params.m_sUserNotes, "MaxElev="), dMaxElev) && dElev > dMaxElev)
dElev = dMaxElev ;
// ingombro aggiuntivo da larghezza sega a catena quando inclinata rispetto al movimento
Vector3d vtTg ; pCompo->GetMidDir( vtTg) ;
double dSinAng = max( ( vtTg ^ vtExtr).Len(), sin( 30 * DEGTORAD)) ;
double dCosAng = min( abs( vtTg * vtExtr), cos( 30 * DEGTORAD)) ;
double dAddEnc = m_TParams.m_dDiam / 2 * dCosAng / dSinAng ;
// affondamento speciale da note utente (!!! da trasformare in parametro come gli altri !!!)
int nPlunge = 0 ;
FromString( ExtractInfo( m_Params.m_sUserNotes, "Plunge="), nPlunge) ;
// verifico che lo step dell'utensile sia sensato
double dOkStep = m_Params.m_dStep ;
double dOkStep = ( nPlunge == MORTISE_PLUNGE_STEP ? m_Params.m_dStep : 0) ;
const double MIN_ZSTEP = 1.0 ;
if ( dOkStep >= EPS_SMALL && dOkStep < MIN_ZSTEP) {
dOkStep = MIN_ZSTEP ;
@@ -1318,38 +1352,23 @@ Mortising::ProcessPath( int nPathId, int nPvId, int nClId)
}
// se lo step supera la capacità dell'utensile
if ( m_Params.m_dStep > m_TParams.m_dMaxMat + EPS_SMALL) {
if ( dOkStep > m_TParams.m_dMaxMat + EPS_SMALL) {
dOkStep = m_TParams.m_dMaxMat ;
string sInfo = "Warning in Mortising : machining step (" + ToString( m_Params.m_dStep, 1) +
") bigger than MaxMaterial (" + ToString( m_TParams.m_dMaxMat, 1) + ")" ;
m_pMchMgr->SetWarning( 2557, sInfo) ;
}
// se lavorazione singola
if ( dOkStep < EPS_SMALL || dOkStep > dElev) {
// se l'elevazione supera la capacità dell'utensile
if ( dElev > m_TParams.m_dMaxMat + EPS_SMALL) {
// segnalo, riduco e continuo
string sInfo = "Warning in Mortising : machining depth (" + ToString(dElev, 1) +
") bigger than MaxMaterial (" + ToString(m_TParams.m_dMaxMat, 1) + ")" ;
m_pMchMgr->SetWarning(2558, sInfo) ;
dDepth -= dElev - m_TParams.m_dMaxMat ;
dElev = m_TParams.m_dMaxMat ;
}
}
// altrimenti lavorazione a step
else {
// massimo affondamento dell'utensile
double dMaxDepth = m_TParams.m_dMaxMat ;
// se l'elevazione supera il massimo affondamento dell'utensile
if ( dElev > dMaxDepth + EPS_SMALL) {
// segnalo, riduco e continuo
string sInfo = "Warning in Mortising : machining depth (" + ToString( dElev, 1) +
") bigger than MaxDepth (" + ToString( dMaxDepth, 1) + ")" ;
m_pMchMgr->SetWarning( 2558, sInfo) ;
dDepth -= dElev - dMaxDepth ;
dElev = dMaxDepth ;
}
}
// massimo affondamento dell'utensile
double dMaxDepth = m_TParams.m_dMaxMat - dAddEnc ;
// se l'elevazione supera il massimo affondamento dell'utensile
if ( dElev > dMaxDepth + EPS_SMALL) {
// segnalo, riduco e continuo
string sInfo = "Warning in Mortising : machining depth (" + ToString( dElev, 1) +
") bigger than MaxDepth (" + ToString( dMaxDepth, 1) + ")" ;
m_pMchMgr->SetWarning( 2558, sInfo) ;
dDepth -= dElev - dMaxDepth ;
dElev = dMaxDepth ;
}
// se richiesta anteprima
if ( nPvId != GDB_ID_NULL) {
@@ -1386,8 +1405,8 @@ Mortising::ProcessPath( int nPathId, int nPvId, int nClId)
SetToolDir( vtTool) ;
SetAuxDir( vtAux) ;
// Calcolo la mortasatura
if ( ! GenerateMortisingCl( pCompo, vtTool, dDepth, dElev, dOkStep))
// Calcolo la mortasatura
if ( ! GenerateMortisingCl( pCompo, vtTool, dDepth, dElev, dOkStep, nPlunge))
return false ;
}
@@ -1473,103 +1492,186 @@ Mortising::GenerateMortisingPv( int nPathId, const ICurveComposite* pCompo)
//----------------------------------------------------------------------------
bool
Mortising::GenerateMortisingCl( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dElev, double dOkStep)
Mortising::GenerateMortisingCl( const ICurveComposite* pCompo, const Vector3d& vtTool,
double dDepth, double dElev, double dOkStep, int nPlunge)
{
// estremi della curva composita
// inizio e fine
Point3d ptStart ; pCompo->GetStartPoint( ptStart) ;
Point3d ptEnd ; pCompo->GetEndPoint( ptEnd) ;
// verifico se affondamento ripetuto è veramente tale
if ( ( nPlunge == MORTISE_PLUNGE_START_END || nPlunge == MORTISE_PLUNGE_START_TO_END) && Dist( ptStart, ptEnd) < 10 * EPS_SMALL)
nPlunge = MORTISE_PLUNGE_START ;
// se affondamento inizio e fine
if ( nPlunge == MORTISE_PLUNGE_START_END) {
// affondamento iniziale
if ( ! GenerateOnePlungeCl( ptStart, ptEnd, vtTool, dDepth, dElev, dOkStep, MORTISE_PLUNGE_START, true))
return false ;
// affondamento finale
if ( ! GenerateOnePlungeCl( ptStart, ptEnd, vtTool, dDepth, dElev, dOkStep, MORTISE_PLUNGE_END, false))
return false ;
}
// se alrimenti affondamenti ripetuti da inizio a fine con ritorno basso
else if ( nPlunge == MORTISE_PLUNGE_START_TO_END) {
// distanza e vettore spostamento laterale
Vector3d vtDir = ptEnd - ptStart ;
double dLen = vtDir.Len() ;
vtDir.Normalize() ;
// affondamenti iniziale e intermedi
int kMax = ( int) floor( dLen / m_TParams.m_dDiam) ;
for ( int k = 0 ; k <= kMax ; ++ k) {
Point3d ptNewStart = ptStart + vtDir * k * m_TParams.m_dDiam ;
// se non è finale
if ( k != kMax || ! AreSamePointEpsilon( ptNewStart, ptEnd, 10 * EPS_SMALL)) {
if ( ! GenerateOnePlungeCl( ptNewStart, ptEnd, vtTool, dDepth, dElev, dOkStep, MORTISE_PLUNGE_START, k == 0))
return false ;
}
}
// affondamento finale
if ( ! GenerateOnePlungeCl( ptEnd, ptStart, vtTool, dDepth, dElev, dOkStep, MORTISE_PLUNGE_STEP, false))
return false ;
}
// altrimenti affondamento singolo
else {
if ( ! GenerateOnePlungeCl( ptStart, ptEnd, vtTool, dDepth, dElev, dOkStep, nPlunge, true))
return false ;
}
// reset dati di movimento
ResetMoveData() ;
// incremento numero di mortasature
++ m_nMortises ;
return true ;
}
//----------------------------------------------------------------------------
bool
Mortising::GenerateOnePlungeCl( const Point3d& ptStart, const Point3d& ptEnd, const Vector3d& vtTool, double dDepth, double dElev,
double dOkStep, int nPlunge, bool bFirst)
{
// compensazione elevazione/affondamento
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 dStartElev = 0 ;
Point3d ptLi = ptStart + vtTool * dDelta ;
bool bUnderStart = GetPointUnderRaw( ptLi, vtTool, 0,
GetRadiusForStartEndElevation(), m_TParams.m_dLen, false, dSafeZ, dStartElev) ;
Point3d ptLi = ( nPlunge != MORTISE_PLUNGE_END ? ptStart : ptEnd) + vtTool * dDelta ;
bool bUnderStart = GetAhPointUnderRaw( ptLi, vtTool, 0,
GetRadiusForStartEndElevation(), m_TParams.m_dLen, false, dSafeZ, vtTool, dStartElev) ;
// altrimenti ridetermino elevazione su inizio percorso di lavoro
if ( ! bUnderStart)
GetElevation( m_nPhase, ptLi, vtTool, GetRadiusForStartEndElevation(), vtTool, dStartElev) ;
// 1 -> punto approccio
SetFlag( 1) ;
Point3d ptP1 = ptStart + vtTool * ( dDelta + dStartElev + dSafeZ) ;
if ( AddRapidStart( ptP1) == GDB_ID_NULL)
int nFirstFlag = ( bFirst ? 1 : 0) ;
SetFlag( nFirstFlag) ;
Point3d ptP1 = ( nPlunge != MORTISE_PLUNGE_END ? ptStart : ptEnd) + vtTool * ( dDelta + dStartElev + dSafeZ) ;
int nStart = ( bFirst ? AddRapidStart( ptP1) : AddRapidMove( ptP1)) ;
if ( nStart == GDB_ID_NULL)
return false ;
SetFlag( 0) ;
// 2 -> punto fuori (se diverso dal precedente)
if ( m_Params.m_dStartPos < dSafeZ) {
Point3d ptP2 = ptStart + vtTool * ( dDelta + m_Params.m_dStartPos) ;
if ( m_Params.m_dStartPos < dSafeZ - 10 * EPS_SMALL) {
Point3d ptP2 = ( nPlunge != MORTISE_PLUNGE_END ? ptStart : ptEnd) + vtTool * ( dDelta + m_Params.m_dStartPos) ;
if ( AddRapidMove( ptP2) == GDB_ID_NULL)
return false ;
}
// determino numero e affondamento degli step
if ( dOkStep < EPS_SMALL)
dOkStep = dElev ;
int nStep = max( 1, static_cast<int>( ceil( dElev / dOkStep))) ;
double dStep = dElev / nStep ;
const double RETURN_DIST = 10 ;
// eseguo ciclo a seconda del tipo di step
// eseguo ciclo a seconda del tipo di affondamento
Point3d ptLast ;
switch ( m_Params.m_nStepType) {
default : // ZIGZAG
for ( int i = 1 ; i <= nStep ; ++ i) {
// 3 -> punto in affondamento
SetFeed( GetStartFeed()) ;
SetFlag( 0) ;
Point3d ptP3 = (( i % 2 == 1) ? ptStart : ptEnd) + ( dDelta - i * dStep) * vtTool ;
if ( AddLinearMove( ptP3) == GDB_ID_NULL)
return false ;
// 4 -> punto termine
SetFeed( GetFeed()) ;
SetFlag( 0) ;
ptLast = (( i % 2 == 1) ? ptEnd : ptStart) ;
Point3d ptP4 = ptLast + ( dDelta - i * dStep) * vtTool ;
if ( AddLinearMove( ptP4) == GDB_ID_NULL)
return false ;
}
break ;
case MORTISE_ST_ONEWAY :
for ( int i = 1 ; i <= nStep ; ++ i) {
// 3 -> punto in affondamento
SetFeed( GetStartFeed()) ;
SetFlag( 0) ;
Point3d ptP3 = ptStart + ( dDelta - i * dStep) * vtTool ;
if ( AddLinearMove( ptP3) == GDB_ID_NULL)
return false ;
// 4 -> punto termine
SetFeed( GetFeed()) ;
SetFlag( 0) ;
ptLast = ptEnd ;
Point3d ptP4 = ptLast + ( dDelta - i * dStep) * vtTool ;
if ( AddLinearMove( ptP4) == GDB_ID_NULL)
return false ;
// 5 -> ritorno sull'inizio, se non ultimo punto
if ( i < nStep) {
// retrocedo
if ( nPlunge == MORTISE_PLUNGE_START) {
// 3 -> punto in affondamento
SetFeed( GetStartFeed()) ;
SetFlag( 0) ;
Point3d ptP3 = ptStart + ( dDelta - dElev) * vtTool ;
if ( AddLinearMove( ptP3) == GDB_ID_NULL)
return false ;
ptLast = ptStart ;
}
else if ( nPlunge == MORTISE_PLUNGE_END) {
// 3 -> punto in affondamento
SetFeed( GetStartFeed()) ;
SetFlag( 0) ;
Point3d ptP3 = ptEnd + ( dDelta - dElev) * vtTool ;
if ( AddLinearMove( ptP3) == GDB_ID_NULL)
return false ;
ptLast = ptEnd ;
}
else {
// determino numero e affondamento degli step
if ( dOkStep < EPS_SMALL)
dOkStep = dElev ;
int nStep = max( 1, static_cast<int>( ceil( ( dElev - 10 * EPS_SMALL) / dOkStep))) ;
double dStep = dElev / nStep ;
const double RETURN_DIST = 10 ;
// a seconda del tipo
switch ( m_Params.m_nStepType) {
default : // ZIGZAG
for ( int i = 1 ; i <= nStep ; ++ i) {
// 3 -> punto in affondamento
SetFeed( GetStartFeed()) ;
SetFlag( 0) ;
Point3d ptP3 = (( i % 2 == 1) ? ptStart : ptEnd) + ( dDelta - i * dStep) * vtTool ;
if ( AddLinearMove( ptP3) == GDB_ID_NULL)
return false ;
// 4 -> punto termine
SetFeed( GetFeed()) ;
SetFlag( 0) ;
Point3d ptP5a = ptP4 + RETURN_DIST * vtTool ;
if ( AddLinearMove( ptP5a) == GDB_ID_NULL)
return false ;
// ritorno sopra inizio
SetFeed( GetFeed()) ;
SetFlag( 0) ;
Point3d ptP5b = ptP3 + RETURN_DIST * vtTool ;
if ( AddLinearMove( ptP5b) == GDB_ID_NULL)
return false ;
ptLast = (( i % 2 == 1) ? ptEnd : ptStart) ;
Point3d ptP4 = ptLast + ( dDelta - i * dStep) * vtTool ;
if ( AddLinearMove( ptP4) == GDB_ID_NULL)
return false ;
}
break ;
case MORTISE_ST_ONEWAY :
for ( int i = 1 ; i <= nStep ; ++ i) {
// 3 -> punto in affondamento
SetFeed( GetStartFeed()) ;
SetFlag( 0) ;
Point3d ptP3 = ptStart + ( dDelta - i * dStep) * vtTool ;
if ( AddLinearMove( ptP3) == GDB_ID_NULL)
return false ;
// 4 -> punto termine
SetFeed( GetFeed()) ;
SetFlag( 0) ;
ptLast = ptEnd ;
Point3d ptP4 = ptLast + ( dDelta - i * dStep) * vtTool ;
if ( AddLinearMove( ptP4) == GDB_ID_NULL)
return false ;
// 5 -> ritorno sull'inizio, se non ultimo punto
if ( i < nStep) {
// retrocedo
SetFeed( GetFeed()) ;
SetFlag( 0) ;
Point3d ptP5a = ptP4 + RETURN_DIST * vtTool ;
if ( AddLinearMove( ptP5a) == GDB_ID_NULL)
return false ;
// ritorno sopra inizio
SetFeed( GetFeed()) ;
SetFlag( 0) ;
Point3d ptP5b = ptP3 + RETURN_DIST * vtTool ;
if ( AddLinearMove( ptP5b) == GDB_ID_NULL)
return false ;
}
}
break ;
}
break ;
}
// determino se la fine dell'uscita è esattamente sotto il grezzo, nel qual caso ricalcolo l'elevazione
double dEndElev = 0 ;
Point3d ptLo = ptLast + vtTool * dDelta ;
bool bUnderEnd = GetPointUnderRaw( ptLo, vtTool, 0,
GetRadiusForStartEndElevation(), m_TParams.m_dLen, false, dSafeZ, dEndElev) ;
bool bUnderEnd = GetAhPointUnderRaw( ptLo, vtTool, 0,
GetRadiusForStartEndElevation(), m_TParams.m_dLen, false, dSafeZ, vtTool, dEndElev) ;
// altrimenti ridetermino elevazione su fine percorso di lavoro
if ( ! bUnderEnd)
GetElevation( m_nPhase, ptLo, vtTool, GetRadiusForStartEndElevation(), vtTool, dEndElev) ;
// 6 -> ritorno all'approccio
SetFeed( GetEndFeed()) ;
SetFlag( 104) ; // risalita sopra la fine
@@ -1577,12 +1679,6 @@ Mortising::GenerateMortisingCl( const ICurveComposite* pCompo, const Vector3d& v
if ( AddLinearMove( ptP6) == GDB_ID_NULL)
return false ;
// reset dati di movimento
ResetMoveData() ;
// incremento numero di mortasature
++ m_nMortises ;
return true ;
}
+3 -1
View File
@@ -74,7 +74,9 @@ class Mortising : public Machining
bool ProcessPath( int nPathId, int nPvId, int nClId) ;
bool CalcPathElevation( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dRad, double dThick, double& dElev) const ;
bool GenerateMortisingPv( int nPathId, const ICurveComposite* pCompo) ;
bool GenerateMortisingCl( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dElev, double dOkStep) ;
bool GenerateMortisingCl( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dElev, double dOkStep, int nPlunge) ;
bool GenerateOnePlungeCl( const Point3d& ptStart, const Point3d& ptEnd, const Vector3d& vtTool, double dDepth, double dElev, double dOkStep,
int nPlunge, bool bFirst) ;
double GetRadiusForStartEndElevation( void) const ;
private :
+6 -2
View File
@@ -77,6 +77,10 @@ struct MortisingData : public MachiningData
//----------------------------------------------------------------------------
inline const MortisingData* GetMortisingData( const MachiningData* pMdata)
{ return (dynamic_cast<const MortisingData*>( pMdata)) ; }
{ if ( pMdata == nullptr || pMdata->GetType() != MT_MORTISING)
return nullptr ;
return ( static_cast<const MortisingData*>( pMdata)) ; }
inline MortisingData* GetMortisingData( MachiningData* pMdata)
{ return (dynamic_cast<MortisingData*>( pMdata)) ; }
{ if ( pMdata == nullptr || pMdata->GetType() != MT_MORTISING)
return nullptr ;
return ( static_cast<MortisingData*>( pMdata)) ; }
+2026 -492
View File
File diff suppressed because it is too large Load Diff
+66 -12
View File
@@ -20,6 +20,7 @@
#include "/EgtDev/Include/EGkUserObj.h"
#include "/EgtDev/Include/EGkSelection.h"
#include "/EgtDev/Include/EgtNumCollection.h"
#include "/EgtDev/Include/EGkStmStandard.h"
class MachMgr ;
class CamData ;
@@ -43,6 +44,7 @@ class Operation : public IUserObj
virtual int GetPhase( void) const
{ return m_nPhase ; }
virtual bool RemoveHome( void) ;
std::string GetName( void) const ;
public :
virtual int GetType( void) const = 0 ;
@@ -68,40 +70,78 @@ class Operation : public IUserObj
bool UpdateFollowingOperationsStatus( int nModif) ;
bool GetElevation( int nPhase, const Point3d& ptP,
const Vector3d& vtDir, double& dElev) const ;
bool GetElevation( int nPhase, const Point3d& ptP,
const Vector3d& vtDir, double& dElev, Vector3d& vtNorm) const ;
bool GetElevation( int nPhase, const Point3d& ptP,
const Vector3d& vtDir, double& dElev, INTVECTOR& vRawStmId) const ;
bool GetElevation( int nPhase, const Point3d& ptP,
const Vector3d& vtDir, double& dElev, Vector3d& vtNorm, INTVECTOR& vRawStmId) const ;
bool GetElevation( int nPhase, const Point3d& ptP1, const Point3d& ptP2,
const Vector3d& vtDir, double& dElev) const ;
bool GetElevation( int nPhase, const Point3d& ptP1, const Point3d& ptP2, const Point3d& ptP3,
const Vector3d& vtDir, double& dElev) const ;
bool GetElevation( int nPhase, const Point3d& ptP, const Vector3d& vtTool, double dRad,
const Vector3d& vtDir, double& dElev) const ;
bool GetPointUnderRaw( const Point3d& ptP, const Vector3d& vtTool, double dToolRad, double dToolRadForElev,
double dToolLen, bool bIsSaw, double dSafeZ, 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& ptS, const Point3d& ptE, const Vector3d& vtTool, double dRad, double dLen,
const Vector3d& vtDir, double& dElev) const ;
bool GetAhPointUnderRaw( const Point3d& ptP, const Vector3d& vtTool, double dToolRad, double dToolRadForElev,
double dToolLen, bool bIsSaw, double dSafeZ, const Vector3d& vtDir, double& dElev) const ;
bool GetUhPointAboveRaw( const Point3d& ptP, const Vector3d& vtTool, double dToolRad, double dToolRadForElev,
double dToolLen, bool bIsSaw, double dSafeZ, const Vector3d& vtDir, double& dElev) const ;
bool GetSignedDistFromStmRaw( int nPhase, const Point3d ptP, const Vector3d vtDir,
double& dDist, Vector3d& vtNorm) const ;
bool GetDistanceFromRawSide( int nPhase, const Point3d& ptP, const Vector3d& vtDir, 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,
double& dDist, Vector3d& vtDir) const ;
bool GetMinDistanceFromRawSide( int nPhase, const Point3d& ptP, double dExpand,
const Vector3d& vtMainDir, double dCosMaxDelta,
double& dDist, Vector3d& vtDir) const ;
bool GetDistanceFromRawBottom( int nPhase, int nPathId, double dToler, double& dRbDist) const
{ double dDummy ;
return GetDistanceFromRawBottom( nPhase, nPathId, dToler, dRbDist, dDummy) ; }
bool GetDistanceFromRawBottom( int nPhase, int nPathId, double dToler, double& dRbDist, double& dAllRbDist) const ;
bool GetDistanceFromRawBottom( int nPhase, BBox3d& b3Test, double dToler, double& dRbDist, double& dAllRbDist) const ;
bool GetRawGlobBox( int nPhase, int nPathId, double dToler, BBox3d& b3Raw) const ;
bool GetRawGlobBox( int nPhase, const BBox3d& b3Test, double dToler, BBox3d& b3Raw) const ;
bool GetCurrRawsGlobBox( BBox3d& b3Raw) const ;
bool AdjustCurveFromSurf( ICurveComposite* pCrvCompo, int nToolDir, int nFaceUse, double dToolThick) ;
bool AdjustCurveFromSurf( ICurveComposite* pCrvCompo, int nToolDir, int nFaceUse, double dToolThick, int nGrade = 3) ;
bool ApproxWithArcsIfUseful( ICurveComposite* pCompo, bool bCareTempProp = false) const ;
bool ApproxWithLines( ICurveComposite* pCompo) const ;
bool ApproxWithLines( ICurveComposite* pCompo, double dMaxLen = 0) const ;
bool VerifyArcs( ICurveComposite* pCompo, double dMaxAngCen = MAX_ANG_CEN) const ;
bool CalcAndSetBBox( int nClId) ;
bool CalcAndSetAxesBBox( void) ;
bool GetInitialAxesValues( DBLVECTOR& vAxVal) const ;
bool GetClPathInitialAxesValues( int nClPathId, DBLVECTOR& vAxVal) const ;
bool CalcMirrorByDouble( int nClId, const std::string& sUserNotes) ;
bool GetInitialAxesValues( bool bSkipClimb, DBLVECTOR& vAxVal) const ;
bool GetClPathInitialAxesValues( int nClPathId, bool bSkipClimb, DBLVECTOR& vAxVal) const ;
bool GetFinalAxesValues( bool bSkipRise, DBLVECTOR& vAxVal) const ;
bool GetClPathFinalAxesValues( int nClPathId, bool bSkipRise, DBLVECTOR& vAxVal) const ;
bool GetInitialToolDir( bool bSkipClimb, Vector3d& vtTool) const ;
bool GetClPathInitialToolDir( int nClPathId, bool bSkipClimb, Vector3d& vtTool) const ;
bool GetFinalToolDir( bool bSkipRise, Vector3d& vtTool) const ;
bool GetClPathFinalToolDir( int nClPathId, bool bSkipRise, Vector3d& vtTool) const ;
const CamData* GetInitialCamData( bool bSkipClimb) const ;
const CamData* GetClPathInitialCamData( int nClPathId, bool bSkipClimb) const ;
const CamData* GetFinalCamData( bool bSkipRise) const ;
const CamData* GetClPathFinalCamData( int nClPathId, bool bSkipRise) const ;
std::string ExtractInfo( const std::string& sNotes, const std::string& sKey) const ;
std::string ExtractHint( const std::string& sNotes) const ;
bool CalculateAxesValues( const std::string& sHint, bool bSolChExact = false) ;
bool SetBlockedRotAxis( const std::string& sBlockedAxis) const ;
bool CalculateAxesValues( const std::string& sHint, bool bRotContOnNext = true, bool bSolChExact = false) ;
bool CalculateClPathCenterAxesValues( int nClPathId, int nLinAxes, int nRotAxes, double dRot1W,
bool bMaxDeltaR2OnFirst, bool bRotContOnNext, double dAngDeltaMinForHome,
const DBLVECTOR& vAxRotHome, DBLVECTOR& vAxRotPrec) ;
bool CalculateClPathAxesValues( int nClPathId, int nLinAxes, int nRotAxes, double dRot1W,
double dAngDeltaMinForHome, const DBLVECTOR& vAxRotHome, DBLVECTOR& vAxRotPrec, int& nOutStrC) ;
bool bMaxDeltaR2OnFirst, bool bRotContOnNext, double dAngDeltaMinForHome,
const DBLVECTOR& vAxRotHome, DBLVECTOR& vAxRotPrec, int& nOutStrC) ;
bool CalculateClPathRobotAxesValues( int nClPathId, int nLinAxes, int nRotAxes, double dRot1W,
bool bMaxDeltaR2OnFirst, bool bRotContOnNext, double dAngDeltaMinForHome,
const DBLVECTOR& vAxRotHome, DBLVECTOR& vAxRotPrec) ;
bool AdjustStartEndMovements( bool bVerifyPreviousLink = true) ;
bool AdjustOneStartMovement( int nClPathId, int nPrevClPathId, Operation* pPrevOp, const DBLVECTOR& vAxPrev, bool bMaxZ) ;
bool ToolChangeNeeded( const Operation& Op1, const Operation& Op2) const ;
@@ -110,17 +150,28 @@ class Operation : public IUserObj
bool AddSpecialRise( const DBLVECTOR& vAxVal, bool bOk = true, int nClPathId = GDB_ID_NULL, int nFlag = 0) ;
bool RemoveRise( int nClPathId = GDB_ID_NULL) ;
bool AddHome( void) ;
bool RemoveClimbRiseHome( void) ;
bool AddRobotClimb( int nEntId, double dDeltaZ) ;
bool CalcRobotAxesAbovePos( const Point3d& ptP, const Vector3d& vtT, const Vector3d& vtA, double dDeltaZ,
DBLVECTOR& vAx, double* pdNewDeltaZ = nullptr) const ;
bool CalcDeltaZForHeadRotation( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, double& dDeltaZ) const ;
bool GetExtraZ( double dSafeZ, double& dExtraZ, double& dMaxAngV) const ;
bool GetExtraZ( const DBLVECTOR& vAx1, const Vector3d& vtTool1,
const DBLVECTOR& vAx2, const Vector3d& vtTool2,
double dHomeZ, double& dExtraZ) const ;
bool SpecialGetMaxZ( const DBLVECTOR& vAx1, const Vector3d& vtTool1,
const DBLVECTOR& vAx2, const Vector3d& vtTool2,
double& dMaxZ) const ;
bool GetRotationAtZmax( void) const ;
bool ForcedZmax( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd) const ;
bool ForcedZmax( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, const BBox3d& b3Raws) const ;
int GetUserNotesZmax( void) const ;
bool GetZHomeDown( void) const ;
bool TestCollisionAvoid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd) const ;
bool SpecialMoveZup( DBLVECTOR& vAx, Vector3d& vtTool, int& nFlag, int& nFlag2, bool& bModif) ;
int SpecialTestCollisionAvoid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd) const ;
bool SpecialMoveZup( DBLVECTOR& vAx, Vector3d& vtTool, int& nFlag, int& nFlag2, bool& bModif) ;
bool SpecialMoveRapid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, DBLVECTOR& vAxNew, bool& bModif) ;
bool GetAggrBottomData( const std::string& sHead, AggrBottom& agbData) const ;
bool IsAggrBottom( const std::string& sHead) const ;
protected :
int m_nOwnerId ; // identificativo dell'oggetto geometrico possessore
@@ -136,6 +187,7 @@ class Operation : public IUserObj
bool SetCorrAuxDir( const Vector3d& vtDir) ;
bool SetFeed( double dFeed) ;
bool SetFlag( int nFlag) ;
bool SetFlagOnLastMove( int nFlag) ;
bool SetFlag2( int nFlag2) ;
bool SetIndex( int nIndex) ;
bool GetCurrPos( Point3d& ptCurr) const
@@ -182,3 +234,5 @@ inline Operation* GetOperation( IUserObj* pUserObj)
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} ;
// risultato di SpecialTestCollisionAvoid
enum { SCAV_ERROR = -1, SCAV_COLLIDE = 0, SCAV_AVOID = 1, SCAV_TOTEST = 2};
+12
View File
@@ -82,6 +82,18 @@ Operation::SetFlag( int nFlag)
return true ;
}
//----------------------------------------------------------------------------
bool
Operation::SetFlagOnLastMove( int nFlag)
{
int nLastEntId = m_pGeomDB->GetLastInGroup( m_nPathId) ;
CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nLastEntId)) ;
if ( pCamData == nullptr)
return false ;
pCamData->SetFlag( nFlag) ;
return true ;
}
//----------------------------------------------------------------------------
bool
Operation::SetFlag2( int nFlag2)
+139 -133
View File
@@ -20,143 +20,147 @@
static const int MAX_AXES = 7 ;
// Variabili
static const std::string GLOB_VAR = "EMT" ; // tavola variabili globali
static const std::string GVAR_VER = ".VER" ; // (string) versione della Dll
static const std::string GVAR_ERR = ".ERR" ; // (int) codice di errore (0=ok)
static const std::string GVAR_USETO1 = ".USETO1" ; // (bool) flag per utilizzo origine tavola
static const std::string GVAR_MODAL = ".MODAL" ; // (bool) flag per emissione modale dei valori
static const std::string GVAR_INCHES = ".INCHES" ; // (bool) flag unità di misura (true=inches, false=mm)
static const std::string GVAR_SPLITARCS = ".SPLITARCS" ; // (int) flag spezzatura archi (0=mai, 1=piani generici, 2=piani diversi da XY, 3=sempre)
static const std::string GVAR_NUM = ".NUM" ; // (bool) flag numerazione
static const std::string GVAR_NUMTOK = ".Nt" ; // (string) token per numerazione
static const std::string GVAR_LINENBR = ".LINENBR" ; // (int) numero progressivo di linea
static const std::string GVAR_LINEINC = ".LINEINC" ; // (int) incremento per numero di linea
static const std::string GVAR_F = ".F" ; // (num) valore della feed
static const std::string GVAR_FT = ".Ft" ; // (string) token per feed
static const std::string GVAR_S = ".S" ; // (num) valore della speed
static const std::string GVAR_ST = ".St" ; // (string) token per speed
static const std::string GVAR_MACHNAME = ".MACHNAME" ; // (string) nome macchina
static const std::string GVAR_FILE = ".FILE" ; // (string) path file di output
static const std::string GVAR_INFO = ".INFO" ; // (string) informazioni iniziali
static const std::string GVAR_SETUP = ".SETUP" ; // (bool) flag definizione setup
static const std::string GVAR_DISPID = ".DISPID" ; // (int) identificativo disposizione
static const std::string GVAR_DISPIND = ".DISPIND" ; // (int) indice disposizione
static const std::string GVAR_PHASE = ".PHASE" ; // (int) indice fase
static const std::string GVAR_EMPTY = ".EMPTY" ; // (bool) flag disposizione passiva
static const std::string GVAR_SBH = ".SBH" ; // (bool) flag disposizione con operazioni manuali
static const std::string GVAR_TABNAME = ".TABNAME" ; // (string) nome tavola
static const std::string GVAR_TABORI1 = ".TABORI1" ; // (Point3d) prima origine di tavola
static const std::string GVAR_FIXID = ".FIXID" ; // (int) identificativo bloccaggio (fixture)
static const std::string GVAR_FIXIND = ".FIXIND" ; // (int) indice bloccaggio
static const std::string GVAR_FIXNAME = ".FIXNAME" ; // (string) nome bloccaggio
static const std::string GVAR_FIXPOS = ".FIXPOS" ; // (Point3d) posizione bloccaggio
static const std::string GVAR_FIXANG = ".FIXANG" ; // (num) angolo di rotazione bloccaggio
static const std::string GVAR_FIXMOB = ".FIXMOB" ; // (num) movimento eventuale parte mobile del bloccaggio
static const std::string GVAR_RAWID = ".RAWID" ; // (int) identificativo grezzo
static const std::string GVAR_RAWIND = ".RAWIND" ; // (int) indice movimento del grezzo
static const std::string GVAR_RAWTYPE = ".RAWTYPE" ; // (int) tipo di movimento del grezzo
static const std::string GVAR_RAWPOS = ".RAWPOS" ; // (Point3d) posizione di movimento del grezzo
static const std::string GVAR_RAWFLAG = ".RAWFLAG" ; // (int) flag per movimento del grezzo
static const std::string GVAR_TOOL = ".TOOL" ; // (string) nome utensile
static const std::string GVAR_HEAD = ".HEAD" ; // (string) nome testa
static const std::string GVAR_EXIT = ".EXIT" ; // (int) indice uscita
static const std::string GVAR_TCPOS = ".TCPOS" ; // (string) eventuale posizione utensile nel TC
static const std::string GVAR_TCOMP = ".TCOMP" ; // (int) numero correttore utensile
static const std::string GVAR_TDIAM = ".TDIAM" ; // (num) diametro utensile
static const std::string GVAR_TTOTDIAM = ".TTOTDIAM" ; // (num) diametro totale utensile
static const std::string GVAR_TLEN = ".TLEN" ; // (num) lunghezza utensile
static const std::string GVAR_TTOTLEN = ".TTOTLEN" ; // (num) lunghezza totale utensile
static const std::string GVAR_TUSED = ".TUSED" ; // (bool) flag per indicare che l'utensile attrezzato è anche utilizzato
static const std::string GVAR_SMAX = ".SMAX" ; // (num) massima speed utensile
static const std::string GVAR_FIRST = ".FIRST" ; // (bool) flag per primo utensile
static const std::string GVAR_NEXTTOOL = ".NEXTTOOL" ; // (string) nome del prossimo utensile
static const std::string GVAR_NEXTHEAD = ".NEXTHEAD" ; // (string) nome testa del prossimo utensile
static const std::string GVAR_NEXTEXIT = ".NEXTEXIT" ; // (int) indice uscita su testa del prox utensile
static const std::string GVAR_NEXTTCPOS = ".NEXTTCPOS" ; // (string) eventuale posizione del prox utensile nel TC
static const std::string GVAR_MCHID = ".MCHID" ; // (int) identificativo lavorazione
static const std::string GVAR_MCHIND = ".MCHIND" ; // (int) indice lavorazione
static const std::string GVAR_MMIN = ".MMIN" ; // (Point3d) punto minimo di ingombro della lavorazione
static const std::string GVAR_MMAX = ".MMAX" ; // (Point3d) punto massimo di ingombro della lavorazione
static const std::string GVAR_VER = ".VER" ; // (string) versione della Dll
static const std::string GVAR_ERR = ".ERR" ; // (int) codice di errore (0=ok)
static const std::string GVAR_USETO1 = ".USETO1" ; // (bool) flag per utilizzo origine tavola
static const std::string GVAR_MODAL = ".MODAL" ; // (bool) flag per emissione modale dei valori
static const std::string GVAR_INCHES = ".INCHES" ; // (bool) flag unità di misura (true=inches, false=mm)
static const std::string GVAR_SPLITARCS = ".SPLITARCS" ; // (int) flag spezzatura archi (0=mai, 1=piani generici, 2=piani diversi da XY, 3=sempre)
static const std::string GVAR_NUM = ".NUM" ; // (bool) flag numerazione
static const std::string GVAR_NUMTOK = ".Nt" ; // (string) token per numerazione
static const std::string GVAR_LINENBR = ".LINENBR" ; // (int) numero progressivo di linea
static const std::string GVAR_LINEINC = ".LINEINC" ; // (int) incremento per numero di linea
static const std::string GVAR_F = ".F" ; // (num) valore della feed
static const std::string GVAR_FT = ".Ft" ; // (string) token per feed
static const std::string GVAR_S = ".S" ; // (num) valore della speed
static const std::string GVAR_ST = ".St" ; // (string) token per speed
static const std::string GVAR_MACHNAME = ".MACHNAME" ; // (string) nome macchina
static const std::string GVAR_FILE = ".FILE" ; // (string) path file di output
static const std::string GVAR_INFO = ".INFO" ; // (string) informazioni iniziali
static const std::string GVAR_SETUP = ".SETUP" ; // (bool) flag definizione setup
static const std::string GVAR_DISPID = ".DISPID" ; // (int) identificativo disposizione
static const std::string GVAR_DISPIND = ".DISPIND" ; // (int) indice disposizione
static const std::string GVAR_PHASE = ".PHASE" ; // (int) indice fase
static const std::string GVAR_EMPTY = ".EMPTY" ; // (bool) flag disposizione passiva
static const std::string GVAR_SBH = ".SBH" ; // (bool) flag disposizione con operazioni manuali
static const std::string GVAR_TABNAME = ".TABNAME" ; // (string) nome tavola
static const std::string GVAR_TABORI1 = ".TABORI1" ; // (Point3d) prima origine di tavola
static const std::string GVAR_FIXID = ".FIXID" ; // (int) identificativo bloccaggio (fixture)
static const std::string GVAR_FIXIND = ".FIXIND" ; // (int) indice bloccaggio
static const std::string GVAR_FIXNAME = ".FIXNAME" ; // (string) nome bloccaggio
static const std::string GVAR_FIXPOS = ".FIXPOS" ; // (Point3d) posizione bloccaggio
static const std::string GVAR_FIXANG = ".FIXANG" ; // (num) angolo di rotazione bloccaggio
static const std::string GVAR_FIXMOB = ".FIXMOB" ; // (num) movimento eventuale parte mobile del bloccaggio
static const std::string GVAR_RAWID = ".RAWID" ; // (int) identificativo grezzo
static const std::string GVAR_RAWIND = ".RAWIND" ; // (int) indice movimento del grezzo
static const std::string GVAR_RAWTYPE = ".RAWTYPE" ; // (int) tipo di movimento del grezzo
static const std::string GVAR_RAWPOS = ".RAWPOS" ; // (Point3d) posizione di movimento del grezzo
static const std::string GVAR_RAWFLAG = ".RAWFLAG" ; // (int) flag per movimento del grezzo
static const std::string GVAR_TOOL = ".TOOL" ; // (string) nome utensile
static const std::string GVAR_HEAD = ".HEAD" ; // (string) nome testa
static const std::string GVAR_EXIT = ".EXIT" ; // (int) indice uscita
static const std::string GVAR_TCPOS = ".TCPOS" ; // (string) eventuale posizione utensile nel TC
static const std::string GVAR_TTYPE = ".TTYPE" ; // (int) tipo utensile
static const std::string GVAR_TCOMP = ".TCOMP" ; // (int) numero correttore utensile
static const std::string GVAR_TDIAM = ".TDIAM" ; // (num) diametro utensile
static const std::string GVAR_TTOTDIAM = ".TTOTDIAM" ; // (num) diametro totale utensile
static const std::string GVAR_TLEN = ".TLEN" ; // (num) lunghezza utensile
static const std::string GVAR_TTOTLEN = ".TTOTLEN" ; // (num) lunghezza totale utensile
static const std::string GVAR_TDIST = ".TDIST" ; // (num) distanza utensile (per mortasatrice/sega a catena)
static const std::string GVAR_TUSED = ".TUSED" ; // (bool) flag per indicare che l'utensile attrezzato è anche utilizzato
static const std::string GVAR_SMAX = ".SMAX" ; // (num) massima speed utensile
static const std::string GVAR_FIRST = ".FIRST" ; // (bool) flag per primo utensile
static const std::string GVAR_NEXTTOOL = ".NEXTTOOL" ; // (string) nome del prossimo utensile
static const std::string GVAR_NEXTHEAD = ".NEXTHEAD" ; // (string) nome testa del prossimo utensile
static const std::string GVAR_NEXTEXIT = ".NEXTEXIT" ; // (int) indice uscita su testa del prox utensile
static const std::string GVAR_NEXTTCPOS = ".NEXTTCPOS" ; // (string) eventuale posizione del prox utensile nel TC
static const std::string GVAR_MCHID = ".MCHID" ; // (int) identificativo lavorazione
static const std::string GVAR_MCHIND = ".MCHIND" ; // (int) indice lavorazione
static const std::string GVAR_MMIN = ".MMIN" ; // (Point3d) punto minimo di ingombro della lavorazione
static const std::string GVAR_MMAX = ".MMAX" ; // (Point3d) punto massimo di ingombro della lavorazione
static const std::string GVAR_MAXMIN = ".MAXMIN" ; // (double/s) minimo di ingombro degli assi della lavorazione
static const std::string GVAR_MAXMAX = ".MAXMAX" ; // (double/s) massimo di ingombro degli assi della lavorazione
static const std::string GVAR_PATHID = ".PATHID" ; // (int) identificativo percorso di lavorazione
static const std::string GVAR_PATHIND = ".PATHIND" ; // (int) indice percorso di lavorazione
static const std::string GVAR_START = ".START" ; // (Point3d) punto iniziale del percorso originale
static const std::string GVAR_END = ".END" ; // (Point3d) punto finale del percorso originale
static const std::string GVAR_EXTR = ".EXTR" ; // (Vector3d)versore estrusione
static const std::string GVAR_PMIN = ".PMIN" ; // (Point3d) punto minimo di ingombro del percorso di lavorazione
static const std::string GVAR_PMAX = ".PMAX" ; // (Point3d) punto massimo di ingombro del percorso di lavorazione
static const std::string GVAR_PATHID = ".PATHID" ; // (int) identificativo percorso di lavorazione
static const std::string GVAR_PATHIND = ".PATHIND" ; // (int) indice percorso di lavorazione
static const std::string GVAR_START = ".START" ; // (Point3d) punto iniziale del percorso originale
static const std::string GVAR_END = ".END" ; // (Point3d) punto finale del percorso originale
static const std::string GVAR_EXTR = ".EXTR" ; // (Vector3d) versore estrusione
static const std::string GVAR_PMIN = ".PMIN" ; // (Point3d) punto minimo di ingombro del percorso di lavorazione
static const std::string GVAR_PMAX = ".PMAX" ; // (Point3d) punto massimo di ingombro del percorso di lavorazione
static const std::string GVAR_PAXMIN = ".PAXMIN" ; // (double/s) minimo di ingombro degli assi del percorso di lavorazione
static const std::string GVAR_PAXMAX = ".PAXMAX" ; // (double/s) massimo di ingombro degli assi del percorso di lavorazione
static const std::string GVAR_ELEV = ".ELEV" ; // (double) massima elevazione
static const std::string GVAR_AUXTOT = ".AUXTOT" ; // (int) numero totale dati ausiliari inizio/fine percorso di lavorazione
static const std::string GVAR_AUXIND = ".AUXIND" ; // (int) indice dato ausiliario inizio/fine percorso di lavorazione
static const std::string GVAR_AUX = ".AUX" ; // (string) dato ausiliario inizio/fine percorso di lavorazione
static const std::string GVAR_MOVEID = ".MOVEID" ; // (int) identificativo movimento
static const std::string GVAR_MOVEIND = ".MOVEIND" ; // (int) indice movimento
static const std::string GVAR_MOVE = ".MOVE" ; // (int) tipo di movimento (0,1,2,3)
static const std::string GVAR_L1 = ".L1" ; // (num) valore del primo asse lineare
static const std::string GVAR_L2 = ".L2" ; // (num) valore del secondo asse lineare
static const std::string GVAR_L3 = ".L3" ; // (num) valore del terzo asse lineare
static const std::string GVAR_R1 = ".R1" ; // (num) valore del primo asse rotante
static const std::string GVAR_R2 = ".R2" ; // (num) valore del secondo asse rotante
static const std::string GVAR_R3 = ".R3" ; // (num) valore del terzo asse rotante
static const std::string GVAR_R4 = ".R4" ; // (num) valore del quarto asse rotante
static const std::string GVAR_C1 = ".C1" ; // (num) valore del primo asse lineare per centro arco
static const std::string GVAR_C2 = ".C2" ; // (num) valore del secondo asse lineare per centro arco
static const std::string GVAR_C3 = ".C3" ; // (num) valore del terzo asse lineare per centro arco
static const std::string GVAR_M1 = ".M1" ; // (num) valore del primo asse lineare per punto medio arco
static const std::string GVAR_M2 = ".M2" ; // (num) valore del secondo asse lineare per punto medio arco
static const std::string GVAR_M3 = ".M3" ; // (num) valore del terzo asse lineare per punto medio arco
static const std::string GVAR_RR = ".RR" ; // (num) valore raggio per arco
static const std::string GVAR_AC = ".AC" ; // (num) valore angolo al centro per arco
static const std::string GVAR_L1P = ".L1p" ; // (num) valore precedente del primo asse lineare
static const std::string GVAR_L2P = ".L2p" ; // (num) valore precedente del secondo asse lineare
static const std::string GVAR_L3P = ".L3p" ; // (num) valore precedente del terzo asse lineare
static const std::string GVAR_R1P = ".R1p" ; // (num) valore precedente del primo asse rotante
static const std::string GVAR_R2P = ".R2p" ; // (num) valore precedente del secondo asse rotante
static const std::string GVAR_R3P = ".R3p" ; // (num) valore precedente del terzo asse rotante
static const std::string GVAR_R4P = ".R4p" ; // (num) valore precedente del quarto asse rotante
static const std::string GVAR_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
static const std::string GVAR_R1T = ".R1t" ; // (string) token del primo asse rotante
static const std::string GVAR_R2T = ".R2t" ; // (string) token del secondo asse rotante
static const std::string GVAR_R3T = ".R3t" ; // (string) token del terzo asse rotante
static const std::string GVAR_R4T = ".R4t" ; // (string) token del quarto asse rotante
static const std::string GVAR_C1T = ".C1t" ; // (string) token del primo asse lineare per centro arco
static const std::string GVAR_C2T = ".C2t" ; // (string) token del secondo asse lineare per centro arco
static const std::string GVAR_C3T = ".C3t" ; // (string) token del terzo asse lineare per centro arco
static const std::string GVAR_M1T = ".M1t" ; // (string) token del primo asse lineare per punto medio arco
static const std::string GVAR_M2T = ".M2t" ; // (string) token del secondo asse lineare per punto medio arco
static const std::string GVAR_M3T = ".M3t" ; // (string) token del terzo asse lineare per punto medio arco
static const std::string GVAR_RRT = ".RRt" ; // (string) token del raggio per arco
static const std::string GVAR_L1N = ".L1n" ; // (string) nome del primo asse lineare
static const std::string GVAR_L2N = ".L2n" ; // (string) nome del secondo asse lineare
static const std::string GVAR_L3N = ".L3n" ; // (string) nome del terzo asse lineare
static const std::string GVAR_R1N = ".R1n" ; // (string) nome del primo asse rotante
static const std::string GVAR_R2N = ".R2n" ; // (string) nome del secondo asse rotante
static const std::string GVAR_R3N = ".R3n" ; // (string) nome del terzo asse rotante
static const std::string GVAR_R4N = ".R4n" ; // (string) nome del quarto asse rotante
static const std::string GVAR_MASK = ".MASK" ; // (int) mask associato ai movimenti in rapido
static const std::string GVAR_FLAG = ".FLAG" ; // (int) flag associato ad ogni movimento
static const std::string GVAR_FLAG2 = ".FLAG2" ; // (int) secondo flag associato ad ogni movimento
static const std::string GVAR_INDEX = ".IDX" ; // (int) indice associato ad ogni movimento
static const std::string GVAR_TDIR = ".TDIR" ; // (Vector3d)versore utensile nel riferimento pezzo
static const std::string GVAR_CDIR = ".CDIR" ; // (Vector3d)versore correzione nel riferimento pezzo
static const std::string GVAR_ADIR = ".ADIR" ; // (Vector3d)versore ausiliario nel riferimento pezzo
static const std::string GVAR_ENABAXES = ".EnabAxes" ; // (bool) flag abilitazione assi attivi per simulazione
static const std::string GVAR_SHOWAXES = ".ShowAxes" ; // (bool) flag visualizzazione assi attivi per simulazione
static const std::string GVAR_AUXAXES = ".AuxAxes" ; // (int) numero assi ausiliari per simulazione
static const std::string GVAR_AN = ".AN" ; // (num) valore del N-esimo asse ausiliario per simulazione
static const std::string GVAR_ANN = ".ANn" ; // (string) nome del N-esimo asse ausiliario per simulazione
static const std::string GVAR_VMILL = ".VMILL" ; // (int/s) identificativi Zmap attivi per Virtual Milling
static const std::string GVAR_CODET = ".CODET" ; // (int/s) identificativi Zmap attivi per Collision Detection
static const std::string GVAR_SIM1ST = ".SIM1ST" ; // (bool) flag inizio simulazione
static const std::string GVAR_SIMSTEP = ".SIMSTEP" ; // (num) step di movimento durante la simulazione
static const std::string GVAR_SIMUISTAT = ".SIMUISTAT" ; // (num) stato simulazione imposto da utente
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_ELEV = ".ELEV" ; // (double) massima elevazione
static const std::string GVAR_AUXTOT = ".AUXTOT" ; // (int) numero totale dati ausiliari inizio/fine percorso di lavorazione
static const std::string GVAR_AUXIND = ".AUXIND" ; // (int) indice dato ausiliario inizio/fine percorso di lavorazione
static const std::string GVAR_AUX = ".AUX" ; // (string) dato ausiliario inizio/fine percorso di lavorazione
static const std::string GVAR_MOVEID = ".MOVEID" ; // (int) identificativo movimento
static const std::string GVAR_MOVEIND = ".MOVEIND" ; // (int) indice movimento
static const std::string GVAR_MOVE = ".MOVE" ; // (int) tipo di movimento (0,1,2,3)
static const std::string GVAR_L1 = ".L1" ; // (num) valore del primo asse lineare
static const std::string GVAR_L2 = ".L2" ; // (num) valore del secondo asse lineare
static const std::string GVAR_L3 = ".L3" ; // (num) valore del terzo asse lineare
static const std::string GVAR_R1 = ".R1" ; // (num) valore del primo asse rotante
static const std::string GVAR_R2 = ".R2" ; // (num) valore del secondo asse rotante
static const std::string GVAR_R3 = ".R3" ; // (num) valore del terzo asse rotante
static const std::string GVAR_R4 = ".R4" ; // (num) valore del quarto asse rotante
static const std::string GVAR_C1 = ".C1" ; // (num) valore del primo asse lineare per centro arco
static const std::string GVAR_C2 = ".C2" ; // (num) valore del secondo asse lineare per centro arco
static const std::string GVAR_C3 = ".C3" ; // (num) valore del terzo asse lineare per centro arco
static const std::string GVAR_M1 = ".M1" ; // (num) valore del primo asse lineare per punto medio arco
static const std::string GVAR_M2 = ".M2" ; // (num) valore del secondo asse lineare per punto medio arco
static const std::string GVAR_M3 = ".M3" ; // (num) valore del terzo asse lineare per punto medio arco
static const std::string GVAR_RR = ".RR" ; // (num) valore raggio per arco
static const std::string GVAR_AC = ".AC" ; // (num) valore angolo al centro per arco
static const std::string GVAR_L1P = ".L1p" ; // (num) valore precedente del primo asse lineare
static const std::string GVAR_L2P = ".L2p" ; // (num) valore precedente del secondo asse lineare
static const std::string GVAR_L3P = ".L3p" ; // (num) valore precedente del terzo asse lineare
static const std::string GVAR_R1P = ".R1p" ; // (num) valore precedente del primo asse rotante
static const std::string GVAR_R2P = ".R2p" ; // (num) valore precedente del secondo asse rotante
static const std::string GVAR_R3P = ".R3p" ; // (num) valore precedente del terzo asse rotante
static const std::string GVAR_R4P = ".R4p" ; // (num) valore precedente del quarto asse rotante
static const std::string GVAR_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
static const std::string GVAR_R1T = ".R1t" ; // (string) token del primo asse rotante
static const std::string GVAR_R2T = ".R2t" ; // (string) token del secondo asse rotante
static const std::string GVAR_R3T = ".R3t" ; // (string) token del terzo asse rotante
static const std::string GVAR_R4T = ".R4t" ; // (string) token del quarto asse rotante
static const std::string GVAR_C1T = ".C1t" ; // (string) token del primo asse lineare per centro arco
static const std::string GVAR_C2T = ".C2t" ; // (string) token del secondo asse lineare per centro arco
static const std::string GVAR_C3T = ".C3t" ; // (string) token del terzo asse lineare per centro arco
static const std::string GVAR_M1T = ".M1t" ; // (string) token del primo asse lineare per punto medio arco
static const std::string GVAR_M2T = ".M2t" ; // (string) token del secondo asse lineare per punto medio arco
static const std::string GVAR_M3T = ".M3t" ; // (string) token del terzo asse lineare per punto medio arco
static const std::string GVAR_RRT = ".RRt" ; // (string) token del raggio per arco
static const std::string GVAR_L1N = ".L1n" ; // (string) nome del primo asse lineare
static const std::string GVAR_L2N = ".L2n" ; // (string) nome del secondo asse lineare
static const std::string GVAR_L3N = ".L3n" ; // (string) nome del terzo asse lineare
static const std::string GVAR_R1N = ".R1n" ; // (string) nome del primo asse rotante
static const std::string GVAR_R2N = ".R2n" ; // (string) nome del secondo asse rotante
static const std::string GVAR_R3N = ".R3n" ; // (string) nome del terzo asse rotante
static const std::string GVAR_R4N = ".R4n" ; // (string) nome del quarto asse rotante
static const std::string GVAR_MASK = ".MASK" ; // (int) mask associato ai movimenti in rapido
static const std::string GVAR_FLAG = ".FLAG" ; // (int) flag associato ad ogni movimento
static const std::string GVAR_FLAG2 = ".FLAG2" ; // (int) secondo flag associato ad ogni movimento
static const std::string GVAR_INDEX = ".IDX" ; // (int) indice associato ad ogni movimento
static const std::string GVAR_TDIR = ".TDIR" ; // (Vector3d) versore utensile nel riferimento pezzo
static const std::string GVAR_CDIR = ".CDIR" ; // (Vector3d) versore correzione nel riferimento pezzo
static const std::string GVAR_ADIR = ".ADIR" ; // (Vector3d) versore ausiliario nel riferimento pezzo
static const std::string GVAR_TDIRP = ".TDIRp" ; // (Vector3d) precedente versore utensile nel riferimento pezzo
static const std::string GVAR_ENABAXES = ".EnabAxes" ; // (bool) flag abilitazione assi attivi per simulazione
static const std::string GVAR_SHOWAXES = ".ShowAxes" ; // (bool) flag visualizzazione assi attivi per simulazione
static const std::string GVAR_AUXAXES = ".AuxAxes" ; // (int) numero assi ausiliari per simulazione
static const std::string GVAR_AN = ".AN" ; // (num) valore del N-esimo asse ausiliario per simulazione
static const std::string GVAR_ANN = ".ANn" ; // (string) nome del N-esimo asse ausiliario per simulazione
static const std::string GVAR_ANM = ".ANm" ; // (string) asse master del N-esimo asse ausiliario per simulazione
static const std::string GVAR_VMILL = ".VMILL" ; // (int/s) identificativi Zmap attivi per Virtual Milling
static const std::string GVAR_CODET = ".CODET" ; // (int/s) identificativi Zmap attivi per Collision Detection
static const std::string GVAR_SIM1ST = ".SIM1ST" ; // (bool) flag inizio simulazione
static const std::string GVAR_SIMSTEP = ".SIMSTEP" ; // (num) step di movimento durante la simulazione
static const std::string GVAR_SIMUISTAT = ".SIMUISTAT" ; // (num) stato simulazione imposto da utente
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
// Funzioni generazione
static const std::string ON_START = "OnStart" ;
static const std::string ON_END = "OnEnd" ;
@@ -202,6 +206,8 @@ static const std::string ON_ESTIM_RAPID = "OnEstimRapid" ;
static const std::string ON_ESTIM_LINEAR = "OnEstimLinear" ;
static const std::string ON_ESTIM_ARC = "OnEstimArc" ;
// Funzioni simulazione
static const std::string ON_SIMUL_INIT = "OnSimulInit" ;
static const std::string ON_SIMUL_EXIT = "OnSimulExit" ;
static const std::string ON_SIMUL_START = "OnSimulStart" ;
static const std::string ON_SIMUL_END = "OnSimulEnd" ;
static const std::string ON_SIMUL_DISPOSITION_STARTING = "OnSimulDispositionStarting" ;
+12828 -2202
View File
File diff suppressed because it is too large Load Diff
+257 -49
View File
@@ -17,8 +17,11 @@
#include "PocketingData.h"
#include "ToolData.h"
#include "/EgtDev/Include/EGkCurveComposite.h"
#include "/EgtDev/Include/EGkCurveLine.h"
#include "/EgtDev/Include/EgtNumUtils.h"
#include "/EgtDev/Include/EgkSurfFlatRegion.h"
#include "/EgtDev/Include/EGkSurfFlatRegion.h"
#include "/EgtDev/Include/EGkSurfTriMesh.h"
#include "/EgtDev/Include/EGkCurveArc.h"
//----------------------------------------------------------------------------
class Pocketing : public Machining
@@ -66,58 +69,248 @@ class Pocketing : public Machining
Pocketing( void) ;
private :
// Debug functions ----
void DrawLoopsSurf( const ISurfFlatRegion* pSfr, bool bWithSurf = true, Color Col = Color( 0., 0., 1., 0.45),
bool bAlphaCoverage = false) ;
void DrawSimpleSurf( const ISurfFlatRegion* pSrf, Color Col = Color( 0., 0., 1., 0.45)) ;
void DrawVectorCurves( const ICRVCOMPOPOVECTOR& vCrv) ;
void DrawSimpleCurve( const ICurveComposite* pCrv, bool bUniform = false, Color Col = WHITE) ;
void DrawSimpleTriMesh( const ISurfTriMesh* pStm, Color Col = Color( 0., 0., 0., 1.)) ;
void DrawSimplePoint( const Point3d& pT, Color Col = WHITE) ;
void DrawSimpleVector( const Vector3d& vt, Point3d ptPos = ORIG, Color Col = WHITE) ;
// --------------------
bool VerifyGeometry( SelData Id, int& nSubs, int& nType) ;
bool GetCurves( SelData Id, ICURVEPLIST& lstPC) ;
bool SetCurveAllTempProp( int nCrvId, ICurve* pCurve) ;
bool GetCurvesAndPartialVolume( SelData Id, ICURVEPLIST& lstPC, ISurfTriMesh* pStmTmp, Vector3d& vtN) ;
bool GetForcedClosed( void) ;
bool SetCurveAllTempProp( int nCrvId, bool bForcedClose, ICurve* pCurve, bool* pbSomeOpen = nullptr) ;
bool ResetCurveAllTempProp( ICurve* pCurve) ;
bool Chain( int nGrpDestId) ;
bool ProcessPath( int nPathId, int nPvId, int nClId) ;
bool CalcRegionElevation( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dRad, double& dElev) const ;
bool CalcRegionElevation( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dRad, double dLen, double& dElev) const ;
bool VerifyPathFromBottom( const ICurveComposite* pCompo, const Vector3d& vtTool) ;
bool GeneratePocketingPv( int nPathId, const ICurveComposite* pCompo) ;
bool AddZigZag( const ICurveComposite* pCompo, const Vector3d& vtTool, const Vector3d& vtExtr,
double dDepth, double dElev, double dOkStep, bool bSplitArcs) ;
bool CalcZigZag( const ICurveComposite* pOffs, ICRVCOMPOPOVECTOR& vpCrvs) ;
bool AddOneWay( const ICurveComposite* pCompo, const Vector3d& vtTool, const Vector3d& vtExtr,
double dDepth, double dElev, double dOkStep, bool bSplitArcs) ;
bool AddSpiralIn( const ICurveComposite* pCompo, const Vector3d& vtTool, const Vector3d& vtExtr,
double dDepth, double dElev, double dOkStep, bool bSplitArcs, bool bMidOpen,
const Point3d& ptMidOpen, const Vector3d& vtMidOut) ;
bool AddSpiralOut( const ICurveComposite* pCompo, const Vector3d& vtTool, const Vector3d& vtExtr,
double dDepth, double dElev, double dOkStep, bool bSplitArcs) ;
bool CalcSpiral( const ICurveComposite* pCompo, int nReg, bool bSplitArcs,
ICurveComposite* pMCrv, ICurveComposite* pRCrv) ;
bool RemoveUncutRegions( const ISurfFlatRegion * pCutRegion, ICURVEPOVECTOR& vOffs) ;
bool FindCurveForPathAdd( const ICurve * pResidualCrv, const ICRVCOMPOPOVECTOR& vOffs, size_t& nIdxMin, Point3d& ptMinDist,
double& dMinDistPar) ;
bool ComputeAdditionalPath( const Point3d ptStart, Point3d ptNew, bool bUsePtEnd, ICurveComposite * pAddPath,
const ICurve * pResidualCrv, const ICurve * pCrvBound, ISurfFlatRegion * pNewCutRegion) ;
bool AdditionalPathExternalCentroid( const Point3d ptStart, ICurveComposite * pAddPath, ICurveComposite * pResidualCrv,
const ICurve * pCrvBound, ISurfFlatRegion * pNewCutRegion) ;
bool CalcBoundedLink( const Point3d& ptStart, const Point3d& ptEnd, const ICurve* pCrvBound,
bool GeneratePocketingPv( int nPathId, const ISurfTriMesh* pStm_PartVolume) ;
bool CheckSimpleOverlap( const ICurve* pCrv, const ICurveComposite* pCrvOri, int& nStat, double dToll) ;
bool CalcDepth( const int nId, const Vector3d& vtExtr, double dThick, double& dDepth) ;
bool ChainCurveArray( ICURVEPOVECTOR& vpCrvs, ICRVCOMPOPOVECTOR& vCrvCompo) ;
bool CreateStmForIntersection( ISurfTriMesh* pStm, ICRVCOMPOPOVECTOR& vCrvCompo, const Vector3d& vtN) ;
bool CalcOffsExtensionsForCurves( const ICurveComposite* pCrvCompo, const Vector3d& vtN, double& dExt) ;
bool GetExtendedLoopToFitStmVolume( ICurveComposite* pCrvLoop, const double& dExt, const Vector3d& vtN) ;
bool GetCurrentPart( const PNTVECTOR& vPtInside, ISurfTriMesh* pStmPart) ;
bool SetPocketingVolume( const PNTVECTOR& vPtInside, ISurfTriMesh* pStm) ;
bool AdjustPocketingSideForVolumePart( ISurfTriMesh* pStmVolPart, const Vector3d& vtTool) ;
bool SewingMissingFacesOnPlanes( ISurfTriMesh* pStm, const Plane3d& plPlane) ;
bool ChainBisectors( ICURVEPOVECTOR& vpCrvs, ICRVCOMPOPOVECTOR& vCrvCompo) ;
bool ChooseBestBisectorPath( ICRVCOMPOPOVECTOR& vCrvCompo, const Point3d& ptS,
const Point3d& ptE, ICurveComposite* pCrvPath) ;
bool GetSpecialElevation( const ISurfFlatRegion* pSfr, const ICurveLine* pLine, const bool bInVsOut,
double& dElev) ;
bool GetDangerSfrForSideStep( const ISurfFlatRegion* pSfr, const ISurfTriMesh* pStm_Part, const double dExtraLenInOut,
ISurfFlatRegion* pSfrDanger) ;
bool AdjustTrapezoidSpiralLeadInLeadOutForSideAngle( ICurveComposite* pMCrv, const double dExtraLenInOut,
const int nOutsideRaw, const Vector3d& vtN) ;
bool GetRaw( ISurfTriMesh* pStmRaw) ;
bool SliceVolume( const ISurfTriMesh* pStmVol, const ISurfTriMesh* pStm_Part, const ISurfTriMesh* pSt_Raw,
ISURFFRPOVECTOR& vSrfSliced, ISURFFRPOVECTOR& vSfrLimit, std::vector<ICRVCOMPOPOVECTOR>& vCrvOEWithFlags,
BOOLVECTOR& vbChangedPrec, VCT3DVECTOR& vVtTrasl, int& nStep, const Vector3d vtTool,
const double dElev, const double dDepth, const double dStep, double& dExtraLenInOut) ;
bool TranslateVolumeFaces( const double dTrasl, Frame3d& frElevation, ISurfTriMesh* pStmVol, ISurfTriMesh* pStm_Part,
ISurfTriMesh* pStmRaw) ;
bool CalcExtraSteps( const ISurfTriMesh* pStmVol, VCT3DVECTOR& vVtTrasl, int& nStep, const double dElev,
const double dDepth, const double dStep, INTVECTOR& vIndExtraSteps,
ISURFTMPOVECTOR& vStmES_Edges_OC) ;
bool CutVolumeByPlane( const ISurfTriMesh* pStmVol, const ISurfTriMesh* pStm_Part, const Vector3d& vtTrasl,
const bool bIsExtraStep, ISurfFlatRegion* pSfrResult) ;
bool CheckSideAngleForVolume( const ISurfTriMesh* pStmVol_Sliced, const ISurfTriMesh* pStm_Part,
ISurfFlatRegion* pSfr_Projection, double& dExtraLenInOut, ISurfFlatRegion* pSfr) ;
bool ProjectVolume( const ISurfTriMesh* pStmVol, const ISurfTriMesh* pStm_Part, const Vector3d& vtTrasl,
const Vector3d& vtTraslPrec, const bool bIsExtraStep, ISurfFlatRegion* pSfrOpenProjPrec,
ISurfFlatRegion* pSfr, const bool bOneStep, double& dExtraLenInOut) ;
bool ChooseCloseOrOpenEdge( ISurfFlatRegion* pSfr, const ISurfTriMesh* pStm, const bool bOnIsClosed = false) ;
bool SimplifySfrLoops( ISurfFlatRegion* pSfr) ;
bool GetCurvesForOptimizedPocketing( ISurfFlatRegion* pSfr, ICRVCOMPOPOVECTOR& vCrvOEWithFlags) ;
bool ModifySurfByOpenEdges( ISurfFlatRegion* pSfr, const ISurfFlatRegion* pSfrLimit) ;
bool AdjustContourWithOpenEdges( ICurveComposite* pCrvCompo, ICRVCOMPOPOVECTOR& vCrvIsl, const double dDiam,
const double dOffR, const double dStep, const ISurfFlatRegion* pSfrLimit) ;
bool AdjustOpenEdge( const ICurveComposite* pCrvCompo, const ICRVCOMPOPOVECTOR& vCrvIsland,
const double dParS, const double dParE, const Vector3d& vtTanS,
const Vector3d& vtTanE, const double dRad, const double dDiamJ,
const ISurfFlatRegion* pSfrLimit, ICurveComposite* pCrvBorder) ;
bool GetProjectionOfStmToNotPocket( const ISurfTriMesh* pStm, const ISurfTriMesh* pStmVol,
const Vector3d& vtTrasl, ISurfFlatRegion* pSfrProj) ;
bool CreateSurfFrIncidence( const ICurveComposite* pCrv, const Vector3d& vtTanS, const Vector3d& vtTaneE,
const double dRad, ISurfFlatRegion* pSfrInc) ;
bool GetNewSfrByAnotherPocketing( ISurfFlatRegion* pSfrPock, const ISurfFlatRegion* pSfrNoExtendedByOpenEdges,
const ISurfTriMesh* pStmVol, const ISurfTriMesh* pStm_Part,
const ISurfFlatRegion* pSfrLimit) ;
bool GetHomogeneousParts( ICurveComposite* pCrvCompo, ICRVCOMPOPOVECTOR& vpCrvs) ;
bool OptimizedSpiralCirle( const ICurveComposite* pCrvCompo, const double dToll, double& dRad,
Point3d& ptC, bool& bIsCirlce) ;
bool ModifyCurveToSmoothed( ICurveComposite* pCrv, double dRightLen, double dLeftLen, bool bAsParam) ;
bool OrderCurvesByLastPntOfPath( ICRVCOMPOPOVECTOR& vCrv, Point3d ptEnd, PNTVECTOR& vPtStart,
VCT3DVECTOR& vVtOut, BOOLVECTOR& vbMidOut) ;
bool SetPtStartForPath( ICurveComposite* pCrv0, const ISurfFlatRegion* pSrfToWork, const Point3d& ptEndPrec,
const Frame3d& frPocket, Point3d& ptStart, Vector3d& vtMidOut, bool& bMidOut,
int nOffs = 0, ICurveComposite* pCrvOrig = nullptr) ;
bool SetSpecialPtStartForOpenEdges( const ICurveComposite* pCrvOrig, const Frame3d& frPocket,
ICurveComposite* pCrvCompo, Point3d& ptStart, Vector3d& vtMidOut,
bool& bMidOut) ;
bool GetOptCrvIndex( const std::vector<ICRVCOMPOPOVECTOR>& vCrvOEWithFlags, int nStep, ISurfFlatRegion* pSrfChunkFinal,
int& nIndex) ;
bool GetTrapezoidFromShape( const ICurveComposite* pCrvCompo, ICurveComposite* pCrvTrap, Frame3d& frTrap,
double& dPocketSize, int& nBase, int& nSecondBase) ;
bool GetBoxCrvOptTrap( const int nCrv, const ICurveComposite* pCrvCompo, const double dDiam, int& nType, ICurveComposite* pCrvBox) ;
bool CheckTrapezoidClosedEdgePosition( const ICurveComposite* pCrvCompo, const int nCrvInd, const double dDimBoxY,
INTVECTOR& vIndClosedSides, bool& bOk,
ICurveComposite* pCrvTrap) ;
bool CheckSecondBaseTrapezoid( const ICurveComposite* pCrvCompo, const int nCrvInd, int& nSecondBase) ;
bool PreparareTrapezoidTwoBases( const ICurveComposite* pCrvCompo, const double dDiam, const int nType, int& nBase,
int& nSecondBase, bool& bOk, ICurveComposite* pCrvTrap) ;
bool GetSfrByStm( const ISurfTriMesh* pStm, ISurfFlatRegion* pSfr, const Plane3d plPock, const Vector3d& vtExtr,
const double dThick, double dToll = 5 * EPS_SMALL) ;
bool ProjectStmOnPlane( const ISurfTriMesh* pStmAbove, const Plane3d plPock, ISurfFlatRegion* pSfrProj) ;
bool GetCoeffLinArc( const ICurveArc* pArc, double dDiam, double& dSubArc) ;
bool GetParamOnOpenSide( const ICurveComposite* pCompo, const ICRVCOMPOPOVECTOR& vCrvIsl,
const Frame3d& frPocket, Point3d& ptMid, Vector3d& vtMidOut) ;
bool AdjustContourStart( ICurveComposite* pCompo, const ICRVCOMPOPOVECTOR& vCrvIsl, bool bOrder = false,
Point3d ptRef = P_INVALID) ;
bool GetParamForPtStartOnEdge( const ICurve* pCrv, const ICurveComposite* pCompo, const ICRVCOMPOPOVECTOR& vCrvIsl,
double& dPar) ;
bool CheckForRemovingIsland( const ICurveComposite* pCrvIslandBorder, double dOffs, bool bRemove) ;
bool AddZigZag( ISURFFRPOVECTOR& vSfr, const std::vector<ICRVCOMPOPOVECTOR>& vCrvOrig, BOOLVECTOR& vbChangedPrec,
VCT3DVECTOR& vVtTrasl, const Vector3d& vtTool, const Vector3d& vtExtr,
double dDepth, double dElev, double dMaxElev, double dOkStep, bool bSplitArcs) ;
bool CalcZigZag( const ISurfFlatRegion* pSrfZigZag, ICRVCOMPOPOVECTOR& vpCrvs) ;
bool CalcZigZagLink( ICurveComposite* pCrv1, ICurveComposite* pCrv2, ICurveComposite* pCrvLink) ;
bool OptimizedZigZag( ISurfFlatRegion* pSrf, const Vector3d & vtTool, double dDepth, double dSafeZ,
Frame3d& frPocket, ICurveComposite* pCrvOrig, bool& bOptimizedZigZag,
ICRVCOMPOPOVECTOR& vpCrvs, ICRVCOMPOPOVECTOR& vCrvIslMergeBorders, double& dOffs,
int& nClosedSides, bool& bTwoOpposite) ;
bool ZigZagOptimizedNoClosedEdges( ICurveComposite* pCrvPocket, bool& bOptimizedZigZag, Vector3d& vtDir, double& dOffs) ;
bool ZigZagOptimizedOneClosedEdge( ICurveComposite* pCrvPocket, int nClosedId, bool& bOptimizedZigZag,
Vector3d& vtDir, double& dOffs) ;
bool ZigZagOptimizedTwoClosedEdges( ICurveComposite* pCrvPocket, const INTVECTOR& vnClosedIds,
bool& bOptimizedZigZag, bool& bOpposite, Vector3d& vtDir, double& dOffs) ;
bool ZigZagOptimizedThreeClosedEdges( ICurveComposite* pCrvPocket, const INTVECTOR& vnClosedIds, bool& bOptimizedZigZag,
bool& bOpposite, Vector3d& vtDir, double& dOffs) ;
bool ZigZagOptimizedComputeOffset( ICurveComposite* pCrvPocket, const Vector3d& vtMainDir, int nOffsettedEdgesOnY,
const INTVECTOR& vnClosedIds, double& dOffs) ;
bool CutCurveWithLine( ICurveComposite* pCrvA, const ICurveLine* pCrvB) ;
bool AddOneWay( ISURFFRPOVECTOR& vSfr, const std::vector<ICRVCOMPOPOVECTOR>& vCrvOrig, BOOLVECTOR& vbChangedPrec,
VCT3DVECTOR& vVtTrasl, const Vector3d& vtTool, const Vector3d& vtExtr,
double dDepth, double dElev, double dMaxElev, double dOkStep, bool bSplitArcs) ;
bool AddSpiralIn( ISURFFRPOVECTOR& vSfr, const std::vector<ICRVCOMPOPOVECTOR>& vCrvOrig, BOOLVECTOR& vbChangedPrec,
VCT3DVECTOR& vVtTrasl, ISURFFRPOVECTOR& vSrfLimit, const Vector3d& vtTool, const Vector3d& vtExtr,
const double dDepth, const double dElev, const double dMaxElev, const double dOkStep,
const bool bSplitArcs, const double dExtraLenInOut) ;
bool AddSpiralOut( ISURFFRPOVECTOR& vSfr, const std::vector<ICRVCOMPOPOVECTOR>& vCrvOrig, BOOLVECTOR& vbChangedPrec,
VCT3DVECTOR& vVtTrasl, ISURFFRPOVECTOR& vSrfLimit, const Vector3d& vtTool, const Vector3d& vtExtr,
double dDepth, double dElev, double dMaxElev, double dOkStep, bool bSplitArcs,
const double dExtraLenInOut) ;
bool CalcSpiral( const ISurfFlatRegion* pSrfPock, int& nReg, Point3d& ptStart, const Point3d& ptEndPrec, Vector3d& vtMidOut , bool& bMidOut,
bool bSplitArcs,ICurveComposite* pMCrv, ICurveComposite* pRCrv, ICurveComposite* pCrvOEWithFlags,
bool vbChangedPrec, bool& bOptimizedTrap) ;
bool CheckIfOffsetIsNecessary( const ICurveComposite* pCrvOffs, const double dOffs, const int nIter,
const int nOffsCount, const Vector3d& vtN, bool& bInsert) ;
bool CreateSpiralPocketingPath( ICRVCOMPOPOVECTOR& vOffs, ICURVEPOVECTOR& vLinks,
const ICRVCOMPOPOVECTOR& vOffsClosedCurves, const ICRVCOMPOPOVECTOR& vOffsFirstCurve) ;
bool GetUnclearedRegion( ICRVCOMPOPOVECTOR& vFirstOffs, ICRVCOMPOPOVECTOR& vCrvs, ICURVEPOVECTOR& vLinks,
const ICurveComposite* pCrv_orig, ISurfFlatRegion* pSrfToCut) ;
bool GetDynamicClearedRegion( ISurfFlatRegion* pSrfPrec, const ICurveComposite* pCrv) ;
bool RemoveFirstLoopFromSfr( ISurfFlatRegion* pSrfOrig) ;
bool RemoveExtraParts( ISurfFlatRegion* pSrfToCut, ICRVCOMPOPOVECTOR& vOffs, ICRVCOMPOPOVECTOR& vOffsClosedCurves,
ICRVCOMPOPOVECTOR& vOffsFirstCurve, ICURVEPOVECTOR& vLinks) ;
bool RemoveExtraPartByMedialAxis( const ISurfFlatRegion* pChunkToCut, ICRVCOMPOPOVECTOR& vOffsFirstCurve,
int& nOptFlag, Point3d& ptCentroid, ICurveComposite* pCrvPath) ;
bool CutOffsetToClosestPoint( ICRVCOMPOPOVECTOR& vCurves, const Point3d& ptFocus, ICurveComposite* pCrv1,
ICurveComposite* pCrv2, int& nIndex) ;
bool CutLinkToClosestPoint( ICURVEPOVECTOR& vCurves, ICRVCOMPOPOVECTOR& vOffs, const Point3d& ptFocus,
ICurveComposite* pCrv1, ICurveComposite* pCrv2, bool& bFound, int& nIndex) ;
bool GetNewCurvetWithCentroid( const ICurveComposite* pCrvH1, const ICurveComposite* pCrvH2, Point3d& ptC, bool bCir,
ICRVCOMPOPOVECTOR& VFirstOff, ICurveComposite* pCrvNewCurve) ;
bool GetNewCurvetWithPath( const ICurveComposite* pCrvH1, const ICurveComposite* pCrvH2, ICurveComposite* pCrvPath,
ICRVCOMPOPOVECTOR& VFirstOff, ICRVCOMPOPOVECTOR& VoffsCl, ICurveComposite* pCrvNewCurve) ;
bool ManageSmoothAndAutoInters( ICurveComposite* pCrv, ICurveComposite* pCrvPath, ICurveComposite* pPath1,
ICurveComposite* pPath2, ICRVCOMPOPOVECTOR& vOffsCL) ;
bool GetCurveWeightInfo( const ICurveComposite* pCrvCompo, double dMaxLen, double& dToTRot, int& nSmallArcs, int& nSmallLines) ;
bool ChoosePath( const ICurveComposite* pCrv1, const ICurveComposite* pCrv2, int nP, double dPerP, double dMaxLen, int& nC) ;
bool CalcBoundedLink( const Point3d& ptStart, const Point3d& ptEnd, const ICRVCOMPOPOVECTOR& vOffIslands,
ICurveComposite* pCrvLink) ;
bool CalcBoundedSmootedLink( const Point3d& ptStart, const Vector3d& vtStart, const Point3d& ptEnd,
const Vector3d& vtEnd, const double dParMeet,
const ICRVCOMPOPOVECTOR& vOffIslands, ICurveComposite* pCrvLink) ;
bool ModifyBiArc( ICurve* pCrvBiArc, double dCutToll, ICurveComposite* pNewCrv) ;
bool CutCurveByOffsets( ICurveComposite* pCurve, ICRVCOMPOPOVECTOR& vOffs) ;
bool CutCurveToConnect( ICurveComposite* pCrvS, ICurveComposite* pCrvE, const ICRVCOMPOPOVECTOR& vOffs,
const ICRVCOMPOPOVECTOR& vOffIslands, ICurveComposite* pCrvLink,
double dLenPercS = 0.01, double dLenPercE = 0.01, int nMaxIter = 2) ;
bool CalcBoundedLinkWithBiArcs( const Point3d& ptStart, const Vector3d& vtStart, const Point3d& ptEnd, const Vector3d& vtEnd,
const ICurve* pCrvBound, ICurveComposite* pCrvLink) ;
bool CalcCircleSpiral( const Point3d& ptCen, const Vector3d& vtN, double dOutRad, double dIntRad,
bool bSplitArcs, ICurveComposite* pMCrv, ICurveComposite* pRCrv) ;
bool CalcTrapezoidSpiral( ICurveComposite* pCrvPocket, const Frame3d& frTrap, double dPocketSize, int nBase,
int nSecondBase, ICurveComposite* pMCrv, ICurveComposite* pRCrv, bool& bOptimizedTrap) ;
bool CalcSingleOffsetSpiral( const ISurfFlatRegion* pSfr, ICurveComposite* pOffs,
Point3d& ptStart, Vector3d& vtMidOut, bool& bMidOut) ;
bool CalcTrapezoidSpiralLocalFrame( ICurveComposite * pCrvPocket, const Vector3d& vtDir, Frame3d& frLoc) ;
bool CalcTrapezoidSpiralXCoord( const ICurveComposite * pCrvPocket, int nBase,int nSecondBase,
bool bStart, double dYCoord, double& dXCoord, double dPocketSize) ;
bool AdjustTrapezoidSpiralForAngles( ICurveComposite * pMCrv, const ICurveComposite * pCrvPocket,
bool bStart) ;
bool SpecialAdjustTrapezoidSpiralForAngles( ICurveComposite* pMCrv, const bool bEven, const ICurveComposite* pCrvPocket) ;
bool AdjustTrapezoidSpiralForLeadInLeadOut( ICurveComposite * pCompo, ICurveComposite * pRCrv, const Vector3d& vtTool,
double dDepth, int& nOutsideRaw) ;
bool ComputeTrapezoidSpiralLeadInLeadOut( ICurveComposite * pCompo, const Vector3d& vtMainDir, bool bLeadIn, const Vector3d& vtTool, double dDepth,
bool& bIsOutsideRaw) ;
bool GetSignedDistFromRealDirection( const Point3d ptP, const Vector3d vtDir, double& dDist, Vector3d& vtNorm) ;
double GetMinFeed( void ) const { return GetFeed() * GetSideStep() / m_TParams.m_dDiam ; }
double GetMaxFeed( void ) const { return GetFeed() ; }
bool GetFeedForParam( double& dPar, double& dFeed) ;
bool AssignDefaultFeed( ICurveComposite* pCrv) ;
bool DrawColoredCrvForFeedTest( ICurve* pCurve, double dFeed) ;
bool AssignFeedForOpenEdge( ICurveComposite* pCrv, const ICurveComposite* pCrvOF_ori) ;
bool AssignFeedForLineInOut( ICurveComposite* pCrv, const bool bIsIn) ;
bool AssignFeedOnCorners( ICurveComposite* pCrv, const ICurveComposite* pCrv_orig, const double dLenToll) ;
bool AssignFeedForEdgeCleaning( ICurveComposite *pCrv, const ICRVCOMPOPOVECTOR& vCrvOF_orig, int nInd = -1) ;
bool AssignFeedZigZagOneWay( ICurveComposite* pCompoLine, const bool bIsLink, const ICURVEPOVECTOR& vLAbove,
const ICURVEPOVECTOR& vLUnder, const ICRVCOMPOPOVECTOR& vAddedLinks) ;
bool AssignFeedSpiral( ICurveComposite* pCrv, const ISurfFlatRegion* pSrfRemoved_offs, const bool bIsLink,
const ICRVCOMPOPOVECTOR& vLinks_done, const ICurveComposite* pCrv_orig, double dToll) ;
bool AssignFeedSpiralOpt( const int nOptType, ICurveComposite* pCrv) ;
bool AssignFeedCrvOnUnclearedRegions( ICurveComposite* pCrv) ;
bool AssignFeedForReturnPath( ICurveComposite* pCrv) ;
bool VerifyLeadInHelix( ISurfFlatRegion* pSrfChunk, const Point3d& ptCen, double dRad) const ;
bool VerifyLeadInZigZag( ISurfFlatRegion* pSrfChunk, const Point3d& ptPa, const Point3d& ptPb) const ;
bool ComputePolishingPath( ICurveComposite* pMCrv, ICurveComposite* pRCrv, bool bSplitArcs) ;
bool AddEpicycles( ICurveComposite * pCompo, ICurveComposite * pCrv, ICurveComposite * pCrvBound = nullptr) ;
bool AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
double dElev, double dAppr, bool bOutStart) ;
bool AddLinkApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
double dElev, double dAppr) ;
double dElev, double dAppr, bool bOutStart = false) ;
bool AddLinkRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
double dElev, double dAppr) ;
bool AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
double dElev, double dAppr) ;
bool CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtN,
const ICurveComposite* pRCrv, Point3d& ptP1) const ;
bool AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtN,
const ICurveComposite* pCompo, const ICurveComposite* pRCrv, bool bAtLeft, bool bSplitArcs, bool bNoneForced = false) ;
bool AddLeadIn( const ICurveComposite* pCrvCompo, const Point3d& ptP1, const Point3d& ptStart, const Vector3d& vtStart,
const Vector3d& vtEnd, const Vector3d& vtN, ISurfFlatRegion* pSrfChunk,
const ICurveComposite* pRCrv, bool bAtLeft, bool bSplitArcs,
bool bNoneForced = false, bool bSkipControl = false) ;
bool AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d& vtN,
const ICurveComposite* pRCrv, bool bSplitArcs, Point3d& ptP1, double& dElev, bool bNoneForced = false) ;
const ICurveComposite* pRCrv, bool bSplitArcs, bool bNoneForced, Point3d& ptP1,
double& dElev, bool bRecalcElev = true) ;
bool AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d& vtN,
const ICurveComposite* pRCrv, bool bSplitArcs, bool bNoneForced,
Point3d& ptP1, double& dElev, bool& bOppositeHome, bool bRecalcElev = true) ;
bool SetLeadInPointStart( const Point3d& ptCurr, const Vector3d vtN,
const bool& bAtLeft, Vector3d& vtStart, Point3d& ptDest) ;
bool CalcLinkOnStep( const Point3d& ptS, const Point3d& ptE, const ISurfFlatRegion* pSfr,
const ISurfFlatRegion* pSfrLimit, ICurveComposite* pCrvStepLink) ;
double GetRadiusForStartEndElevation( void) const ;
bool GetMidOfLongestOpenSide( const ICurveComposite* pCompo, Point3d& ptMid, Vector3d& vtMidOut) ;
bool AdjustContourWithOpenEdges( ICurveComposite* pCompo) ;
bool AdjustContourStart( ICurveComposite* pCompo) ;
bool VerifyLeadInHelix( const ICurveComposite* pCompo, const Point3d& ptCen, double dRad) const ;
bool VerifyLeadInZigZag( const ICurveComposite* pCompo, const Point3d& ptPa, const Point3d& ptPb) const ;
// ===================================================================
private :
double GetSpeed( void) const
@@ -142,27 +335,42 @@ class Pocketing : public Machining
if ( m_Params.m_nLeadInType != POCKET_LI_GLIDE && m_Params.m_dLiElev < 10 * EPS_SMALL)
return POCKET_LI_NONE ;
return m_Params.m_nLeadInType ; }
int LeadInIsOk( void) const
bool LeadInRawIsOk( void) const
{ if ( m_TParams.m_nType != TT_MILL_NOTIP)
return true ;
return ( GetLeadInType() == POCKET_LI_HELIX && m_Params.m_dLiTang >= 0.49 * m_TParams.m_dDiam && m_Params.m_dLiElev <= 2) ; }
return (( GetLeadInType() == POCKET_LI_ZIGZAG || GetLeadInType() == POCKET_LI_HELIX) &&
m_Params.m_dLiTang >= 0.9 * m_TParams.m_dDiam && m_Params.m_dLiElev <= 2) ; }
int GetLeadOutType( void) const
{ if ( m_Params.m_dLoTang < std::min( 0.1 * m_TParams.m_dDiam, 1.0))
return POCKET_LO_NONE ;
return m_Params.m_nLeadOutType ; }
private :
SELVECTOR m_vId ; // identificativi entità geometriche da lavorare
PocketingData m_Params ; // parametri lavorazione
ToolData m_TParams ; // parametri utensile
double m_dTHoldLen ; // lunghezza del porta-utensile
double m_dTHoldDiam ; // diametro del porta-utensile
double m_dMaxHelixRad ; // raggio massimo attacco ad elica nel caso di cerchi
int m_nStatus ; // stato di aggiornamento della lavorazione
int m_nPockets ; // numero di percorsi di svuotatura generati
bool m_bTiltingTab ; // flag utilizzo tavola basculante
bool m_bAboveHead ; // flag utilizzo testa da sopra
bool m_bAggrBottom ; // flag di utilizzo dell'aggregato da sotto
Vector3d m_vtAggrBottom ; // vettore direzione ausiliaria aggregato da sotto
AggrBottom m_AggrBottom ; // dati eventuale aggregato da sotto
SELVECTOR m_vId ; // identificativi entit geometriche da lavorare
PocketingData m_Params ; // parametri lavorazione
ToolData m_TParams ; // parametri utensile
double m_dTHoldBase ; // posizione base del porta-utensile
double m_dTHoldLen ; // lunghezza del porta-utensile
double m_dTHoldDiam ; // diametro del porta-utensile
double m_dMaxHelixRad ; // raggio massimo attacco ad elica nel caso di cerchi
int m_nStatus ; // stato di aggiornamento della lavorazione
int m_nPockets ; // numero di percorsi di svuotatura generati
bool m_bTiltingTab ; // flag utilizzo tavola basculante
Vector3d m_vtTiltingAx ; // versore direzione eventuale asse basculante
bool m_bAboveHead ; // flag utilizzo testa da sopra
bool m_bAggrBottom ; // flag di utilizzo dell'aggregato da sotto
Vector3d m_vtAggrBottom ; // vettore direzione ausiliaria aggregato da sotto
AggrBottom m_AggrBottom ; // dati eventuale aggregato da sotto
bool m_bOpenOutRaw ; // flag forzatura lati aperti sempre fuori dal grezzo
double m_dOpenMinSafe ; // minima distanza di sicurezza di attacco su lato aperto
bool m_bOptOffset ; // flag per ottimizzazione numero di Offset necessari
bool m_bOptOffsetCM ; // flag per ottimizzazione numero di Offset necessari con centroidi e medial Axis
bool m_bAssignFeed ; // flag per controllo della Feed
double m_dDiam_Prec ; // diametro utensile per precedente svuotatura
double m_dOffsetR_Prec ; // offset radiale della svuotatura precedente
double m_dSideStep_Prec ; // side Step della svuotatura precedente
double m_dLen_Prec ; // Lunghezza del tool precedente
bool m_bOrderStepZ ; // parametro per ordinare gli step Extra per Z decrescente o meno
bool m_bPocketPlane ; // flag per svuotare solo la rimanenza sullo Step Extra
double m_dOpenEdgeRad ; // raggio di rientro per i lati aperti
} ;
+14 -1
View File
@@ -29,6 +29,8 @@ enum nPocketingKey {
KEY_AB = 0,
KEY_AI,
KEY_DH,
KEY_EPCD,
KEY_EPCR,
KEY_F,
KEY_FE,
KEY_FS,
@@ -61,6 +63,8 @@ static const array<string,KEY_ZZZ> sPocketingKey = {
"AB",
"AI",
"DH",
"EPCD",
"EPCR",
"F",
"FE",
"FS",
@@ -241,6 +245,12 @@ PocketingData::FromString( const string& sString, int& nKey)
if ( m_sDepth.empty())
m_sDepth = "0" ;
break ;
case KEY_EPCD :
bOk = ::FromString( sVal, m_dEpicyclesDist) ;
break ;
case KEY_EPCR :
bOk = ::FromString( sVal, m_dEpicyclesRad) ;
break ;
case KEY_F :
bOk = ::FromString( sVal, m_dFeed) ;
break ;
@@ -335,6 +345,8 @@ PocketingData::ToString( int nInd) const
case KEY_AB : return ( sPocketingKey[KEY_AB] + "=" + m_sBlockedAxis) ;
case KEY_AI : return ( sPocketingKey[KEY_AI] + "=" + m_sInitAngs) ;
case KEY_DH : return ( sPocketingKey[KEY_DH] + "=" + m_sDepth) ;
case KEY_EPCD : return ( m_dEpicyclesRad < EPS_SMALL ? "" : sPocketingKey[KEY_EPCD] + "=" + ::ToString( m_dEpicyclesDist)) ;
case KEY_EPCR : return ( m_dEpicyclesRad < EPS_SMALL ? "" : sPocketingKey[KEY_EPCR] + "=" + ::ToString( m_dEpicyclesRad)) ;
case KEY_F : return ( sPocketingKey[KEY_F] + "=" + ::ToString( m_dFeed)) ;
case KEY_FE : return ( sPocketingKey[KEY_FE] + "=" + ::ToString( m_dEndFeed)) ;
case KEY_FS : return ( sPocketingKey[KEY_FS] + "=" + ::ToString( m_dStartFeed)) ;
@@ -369,7 +381,8 @@ PocketingData::ToString( int nInd) const
bool
PocketingData::IsOptional( int nKey) const
{
return ( nKey == KEY_AB || nKey == KEY_AI || nKey == KEY_LIEL || nKey == KEY_TI) ;
return ( nKey == KEY_AB || nKey == KEY_AI || nKey == KEY_EPCD || nKey == KEY_EPCR ||
nKey == KEY_LIEL || nKey == KEY_TI) ;
}
//----------------------------------------------------------------------------
+9 -3
View File
@@ -43,6 +43,8 @@ struct PocketingData : public MachiningData
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_dEpicyclesRad ; // raggio epicicli lucidatura
double m_dEpicyclesDist ; // distanza epicicli lucidatura
std::string m_sSysNotes ; // note interne
std::string m_sUserNotes ; // note dell'utente
@@ -51,7 +53,7 @@ struct PocketingData : public MachiningData
m_dOffsR( UNKNOWN_PAR), m_dOffsL( UNKNOWN_PAR), m_bToolInvert( false), m_bInvert( false),
m_dStartPos( 0), m_dStep( 0), m_dSideStep( 0), m_nSubType( 0), m_dSideAngle( 0),
m_nLeadInType( 0), m_dLiTang( 0), m_dLiElev( 0),
m_nLeadOutType( 0), m_dLoTang( 0) {}
m_nLeadOutType( 0), m_dLoTang( 0), m_dEpicyclesRad( 0), m_dEpicyclesDist( 0) {}
PocketingData* Clone( void) const override ;
bool CopyFrom( const MachiningData* pMdata) override ;
bool SameAs(const MachiningData* pMdata) const override ;
@@ -81,6 +83,10 @@ struct PocketingData : public MachiningData
//----------------------------------------------------------------------------
inline const PocketingData* GetPocketingData( const MachiningData* pMdata)
{ return (dynamic_cast<const PocketingData*>( pMdata)) ; }
{ if ( pMdata == nullptr || pMdata->GetType() != MT_POCKETING)
return nullptr ;
return ( static_cast<const PocketingData*>( pMdata)) ; }
inline PocketingData* GetPocketingData( MachiningData* pMdata)
{ return (dynamic_cast<PocketingData*>( pMdata)) ; }
{ if ( pMdata == nullptr || pMdata->GetType() != MT_POCKETING)
return nullptr ;
return ( static_cast<PocketingData*>( pMdata)) ; }
+40 -13
View File
@@ -84,6 +84,9 @@ Processor::Run( const string& sOutFile, const string& sInfo)
if ( ! VerifySetup())
return false ;
// imposto la fase iniziale come corrente
m_pMchMgr->SetCurrPhase( 1) ;
// evento inizio esecuzione
bool bOk = true ;
if ( ! OnStart()) {
@@ -145,6 +148,9 @@ Processor::Run( const string& sOutFile, const string& sInfo)
LOG_ERROR( GetEMkLogger(), "OnEnd error") ;
}
// imposto la fase iniziale come corrente
m_pMchMgr->SetCurrPhase( 1) ;
return bOk ;
}
@@ -184,8 +190,8 @@ Processor::ProcessDisposition( int nOpId, int nOpInd)
bool bEmpty = pDisp->IsEmpty() ;
bool bSomeByHand = pDisp->GetSomeByHand() ;
// Se disposizione con movimenti macchina
if ( ! pDisp->IsEmpty()) {
// Se disposizione con movimenti autonomi e utensile associato
if ( ! pDisp->IsEmpty() && pDisp->IsWithTool()) {
// Recupero l'utensile della disposizione corrente
string sTool ; string sHead ; int nExit ; string sTcPos ;
if ( ! pDisp->GetToolData( sTool, sHead, nExit, sTcPos))
@@ -447,13 +453,13 @@ Processor::ProcessClEnt( int nEntId, int nEntInd, int nClPathId, int nClPathInd,
int nMove = pCamData->GetMoveType() ;
switch ( nMove) {
case 0 : // rapido
if ( ! OnRapid( nMove, AxesEnd, pCamData->GetAxesMask(),
if ( ! OnRapid( nEntId, nEntInd, nMove, AxesEnd, pCamData->GetAxesMask(),
pCamData->GetToolDir(), pCamData->GetCorrDir(), pCamData->GetBackAuxDir(),
pCamData->GetFlag(), pCamData->GetFlag2(), pCamData->GetIndex()))
return false ;
break ;
case 1 : // linea
if ( ! OnLinear( nMove, AxesEnd,
if ( ! OnLinear( nEntId, nEntInd, nMove, AxesEnd,
pCamData->GetToolDir(), pCamData->GetCorrDir(), pCamData->GetBackAuxDir(),
pCamData->GetFeed(), pCamData->GetFlag(), pCamData->GetFlag2(), pCamData->GetIndex()))
return false ;
@@ -462,7 +468,8 @@ Processor::ProcessClEnt( int nEntId, int nEntInd, int nClPathId, int nClPathInd,
case 3 : // arco CCW
Point3d ptMid( AxesEnd[0], AxesEnd[1], AxesEnd[2]) ;
ptMid.Rotate( pCamData->GetAxesCen(), pCamData->GetAxesNormDir(), - pCamData->GetAxesAngCen() / 2) ;
if ( ! OnArc( nMove, AxesEnd, pCamData->GetAxesCen(), ptMid, pCamData->GetAxesRad(), pCamData->GetAxesAngCen(),
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()))
return false ;
@@ -602,14 +609,16 @@ Processor::ProcessToolData( void)
string sHead ;
int nExit ;
string sTcPos ;
int nType ;
int nComp ;
double dDiam ;
double dTDiam ;
double dLen ;
double dTLen ;
double dDist ;
double dMaxSpeed ;
MyToolData( void)
: sName(), sHead(), nExit( 0), sTcPos(), nComp(0), dDiam( 0), dLen( 0), dMaxSpeed( 0) {}
: sName(), sHead(), nExit( 0), sTcPos(), nType(0), nComp(0), dDiam( 0), dLen( 0), dDist( 0), dMaxSpeed( 0) {}
} ;
typedef vector<MyToolData> TDATAVECTOR ;
TDATAVECTOR vTdata ;
@@ -634,11 +643,13 @@ Processor::ProcessToolData( void)
m_pMchMgr->TdbGetCurrToolParam( TPA_HEAD, Tdata.sHead) ;
m_pMchMgr->TdbGetCurrToolParam( TPA_EXIT, Tdata.nExit) ;
m_pMchMgr->TdbGetCurrToolParam( TPA_TCPOS, Tdata.sTcPos) ;
m_pMchMgr->TdbGetCurrToolParam( TPA_TYPE, Tdata.nType) ;
m_pMchMgr->TdbGetCurrToolParam( TPA_CORR, Tdata.nComp) ;
m_pMchMgr->TdbGetCurrToolParam( TPA_DIAM, Tdata.dDiam) ;
m_pMchMgr->TdbGetCurrToolParam( TPA_TOTDIAM, Tdata.dTDiam) ;
m_pMchMgr->TdbGetCurrToolParam( TPA_LEN, Tdata.dLen) ;
m_pMchMgr->TdbGetCurrToolParam( TPA_TOTLEN, Tdata.dTLen) ;
m_pMchMgr->TdbGetCurrToolParam( TPA_DIST, Tdata.dDist) ;
m_pMchMgr->TdbGetCurrToolParam( TPA_MAXSPEED, Tdata.dMaxSpeed) ;
vTdata.push_back( Tdata) ;
}
@@ -671,18 +682,22 @@ Processor::ProcessToolData( void)
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_EXIT, nExit) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TCPOS, sTcPos) ;
if ( m_pMchMgr->TdbSetCurrTool( sTool)) {
int nComp ; double dDiam ; double dTDiam ; double dLen ; double dTLen ; double dMaxSpeed ;
int nType ; int nComp ; double dDiam ; double dTDiam ; double dLen ; double dTLen ; double dDist ; double dMaxSpeed ;
m_pMchMgr->TdbGetCurrToolParam( TPA_TYPE, nType) ;
m_pMchMgr->TdbGetCurrToolParam( TPA_CORR, nComp) ;
m_pMchMgr->TdbGetCurrToolParam( TPA_DIAM, dDiam) ;
m_pMchMgr->TdbGetCurrToolParam( TPA_TOTDIAM, dTDiam) ;
m_pMchMgr->TdbGetCurrToolParam( TPA_LEN, dLen) ;
m_pMchMgr->TdbGetCurrToolParam( TPA_TOTLEN, dTLen) ;
m_pMchMgr->TdbGetCurrToolParam( TPA_DIST, dDist) ;
m_pMchMgr->TdbGetCurrToolParam( TPA_MAXSPEED, dMaxSpeed) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TTYPE, nType) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TCOMP, nComp) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TDIAM, dDiam) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TTOTDIAM, dTDiam) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TLEN, dLen) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TTOTLEN, dTLen) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TDIST, dDist) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_SMAX, dMaxSpeed) ;
}
bool bUsed = false ;
@@ -716,11 +731,13 @@ Processor::ProcessToolData( void)
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_HEAD, vTdata[i].sHead) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_EXIT, vTdata[i].nExit) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TCPOS, vTdata[i].sTcPos) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TTYPE, vTdata[i].nType) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TCOMP, vTdata[i].nComp) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TDIAM, vTdata[i].dDiam) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TTOTDIAM, vTdata[i].dTDiam) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TLEN, vTdata[i].dLen) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TTOTLEN, vTdata[i].dTLen) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TDIST, vTdata[i].dDist) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_SMAX, vTdata[i].dMaxSpeed) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TUSED, true) ;
// se esiste, chiamo la funzione di emissione dati utensile
@@ -954,14 +971,17 @@ Processor::OnPathEndAux( int nInd, const string& sAE)
//----------------------------------------------------------------------------
bool
Processor::OnRapid( int nMove, const DBLVECTOR& AxesEnd, int nAxesMask,
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)
{
// cancello variabili estranee
ResetArcData() ;
// assegno Id e indice entità di movimento
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVEID, nEntId) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVEIND, nEntInd) ;
// assegno il tipo di movimento
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVE, nMove) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVE, nMove) ;
// assegno il valore degli assi
int nNumAxes = int( AxesEnd.size()) ;
for ( int i = 1 ; i <= MAX_AXES ; ++ i) {
@@ -991,14 +1011,17 @@ Processor::OnRapid( int nMove, const DBLVECTOR& AxesEnd, int nAxesMask,
//----------------------------------------------------------------------------
bool
Processor::OnLinear( int nMove, const DBLVECTOR& AxesEnd,
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)
{
// cancello variabili estranee
ResetArcData() ;
// assegno Id e indice entità di movimento
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVEID, nEntId) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVEIND, nEntInd) ;
// assegno il tipo di movimento
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVE, nMove) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVE, nMove) ;
// assegno il valore degli assi
int nNumAxes = int( AxesEnd.size()) ;
for ( int i = 1 ; i <= MAX_AXES ; ++ i) {
@@ -1028,12 +1051,16 @@ Processor::OnLinear( int nMove, const DBLVECTOR& AxesEnd,
//----------------------------------------------------------------------------
bool
Processor::OnArc( int nMove, const DBLVECTOR& AxesEnd, const Point3d& ptCen, const Point3d& ptMid, double dRad, double dAngCen,
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)
{
// assegno Id e indice entità di movimento
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVEID, nEntId) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVEIND, nEntInd) ;
// assegno il tipo di movimento
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVE, nMove) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVE, nMove) ;
// assegno il valore degli assi
int nNumAxes = int( AxesEnd.size()) ;
for ( int i = 1 ; i <= MAX_AXES ; ++ i) {
+5 -3
View File
@@ -59,12 +59,14 @@ class Processor
bool OnPathEnd( int nAE) ;
bool OnPathStartAux( int nInd, const std::string& sAS) ;
bool OnPathEndAux( int nInd, const std::string& sAE) ;
bool OnRapid( int nMove, const DBLVECTOR& AxesEnd, int nAxesMask,
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) ;
bool OnLinear( int nMove, const DBLVECTOR& AxesEnd, const Vector3d& vtTool, const Vector3d& vtCorr, const Vector3d& vtAux,
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) ;
bool OnArc( int nMove, const DBLVECTOR& AxesEnd, const Point3d& ptCen, const Point3d& ptMid, double dRad, double dAngCen,
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) ;
bool ResetArcData( void) ;
+45 -21
View File
@@ -23,8 +23,8 @@
#include "/EgtDev/Include/EGkCurveLine.h"
#include "/EgtDev/Include/EGkCurveArc.h"
#include "/EgtDev/Include/EGkCurveComposite.h"
#include "/EgtDev/Include/EgkOffsetCurve.h"
#include "/EgtDev/Include/EgkOffsetCurveOnX.h"
#include "/EgtDev/Include/EGkOffsetCurve.h"
#include "/EgtDev/Include/EGkOffsetCurveOnX.h"
#include "/EgtDev/Include/EGkSfrCreate.h"
#include "/EgtDev/Include/EGkIntervals.h"
#include "/EgtDev/Include/EGkUserObjFactory.h"
@@ -499,8 +499,14 @@ SawFinishing::Apply( bool bRecalc, bool bPostApply)
// verifico se necessario continuare nell'aggiornamento
if ( ! bRecalc && ! bToolChanged &&
( m_nStatus == MCH_ST_OK || ( ! bPostApply && m_nStatus == MCH_ST_NO_POSTAPPL))) {
// confermo i percorsi di lavorazione
m_nCuts = nCurrCuts ;
LOG_DBG_INFO( GetEMkLogger(), "SawFinishing 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 ;
@@ -582,6 +588,8 @@ SawFinishing::Apply( bool bRecalc, bool bPostApply)
// dichiaro successiva da aggiornare
UpdateFollowingOperationsStatus( MCH_ST_OTH_MODIF) ;
LOG_DBG_INFO( GetEMkLogger(), "SawFinishing apply done") ;
return true ;
}
@@ -599,15 +607,11 @@ SawFinishing::Update( bool bPostApply)
return true ;
}
// elimino le entità CLIMB, RISE e HOME della lavorazione, potrebbero falsare i calcoli degli assi (in ogni casi vengono riaggiunte dopo)
RemoveClimbRiseHome() ;
// imposto eventuale asse bloccato da lavorazione
if ( ! m_Params.m_sBlockedAxis.empty()) {
string sAxis, sVal ;
Split( m_Params.m_sBlockedAxis, "=", true, sAxis, sVal) ;
double dVal = 0 ;
FromString( sVal, dVal) ;
m_pMchMgr->ClearRotAxisBlock() ;
m_pMchMgr->SetRotAxisBlock( sAxis, dVal) ;
}
SetBlockedRotAxis( m_Params.m_sBlockedAxis) ;
// calcolo gli assi macchina
string sHint = ExtractHint( m_Params.m_sUserNotes) ;
@@ -794,11 +798,31 @@ SawFinishing::UpdateToolData( bool* pbChanged)
const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ;
if ( pTdata == nullptr)
return false ;
// verifico se sono diversi (ad esclusione del nome)
m_TParams.m_sName = pTdata->m_sName ;
bool bChanged = ! SameTool( m_TParams, *pTdata) ;
// 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 SawFinishing : tool name changed (" +
@@ -958,15 +982,15 @@ SawFinishing::AdjustGeometry( int nAuxId)
if ( ! pGuide->IsFlat( plPlane, false, 10 * EPS_SMALL) || ! AreSameOrOppositeVectorApprox( plPlane.GetVersN(), Z_AX))
return false ;
// verifiche sulla curva (che trasformo in composita)
PtrOwner<ICurveComposite> pCompo( CreateCurveComposite()) ;
if ( IsNull( pCompo) || ! pCompo->AddCurve( Release( pGuide)))
PtrOwner<ICurveComposite> pCompo ;
if ( ! pCompo.Set( ConvertCurveToComposite( Release( pGuide))))
return false ;
// converto in archi e rette
pCompo->ArcsBezierCurvesToArcsPerpExtr( LIN_TOL_MID, ANG_TOL_STD_DEG) ;
// verifiche sull'ampiezza dell'angolo al centro degli eventuali archi
VerifyArcs( pCompo) ;
// reinserisco nella curva originale
pGuide.Set( Release( pCompo)) ;
pGuide.Set( pCompo) ;
}
// deve iniziare in comune con la prima sezione ed essere ivi perpendicolare
Vector3d vtGdDir ;
@@ -1774,7 +1798,7 @@ SawFinishing::TrimSection( ICurve* pCrv)
// calcolo la classificazione della curva rispetto alla regione
CRVCVECTOR ccClass ;
if ( ! pSfr->GetCurveClassification( *pCrv, ccClass))
if ( ! pSfr->GetCurveClassification( *pCrv, EPS_SMALL, ccClass))
return false ;
// determino l'intervallo di curva da conservare
@@ -2379,8 +2403,8 @@ SawFinishing::CalcCurvedAlongVerticalCuts( ICurve* pSect, int nUmin, int nUmax,
Vector3d vtMove = ( dY - m_TParams.m_dThick / 2) * Z_AX ;
OffsetCurve OffsCrv ;
OffsCrv.Make( pGuide, dOffs, ICurve::OFF_FILLET) ;
PtrOwner<ICurveComposite> pCut( CreateCurveComposite()) ;
if ( IsNull( pCut) || ! pCut->AddCurve( OffsCrv.GetLongerCurve()))
PtrOwner<ICurveComposite> pCut ;
if ( ! pCut.Set( ConvertCurveToComposite( OffsCrv.GetLongerCurve())))
return false ;
VerifyArcs( pCut) ;
pCut->SimpleOffset( SAWRF_OFFS, ICurve::OFF_FORCE_OPEN) ;
@@ -2454,8 +2478,8 @@ SawFinishing::CalcCurvedAlongStdCuts( ICurve* pSect, double dUmin, double dUmax,
Vector3d vtMove = ( ptP.y - m_TParams.m_dThick / 2) * Z_AX ;
OffsetCurve OffsCrv ;
OffsCrv.Make( pGuide, dOffs, ICurve::OFF_FILLET) ;
PtrOwner<ICurveComposite> pCut( CreateCurveComposite()) ;
if ( IsNull( pCut) || ! pCut->AddCurve( OffsCrv.GetLongerCurve()))
PtrOwner<ICurveComposite> pCut ;
if ( ! pCut.Set( ConvertCurveToComposite( OffsCrv.GetLongerCurve())))
return false ;
VerifyArcs( pCut) ;
pCut->SimpleOffset( SAWRF_OFFS, ICurve::OFF_FORCE_OPEN) ;
+6 -2
View File
@@ -81,6 +81,10 @@ struct SawFinishingData : public MachiningData
//----------------------------------------------------------------------------
inline const SawFinishingData* GetSawFinishingData( const MachiningData* pMdata)
{ return (dynamic_cast<const SawFinishingData*>( pMdata)) ; }
{ if ( pMdata == nullptr || pMdata->GetType() != MT_SAWFINISHING)
return nullptr ;
return ( static_cast<const SawFinishingData*>( pMdata)) ; }
inline SawFinishingData* GetSawFinishingData( MachiningData* pMdata)
{ return (dynamic_cast<SawFinishingData*>( pMdata)) ; }
{ if ( pMdata == nullptr || pMdata->GetType() != MT_SAWFINISHING)
return nullptr ;
return ( static_cast<SawFinishingData*>( pMdata)) ; }
+43 -19
View File
@@ -23,8 +23,8 @@
#include "/EgtDev/Include/EGkCurveLine.h"
#include "/EgtDev/Include/EGkCurveArc.h"
#include "/EgtDev/Include/EGkCurveComposite.h"
#include "/EgtDev/Include/EgkOffsetCurve.h"
#include "/EgtDev/Include/EgkOffsetCurveOnX.h"
#include "/EgtDev/Include/EGkOffsetCurve.h"
#include "/EgtDev/Include/EGkOffsetCurveOnX.h"
#include "/EgtDev/Include/EGkSfrCreate.h"
#include "/EgtDev/Include/EGkIntervals.h"
#include "/EgtDev/Include/EGkUserObjFactory.h"
@@ -482,8 +482,14 @@ SawRoughing::Apply( bool bRecalc, bool bPostApply)
// verifico se necessario continuare nell'aggiornamento
if ( ! bRecalc && ! bToolChanged &&
( m_nStatus == MCH_ST_OK || ( ! bPostApply && m_nStatus == MCH_ST_NO_POSTAPPL))) {
// confermo i percorsi di lavorazione
m_nCuts = nCurrCuts ;
LOG_DBG_INFO( GetEMkLogger(), "SawRoughing 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 ;
@@ -546,6 +552,8 @@ SawRoughing::Apply( bool bRecalc, bool bPostApply)
// dichiaro successiva da aggiornare
UpdateFollowingOperationsStatus( MCH_ST_OTH_MODIF) ;
LOG_DBG_INFO( GetEMkLogger(), "SawRoughing apply done") ;
return true ;
}
@@ -563,15 +571,11 @@ SawRoughing::Update( bool bPostApply)
return true ;
}
// elimino le entità CLIMB, RISE e HOME della lavorazione, potrebbero falsare i calcoli degli assi (in ogni casi vengono riaggiunte dopo)
RemoveClimbRiseHome() ;
// imposto eventuale asse bloccato da lavorazione
if ( ! m_Params.m_sBlockedAxis.empty()) {
string sAxis, sVal ;
Split( m_Params.m_sBlockedAxis, "=", true, sAxis, sVal) ;
double dVal = 0 ;
FromString( sVal, dVal) ;
m_pMchMgr->ClearRotAxisBlock() ;
m_pMchMgr->SetRotAxisBlock( sAxis, dVal) ;
}
SetBlockedRotAxis( m_Params.m_sBlockedAxis) ;
// calcolo gli assi macchina
string sHint = ExtractHint( m_Params.m_sUserNotes) ;
@@ -752,11 +756,31 @@ SawRoughing::UpdateToolData( bool* pbChanged)
const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ;
if ( pTdata == nullptr)
return false ;
// verifico se sono diversi (ad esclusione del nome)
m_TParams.m_sName = pTdata->m_sName ;
bool bChanged = ! SameTool( m_TParams, *pTdata) ;
// 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 SawRoughing : tool name changed (" +
@@ -916,15 +940,15 @@ SawRoughing::AdjustGeometry( int nAuxId)
if ( ! pGuide->IsFlat( plPlane, false, 10 * EPS_SMALL) || ! AreSameOrOppositeVectorApprox( plPlane.GetVersN(), Z_AX))
return false ;
// verifiche sulla curva (che trasformo in composita)
PtrOwner<ICurveComposite> pCompo( CreateCurveComposite()) ;
if ( IsNull( pCompo) || ! pCompo->AddCurve( Release( pGuide)))
PtrOwner<ICurveComposite> pCompo ;
if ( ! pCompo.Set( ConvertCurveToComposite( Release( pGuide))))
return false ;
// converto in archi e rette
pCompo->ArcsBezierCurvesToArcsPerpExtr( LIN_TOL_MID, ANG_TOL_STD_DEG) ;
// verifiche sull'ampiezza dell'angolo al centro degli eventuali archi
VerifyArcs( pCompo) ;
// reinserisco nella curva originale
pGuide.Set( Release( pCompo)) ;
pGuide.Set( pCompo) ;
}
// deve iniziare in comune con la prima sezione ed essere ivi perpendicolare
Vector3d vtGdDir ;
@@ -1306,8 +1330,8 @@ SawRoughing::CalculateCurvedToolPath( int nAuxId, int nClId)
// creo la curva di taglio
OffsetCurve OffsCrv ;
OffsCrv.Make( pGuide, dX, ICurve::OFF_FILLET) ;
PtrOwner<ICurveComposite> pCut( CreateCurveComposite()) ;
if ( IsNull( pCut) || ! pCut->AddCurve( OffsCrv.GetLongerCurve()))
PtrOwner<ICurveComposite> pCut ;
if ( ! pCut.Set( ConvertCurveToComposite( OffsCrv.GetLongerCurve())))
return false ;
VerifyArcs( pCut) ;
Vector3d vtMove = ( dY - m_TParams.m_dThick / 2) * Z_AX ;
@@ -1459,7 +1483,7 @@ SawRoughing::TrimSection( ICurve* pCrv)
// calcolo la classificazione della curva rispetto alla regione
CRVCVECTOR ccClass ;
if ( ! pSfr->GetCurveClassification( *pCrv, ccClass))
if ( ! pSfr->GetCurveClassification( *pCrv, EPS_SMALL, ccClass))
return false ;
// determino l'intervallo di curva da conservare
+6 -2
View File
@@ -78,6 +78,10 @@ struct SawRoughingData : public MachiningData
//----------------------------------------------------------------------------
inline const SawRoughingData* GetSawRoughingData( const MachiningData* pMdata)
{ return (dynamic_cast<const SawRoughingData*>( pMdata)) ; }
{ if ( pMdata == nullptr || pMdata->GetType() != MT_SAWROUGHING)
return nullptr ;
return ( static_cast<const SawRoughingData*>( pMdata)) ; }
inline SawRoughingData* GetSawRoughingData( MachiningData* pMdata)
{ return (dynamic_cast<SawRoughingData*>( pMdata)) ; }
{ if ( pMdata == nullptr || pMdata->GetType() != MT_SAWROUGHING)
return nullptr ;
return ( static_cast<SawRoughingData*>( pMdata)) ; }
+89 -35
View File
@@ -647,8 +647,14 @@ Sawing::Apply( bool bRecalc, bool bPostApply)
// verifico se necessario continuare nell'aggiornamento
if ( ! bRecalc && ! bToolChanged &&
( m_nStatus == MCH_ST_OK || ( ! bPostApply && m_nStatus == MCH_ST_NO_POSTAPPL))) {
// confermo i percorsi di lavorazione
m_nCuts = nCurrCuts ;
LOG_DBG_INFO( GetEMkLogger(), "Sawing 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 ;
@@ -717,6 +723,8 @@ Sawing::Apply( bool bRecalc, bool bPostApply)
// dichiaro successiva da aggiornare
UpdateFollowingOperationsStatus( MCH_ST_OTH_MODIF) ;
LOG_DBG_INFO( GetEMkLogger(), "Sawing apply done") ;
return true ;
}
@@ -734,15 +742,11 @@ Sawing::Update( bool bPostApply)
return true ;
}
// elimino le entità CLIMB, RISE e HOME della lavorazione, potrebbero falsare i calcoli degli assi (in ogni casi vengono riaggiunte dopo)
RemoveClimbRiseHome() ;
// imposto eventuale asse bloccato da lavorazione
if ( ! m_Params.m_sBlockedAxis.empty()) {
string sAxis, sVal ;
Split( m_Params.m_sBlockedAxis, "=", true, sAxis, sVal) ;
double dVal = 0 ;
FromString( sVal, dVal) ;
m_pMchMgr->ClearRotAxisBlock() ;
m_pMchMgr->SetRotAxisBlock( sAxis, dVal) ;
}
SetBlockedRotAxis( m_Params.m_sBlockedAxis) ;
// calcolo gli assi macchina
string sHint = ExtractHint( m_Params.m_sUserNotes) ;
@@ -1024,11 +1028,31 @@ Sawing::UpdateToolData( bool* pbChanged)
const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ;
if ( pTdata == nullptr)
return false ;
// verifico se sono diversi (ad esclusione del nome)
m_TParams.m_sName = pTdata->m_sName ;
bool bChanged = ! SameTool( m_TParams, *pTdata) ;
// 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 Sawing : tool name changed (" +
@@ -1221,7 +1245,7 @@ Sawing::GetCurve( SelData Id)
pCrvCompo->ToGlob( frGlob) ;
vtN.ToGlob( frGlob) ;
// sistemazioni varie
AdjustCurveFromSurf( pCrvCompo, TOOL_ORTUP, FACE_DOWN, 0) ;
AdjustCurveFromSurf( pCrvCompo, TOOL_ORTUP, FACE_DOWN, 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 ;
@@ -1255,8 +1279,8 @@ Sawing::GetCurve( SelData Id)
// recupero l'indice del chunk
int nChunk = ( ( Id.nSub == SEL_SUB_ALL) ? 0 : Id.nSub) ;
// recupero il contorno esterno del chunk
PtrOwner<ICurveComposite> pCrvCompo( CreateCurveComposite()) ;
if ( IsNull( pCrvCompo) || ! pCrvCompo->AddCurve( pReg->GetLoop( nChunk, 0)))
PtrOwner<ICurveComposite> pCrvCompo ;
if ( ! pCrvCompo.Set( ConvertCurveToComposite( pReg->GetLoop( nChunk, 0))))
return nullptr ;
// recupero la normale della regione
Vector3d vtN = pReg->GetNormVersor() ;
@@ -1270,7 +1294,7 @@ Sawing::GetCurve( SelData Id)
pCrvCompo->ToGlob( frGlob) ;
vtN.ToGlob( frGlob) ;
// sistemazioni varie
AdjustCurveFromSurf( pCrvCompo, TOOL_ORTUP, FACE_DOWN, 0) ;
AdjustCurveFromSurf( pCrvCompo, TOOL_ORTUP, FACE_DOWN, 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 ;
@@ -1477,7 +1501,7 @@ Sawing::ProcessPath( int nPathId, int nPvId, int nClId)
ICurveComposite* pCompo = GetCurveComposite( m_pGeomDB->GetGeoObj( nCopyId)) ;
// unisco le parti allineate
if ( ! pCompo->MergeCurves( 10 * EPS_SMALL, 10 * EPS_ANG_SMALL))
if ( ! pCompo->MergeCurves( 100 * EPS_SMALL, 100 * EPS_ANG_SMALL))
return false ;
// eventuale inversione percorso
@@ -1767,10 +1791,11 @@ Sawing::ProcessLine( const ICurve* pCrvP, const ICurveLine* pLineC, const ICurve
// aggiungo affondamento
pLine->Translate( - vtCorr * dDepth) ;
// calcolo elevazione (sui due bordi della striscia, leggermente allargata)
const double DELTA_ELEV_THICK = 2.0 ;
double dElev, dElev2 ;
Vector3d vtToolH( vtTool.x, vtTool.y, 0) ;
Vector3d vtSafe = vtToolH * ( 10 * EPS_SMALL) ;
Vector3d vtThick = vtToolH * ( m_TParams.m_dThick / vtToolH.SqLen() + 10 * EPS_SMALL) ;
Vector3d vtSafe = vtToolH * DELTA_ELEV_THICK ;
Vector3d vtThick = vtToolH * ( m_TParams.m_dThick / vtToolH.SqLen() + DELTA_ELEV_THICK) ;
if ( ! GetElevation( m_nPhase, pLine->GetStart() - vtSafe, pLine->GetEnd() - vtSafe, vtCorr, dElev) ||
! GetElevation( m_nPhase, pLine->GetStart() + vtThick, pLine->GetEnd() + vtThick, vtCorr, dElev2) ) {
m_pMchMgr->SetLastError( 2210, "Error in Sawing : Entity GetElevation") ;
@@ -1829,10 +1854,10 @@ Sawing::ProcessLine( const ICurve* pCrvP, const ICurveLine* pLineC, const ICurve
// Eventuale variazioni di velocità all'inizio e alla fine del percorso
FseVar FvVar ;
if ( pCrvP == nullptr) {
string sFsta = ExtractInfo( m_Params.m_sUserNotes, "Fsta:") ;
string sFsta = ExtractInfo( m_Params.m_sUserNotes, "Fsta=") ;
if ( ! sFsta.empty()) {
string sLen, sPu ;
SplitFirst( sFsta, "=", sLen, sPu) ;
SplitFirst( sFsta, ",", sLen, sPu) ;
FromString( sLen, FvVar.dLenStart) ;
FvVar.dLenStart = max( FvVar.dLenStart, 0.) ;
FromString( sPu, FvVar.dPuStart) ;
@@ -1840,10 +1865,10 @@ Sawing::ProcessLine( const ICurve* pCrvP, const ICurveLine* pLineC, const ICurve
}
}
if ( pCrvN == nullptr) {
string sFend = ExtractInfo( m_Params.m_sUserNotes, "Fend:") ;
string sFend = ExtractInfo( m_Params.m_sUserNotes, "Fend=") ;
if ( ! sFend.empty()) {
string sLen, sPu ;
SplitFirst( sFend, "=", sLen, sPu) ;
SplitFirst( sFend, ",", sLen, sPu) ;
FromString( sLen, FvVar.dLenEnd) ;
FvVar.dLenEnd = max( FvVar.dLenEnd, 0.) ;
FromString( sPu, FvVar.dPuEnd) ;
@@ -1981,7 +2006,10 @@ Sawing::GenerateLinePv( const ICurveLine* pLine, const Vector3d& vtTool, const V
double dMove = ( dElev - dExtraCut) ;
// se sottosquadra (controllo il lato opposto della lama, quindi ...)
if ( m_Params.m_dSideAngle < 0)
dMove -= m_TParams.m_dThick * tan( abs( m_Params.m_dSideAngle) * DEGTORAD) ;
dMove = dElev - dExtraCut - m_TParams.m_dThick * tan( abs( m_Params.m_dSideAngle) * DEGTORAD) ;
// altrimenti tengo conto di dove si trova il sopra del lato esterno
else
dMove = dElev - max( dExtraCut, m_TParams.m_dThick * tan( abs( m_Params.m_dSideAngle) * DEGTORAD)) ;
// vettore movimento
Vector3d vtMove = - dMove * vtCorr ; vtMove.z = 0 ;
// rettangolo per parte di taglio completo
@@ -2012,6 +2040,21 @@ Sawing::GenerateLinePv( const ICurveLine* pLine, const Vector3d& vtTool, const V
int nDwnReId = m_pGeomDB->Copy( nReId, GDB_ID_NULL, nPxId) ;
m_pGeomDB->Translate( nDwnReId, vtMove) ;
m_pGeomDB->SetName( nDwnReId, MCH_PV_DOWN_RLOCUT) ;
// riduzione larghezza regioni per tagli da sopra
if ( m_Params.m_dSideAngle > 0) {
double dRefH = max( m_TParams.m_dThick * sin( m_Params.m_dSideAngle * DEGTORAD) - dExtraCut * cos( m_Params.m_dSideAngle * DEGTORAD), 0.) ;
if ( dRefH > EPS_SMALL) {
double dLargh = vtToolH.LenXY() ;
double dRedLargh = dLargh - dRefH * tan( m_Params.m_dSideAngle * DEGTORAD) - EPS_SMALL ;
double dCoeff = dRedLargh / dLargh ;
Frame3d frScale ;
frScale.Set( ptRCross + vtMove, Z_AX, vtDir) ;
m_pGeomDB->Scale( nDwnRId, frScale, 1, dCoeff, 1) ;
m_pGeomDB->Scale( nDwnRrId, frScale, 1, dCoeff, 1) ;
m_pGeomDB->Scale( nDwnRsId, frScale, 1, dCoeff, 1) ;
m_pGeomDB->Scale( nDwnReId, frScale, 1, dCoeff, 1) ;
}
}
}
// salvo in info gruppo : larghezza XY del taglio, distanza XY tra centro e bordo taglio, extra taglio e quota minima della lama
@@ -3792,29 +3835,40 @@ bool
Sawing::CalculateToolAndCorrVersors( const Vector3d& vtTang, int nHeadSide, int nWorkSide, double dSideAng,
Vector3d& vtTool, Vector3d& vtCorr)
{
// Versore fresa : annullo la componente in Z e normalizzo
vtTool = vtTang ;
vtTool.z = 0 ;
if ( ! vtTool.Normalize())
// Direzione tangente nel piano XY
Vector3d vtXYTg = vtTang ;
vtXYTg.z = 0 ;
double dLenXYTg = vtXYTg.Len() ;
if ( dLenXYTg < EPS_SMALL)
return false ;
// ruoto attorno a Zglob+ a seconda del lato mandrino
vtXYTg /= dLenXYTg ;
// se direzione tangente inclinata in Z e SideAng non nullo devo calcolare la vera tangente nel piano XY
if ( abs( vtTang.z) > EPS_SMALL && abs( dSideAng) > EPS_ANG_SMALL) {
double dSinDelta = vtTang.z * tan( dSideAng * DEGTORAD) / dLenXYTg ;
double dCosDelta = sqrt( 1 - dSinDelta * dSinDelta) ;
if ( nHeadSide == SAW_HS_LEFT)
vtXYTg.Rotate( Z_AX, dCosDelta, dSinDelta) ;
else
vtXYTg.Rotate( Z_AX, dCosDelta, -dSinDelta) ;
}
// Versore fresa : ruoto direzione nel piano XY attorno a Zglob+ a seconda del lato mandrino
vtTool = vtXYTg ;
if ( nHeadSide == SAW_HS_LEFT)
vtTool.Rotate( Z_AX, 0, 1) ;
else
vtTool.Rotate( Z_AX, 0, -1) ;
// Versore correzione
// Versore correzione : se lama sbandata devo aggiustare
vtCorr = Z_AX ;
// Se lama sbandata
if ( abs( dSideAng) > EPS_ANG_SMALL) {
if ( nWorkSide == SAW_WS_RIGHT) {
vtTool.Rotate( vtTang, - dSideAng) ;
vtCorr.Rotate( vtTang, - dSideAng) ;
vtTool.Rotate( vtXYTg, - dSideAng) ;
vtCorr.Rotate( vtXYTg, - dSideAng) ;
}
else {
vtTool.Rotate( vtTang, dSideAng) ;
vtCorr.Rotate( vtTang, dSideAng) ;
vtTool.Rotate( vtXYTg, dSideAng) ;
vtCorr.Rotate( vtXYTg, dSideAng) ;
}
}
+6 -2
View File
@@ -99,6 +99,10 @@ struct SawingData : public MachiningData
//----------------------------------------------------------------------------
inline const SawingData* GetSawingData( const MachiningData* pMdata)
{ return (dynamic_cast<const SawingData*>( pMdata)) ; }
{ if ( pMdata == nullptr || pMdata->GetType() != MT_SAWING)
return nullptr ;
return ( static_cast<const SawingData*>( pMdata)) ; }
inline SawingData* GetSawingData( MachiningData* pMdata)
{ return (dynamic_cast<SawingData*>( pMdata)) ; }
{ if ( pMdata == nullptr || pMdata->GetType() != MT_SAWING)
return nullptr ;
return ( static_cast<SawingData*>( pMdata)) ; }
+21 -11
View File
@@ -181,16 +181,12 @@ SetupMgr::Import( const string& sFileName)
m_pMchMgr->GetCurrMachGroup() == GDB_ID_NULL)
return false ;
// recupero il gruppo di setup
int nSetupId = m_pMchMgr->GetCurrSetupGroupId() ;
// inizializzo lo scanner
Scanner TheScanner ;
if ( ! TheScanner.Init( sFileName, ";"))
return false ;
// eseguo la lettura dei campi di attrezzaggio
int nPos = 1 ;
string sLine ;
while ( TheScanner.GetLine( sLine)) {
// salto dichiarazione sezione
@@ -228,8 +224,6 @@ SetupMgr::Import( const string& sFileName)
stuData.m_nExit = 0 ;
m_vStuData.emplace_back( stuData) ;
}
// passo alla successiva posizione
++ nPos ;
}
return true ;
@@ -277,14 +271,20 @@ SetupMgr::GetPosData( int nPos, string& sTcPos, string& sHead, int& nExit, strin
bool
SetupMgr::GetToolData( const string& sName, string& sTcPos, string& sHead, int& nExit, int* pnPos) const
{
// reset valori di ritorno
sTcPos.clear() ;
sHead.clear() ;
nExit = 0 ;
if ( pnPos != nullptr)
*pnPos = 0 ;
// verifico validità utensile
if ( IsEmptyOrSpaces( sName))
return false ;
// cerco l'utensile
int nI = - 1 ;
for ( size_t i = 0 ; i < m_vStuData.size() ; ++ i) {
for ( int i = 0 ; i < int( m_vStuData.size()) ; ++ i) {
if ( m_vStuData[i].m_nExit > 0 && EqualNoCase( sName, m_vStuData[i].m_sName)) {
nI = int( i) ;
nI = i ;
break ;
}
}
@@ -318,11 +318,21 @@ SetupMgr::GetToolName( const string& sHead, int nExit, string& sName) const
bool
SetupMgr::GetToolsInSetupPos( const string& sTcPos, STRVECTOR& vsTools) const
{
// default vettore vuoto
vsTools.clear() ;
// eseguo ricerca
// verifico macchina
if ( m_pMachine == nullptr)
return false ;
// eseguo ricerca (con inserimento nel vettore secondo indice dell'uscita)
for ( int i = 0 ; i < int( m_vStuData.size()) ; ++ i) {
if ( EqualNoCase( sTcPos, m_vStuData[i].m_sTcPos)) {
vsTools.emplace_back( m_vStuData[i].m_sName) ;
if ( ! IsEmptyOrSpaces( m_vStuData[i].m_sHead) && EqualNoCase( sTcPos, m_vStuData[i].m_sTcPos)) {
if ( vsTools.empty()) {
int nExitCnt = m_pMachine->GetHeadExitCount( m_vStuData[i].m_sHead) ;
vsTools.resize( nExitCnt) ;
}
int nExit = m_vStuData[i].m_nExit ;
if ( nExit > 0 && nExit <= int( vsTools.size()))
vsTools[nExit - 1] = m_vStuData[i].m_sName ;
}
}
return true ;
+645 -173
View File
File diff suppressed because it is too large Load Diff
+58 -15
View File
@@ -1,7 +1,7 @@
//----------------------------------------------------------------------------
// EgalTech 2015-2015
// EgalTech 2015-2023
//----------------------------------------------------------------------------
// File : Simulator.h Data : 19.10.15 Versione : 1.6j2
// File : Simulator.h Data : 16.01.23 Versione : 2.5a2
// Contenuto : Dichiarazione della classe Simulator.
//
//
@@ -21,6 +21,22 @@ class IGeomDB ;
class Machine ;
class PerformanceCounter ;
//------------------------ Struttura per movimento esterno assi --------------
struct SimAxMv
{
std::string sName ;
double dEndPos ;
double dStep ;
SimAxMv( void) : dEndPos( 0), dStep( 0) { }
SimAxMv( std::string sN, double dE, double dS) : sName( sN), dEndPos( dE), dStep( dS) {}
} ;
typedef std::vector<SimAxMv> SAMVECTOR ;
//------------------------ Risultato movimento esterno assi -------------------
enum SimAxMvRes { SIM_AXMV_RES_STOP = -1,
SIM_AXMV_RES_ERR = 0,
SIM_AXMV_RES_OK = 1} ;
//----------------------------------------------------------------------------
class Simulator
{
@@ -37,9 +53,11 @@ class Simulator
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, int nFrameId, int nType, const Vector3d& vtMove, double dPar1, double dPar2, double dPar3) ;
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) ;
@@ -60,15 +78,18 @@ class Simulator
bool ManageMove( int& nStatus) ;
bool ManageSingleMove( int& nStatus, double& dMove) ;
int CalcStatusOnError( int nErr) ;
bool GetHeadCurrPosDirAux( Point3d& ptH, Vector3d& vtH, Vector3d& vtA) ;
bool ExecLineVmill( int nVmId, 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 GetHeadCurrPosDirAux( const std::string& sHead, int nExit, Point3d& ptH, Vector3d& vtH, Vector3d& vtA) ;
bool ExecLineVmill( int nVmId, int nCurrTool, double dVmTdOffs, double dVmAdOffs,
const Point3d& ptHi, const Vector3d& vtHi, const Vector3d& vtAi, const Frame3d& frVzmI,
const Point3d& ptHf, const Vector3d& vtHf, const Vector3d& vtAf, const Frame3d& frVzmF) ;
bool NeedCollisionCheck( void) const
{ return ( ! m_CollObj.empty() && ! m_CdId.empty()) ; }
bool Stopped( void)
{ return ( m_nUiStatus == MCH_UISIM_STOP) ; }
bool OnStart( bool bFirst) ;
bool OnEnd( void) ;
bool 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,
@@ -92,23 +113,41 @@ class Simulator
private :
struct CollObj {
int nInd ;
bool bToolOn ;
int nFrameId ;
int nType ;
Vector3d vtMove ;
double dPar1 ;
double dPar2 ;
double dPar3 ;
CollObj( void) : nInd( 0), nFrameId( -1), nType( 0), vtMove(), dPar1( 0), dPar2( 0), dPar3( 0) {}
CollObj( int nI, int nF, int nT, const Vector3d& vtM, double dP1, double dP2, double dP3)
: nInd( nI), nFrameId( nF), nType( nT), vtMove( vtM), dPar1( dP1), dPar2( dP2), dPar3( dP3) {}
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 ;
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
@@ -126,23 +165,27 @@ class Simulator
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
double m_dVmTdOffs ; // offset utensile in direzione principale per VM
double m_dVmAdOffs ; // offset utensile in direzione ausiliaria per VM
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
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)
} ;
+102 -40
View File
@@ -24,8 +24,8 @@
#include "/EgtDev/Include/EGkCurveArc.h"
#include "/EgtDev/Include/EGkCurveComposite.h"
#include "/EgtDev/Include/EGkChainCurves.h"
#include "/EgtDev/Include/EgkOffsetCurve.h"
#include "/EgtDev/Include/EgkOffsetCurveOnX.h"
#include "/EgtDev/Include/EGkOffsetCurve.h"
#include "/EgtDev/Include/EGkOffsetCurveOnX.h"
#include "/EgtDev/Include/EGkSfrCreate.h"
#include "/EgtDev/Include/EGkSurfLocal.h"
#include "/EgtDev/Include/EGkCAvToolSurfTm.h"
@@ -88,6 +88,9 @@ SurfFinishing::Clone( void) const
pSrF->m_nPhase = m_nPhase ;
pSrF->m_Params = m_Params ;
pSrF->m_TParams = m_TParams ;
pSrF->m_dTHoldBase = m_dTHoldBase ;
pSrF->m_dTHoldLen = m_dTHoldLen ;
pSrF->m_dTHoldDiam = m_dTHoldDiam ;
pSrF->m_nStatus = m_nStatus ;
pSrF->m_nPaths = m_nPaths ;
}
@@ -201,6 +204,7 @@ SurfFinishing::SurfFinishing( void)
m_Params.m_sToolName = "*" ;
m_TParams.m_sName = "*" ;
m_TParams.m_sHead = "*" ;
m_dTHoldBase = 0 ;
m_dTHoldLen = 0 ;
m_dTHoldDiam = 0 ;
m_nStatus = MCH_ST_TO_VERIFY ;
@@ -497,8 +501,14 @@ SurfFinishing::Apply( bool bRecalc, bool bPostApply)
// verifico se necessario continuare nell'aggiornamento
if ( ! bRecalc && ! bToolChanged &&
( m_nStatus == MCH_ST_OK || ( ! bPostApply && m_nStatus == MCH_ST_NO_POSTAPPL))) {
// confermo i percorsi di lavorazione
m_nPaths = nCurrPaths ;
LOG_DBG_INFO( GetEMkLogger(), "SurfFinishing 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 ;
@@ -528,6 +538,8 @@ SurfFinishing::Apply( bool bRecalc, bool bPostApply)
}
// recupero i dati del portautensile
int nToolId = m_pMchMgr->GetCalcTool() ;
m_dTHoldBase = 0 ;
m_pGeomDB->GetInfo( nToolId, TTH_BASE, m_dTHoldBase) ;
m_dTHoldLen = 0 ;
m_pGeomDB->GetInfo( nToolId, TTH_LEN, m_dTHoldLen) ;
m_dTHoldDiam = 0 ;
@@ -575,6 +587,8 @@ SurfFinishing::Apply( bool bRecalc, bool bPostApply)
// dichiaro successiva da aggiornare
UpdateFollowingOperationsStatus( MCH_ST_OTH_MODIF) ;
LOG_DBG_INFO( GetEMkLogger(), "SurfFinishing apply done") ;
return true ;
}
@@ -592,15 +606,11 @@ SurfFinishing::Update( bool bPostApply)
return true ;
}
// elimino le entità CLIMB, RISE e HOME della lavorazione, potrebbero falsare i calcoli degli assi (in ogni casi vengono riaggiunte dopo)
RemoveClimbRiseHome() ;
// imposto eventuale asse bloccato da lavorazione
if ( ! m_Params.m_sBlockedAxis.empty()) {
string sAxis, sVal ;
Split( m_Params.m_sBlockedAxis, "=", true, sAxis, sVal) ;
double dVal = 0 ;
FromString( sVal, dVal) ;
m_pMchMgr->ClearRotAxisBlock() ;
m_pMchMgr->SetRotAxisBlock( sAxis, dVal) ;
}
SetBlockedRotAxis( m_Params.m_sBlockedAxis) ;
// calcolo gli assi macchina
string sHint = ExtractHint( m_Params.m_sUserNotes) ;
@@ -793,11 +803,31 @@ SurfFinishing::UpdateToolData( bool* pbChanged)
const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ;
if ( pTdata == nullptr)
return false ;
// verifico se sono diversi (ad esclusione del nome)
m_TParams.m_sName = pTdata->m_sName ;
bool bChanged = ! SameTool( m_TParams, *pTdata) ;
// 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 SurfFinishing : tool name changed (" +
@@ -840,28 +870,39 @@ bool
SurfFinishing::VerifyGeometry( SelData Id, int& nSubs)
{
// ammessi : curve o superfici
// per ora accetto solo curve
const ICurve* pCurve = nullptr ;
const IGeoObj* pGObj = m_pGeomDB->GetGeoObj( Id.nId) ;
// 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 ;
if ( pGObj == nullptr)
return false ;
// se curva
if ( ( 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) ;
}
// altrimenti sottocurva di composita
else {
const ICurveComposite* pCompo = GetCurveComposite( pGObj) ;
if ( pCompo != nullptr)
pCurve = pCompo->GetCurve( Id.nSub) ;
nSubs = 0 ;
// se altrimenti è superficie trimesh
else if ( pGObj->GetType() == SRF_TRIMESH) {
const ISurfTriMesh* pSurf = ::GetSurfTriMesh( pGObj) ;
return ( pSurf != nullptr && pSurf->GetFacetCount() >= 1) ;
}
return ( pCurve != nullptr) ;
// altrimenti errore
else
return false ;
}
//----------------------------------------------------------------------------
@@ -921,6 +962,10 @@ SurfFinishing::GetCurves( SelData Id, ICURVEPLIST& lstPC)
lstPC.emplace_back( Release( pCurve)) ;
return true ;
}
// se altrimenti superficie
else if ( pGObj->GetType() == SRF_TRIMESH)
return true ;
// altrimenti errore
else
return false ;
}
@@ -1222,7 +1267,16 @@ SurfFinishing::GetActiveSurfaces( INTVECTOR& vSurfId) const
// verifiche
if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr)
return false ;
// ciclo sui grezzi attivi nella fase
// cerco tra gli oggetti selezionati
for ( const auto& Id : m_vId) {
int nEntId = Id.nId ;
if ( m_pGeomDB->GetGeoType( nEntId) == SRF_TRIMESH)
vSurfId.emplace_back( nEntId) ;
}
// se trovate superfici, considero solo queste ed esco
if ( ! vSurfId.empty())
return true ;
// altrimenti considero tutte le superfici dei pezzi nei grezzi attivi della fase
int nRawId = m_pMchMgr->GetFirstRawPart() ;
while ( nRawId != GDB_ID_NULL) {
if ( m_pMchMgr->VerifyRawPartPhase(nRawId, m_nPhase)) {
@@ -1277,8 +1331,8 @@ SurfFinishing::AddZigZag( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf,
bool bStart = true ;
while ( OffsCrv.GetCurveCount() > 0) {
// recupero la prima curva di offset
PtrOwner<ICurveComposite> pOffs( CreateCurveComposite()) ;
if ( IsNull( pOffs) || ! pOffs->AddCurve( OffsCrv.GetLongerCurve())) {
PtrOwner<ICurveComposite> pOffs ;
if ( ! pOffs.Set( ConvertCurveToComposite( OffsCrv.GetLongerCurve()))) {
m_pMchMgr->SetLastError( 3110, "Error in SurfFinishing : Toolpath not computable") ;
return false ;
}
@@ -1328,7 +1382,7 @@ SurfFinishing::AddZigZag( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf,
if ( IsNull( pCompo) || ! pCompo->FromPolyLine( PL))
return false ;
// sostituisco la vecchia curva con la nuova
vpCrvs[k].Set( Release( pCompo )) ;
vpCrvs[k].Set( pCompo) ;
}
// ciclo sulle curve elementari
int nMaxInd = vpCrvs[k]->GetCurveCount() - 1 ;
@@ -1475,7 +1529,7 @@ SurfFinishing::CalcZigZag( const ICurveComposite* pOffs,
// calcolo la classificazione della curva rispetto al contorno esterno offsettato
IntersCurveCurve intCC( *pLine, *pOffs) ;
CRVCVECTOR ccClass ;
if ( ! intCC.GetCurveClassification( 0, ccClass)) {
if ( ! intCC.GetCurveClassification( 0, EPS_SMALL, ccClass)) {
m_pMchMgr->SetLastError( 3110, "Error in SurfFinishing : Toolpath not computable") ;
return false ;
}
@@ -1618,6 +1672,13 @@ SurfFinishing::CalcZigZag( const ICurveComposite* pOffs,
nJ = -1 ;
}
}
// se richiesta percorrenza invertita
if ( m_Params.m_bInvert) {
for ( auto& pCompo : vpCrvs)
pCompo->Invert() ;
}
return true ;
}
@@ -1689,7 +1750,7 @@ SurfFinishing::AddSpiral( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf,
if ( IsNull( pCompo) || ! pCompo->FromPolyLine( PL))
return false ;
// sostituisco la vecchia curva con la nuova
pMCrv.Set( Release( pCompo )) ;
pMCrv.Set( pCompo) ;
}
// ciclo sulle curve elementari
int nMaxInd = pMCrv->GetCurveCount() - 1 ;
@@ -1852,7 +1913,7 @@ SurfFinishing::CalcSpiral( const ICurveComposite* pCompo, bool bSplitArcs,
if ( bNextOk) {
// sistemo per prossimo step
dCurrRad = dRad ;
pOffs.Set( Release( pNextOffs)) ;
pOffs.Set( pNextOffs) ;
pCurr = Get( pOffs) ;
// nuovo valore pari allo step
dOffs = GetSideStep() ;
@@ -2052,6 +2113,7 @@ SurfFinishing::GetRightFeed( const Vector3d& vtMove, const Vector3d& vtTool) con
double
SurfFinishing::GetRadiusForStartEndElevation( void) const
{
const double DELTA_ELEV_RAD = 20.0 ;
return ( 0.5 * m_TParams.m_dTDiam + DELTA_ELEV_RAD) ;
const double DELTA_ELEV_RAD = 4.0 ;
double dDeltaRad = min( DELTA_ELEV_RAD, 0.5 * m_TParams.m_dTDiam) ;
return ( 0.5 * m_TParams.m_dTDiam + dDeltaRad) ;
}
+1
View File
@@ -113,6 +113,7 @@ class SurfFinishing : public Machining
SELVECTOR m_vId ; // identificativi entità geometriche da lavorare
SurfFinishingData 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
+6 -2
View File
@@ -83,6 +83,10 @@ struct SurfFinishingData : public MachiningData
//----------------------------------------------------------------------------
inline const SurfFinishingData* GetSurfFinishingData( const MachiningData* pMdata)
{ return (dynamic_cast<const SurfFinishingData*>( pMdata)) ; }
{ if ( pMdata == nullptr || pMdata->GetType() != MT_SURFFINISHING)
return nullptr ;
return ( static_cast<const SurfFinishingData*>( pMdata)) ; }
inline SurfFinishingData* GetSurfFinishingData( MachiningData* pMdata)
{ return (dynamic_cast<SurfFinishingData*>( pMdata)) ; }
{ if ( pMdata == nullptr || pMdata->GetType() != MT_SURFFINISHING)
return nullptr ;
return ( static_cast<SurfFinishingData*>( pMdata)) ; }
+12 -2
View File
@@ -354,17 +354,23 @@ ToolData::SetParam( int nType, double dVal)
m_dMinFeed = dVal ;
return true ;
case TPA_DIST :
if ( abs( dVal) > 0)
if ( abs( dVal) > EPS_SMALL)
SetValInNotes( TSI_DIST, dVal, m_sSysNotes) ;
else
RemoveValInNotes( TSI_DIST, m_sSysNotes) ;
return true ;
case TPA_STEMDIAM :
if ( abs( dVal) > 0)
if ( abs( dVal) > EPS_SMALL)
SetValInNotes( TSI_STEM_DIAM, dVal, m_sSysNotes) ;
else
RemoveValInNotes( TSI_STEM_DIAM, m_sSysNotes) ;
return true ;
case TPA_CORE :
if ( abs( dVal) > EPS_SMALL)
SetValInNotes( TSI_CORE, dVal, m_sSysNotes) ;
else
RemoveValInNotes( TSI_CORE, m_sSysNotes) ;
return true ;
}
return false ;
}
@@ -500,6 +506,10 @@ ToolData::GetParam( int nType, double& dVal) const
dVal = 0 ;
GetValInNotes( m_sSysNotes, TSI_STEM_DIAM, dVal) ;
return true ;
case TPA_CORE :
dVal = 0 ;
GetValInNotes( m_sSysNotes, TSI_CORE, dVal) ;
return true ;
}
dVal = 0 ;
return false ;
+5 -5
View File
@@ -72,7 +72,7 @@ struct ToolData
//----------------------------------------------------------------------------
inline bool
SameTool( const ToolData& Td1, const ToolData& Td2)
SameTool( const ToolData& Td1, const ToolData& Td2, bool bAlsoNameTcPosHeadExit = true)
{
const double EPS_TOOL_LEN = 10 * EPS_SMALL ;
const double EPS_TOOL_ANG = 10 * EPS_ANG_SMALL ;
@@ -80,11 +80,11 @@ SameTool( const ToolData& Td1, const ToolData& Td2)
const double EPS_FEED = 0.5 ;
const double EPS_ABSORP = 0.5 ;
return ( Td1.m_Uuid == Td2.m_Uuid &&
Td1.m_sName == Td2.m_sName &&
( Td1.m_sName == Td2.m_sName || ! bAlsoNameTcPosHeadExit) &&
Td1.m_sDraw == Td2.m_sDraw &&
Td1.m_sTcPos == Td2.m_sTcPos &&
Td1.m_sHead == Td2.m_sHead &&
Td1.m_nExit == Td2.m_nExit &&
( Td1.m_sTcPos == Td2.m_sTcPos || ! bAlsoNameTcPosHeadExit) &&
( Td1.m_sHead == Td2.m_sHead || ! bAlsoNameTcPosHeadExit) &&
( Td1.m_nExit == Td2.m_nExit || ! bAlsoNameTcPosHeadExit) &&
Td1.m_nCorr == Td2.m_nCorr &&
Td1.m_nType == Td2.m_nType &&
abs( Td1.m_dMaxSpeed - Td2.m_dMaxSpeed) < EPS_SPEED &&
+116 -85
View File
@@ -112,7 +112,19 @@ ToolsMgr::Reload( void)
// ciclo di lettura degli utensili
do {
if ( ! LoadOneTool( TheScanner, nToolSize, bEnd)) {
ToolData tData ;
if ( LoadOneTool( TheScanner, nToolSize, tData, bEnd)) {
if ( ! tData.m_sName.empty()) {
// salvo i dati dell'utensile
if ( ! m_utData.emplace( tData.m_Uuid, tData).second ||
! m_suData.emplace( tData.m_sName, tData.m_Uuid).second) {
bOk = false ;
string sOut = "ReloadTools : Error adding tool " + tData.m_sName ;
LOG_ERROR( GetEMkLogger(), sOut.c_str())
}
}
}
else {
bOk = false ;
string sOut = "ReloadTools : Error on line " + ToString( TheScanner.GetCurrLineNbr()) ;
LOG_ERROR( GetEMkLogger(), sOut.c_str())
@@ -133,7 +145,7 @@ ToolsMgr::Reload( void)
//----------------------------------------------------------------------------
bool
ToolsMgr::LoadHeader( Scanner& TheScanner, int& nVersion, int& nToolSize, int& nTotal, bool& bEnd)
ToolsMgr::LoadHeader( Scanner& TheScanner, int& nVersion, int& nToolSize, int& nTotal, bool& bEnd) const
{
// leggo la prossima linea
string sLine ;
@@ -176,12 +188,12 @@ ToolsMgr::LoadHeader( Scanner& TheScanner, int& nVersion, int& nToolSize, int& n
//----------------------------------------------------------------------------
bool
ToolsMgr::LoadOneTool( Scanner& TheScanner, int nToolSize, bool& bEnd)
ToolsMgr::LoadOneTool( Scanner& TheScanner, int nToolSize, ToolData& tData, bool& bEnd) const
{
ToolData tData ;
// leggo la prossima linea
string sLine ;
if ( ! TheScanner.GetLine( sLine)) {
tData.m_sName = "" ;
// fine file
bEnd = true ;
return true ;
@@ -213,9 +225,6 @@ ToolsMgr::LoadOneTool( Scanner& TheScanner, int nToolSize, bool& bEnd)
}
// verifico di aver letto tutti i campi
bOk = bOk && ( Flag.count() == nToolSize) ;
// salvo i dati dell'utensile
bOk = bOk && m_utData.emplace( tData.m_Uuid, tData).second ;
bOk = bOk && m_suData.emplace( tData.m_sName, tData.m_Uuid).second ;
return bOk ;
}
@@ -542,8 +551,6 @@ ToolsMgr::SaveCurrTool( void)
m_suData.emplace( m_tdCurrTool.m_sName, m_tdCurrTool.m_Uuid) ;
}
}
// aggiorno dati portautensile
UpdateCurrToolHolderData() ;
// eseguo salvataggio
m_bModified = true ;
if ( find( m_utModified.begin(), m_utModified.end(), m_tdCurrTool.m_Uuid) == m_utModified.end())
@@ -554,19 +561,13 @@ ToolsMgr::SaveCurrTool( void)
//----------------------------------------------------------------------------
bool
ToolsMgr::UpdateCurrToolHolderData( void)
ToolsMgr::UpdateCurrToolHolderData( double dTHoldBase, double dTHoldLen, double dTHoldDiam)
{
// Leggo i dati del portautensile dal disegno dell'utensile
PtrOwner<IGeomDB> pGeomDB( CreateGeomDB()) ;
pGeomDB->Init() ;
string sDrawPath = m_sToolsDir + "\\" + m_tdCurrTool.m_sDraw ;
pGeomDB->Load( sDrawPath) ;
int nToolId = pGeomDB->GetFirstGroupInGroup( GDB_ID_ROOT) ;
double dTHoldLen = 0 ;
pGeomDB->GetInfo( nToolId, TTH_LEN, dTHoldLen) ;
double dTHoldDiam = 0 ;
pGeomDB->GetInfo( nToolId, TTH_DIAM, dTHoldDiam) ;
// verifico validità utensile corrente
if ( ! m_bCurrTool)
return false ;
// Aggiorno i dati nelle note di sistema
SetValInNotes( TSI_THBASE, dTHoldBase, m_tdCurrTool.m_sSysNotes) ;
SetValInNotes( TSI_THLEN, dTHoldLen, m_tdCurrTool.m_sSysNotes) ;
SetValInNotes( TSI_THDIAM, dTHoldDiam, m_tdCurrTool.m_sSysNotes) ;
return true ;
@@ -679,17 +680,30 @@ ToolsMgr::GetCurrToolMaxDepth( double dSafe, double& dMaxDepth) const
// se fresa
else if ( ( m_tdCurrTool.m_nType & TF_MILL) != 0) {
// recupero le dimensioni del porta utensili
double dTHoldBase = 0 ;
double dTHoldLen = 0 ;
double dTHoldDiam = 0 ;
if ( ! GetValInNotes( m_tdCurrTool.m_sSysNotes, TSI_THLEN, dTHoldLen) ||
! GetValInNotes( m_tdCurrTool.m_sSysNotes, TSI_THDIAM, dTHoldDiam)) {
bool bBaseOk = GetValInNotes( m_tdCurrTool.m_sSysNotes, TSI_THBASE, dTHoldBase) ;
bool bLenOk = GetValInNotes( m_tdCurrTool.m_sSysNotes, TSI_THLEN, dTHoldLen) ;
bool bDiamOk = GetValInNotes( m_tdCurrTool.m_sSysNotes, TSI_THDIAM, dTHoldDiam) ;
if ( ! bBaseOk || ! bLenOk || ! bDiamOk) {
(const_cast<ToolsMgr*>(this))->UpdateCurrToolHolderData( dTHoldBase, dTHoldLen, dTHoldDiam) ;
(const_cast<ToolsMgr*>(this))->SaveCurrTool() ;
Save() ;
GetValInNotes( m_tdCurrTool.m_sSysNotes, TSI_THBASE, dTHoldBase) ;
GetValInNotes( m_tdCurrTool.m_sSysNotes, TSI_THLEN, dTHoldLen) ;
GetValInNotes( m_tdCurrTool.m_sSysNotes, TSI_THDIAM, dTHoldDiam) ;
}
// calcolo il massimo affondamento
dMaxDepth = m_tdCurrTool.m_dLen - ( m_tdCurrTool.m_dDiam > dTHoldDiam ? 0 : dTHoldLen) - dSafe ;
// calcolo il massimo affondamento per le limitazioni dal portautensili
dMaxDepth = m_tdCurrTool.m_dLen - dSafe ;
if ( dTHoldDiam > m_tdCurrTool.m_dDiam + EPS_SMALL)
dMaxDepth -= dTHoldLen ;
else
dMaxDepth -= dTHoldBase ;
// recupero l'eventuale diametro gambo utensile (definito se non nullo)
double dStemDiam ; m_tdCurrTool.GetParam( TPA_STEMDIAM, dStemDiam) ;
if ( dStemDiam > m_tdCurrTool.m_dDiam + EPS_SMALL)
dMaxDepth = min( dMaxDepth, m_tdCurrTool.m_dMaxMat) ;
return true ;
}
// se mortasatrice o sega a catena
@@ -724,27 +738,32 @@ ToolsMgr::GetCurrToolThDiam( double& dThDiam) const
if ( ! m_bCurrTool)
return false ;
// se punta a forare, lama, fresa o scalpello
// se punta a forare, lama, fresa, mortasatrice/sega a catena o scalpello
if ( ( m_tdCurrTool.m_nType & TF_DRILLBIT) != 0 ||
( m_tdCurrTool.m_nType & TF_SAWBLADE) != 0 ||
( m_tdCurrTool.m_nType & TF_MILL) != 0 ||
( m_tdCurrTool.m_nType & TF_MORTISE) != 0 ||
( m_tdCurrTool.m_nType & TF_CHISEL) != 0) {
// recupero le dimensioni del porta utensili
double dTHoldBase = 0 ;
double dTHoldLen = 0 ;
double dTHoldDiam = 0 ;
if ( ! GetValInNotes( m_tdCurrTool.m_sSysNotes, TSI_THLEN, dTHoldLen) ||
! GetValInNotes( m_tdCurrTool.m_sSysNotes, TSI_THDIAM, dTHoldDiam)) {
bool bBaseOk = GetValInNotes( m_tdCurrTool.m_sSysNotes, TSI_THBASE, dTHoldBase) ;
bool bLenOk = GetValInNotes( m_tdCurrTool.m_sSysNotes, TSI_THLEN, dTHoldLen) ;
bool bDiamOk = GetValInNotes( m_tdCurrTool.m_sSysNotes, TSI_THDIAM, dTHoldDiam) ;
if ( ! bBaseOk || ! bLenOk || ! bDiamOk) {
(const_cast<ToolsMgr*>(this))->UpdateCurrToolHolderData( dTHoldBase, dTHoldLen, dTHoldDiam) ;
(const_cast<ToolsMgr*>(this))->SaveCurrTool() ;
Save() ;
GetValInNotes( m_tdCurrTool.m_sSysNotes, TSI_THBASE, dTHoldBase) ;
GetValInNotes( m_tdCurrTool.m_sSysNotes, TSI_THLEN, dTHoldLen) ;
GetValInNotes( m_tdCurrTool.m_sSysNotes, TSI_THDIAM, dTHoldDiam) ;
}
dThDiam = dTHoldDiam ;
return true ;
}
// se mortasatrice/sega a catena o waterjet
else if ( ( m_tdCurrTool.m_nType & TF_MORTISE) != 0 ||
( m_tdCurrTool.m_nType & TF_WATERJET) != 0) {
// se waterjet
else if ( ( m_tdCurrTool.m_nType & TF_WATERJET) != 0) {
dThDiam = 0 ;
return true ;
}
@@ -760,27 +779,32 @@ ToolsMgr::GetCurrToolThLength( double& dThLen) const
if ( ! m_bCurrTool)
return false ;
// se punta a forare, lama, fresa o scalpello
// se punta a forare, lama, fresa, mortasatrice/sega a catena o scalpello
if ( ( m_tdCurrTool.m_nType & TF_DRILLBIT) != 0 ||
( m_tdCurrTool.m_nType & TF_SAWBLADE) != 0 ||
( m_tdCurrTool.m_nType & TF_MILL) != 0 ||
( m_tdCurrTool.m_nType & TF_MORTISE) != 0 ||
( m_tdCurrTool.m_nType & TF_CHISEL) != 0) {
// recupero le dimensioni del porta utensili
double dTHoldBase = 0 ;
double dTHoldLen = 0 ;
double dTHoldDiam = 0 ;
if ( ! GetValInNotes( m_tdCurrTool.m_sSysNotes, TSI_THLEN, dTHoldLen) ||
! GetValInNotes( m_tdCurrTool.m_sSysNotes, TSI_THDIAM, dTHoldDiam)) {
bool bBaseOk = GetValInNotes( m_tdCurrTool.m_sSysNotes, TSI_THBASE, dTHoldBase) ;
bool bLenOk = GetValInNotes( m_tdCurrTool.m_sSysNotes, TSI_THLEN, dTHoldLen) ;
bool bDiamOk = GetValInNotes( m_tdCurrTool.m_sSysNotes, TSI_THDIAM, dTHoldDiam) ;
if ( ! bBaseOk || ! bLenOk || ! bDiamOk) {
(const_cast<ToolsMgr*>(this))->UpdateCurrToolHolderData( dTHoldBase, dTHoldLen, dTHoldDiam) ;
(const_cast<ToolsMgr*>(this))->SaveCurrTool() ;
Save() ;
GetValInNotes( m_tdCurrTool.m_sSysNotes, TSI_THBASE, dTHoldBase) ;
GetValInNotes( m_tdCurrTool.m_sSysNotes, TSI_THLEN, dTHoldLen) ;
GetValInNotes( m_tdCurrTool.m_sSysNotes, TSI_THDIAM, dTHoldDiam) ;
}
dThLen = dTHoldLen ;
return true ;
}
// se mortasatrice/sega a catena o waterjet
else if ( ( m_tdCurrTool.m_nType & TF_MORTISE) != 0 ||
( m_tdCurrTool.m_nType & TF_WATERJET) != 0) {
// se waterjet
else if ( ( m_tdCurrTool.m_nType & TF_WATERJET) != 0) {
dThLen = 0 ;
return true ;
}
@@ -790,7 +814,7 @@ ToolsMgr::GetCurrToolThLength( double& dThLen) const
//----------------------------------------------------------------------------
bool
ToolsMgr::Export( const STRVECTOR& vsToolsNames, const string& sOutFile, bool bCompressed)
ToolsMgr::Export( const STRVECTOR& vsToolsNames, const string& sOutFile, bool bCompressed) const
{
LOG_INFO( GetEMkLogger(), ( "Export Tools " + sOutFile).c_str()) ;
@@ -854,10 +878,10 @@ ToolsMgr::Export( const STRVECTOR& vsToolsNames, const string& sOutFile, bool bC
//----------------------------------------------------------------------------
bool
ToolsMgr::ExportOneTool( const string& sToolName, Writer& TheWriter, const int& nCounter, const string& sOutDir)
ToolsMgr::ExportOneTool( const string& sToolName, Writer& TheWriter, int nCounter, const string& sOutDir) const
{
// se il tool non esiste nel DB lo ignoro
if ( m_suData.find( sToolName) == m_suData.end()){
if ( m_suData.find( sToolName) == m_suData.end()) {
string sOut = "Warning Export Tool : " + sToolName + " not found. Tool is ignored" ;
LOG_ERROR( GetEMkLogger(), sOut.c_str()) ;
return true ;
@@ -865,7 +889,7 @@ ToolsMgr::ExportOneTool( const string& sToolName, Writer& TheWriter, const int&
const ToolData * tData = GetTool( sToolName) ;
string sOut ;
if ( tData == nullptr){
if ( tData == nullptr) {
sOut = "Export Tools : Error exporting " + sToolName ;
LOG_ERROR( GetEMkLogger(), sOut.c_str()) ;
return false ;
@@ -885,7 +909,7 @@ ToolsMgr::ExportOneTool( const string& sToolName, Writer& TheWriter, const int&
bOk = ! sOut.empty() && TheWriter.OutText( sOut) ;
}
if ( ! bOk){
if ( ! bOk) {
sOut = "Export Tools : Error exporting " + sToolName ;
LOG_ERROR( GetEMkLogger(), sOut.c_str()) ;
// visto che non ho salvato correttamente il tool elimino il suo disegno
@@ -898,7 +922,7 @@ ToolsMgr::ExportOneTool( const string& sToolName, Writer& TheWriter, const int&
//----------------------------------------------------------------------------
bool
ToolsMgr::ToBeImported( const string& sFile, STRVECTOR& vsToolsNames, INTVECTOR& vToolsTypes)
ToolsMgr::ToBeImported( const string& sFile, STRVECTOR& vsToolsNames, INTVECTOR& vToolsTypes) const
{
Scanner TheScanner ;
if ( ! TheScanner.Init( sFile, ";")) {
@@ -911,7 +935,7 @@ ToolsMgr::ToBeImported( const string& sFile, STRVECTOR& vsToolsNames, INTVECTOR&
int nToolSize = 0 ;
int nTotal = 0 ;
bool bEnd = false ;
if ( ! LoadHeader( TheScanner, nVersion, nToolSize, nTotal, bEnd)){
if ( ! LoadHeader( TheScanner, nVersion, nToolSize, nTotal, bEnd)) {
LOG_ERROR( GetEMkLogger(), "Tools ToBeImported : Error on Header") ;
}
@@ -960,7 +984,7 @@ ToolsMgr::ToBeImported( const string& sFile, STRVECTOR& vsToolsNames, INTVECTOR&
}
// aggiungo ultimo tool se ok
if ( bAdd && bToolType && bToolName) {
if ( bAdd && bToolType && bToolName) {
vsToolsNames.push_back( sName) ;
vToolsTypes.push_back( stoi( sType)) ;
}
@@ -986,14 +1010,14 @@ ToolsMgr::Import( const string& sFile, const STRVECTOR& vsToolsToImport, const S
return false ;
}
}
// Verfico che il nome non sia ripetuto nella lista dei vsToolsNames
// Verifico che il nome non sia ripetuto nella lista dei vsToolsNames
if ( i != vsToolsNames.size() - 1 && find( vsToolsNames.begin() + i + 1, vsToolsNames.end(), vsToolsNames[i]) != vsToolsNames.end()) {
LOG_ERROR( GetEMkLogger(), ( " Error : name \"" + vsToolsNames[i] + "\" is already used").c_str()) ;
return false ;
}
}
// sFile directory
// File directory
size_t pos = sFile.rfind( "\\") ;
if ( pos == string::npos)
return false ;
@@ -1018,7 +1042,7 @@ ToolsMgr::Import( const string& sFile, const STRVECTOR& vsToolsToImport, const S
// leggo i tool
string sLine ;
if( ! TheScanner.GetLine( sLine))
if ( ! TheScanner.GetLine( sLine))
return false ;
if ( sLine.front() != '[' || sLine.back() != ']')
return false ;
@@ -1032,7 +1056,7 @@ ToolsMgr::Import( const string& sFile, const STRVECTOR& vsToolsToImport, const S
vector<string>::const_iterator it = find( vsToolsToImport.begin(), vsToolsToImport.end(), tData.m_sName) ;
// Se il tool non deve essere importato proseguo con il successivo
if ( it == vsToolsToImport.end())
if ( it == vsToolsToImport.end())
continue ;
// Se errore nel leggere il tool, proseguo con il successivo
@@ -1085,7 +1109,7 @@ ToolsMgr::Import( const string& sFile, const STRVECTOR& vsToolsToImport, const S
//--------------------------------------------------------------------------
bool
ToolsMgr::ReadTool( Scanner& TheScanner, ToolData& tData, const int& nToolSize) const
ToolsMgr::ReadTool( Scanner& TheScanner, ToolData& tData, int nToolSize) const
{
string sLine ;
TheScanner.GetLine( sLine) ;
@@ -1122,49 +1146,56 @@ ToolsMgr::ReadTool( Scanner& TheScanner, ToolData& tData, const int& nToolSize)
//----------------------------------------------------------------------------
bool
ToolsMgr::CopyToolDraw( const string& sDraw, const string& sOutDraw, const string& sToolName)
ToolsMgr::CopyToolDraw( const string& sDraw, const string& sOutDraw, const string& sToolName) const
{
// se il file del disegno esiste lo copio nella nuova cartella
if ( ExistsFile( sDraw)){
if ( ExistsFile( sDraw)) {
if ( ! CopyFileEgt( sDraw, sOutDraw)) {
string sOut = " Error in copying " + sToolName + " draw" ;
LOG_ERROR( GetEMkLogger(), sOut.c_str()) ;
return false ;
}
}
else {
// se il file non esiste e non è standard restituisco errore
if ( ! IsUUID( GetFileTitleEgt( sDraw))) {
string sOut = " Error : " + sToolName + " draw not found" ;
LOG_ERROR( GetEMkLogger(), sOut.c_str()) ;
return false ;
}
// se il file non esiste ma è standard lo ricreo
else {
int nGenCtx = ExeGetCurrentContext() ;
int nToolCtx = ExeInitContext() ;
bool bOk = SetCurrTool( sToolName) ; // setto il tool corrente per farne il disegno
if ( ! bOk){
string sOut = " Error in " + sToolName + " draw" ;
LOG_ERROR( GetEMkLogger(), sOut.c_str()) ;
return false ;
}
if ( ExeTdbCurrToolDraw( nGenCtx, nToolCtx)) {
string sOut = " Error : " + sToolName + " CurrToolDraw" ;
LOG_ERROR( GetEMkLogger(), sOut.c_str()) ;
return false ;
}
if ( ! ExeSaveFile( sOutDraw, GDB_SV_CMPTXT)) {
string sOut = " Error : saving " + sToolName + " tool draw" ;
LOG_ERROR( GetEMkLogger(), sOut.c_str()) ;
return false ;
}
ExeSetCurrentContext( nGenCtx) ;
ExeDeleteContext( nToolCtx) ;
}
return true ;
}
return true ;
// se il file non esiste e non è standard restituisco errore
if ( ! IsUUID( GetFileTitleEgt( sDraw))) {
string sOut = " Error : " + sToolName + " draw not found" ;
LOG_ERROR( GetEMkLogger(), sOut.c_str()) ;
return false ;
}
// altrimenti il file non esiste ma è standard lo ricreo
// recupero indice contesto corrente e creo nuovo contesto per disegno utensile
int nGenCtx = ExeGetCurrentContext() ;
int nToolCtx = ExeInitContext() ;
// salvo dati utensile corrente
bool bCurrToolOld = m_bCurrTool ;
ToolData tdCurrToolOld = m_tdCurrTool ;
// imposto utensile da esportare come corrente
bool bOk = true ;
if ( bOk && ! const_cast<ToolsMgr*>(this)->SetCurrTool( sToolName)) {
string sOut = " Error in " + sToolName + " draw" ;
LOG_ERROR( GetEMkLogger(), sOut.c_str()) ;
bOk = false ;
}
if ( bOk && ExeTdbCurrToolDraw( nGenCtx, nToolCtx) != 0) {
string sOut = " Error : " + sToolName + " CurrToolDraw" ;
LOG_ERROR( GetEMkLogger(), sOut.c_str()) ;
bOk = false ;
}
if ( bOk && ! ExeSaveFile( sOutDraw, GDB_SV_CMPTXT)) {
string sOut = " Error : saving " + sToolName + " tool draw" ;
LOG_ERROR( GetEMkLogger(), sOut.c_str()) ;
bOk = false ;
}
// ripristino utensile corrente
const_cast<ToolsMgr*>(this)->m_bCurrTool = bCurrToolOld ;
const_cast<ToolsMgr*>(this)->m_tdCurrTool = tdCurrToolOld ;
// ripristino contesto corrente e cancello quello creato ad hoc
ExeSetCurrentContext( nGenCtx) ;
ExeDeleteContext( nToolCtx) ;
return bOk ;
}
+8 -8
View File
@@ -56,26 +56,26 @@ class ToolsMgr
bool GetCurrToolParam( int nType, double& dVal) const ;
bool GetCurrToolParam( int nType, std::string& sVal) const ;
template <class T> bool GetCurrToolValInNotes( int nType, const std::string& sKey, T& Val) const ;
bool UpdateCurrToolHolderData( double dTHoldBase, double dTHoldLen, double dTHoldDiam) ;
bool GetCurrToolMaxDepth( double dSafe, double& dMaxDepth) const ;
bool GetCurrToolThDiam( double& dThDiam) const ;
bool GetCurrToolThLength( double& dThLen) const ;
const ToolData* GetCurrTool(void) const
{ return (m_bCurrTool ? &m_tdCurrTool : nullptr) ; }
bool Export( const STRVECTOR& vsToolsNames, const std::string& sOutFile, bool bCompressed = true) ;
bool ToBeImported( const std::string& sFile, STRVECTOR& vsToolsNames, INTVECTOR& vToolsTypes) ;
bool Export( const STRVECTOR& vsToolsNames, const std::string& sOutFile, bool bCompressed = true) const ;
bool ToBeImported( const std::string& sFile, STRVECTOR& vsToolsNames, INTVECTOR& vToolsTypes) const ;
bool Import( const std::string& sFile, const STRVECTOR& vsToolsToImport, const STRVECTOR& vsToolsNames, STRVECTOR& vsImported) ;
private :
bool Clear( void) ;
bool LoadHeader( Scanner& TheScanner, int& nVersion, int& nToolSize, int& nTotal, bool& bEnd) ;
bool LoadOneTool( Scanner& TheScanner, int nToolSize, bool& bEnd) ;
bool LoadHeader( Scanner& TheScanner, int& nVersion, int& nToolSize, int& nTotal, bool& bEnd) const ;
bool LoadOneTool( Scanner& TheScanner, int nToolSize, ToolData& tData, bool& bEnd) const ;
bool SaveHeader( Writer& TheWriter) const ;
bool SaveOneTool( const EgtUUID& Uuid, int& nCounter, Writer& TheWriter) const ;
bool VerifyTool( int nFamily, std::string& sName, int& nType) const ;
bool UpdateCurrToolHolderData( void) ;
bool ExportOneTool( const std::string& sToolName, Writer& TheWriter, const int& nCounter, const std::string& sOutDir) ;
bool ReadTool( Scanner& TheScanner, ToolData& tData, const int& nToolSize) const ;
bool CopyToolDraw( const std::string& sDraw, const std::string& sOutDraw, const std::string& sToolName) ;
bool ExportOneTool( const std::string& sToolName, Writer& TheWriter, int nCounter, const std::string& sOutDir) const ;
bool ReadTool( Scanner& TheScanner, ToolData& tData, int nToolSize) const ;
bool CopyToolDraw( const std::string& sDraw, const std::string& sOutDraw, const std::string& sToolName) const ;
private :
typedef std::unordered_map< EgtUUID, ToolData> UUIDTDATA_UMAP ;
+179 -19
View File
@@ -28,7 +28,9 @@
#include "/EgtDev/Include/EGkSfrCreate.h"
#include "/EgtDev/Include/EGkSurfTriMesh.h"
#include "/EgtDev/Include/EGkExtText.h"
#include "/EgtDev/Include/EGkDistPointCurve.h"
#include "/EgtDev/Include/EGkUserObjFactory.h"
#include "/EgtDev/Include/EGkStringUtils3d.h"
#include "/EgtDev/Include/EGnStringKeyVal.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
@@ -89,6 +91,7 @@ WaterJetting::Clone( void) const
pWJ->m_nPhase = m_nPhase ;
pWJ->m_Params = m_Params ;
pWJ->m_TParams = m_TParams ;
pWJ->m_dTHoldBase = m_dTHoldBase ;
pWJ->m_dTHoldLen = m_dTHoldLen ;
pWJ->m_dTHoldDiam = m_dTHoldDiam ;
pWJ->m_dElev = m_dElev ;
@@ -207,6 +210,7 @@ WaterJetting::WaterJetting( void)
m_Params.m_sToolName = "*" ;
m_TParams.m_sName = "*" ;
m_TParams.m_sHead = "*" ;
m_dTHoldBase = 0 ;
m_dTHoldLen = 0 ;
m_dTHoldDiam = 0 ;
m_dElev = 0 ;
@@ -563,6 +567,8 @@ WaterJetting::Preview( bool bRecalc)
}
// recupero i dati del portautensile
int nToolId = m_pMchMgr->GetCalcTool() ;
m_dTHoldBase = 0 ;
m_pGeomDB->GetInfo( nToolId, TTH_BASE, m_dTHoldBase) ;
m_dTHoldLen = 0 ;
m_pGeomDB->GetInfo( nToolId, TTH_LEN, m_dTHoldLen) ;
m_dTHoldDiam = 0 ;
@@ -625,8 +631,14 @@ WaterJetting::Apply( bool bRecalc, bool bPostApply)
// verifico se necessario continuare nell'aggiornamento
if ( ! bRecalc && ! bToolChanged &&
( m_nStatus == MCH_ST_OK || ( ! bPostApply && m_nStatus == MCH_ST_NO_POSTAPPL))) {
// confermo i percorsi di lavorazione
m_nMills = nCurrMills ;
LOG_DBG_INFO( GetEMkLogger(), "Milling 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 ;
@@ -656,6 +668,8 @@ WaterJetting::Apply( bool bRecalc, bool bPostApply)
}
// recupero i dati del portautensile
int nToolId = m_pMchMgr->GetCalcTool() ;
m_dTHoldBase = 0 ;
m_pGeomDB->GetInfo( nToolId, TTH_BASE, m_dTHoldBase) ;
m_dTHoldLen = 0 ;
m_pGeomDB->GetInfo( nToolId, TTH_LEN, m_dTHoldLen) ;
m_dTHoldDiam = 0 ;
@@ -707,6 +721,8 @@ WaterJetting::Apply( bool bRecalc, bool bPostApply)
// dichiaro successiva da aggiornare
UpdateFollowingOperationsStatus( MCH_ST_OTH_MODIF) ;
LOG_DBG_INFO( GetEMkLogger(), "WaterJetting apply done") ;
return true ;
}
@@ -724,15 +740,11 @@ 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)
RemoveClimbRiseHome() ;
// imposto eventuale asse bloccato da lavorazione
if ( ! m_Params.m_sBlockedAxis.empty()) {
string sAxis, sVal ;
Split( m_Params.m_sBlockedAxis, "=", true, sAxis, sVal) ;
double dVal = 0 ;
FromString( sVal, dVal) ;
m_pMchMgr->ClearRotAxisBlock() ;
m_pMchMgr->SetRotAxisBlock( sAxis, dVal) ;
}
SetBlockedRotAxis( m_Params.m_sBlockedAxis) ;
// calcolo gli assi macchina
string sHint = ExtractHint( m_Params.m_sUserNotes) ;
@@ -955,11 +967,31 @@ WaterJetting::UpdateToolData( bool* pbChanged)
const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ;
if ( pTdata == nullptr)
return false ;
// verifico se sono diversi (ad esclusione del nome)
m_TParams.m_sName = pTdata->m_sName ;
bool bChanged = ! SameTool( m_TParams, *pTdata) ;
// 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 WaterJetting : tool name changed (" +
@@ -1176,6 +1208,11 @@ WaterJetting::Chain( int nGrpDestId)
vInds.emplace_back( Id) ;
}
}
// verifico se sono necessarie sistemazioni per collegamenti (bridges)
if ( abs( m_Params.m_dSideAngle) < EPS_ANG_SMALL &&
m_pGeomDB->GetFirstNameInGroup( m_pMchMgr->GetCurrMachGroup(), MACH_BRIDGES_GROUP) != GDB_ID_NULL) {
AdjustCurvesForBridges( vpCrvs, vInds) ;
}
// preparo i dati per il concatenamento
bool bFirst = true ;
Point3d ptNear = ORIG ;
@@ -1262,6 +1299,108 @@ WaterJetting::Chain( int nGrpDestId)
return true ;
}
//----------------------------------------------------------------------------
bool
WaterJetting::AdjustCurvesForBridges( ICURVEPOVECTOR& vpCrvs, SELVECTOR& vInds)
{
// Gruppo dei collegamenti
struct Bridge {
int nId ;
int nEnt1 ;
int nEnt2 ;
double dWidth ;
Point3d ptP1 ;
Point3d ptP2 ;
Bridge( int nI, int nE1, int nE2, double dW, const Point3d& ptQ1, const Point3d& ptQ2)
: nId( nI), nEnt1( nE1), nEnt2( nE2), dWidth( dW), ptP1( ptQ1), ptP2( ptQ2) {}
} ;
vector<Bridge> vBridges ;
int nBridGrpId = m_pGeomDB->GetFirstNameInGroup( m_pMchMgr->GetCurrMachGroup(), MACH_BRIDGES_GROUP) ;
int nBridgeId = m_pGeomDB->GetFirstInGroup( nBridGrpId) ;
while ( nBridgeId != GDB_ID_NULL) {
int nEnt1, nEnt2 ;
double dWidth ;
Point3d ptP1, ptP2 ;
if ( m_pGeomDB->GetInfo( nBridgeId, "EntStart", nEnt1) &&
m_pGeomDB->GetInfo( nBridgeId, "EntEnd", nEnt2) &&
m_pGeomDB->GetInfo( nBridgeId, "BridgeW", dWidth) &&
ExeStartPoint( nBridgeId, GDB_ID_ROOT, ptP1) &&
ExeEndPoint( nBridgeId, GDB_ID_ROOT, ptP2)) {
vBridges.emplace_back( nBridgeId, nEnt1, nEnt2, dWidth, ptP1, ptP2) ;
}
nBridgeId = m_pGeomDB->GetNext( nBridgeId) ;
}
// Verifico i collegamenti che interessano le geometrie della lavorazione
for ( int i = 0 ; i < int( vBridges.size()) ; ++ i) {
// cerco le due curve interessate dal collegamento
int nI1 = -1 ;
for ( int j = 0 ; j < int( vInds.size()) ; ++ j) {
if ( vInds[j].nId == vBridges[i].nEnt1) {
nI1 = j ;
break ;
}
}
int nI2 = -1 ;
for ( int j = 0 ; j < int( vInds.size()) ; ++ j) {
if ( vInds[j].nId == vBridges[i].nEnt2) {
nI2 = j ;
break ;
}
}
if ( nI1 == -1 || nI2 == -1)
continue ;
// calcolo e verifico la posizione dei punti di collegamento sulle due curve
double const DIST_MAX = 5 ;
double dDist1, dU1, dLenP1, dLen1 ; int nF1 ;
DistPointCurve distPC1( vBridges[i].ptP1, *vpCrvs[nI1]) ;
if ( ! distPC1.GetDist( dDist1) || dDist1 > DIST_MAX ||
! distPC1.GetParamAtMinDistPoint( 0, dU1, nF1) ||
! vpCrvs[nI1]->GetLengthAtParam( dU1, dLenP1) ||
! vpCrvs[nI1]->GetLength( dLen1) ||
dLenP1 < vBridges[i].dWidth + m_TParams.m_dDiam ||
( dLen1 - dLenP1) < vBridges[i].dWidth + m_TParams.m_dDiam)
continue ;
double dDist2, dU2, dLenP2, dLen2 ; int nF2 ;
DistPointCurve distPC2( vBridges[i].ptP2, *vpCrvs[nI2]) ;
if ( ! distPC2.GetDist( dDist2) || dDist2 > DIST_MAX ||
! distPC2.GetParamAtMinDistPoint( 0, dU2, nF2) ||
! vpCrvs[nI2]->GetLengthAtParam( dU2, dLenP2) ||
! vpCrvs[nI2]->GetLength( dLen2) ||
dLenP2 < vBridges[i].dWidth + m_TParams.m_dDiam ||
( dLen2 - dLenP2) < vBridges[i].dWidth + m_TParams.m_dDiam)
continue ;
// spezzo le curve nei punti del collegamento e creo i segmenti di collegamento
PtrOwner<ICurve> pCopy1( vpCrvs[nI1]->Clone()) ;
PtrOwner<ICurve> pCopy2( vpCrvs[nI2]->Clone()) ;
PtrOwner<ICurveLine> pLinkA( CreateCurveLine()) ;
PtrOwner<ICurveLine> pLinkB( CreateCurveLine()) ;
if ( IsNull( pCopy1) || IsNull( pCopy2) || IsNull( pLinkA) || IsNull( pLinkB))
continue ;
vpCrvs[nI1]->TrimEndAtLen( dLenP1 - vBridges[i].dWidth / 2) ;
pCopy1->TrimStartAtLen( dLenP1 + vBridges[i].dWidth / 2) ;
vpCrvs[nI2]->TrimEndAtLen( dLenP2 - vBridges[i].dWidth / 2) ;
pCopy2->TrimStartAtLen( dLenP2 + vBridges[i].dWidth / 2) ;
Point3d ptAs ; vpCrvs[nI1]->GetEndPoint( ptAs) ;
Point3d ptAe ; pCopy2->GetStartPoint( ptAe) ;
pLinkA->Set( ptAs, ptAe) ;
Point3d ptBs ; vpCrvs[nI2]->GetEndPoint( ptBs) ;
Point3d ptBe ; pCopy1->GetStartPoint( ptBe) ;
pLinkB->Set( ptBs, ptBe) ;
// inserisco le nuove curve nel vettore delle curve e aggiorno il vettore degli indici
vpCrvs.emplace_back( Release( pCopy1)) ;
vInds.emplace_back( vInds[nI1]) ;
vpCrvs.emplace_back( Release( pCopy2)) ;
vInds.emplace_back( vInds[nI2]) ;
vpCrvs.emplace_back( Release( pLinkA)) ;
vInds.emplace_back( 0, 0) ;
vpCrvs.emplace_back( Release( pLinkB)) ;
vInds.emplace_back( 0, 0) ;
}
return true ;
}
//----------------------------------------------------------------------------
bool
WaterJetting::VerifySideAngle( void)
@@ -1366,8 +1505,10 @@ WaterJetting::ProcessPath( int nPathId, int nPvId, int nClId)
nStart = 2 ;
else if ( sMyNotes.find( "START=YM") != string::npos)
nStart = -2 ;
else if ( sMyNotes.find( "START=") != string::npos)
nStart = 11 ;
// se richiesta sistemazione punto di inizio
if ( nStart != 0) {
if ( nStart != 0 && nStart != 11) {
const double COS_ANG_PERD_TG = cos( 5 * DEGTORAD) ;
const double DIST_SIC_WJ_LIO = 2 ;
double dMinLen = m_Params.m_dOverlap + 2 * DIST_SIC_WJ_LIO ;
@@ -1426,6 +1567,18 @@ WaterJetting::ProcessPath( int nPathId, int nPvId, int nClId)
if ( dMin >= 0)
pCompo->ChangeStartPoint( dMin) ;
}
// se altrimenti suggerito punto di inizio
else if ( nStart == 11) {
ReplaceString( sMyNotes, "(", "") ;
ReplaceString( sMyNotes, ")", "") ;
Point3d ptStart ;
double dPar ;
int nFlag ;
if ( GetValInNotes( sMyNotes, "START", ptStart) &&
DistPointCurve( ptStart, *pCompo).GetParamAtMinDistPoint( 0, dPar, nFlag)) {
pCompo->ChangeStartPoint( dPar) ;
}
}
}
// eventuali allungamenti/accorciamenti per percorso aperto o chiuso senza sovrapposizione
@@ -1811,7 +1964,7 @@ WaterJetting::AddLeadInPreview( const ICurveComposite* pCompo, ISurfFlatRegion*
{ PtrOwner<ICurveLine> pLine( CreateCurveLine()) ;
if ( IsNull( pLine) || ! pLine->Set( ptP1, ptStart))
return false ;
pCrv.Set( Release( pLine)) ;
pCrv.Set( pLine) ;
} break ;
case WJET_LI_TANGENT :
pCrv.Set( GetArc2PVN( ptStart, ptP1, - vtStart, vtN)) ;
@@ -1880,7 +2033,7 @@ WaterJetting::AddLeadOutPreview( const ICurveComposite* pCompo, ISurfFlatRegion*
Point3d ptP1 = ptEnd + vtEnd * dTang + vtPerp * dPerp ;
if ( IsNull( pLine) || ! pLine->Set( ptEnd, ptP1))
return false ;
pCrv.Set( Release( pLine)) ;
pCrv.Set( pLine) ;
} break ;
case WJET_LO_TANGENT :
{ // calcolo punto finale dell'uscita
@@ -2457,8 +2610,8 @@ WaterJetting::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vect
pCrv->Invert() ;
// eventuale spezzatura
if ( bSplitArcs) {
PtrOwner<ICurveComposite> pCompo( CreateCurveComposite()) ;
if ( IsNull( pCompo) || ! pCompo->AddCurve( Release( pCrv)) || ! ApproxWithLines( pCompo))
PtrOwner<ICurveComposite> pCompo ;
if ( ! pCompo.Set( ConvertCurveToComposite( Release( pCrv))) || ! ApproxWithLines( pCompo))
return false ;
return ( AddCurveMove( pCompo, MCH_CL_LEADIN) != GDB_ID_NULL) ;
}
@@ -2528,8 +2681,8 @@ WaterJetting::AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vec
return false ;
// eventuale spezzatura
if ( bSplitArcs) {
PtrOwner<ICurveComposite> pCompo( CreateCurveComposite()) ;
if ( IsNull( pCompo) || ! pCompo->AddCurve( Release( pCrv)) || ! ApproxWithLines( pCompo))
PtrOwner<ICurveComposite> pCompo ;
if ( ! pCompo.Set( ConvertCurveToComposite( Release( pCrv))) || ! ApproxWithLines( pCompo))
return false ;
return ( AddCurveMove( pCompo, MCH_CL_LEADOUT) != GDB_ID_NULL) ;
}
@@ -2769,8 +2922,15 @@ WaterJetting::CalcCorrDir( const ICurveComposite* pCompo, double dU)
bool
WaterJetting::CalcOffset( ICurveComposite* pCompo, double dSignOffs)
{
// determino opzioni di offset
int nFlag = ICurve::OFF_EXTEND ;
if ( pCompo->IsClosed()) {
Vector3d vtStart ; pCompo->GetStartDir( vtStart) ;
Vector3d vtEnd ; pCompo->GetEndDir( vtEnd) ;
if ( ! AreSameVectorEpsilon( vtStart, vtEnd, sin( 5 * DEGTORAD)))
nFlag |= ICurve::OFF_FORCE_OPEN ;
}
// eseguo offset semplice
int nFlag = ICurve::OFF_EXTEND | ICurve::OFF_FORCE_OPEN ;
if ( pCompo->SimpleOffset( dSignOffs, nFlag))
return true ;
// se curva piatta, provo con offset avanzato
+2
View File
@@ -72,6 +72,7 @@ class WaterJetting : public Machining
bool VerifyGeometry( SelData Id, int& nSubs, int& nType) ;
bool GetCurves( SelData Id, ICURVEPLIST& lstPC) ;
bool Chain( int nGrpDestId) ;
bool AdjustCurvesForBridges( ICURVEPOVECTOR& vpCrvs, SELVECTOR& vInds) ;
bool VerifySideAngle( void) ;
bool ProcessPath( int nPathId, int nPvId, int nClId) ;
bool AdjustPathForInternalAngles( ICurveComposite* pCompo) ;
@@ -121,6 +122,7 @@ class WaterJetting : public Machining
SELVECTOR m_vId ; // identificativi entità geometriche da lavorare
WaterJettingData m_Params ; // parametri lavorazione
ToolData m_TParams ; // parametri utensile
double m_dTHoldBase ; // posizione base del porta-utensile
double m_dTHoldLen ; // lunghezza del porta-utensile
double m_dTHoldDiam ; // diametro del porta-utensile
double m_dElev ; // elevazione del percorso tenendo conto dell'angolo di fianco
+6 -2
View File
@@ -102,6 +102,10 @@ struct WaterJettingData : public MachiningData
//----------------------------------------------------------------------------
inline const WaterJettingData* GetWaterJettingData( const MachiningData* pMdata)
{ return (dynamic_cast<const WaterJettingData*>( pMdata)) ; }
{ if ( pMdata == nullptr || pMdata->GetType() != MT_WATERJETTING)
return nullptr ;
return ( static_cast<const WaterJettingData*>( pMdata)) ; }
inline WaterJettingData* GetWaterJettingData( MachiningData* pMdata)
{ return (dynamic_cast<WaterJettingData*>( pMdata)) ; }
{ if ( pMdata == nullptr || pMdata->GetType() != MT_WATERJETTING)
return nullptr ;
return ( static_cast<WaterJettingData*>( pMdata)) ; }
+1 -1
View File
@@ -33,4 +33,4 @@
#pragma comment(lib, EGTLIBDIR "EgtGeomKernel" EGTLIBVER ".lib")
#pragma comment(lib, EGTLIBDIR "EgtExecutor" EGTLIBVER ".lib")
#pragma comment(lib, EGTLIBDIR "SEgtLock" EGTLIBVER ".lib")
#pragma comment(lib, EGTEXTDIR "Lua/Lib/Lua53" EGTLIBVER ".lib")
#pragma comment(lib, EGTEXTDIR "Lua/Lib/Lua54" EGTLIBVER ".lib")