286 Commits

Author SHA1 Message Date
Riccardo Elitropi e1c69e207d Merge commit '67b34008c514359dc8ef3c440de02127f970b0ed' into NewLink 2026-04-09 08:16:55 +02:00
Dario Sassi 67b34008c5 EgtMachKernel 3.1d2 :
- migliorata gestione Versore Direzione Ausiliaria per robot e centri di lavoro
- aggiunta anche a sgrossatura e finitura superfici.
2026-04-08 14:49:54 +02:00
Riccardo Elitropi 1bb839e9f4 Merge commit '083f896d50e8f859d8aa77b41586a87f9fd7ddb6' into NewLink 2026-04-08 10:25:13 +02:00
Riccardo Elitropi 083f896d50 EgtMachKernel :
- in pocketingNT aggiunta memorizzazione SelId al gruppo PathId corrente.
2026-04-08 09:45:36 +02:00
Dario Sassi 83c83fb5f0 EgtMacheKernel :
- aggiunta gestione calcolo angoli di macchine con tre assi rotanti liberi (di tipo ZYZ o equivalenti) purchè fornito versore ausiliario
- aggiunta possibilità di impostare versore ausiliario tramite UserNotes (VtAuxDir=Vx,Vy,Vz) in fresature, svuotature e forature con punta singola.
2026-04-07 17:50:13 +02:00
Riccardo Elitropi b577dfe86b EgtMachKernel :
- modifica nomi gruppi Paths per Sgrossature e PocketingNT sotto al gruppo CL.
In Sgrossature e Finiture migliorati i controlli sulla semplificazione delle curve mediante frame Locale.
2026-04-07 14:49:34 +02:00
Dario Sassi 624bc499a2 EgtMachKernel :
- in fresatura e taglio di lama portate info di Start, End, Extr e Elev anche nei gruppi P1, P2, ... di Preview
- in simulazione migliorato nascondere della traccia utensile.
2026-04-06 09:59:00 +02:00
Riccardo Elitropi 79e1e9fefd EgtMachKernel :
- in Preview utensile piccole modifiche e migliorie.
2026-04-03 16:21:53 +02:00
Riccardo Elitropi dcb3e6984f EgtMachKernel (NewLink) :
- Piccola correzione per passaggio parametro StartZMax per ultima lavorazione ( sia singola che in doppio).
2026-04-03 15:24:42 +02:00
Riccardo Elitropi 0722c496ac EgtMachKernel :
- in PocketingNT corretto parametro SideStep per Lucidature.
2026-04-03 11:07:27 +02:00
Riccardo Elitropi 04a252418c Merge commit '7dd75bc14bf47dbc51873e1a0231d64aa4c6cd06' into NewLink 2026-04-03 07:49:43 +02:00
Riccardo Elitropi 7dd75bc14b EgtMachKernel :
- piccola correzione in SurfRoughing per ordine ZChunk con un solo piano di svuotatura.
2026-04-02 12:41:53 +02:00
Riccardo Elitropi 3a6da43acc EgtMachKernel 4.1d1 :
- in Sgrossature aggiunto il parametro Overlap.
2026-04-01 18:01:28 +02:00
Dario Sassi dd45642748 EgtMachKernel :
- modifica a Preview di WaterJetting per permettere magnetico di pezzi con questa lavorazione.
2026-04-01 10:20:44 +02:00
Riccardo Elitropi 97e95741b9 Merge commit '73739a293149f41d60b7b75f480cc00b1f5b243d' into NewLink 2026-03-31 19:03:52 +02:00
Riccardo Elitropi 73739a2931 EgtMachKernel :
- in PocketingNT aggiunta gestione lucidature.
2026-03-31 18:55:32 +02:00
Riccardo Elitropi 690c53a5dc Merge commit 'f9964a2f3c6501ef5005acdc764dae9b2c4b9775' into NewLink 2026-03-30 15:28:25 +02:00
Dario Sassi f9964a2f3c EgtMachKernel 3.1c8 :
- piccola miglioria in simulatori per log di errori.
2026-03-30 08:04:59 +02:00
Riccardo Elitropi 39b5434c22 EgtMachKernel (NewLink) :
- correzione per disposizioni con Path(s) esistenti.
2026-03-27 18:41:45 +01:00
Riccardo Elitropi 00881757a7 Merge commit '4be087a16d33702218b4ca5437824081e4d3431c' into NewLink 2026-03-26 09:26:41 +01:00
Dario Sassi 4be087a16d EgtMachKernel :
- corretta anteprima WaterJetting (poteva sbagliare disegno ingresso/uscita con geometria senza vettore estrusione).
2026-03-25 19:56:04 +01:00
Dario Sassi b6ef052c50 EgtMachKernel 3.1c7 :
- esportata VerifyOutstroke con angoli da vettore di double
- resa più robusta GetCalcAngles che restituisce due soli assi rotanti (ora i primi due)
- nelle GetCalcAngles ora si applicano gli assi bloccati impostati tramite SetBlockedRotAxis
- consentiti fino a 4 assi rotanti nelle catene cinematiche dei centri di lavoro.
2026-03-25 16:42:53 +01:00
Riccardo Elitropi 1ec2188326 EgtMachKernel (NewLink) :
- aggiunta gestione ZMax.
2026-03-23 17:03:52 +01:00
Riccardo Elitropi 58fe1d1f8f Merge commit '8fed51ca793ba0784e08a787aa8ec157b303df27' into NewLink 2026-03-20 11:23:14 +01:00
Dario Sassi 8fed51ca79 EgtMachKernel :
- aggiunta scrittura nota "EXTR" in Px di CL per SawRoughing e SawFinishing.
2026-03-20 10:40:18 +01:00
Riccardo Elitropi 708fe02b9b EgtMachKernel (NewLink) :
- correzione a funzione SpecialLink e aggiunto parametro a funzione GetDoubleToolData.
2026-03-19 09:52:01 +01:00
Riccardo Elitropi b418e2d3ef Merge commit '0ba49c41eb98e295baa2bc6994a94469cddd3df5' into NewLink 2026-03-18 16:19:59 +01:00
Riccardo Elitropi 0ba49c41eb EgtMachKernel 3.1c6 :
- in MachMgr aggiunte funzioni per ottenere vTDir, vCDir e vADir da entità CamData.
2026-03-18 15:58:43 +01:00
Riccardo Elitropi 4925ab462c EgtMachKernel (NewLink) :
- in SimulatorSP e SimulatorMP aggiunta gestione lavorazioni in doppio per OnPathStart.
2026-03-18 11:06:14 +01:00
Riccardo Elitropi 1f09c33e46 Merge commit 'f0eccf0efc72b360902087e14f3a940497891101' into NewLink 2026-03-18 08:16:11 +01:00
Dario Sassi f0eccf0efc EgtMachKernel :
- in waterjetting portate info di Start, End, Extr e Elev anche in gruppi P1, P2, ... di Preview.
2026-03-16 12:33:11 +01:00
Dario Sassi 6040a7c43d EgtMachKernel :
- colore preview Waterjet Cambiato in TEAL.
2026-03-15 18:27:24 +01:00
Riccardo Elitropi 984f206d56 EgtMachKernel (NewLink) :
- primo commit per codice NewLink.
2026-03-13 17:28:21 +01:00
Riccardo Elitropi 1ba62546b0 EgtMachKernel 3.1c5 :
- in Operation corretta assegnazione entità/camData con Info per funzione AdjustOneStartEndMovement.
2026-03-12 18:20:36 +01:00
Riccardo Elitropi d7712e133e EgtMachKernel 3.1c4 :
- in Drilling in doppio aggiunto flag 105 per movimenti in parallelo.
2026-03-09 11:49:15 +01:00
Riccardo Elitropi 6d6da429e4 EgtMachKernel 3.1c3 :
- in PocketingNT aggiunte info di Extr, Elev, Start ed End al gruppo del percorso.
2026-03-06 12:18:31 +01:00
Riccardo Elitropi aace2ff81d EgtMachKernel :
- in MachiningToolPreview migliorata la visualizzazione delle teste.
2026-03-05 09:52:54 +01:00
Dario Sassi 616026d74e EgtMachKernel :
- piccola miglioria a MachiningToolPreview.
2026-03-04 17:49:59 +01:00
Riccardo Elitropi 00c97b0503 EgtMachKernel 3.1c2 :
- cambio di versione.
2026-03-04 16:05:36 +01:00
Riccardo Elitropi 9a749e0f20 EgtMachKernel :
- in PocketingNT semplificazione e pulizia codice.
2026-03-04 14:59:40 +01:00
Dario Sassi b88c276bb0 EgtMachKernel :
- aggiunta in interfaccia funzione ChangePreviewMachiningToolShow.
2026-03-03 18:33:50 +01:00
Riccardo Elitropi 3b2b185fd1 EgtMachKernel 3.1c1 :
- aggiunta nuova gestione della Preview Utensile (merge ramo Preview).
2026-03-03 17:15:43 +01:00
Riccardo Elitropi ed58f649f3 Merge commit '5801b85a31cd6ba0ca8330acbce443d5ad45e45a' 2026-03-03 17:13:21 +01:00
Riccardo Elitropi 5801b85a31 EgtMachKernel (Preview) :
- in Drilling in doppio aggiunta nuova gestione per punte in opposizione e aggiunta gestione della realtiva preview.
- correzioni varie.
2026-03-03 17:10:23 +01:00
Riccardo Elitropi e8e8a209b1 EgtMachKernel :
- in PocketingNT piccola correzione.
2026-03-02 16:20:55 +01:00
Riccardo Elitropi 9005ea481f EgtMachKernel (Preview) :
- aggiunta preview per lavorazioni in doppio.
2026-02-27 17:08:03 +01:00
Riccardo Elitropi 0748186661 Merge commit 'e8099c11e00051ccb754bd2d697b73305fe1fbf7' into Preview 2026-02-27 17:07:26 +01:00
Dario Sassi e8099c11e0 EgtMachKernel :
- modifiche alla simulazione per eseguire la verifica collisione correttamente anche alla massima velocità.
2026-02-27 11:48:43 +01:00
Riccardo Elitropi 561796b625 EgtMachKernel (Preview) :
- aggiunta preview per forature multiple fisse e di selezione
- correzioni varie.
2026-02-26 12:49:49 +01:00
Riccardo Elitropi 74996adf48 Merge commit '22c691f9e50bd4c8241e5ec9a4d1a72b054b3e82' into Preview 2026-02-25 18:08:09 +01:00
Riccardo Elitropi fc29cbd471 EgtMachKernel (Preview) :
- primo Test Preview Utensile.
2026-02-25 18:07:19 +01:00
Dario Sassi 22c691f9e5 EgtMacheKernel :
- in preview utensile si tolgono anche i movimenti con nome Home, come CLIMB e RISE (copyright Riccardo).
2026-02-25 17:08:24 +01:00
Dario Sassi 9351b9b2d8 EgtMachKernel :
- aggiunte funzioni lua EmtRemoveCollisionObj e EmtGetCollisionObj per meglio gestire gli oggetti di collisione di tipo testa da postproc.
2026-02-25 15:19:28 +01:00
Dario Sassi 8a289d07b8 EgtMachKernel 3.1b2 :
- in forature in doppio aggiunta gestione parametro LastStep da UserNotes.
2026-02-24 13:06:52 +01:00
Dario Sassi 8ce8982ca6 EgtMachKernel :
- correzione archi in taglio con lama per normale intrinseca allineata con estrusione.
2026-02-23 08:39:56 +01:00
Dario Sassi 1e6120184f EgtMachKernel 3.1b1 :
- aggiunta a funzione lua EmtAddRapidStart parametro opzionale Flag2
2026-02-17 10:42:08 +01:00
Riccardo Elitropi a1c50a1797 EgtMachKernel :
- in PocketingNT modifiche stilistiche
- in PocketingNT migliorate le uscite a scivolo nel caso ottimizzato dei trapezi.
2026-02-17 09:26:07 +01:00
Dario Sassi 9389b62ff1 EgtMachKernel :
- miglioria in Trace di SimulatorSP.
2026-02-14 09:27:21 +01:00
Riccardo Elitropi cda17543fe EgtMachKernel 3.1a6 :
- correzioni a PocketingNT.
2026-02-12 15:49:02 +01:00
Riccardo Elitropi 66f763a772 EgtMachKernel :
- in sgrossature aggiunto parametro utente per offset radiale da superfici di supporto
- in sgrossature modifiche stilistiche
- in sgrossature correzioni nel calcolo delle superfici nei vari Step e SubSteps.
2026-02-11 17:24:19 +01:00
Dario Sassi a1300b26b9 EgtMachKernel 3.1a5 :
- correzione per evitare crash in sgrossatura di superfici in presenza di supporti.
2026-02-11 09:14:26 +01:00
Riccardo Elitropi ac7c5e2e93 EgtMachKernel 3.1a4 :
- piccola correzione in PocketingNT.
2026-02-10 17:01:19 +01:00
Dario Sassi ab56d95f77 EgtMachKernel :
- aggiunta la funzione GetClEntFeed a MachMgr.
2026-02-03 17:28:41 +01:00
Riccardo Elitropi 6e359a5740 EgtMachKernel :
- In PocketingNT migliorati gli ingressi.
2026-02-02 10:42:34 +01:00
Dario Sassi 4c5849dc7b EgtMachKernel 3.1a3 :
- ricompilazione con cambio versione.
2026-01-30 16:01:19 +01:00
Riccardo Elitropi 97c9f10813 EgtMachKernel :
- In PocketingNT corrette le retroazioni.
2026-01-30 14:52:53 +01:00
Riccardo Elitropi fd920a2786 EgtMachKernel :
- In PocketingNT migliorate le considerazioni sul Grezzo e sulle sue Parts.
2026-01-23 12:39:19 +01:00
Riccardo Elitropi 63300c9620 EgtMachKernel :
- in Sgrossature reso uniforme il parametro MaxElev con le altre lavorazioni.
2026-01-21 17:19:58 +01:00
Dario Sassi 3480d3dae6 EgtMachKernel :
- in milling OneWay correzione a verifica necessità risalite intermedie.
2026-01-21 15:33:46 +01:00
Riccardo Elitropi be03fea253 EgtMachKernel :
- In PocketingNT correzione in fori.
2026-01-21 11:29:30 +01:00
Dario Sassi 4ab7788d6d EgtMachkernel :
- aggiunta gestione OnSpecialApplyMachining appena prima del calcolo dei collegamenti tra lavorazioni.
2026-01-21 09:46:38 +01:00
Riccardo Elitropi 2bd9b292fd EgtMachKernel :
- Miglioria Gestione Box di Collisione per Sgrossature.
2026-01-20 11:17:47 +01:00
Dario Sassi 84d21c48af EgtMachKernel :
- di default le svuotature sono fatte con PocketingNT (si può forzare da INI la vecchia modalità [Mach] Pocketing=1).
2026-01-14 12:43:43 +01:00
Riccardo Elitropi cfb8e0553d EgtMachKernel :
- in Sgrossature piccole migliore e semplificazioni.
2026-01-14 10:20:10 +01:00
Riccardo Elitropi 0c9575f754 EgtMachKernel 3.1a2 :
- In Sgrossature aggiunti controlli con Tavola e Ventose.
2026-01-13 15:21:01 +01:00
Dario Sassi 04bb4165c9 EgtMachKernel :
- modifiche a UpdateToolData per impostare lavorazione da riverificare se sono cambiati i dati dell'utensile.
2026-01-11 18:53:35 +01:00
Riccardo Elitropi 564817122f EgtMachKernel :
- In PocketingNT migliorati gli ingressi
2026-01-08 19:24:34 +01:00
Dario Sassi 37de3713ff EgtMachKernel 3.1a1 :
- ricompilazione con cambio major version.
2026-01-02 18:29:19 +01:00
Dario Sassi 117c87c2b5 EgtMachKernel 2.7l3 :
- portate in interfaccia funzioni SetCalcSolCh e GetCalcSolCh.
2025-12-19 09:50:37 +01:00
Dario Sassi c856a2c4c2 EgtMachKernel :
- si segnala nel log il tipo di pocketing usato (Mach-Pocketing=1/2).
2025-12-16 13:12:25 +01:00
Dario Sassi 2ab5a38ffb EgtMachKernel 2.7l2 :
- nei tagli di lama il rallentamento iniziale e finale si può aggiungere anche quando si lavora a step.
2025-12-15 08:18:22 +01:00
Dario Sassi 2973f3f627 EgtMachKernel :
- aggiunta in interfaccia funzione ExistsCurrSetup.
2025-12-11 08:50:20 +01:00
Dario Sassi 46aa62244c EgtMachKernel :
- aggiunte in interfaccia funzioni GetMachiningStartAxes e GetMachiningEndAxes.
2025-12-09 08:20:21 +01:00
Dario Sassi 2133351006 EgtMachKernel 2.7l1 :
- ricompilazione con cambio versione.
2025-12-04 19:10:33 +01:00
Dario Sassi 63381e4cc9 EgtMachKernel 2.7k4 :
- in simulazione SP aggiunta gestione trace per estrusione sul sopra dello strand e non sul sotto.
2025-11-26 19:05:15 +01:00
Dario Sassi 1ba961c2fc EgtMachKernel :
- le regioni sopra e sotto dei grezzi impostate con modo Hidden per non essere visualizzate.
2025-11-18 08:19:21 +01:00
Dario Sassi 286a9906b7 EgtMachKernel :
- aggiustamenti per lavorazioni in doppio.
2025-11-17 08:53:14 +01:00
Dario Sassi ae9bc56917 EgtMachKernel :
- prime modifiche per miglior gestione delle lavorazioni in doppio.
2025-11-15 11:08:33 +01:00
Dario Sassi 8282548bf0 EgtMachKernel 2.7k3 :
- razionalizzate costanti per parametri in UserNotes di lavorazioni (tutte nel nuovo file OperUserNotesConst.h)
- modifiche per consentire più facilmente la lavorazione in doppio dei fori (step finale costante).
2025-11-10 17:49:18 +01:00
SaraP e8aa3dadd7 EgtMachKernel :
- in Waterjet piccola correzione e migliorie nei ponticelli.
2025-11-07 10:48:35 +01:00
Dario Sassi 517d93ba8a EgtMachKernel :
- in waterjet se non è definita estrusione della geometria assegno Z+.
2025-11-06 19:57:20 +01:00
Dario Sassi 9e16e604ec EgtMachKernel 2.7k2 :
- correzioni a lav. waterjet per angoli esterni.
2025-11-06 18:48:30 +01:00
Dario Sassi 06261b64be EgtMachKernel 2.7k1 :
- adattamenti e ricompilazione per passaggio a C++ 20.
2025-11-01 17:39:23 +01:00
Dario Sassi 7bad9a5cc6 EgtMachKernel :
- miglioria nel calcolo assi per robot (verifica continuità).
2025-10-26 19:25:10 +01:00
Riccardo Elitropi ec5590bd29 Merge branch 'master' of https://gitlab.steamware.net/egaltech/EgtMachKernel 2025-10-22 16:16:19 +02:00
Riccardo Elitropi 799aef3d5a EgtMachKernel :
- In PocketingNT piccola correzione.
2025-10-22 16:16:15 +02:00
Dario Sassi eab9c2085a EgtMachKernel :
- correzione in CalculateRobotAxesValues per caso con una sola soluzione.
2025-10-22 16:12:51 +02:00
SaraP 4b346b39ba EgtMachKernel 2.7j2 :
- in preview WaterJet aggiunto indicatore del punto di inizio se non è impostato attacco
- correzioni nella preview dei loops.
2025-10-22 11:13:20 +02:00
SaraP 14d9819153 EgtMachKernel :
- in WaterJet nel calcolo dell'offset forzata apertura solo se spigoli di loop esterni.
2025-10-09 15:45:52 +02:00
Riccardo Elitropi d12d6bcfb6 EgtMachKernel :
- in PocketingNT piccola miglioria.
2025-10-09 15:23:35 +02:00
Riccardo Elitropi d83ea12f1f EgtMachKernel :
- in PocketingNT piccolo miglioramento per i punti iniziali della svuotature.
2025-10-08 09:15:34 +02:00
Dario Sassi 043a2043aa EgtMachKernel 2.7j1 :
- ricompilazione con cambio versione.
2025-10-08 08:36:08 +02:00
Riccardo Elitropi 5f5c0d9a8f EgtMachKernel :
- in PocketingNT correzione memoryLeaks.
2025-10-07 16:35:10 +02:00
Riccardo Elitropi d162bb58f3 EgtMachKernel :
- piccola correzione in PocketinNT.
2025-10-06 17:40:25 +02:00
SaraP da8ba3a23f EgtMachKernel :
- in WaterJet correzioni per gestire tratti piccoli.
2025-10-03 16:17:22 +02:00
Riccardo Elitropi bd1e7e04ee EgtMachKernel :
- in PocketingNT piccola miglioria sui punti inziali delle lavorazioni Spiral ( e casi Trapezi)
- in PocketingNT migliorata l'elevazione per la funzione AddRetract.
2025-10-02 17:59:14 +02:00
Dario Sassi 75fa4a3f90 EgtMachKernel :
- velocizzata GetEMkVer che rallentava assegnazione della variabile lua con versione della dll (specie in verifica aree protette)
- migliorata verifica extracorse in calcolo assi centri di lavoro.
2025-09-30 08:25:27 +02:00
Dario Sassi 34a26f7d3e EgtMachKernel :
- aggiunto controllo corse sui valori assegnati agli assi correnti in EmtAddClimb e EmtAddRise (con errore lua).
2025-09-26 19:03:35 +02:00
Dario Sassi bf8fd98d8c EgtMachKernel :
- aggiunto controllo corrispondenza tra numero valori assegnati e numero assi correnti a EmtAddClimb e EmtAddRise (con errore lua)
- in ManageSpecialLink ora anche in caso di errore in SpecialLink si torna false.
2025-09-26 11:26:33 +02:00
Dario Sassi f36c4288d4 EgtMacjìhKernel :
- aggiunto nella simulazione (SP e MP) il controllo che il numero di valori assegnati sia uguale al numero di assi correnti.
2025-09-25 19:36:16 +02:00
Dario Sassi d78003437d EgtMachKernel 2.7i3 :
- nella verifica collisione della simulazione negli oggetti sorgente è possibile indicare il nome degli oggetti bersaglio da ignorare (CollSkip=Name).
2025-09-24 17:21:29 +02:00
Riccardo Elitropi f2a70b9fe0 EgtMachKernel :
- in PocketingNT pulizia codice e piccola correzione per casi a Spirale.
2025-09-16 10:29:56 +02:00
Dario Sassi 2e5caf2def EgtMachKernel :
- da GetPositions di Machine eliminato parametro nStat inutile
- da GetCalcPositions di MachMgr eliminato lo stesso parametro
- nei robot ora si assegna sempre BackAuxDir
- migliorato calcolo angoli nei robot.
2025-09-14 23:07:30 +02:00
Dario Sassi ec021af82f EgtMachKernel 2.7i2 :
- aggiunta in interfaccia funzione GetRobotAngles.
2025-09-10 08:54:09 +02:00
Dario Sassi d0383b7949 EgtMachKernel :
- in lavorazione 5assi aggiunta gestione parametro SingConeAng da UserNotes (angolo di apertura del cono di direzioni equivalenti a quella singolare).
2025-09-08 11:03:42 +02:00
Riccardo Elitropi c2fc8dabf5 EgtMachKernel :
- in finiture Optimal di tipo ZigZag aggiunta la possibilità di scelta del SideAngle.
2025-09-08 08:21:13 +02:00
Dario Sassi ff143a7fc5 EgtMachKernel :
- corretto nome parametro passato a script per lavorazione 5assi (EMC.TTHICK).
2025-09-05 20:18:51 +02:00
Dario Sassi bd03f0f259 EgtMachKernel :
- prime modifiche per la gestione della direzione singolare nei centri di lavoro (con angolo di apertura del cono di coincidenza).
2025-09-05 19:39:27 +02:00
Riccardo Elitropi be7d023031 EgtMachKernel 2.7i1 :
- In Sgrossature aggiunta la possibilità di Ordinare i Chunk per piani o per Z locale.
2025-09-04 12:49:15 +02:00
Dario Sassi 266f125f2d EgtMachJernel :
- modifiche per permettere le superfici di Bezier nelle lavorazioni 5assi.
2025-08-29 12:36:27 +02:00
Riccardo Elitropi b66db767a0 EgtMachKernel :
- piccola correzione in VerifyGeometry per finiture e sgrossature per superfici di Bezier.
2025-08-29 11:32:39 +02:00
Dario Sassi e773b5b4f7 EgtMachKernel 2.7h4 :
- cambiata versione per non confondere con installata con CAM5.
2025-08-29 11:11:06 +02:00
Riccardo Elitropi 69711359f5 EgtMachKernel :
- in Sgrossature e Finiture aggiunta gestione superfici di Bezier.
2025-08-28 14:40:14 +02:00
Dario Sassi b569f7c631 EgtMachKernel :
- piccola miglioria.
2025-08-28 09:05:17 +02:00
Dario Sassi ed4df55645 EgtMachKernel 2.7h3 :
- in controllo collisione link a cavallo di cambio di fase aggiunta gestione riposizionamento pezzo con cambio origine asse tavola tramite script OnSpecialGetPrevMachiningOffset.
2025-08-26 08:07:15 +02:00
Dario Sassi 21512c7e2b EgtMachKernel 2.7h2 :
- GetClPathFinalCamData quando richiesto di saltare posizioni RISE ora salta anche posizioni HOME.
2025-08-22 18:27:43 +02:00
SaraP 59a2e60677 EgtMachKernel :
- in SawRoughing aggiunte nuove modalità ed estensioni varie per gestire spianature
- aggiunta preview.
2025-08-22 12:34:07 +02:00
SaraP ee01fe5516 EgtMachKernel :
- in pocketing nel caso di lucidatura a spirale forzate le elevazioni in ingresso e uscita al parametro impostato.
2025-08-20 14:25:22 +02:00
Dario Sassi dcbf9a497a EgtMachKernel :
- in GetRobotAngles aggiunti controlli dei limiti di corsa.
2025-08-13 18:09:06 +02:00
Dario Sassi e92a37aa4f EgtMachKernel :
- nel calcolo assi di robot ora si gestiscono anche MCH_SCC_ADIR_NEAR e MCH_SCC_ADIR_FAR.
2025-08-11 18:48:08 +02:00
Riccardo Elitropi bc6c7d8745 EgtMachKernel :
- in Finiture ZLevel migliorato l'ordinamento delle curve.
2025-08-07 17:00:27 +02:00
SaraP dc0bb1876f EgtMachKernel :
- in milling nel caso di lucidatura eliminato il limite sull'elevazione per lead in e lead out.
2025-08-04 15:18:41 +02:00
Riccardo Elitropi ca562d1c29 EgtMachKernel :
- in Sgrossature, aggiornamento e correzione funzioni di deubg.
2025-08-04 14:34:50 +02:00
Dario Sassi be6750fd14 EgtMachKernel :
- correzioni per controllo punto medio con centri di lavoro e robot.
2025-08-04 07:59:59 +02:00
Dario Sassi 3f8d6867e2 EgtMachKernel 2.7h1 :
- in simulazione corretta segnalazione extracorsa per robot
- aggiunta gestione suggerimento angoli iniziali come home con comando "Home".
2025-08-03 13:37:44 +02:00
Riccardo Elitropi 9d447b875b EgtMachKernel :
- in SurfFinishing aggiunto vincolo per Depth rispetto al grezzo e per tipo Optimal aggiunto Flag "OptimalType".
2025-08-01 16:33:08 +02:00
Riccardo Elitropi 15dd5d78e3 Merge branch 'master' of https://gitlab.steamware.net/egaltech/EgtMachKernel 2025-07-30 13:20:20 +02:00
Riccardo Elitropi 8f01a11205 EgtMachKernel :
- in Sgrossature migliorata la gestione di PlaneZ, corretta gestione Silhouette con Offset radiali e migliorati i collegamenti tra i percorsi di sgrossatura tra Step e Chunks.
2025-07-30 13:20:14 +02:00
Dario Sassi 21459f66d7 EgtMachKernel 2.7g5 :
- modifiche per controllo punto medio nel calcolo assi robot.
2025-07-30 07:47:12 +02:00
Dario Sassi 517a1021b5 EgtMachKernel 2.7g4 :
- correione ad AdjustOneStartEndMovement (si aggiunge RISE anche a percorso finale di lavorazione precedente se non già presente)
- in Rise e Climb per robot setto Flag2 a -1 per i punti intermedi aggiunti per garantire la traiettoria
- nelle funzioni lua EmtAddRapidMove e EmtAddLinearMove aggiunto parametro opzionale Flag2.
2025-07-28 08:38:34 +02:00
Riccardo Elitropi 037c52c913 EgtGeomKernel :
- In SurfFinishing cambiata la gestione per il tipo Optimal
- In SurfFinishing aggiunto calcolo di elevazione della curva
- In SurfFinishing uniformate le funzioni per il calcolo del percorsi e migliorate/corrette le funzioni di LeadIn/LeadOut
- In SurfFinishing corretto il funzionamento del parametro di Overlap.
2025-07-24 16:56:19 +02:00
Riccardo Elitropi 857e96591a Merge branch 'master' of https://gitlab.steamware.net/egaltech/EgtMachKernel 2025-07-24 11:19:38 +02:00
Riccardo Elitropi 12abb88b28 EgtMachKernel :
- in PocketingNT aggiunta gestione con superfici di Trim.
2025-07-24 11:19:29 +02:00
Dario Sassi 1be259cf25 EgtMachKernel 2.7g3 :
- corretto IsEmpty per Disposition con ClPath vuoto per contenere solo comandi ausiliari.
2025-07-23 18:18:37 +02:00
Dario Sassi 56e949015f EgtMachKernel :
- correzioni a AddRawPart per superfici di Bezier.
2025-07-22 15:38:05 +02:00
Dario Sassi 85b76f68ff EgtMachKernel :
- modifiche a AddRawPart per gestire anche le superfici di Bezier.
2025-07-22 08:32:42 +02:00
Dario Sassi 156ec315e0 Merge branch 'master' of https://gitlab.steamware.net/egalware-cadcam/libreriebase/EgtMachKernel 2025-07-21 08:25:37 +02:00
Dario Sassi e851ed0a21 EgtMachKernel :
- in definizione grezzo da superficie aggiunta verifica che questa sia chiusa.
2025-07-21 08:24:09 +02:00
SaraP fcc2289b93 EgtMachKernel :
- in waterjet ignorati tratti di lavorazione piccoli nella gestione dei corners.
2025-07-17 11:10:21 +02:00
Riccardo Elitropi 8066f937e2 Merge commit '38b61c567614a87695520af4b90192654c50c731' 2025-07-14 10:24:18 +02:00
Riccardo Elitropi 38b61c5676 EgtMachKernel :
- Nelle finiture non vengono più calcolate le regioni non svuotate.
2025-07-14 10:23:31 +02:00
Dario Sassi 7282af4d9d Merge commit '7a62031eb4d7aed732c4c52b676533f831dfb197' 2025-07-11 16:21:19 +02:00
Riccardo Elitropi 7a62031eb4 EgtMachKernel :
- piccola correzione in Sgrossature.
2025-07-11 15:46:12 +02:00
Riccardo Elitropi 593545bc54 Merge commit 'c6903e1cadb19b2b05d5a29e8d08fbd82d0d1332' into feature/Svuotature 2025-07-10 10:53:39 +02:00
Dario Sassi c6903e1cad EgtMachKernel :
- in finitura superfici correzioni per esplosione archi.
2025-07-10 10:33:02 +02:00
Dario Sassi ff4df06a3a EgtMachKernel :
- in sgrossature superfici correzione per esplosione archi.
2025-07-10 09:34:33 +02:00
Dario Sassi dbbbfb67fc EgtMachKernel :
- piccola modifica per NewLinkManager.
2025-07-09 18:33:36 +02:00
Dario Sassi e39fbd8707 EgtMachKernel 2.7g2 :
- ulteriori modifiche per NewLinkManager.
2025-07-09 12:41:28 +02:00
Riccardo Elitropi db7defa9ce Merge commit '2ed88f66e9daa224e881c6be61bb5a7616b0e349' into feature/Svuotature 2025-07-07 15:15:48 +02:00
Dario Sassi 2ed88f66e9 EgtMachKernel :
- prime modifiche per nuova versionedi NewLinkMgr (aggiunta OnSpecialLink).
2025-07-07 15:01:59 +02:00
Dario Sassi 3283f1780f Merge commit '3d31988979706c38178e8b31bf5cb52ef9576861' 2025-07-02 17:23:10 +02:00
Riccardo Elitropi 3d31988979 Merge commit '0c3e6c83d232af62f578ecc176f16f8dfbbccaaa' into feature/Svuotature 2025-07-02 11:38:00 +02:00
Riccardo Elitropi aa431b341e EgtMachKernel :
- in SurfFinishing migliorata la finitura Optimal
- in SurfRoughing migliorata la funzione GetRaw().
2025-07-02 11:37:40 +02:00
Dario Sassi 0c3e6c83d2 EgtMachKernel :
- aggiunta funzione lua EmtGetCurrAxesHomePos.
2025-07-02 08:57:03 +02:00
Dario Sassi d7fadcb596 EgtMachKernel 2.7g1 :
- riportate su tutte le lavorazioni le modifiche in Update prima fatte solo a milling.
2025-07-02 08:22:00 +02:00
Dario Sassi 407cbaccfa EgtMachKernel :
- modifica alla funzione lua EmtAddClimb per inserire il movimento di discesa prima della lavorazione e dopo eventuali altre discese già inserite.
2025-07-01 15:22:33 +02:00
Dario Sassi 10bdf80b2a EgtMachKernel :
- aggiunte funzioni lua EmtAddClimb, EmtRemoveClimb, EmtAddRise, EmtRemoveRise, EmtGetInitialAxesPos e EmtGetFinalAxesPos
- prime modifiche per gestione custom dei link tra lavorazioni in OnPostApplyMachining.
2025-06-30 11:46:46 +02:00
Riccardo Elitropi 3d6567fbce Merge commit '4a53f3522e0151ece0465b6f6c1884b08ea0fc9e' into feature/Svuotature 2025-06-30 07:43:18 +02:00
Dario Sassi 4a53f3522e EgtMachKernel 2.7f3 :
- ricompilazione con cambio versione.
2025-06-26 09:48:44 +02:00
Dario Sassi e99822f53e Merge commit 'de3dcb2985c738a9bbf16456387c0219aeafaf3c' 2025-06-25 16:46:16 +02:00
Riccardo Elitropi de3dcb2985 EgtMachKernel :
- Prima versione temporanea di finitura Pencil.
2025-06-25 15:52:48 +02:00
Riccardo Elitropi 30f164badf EgtMachKernel :
- in finiture rimozione classe PerformanceCounter per Debug.
2025-06-17 15:21:42 +02:00
Riccardo Elitropi ba9bf97372 EgtMachKernel :
- In finiture primo utilizzo delle funzioni di Offset per superfici di supporto
- in finiture semplicificazione e riorganizzazione del codice.
2025-06-17 14:31:12 +02:00
Riccardo Elitropi 478a23c3fe Merge commit 'e560a513fe859e43cb3b7744fadfa2d54f99e830' into feature/Svuotature 2025-06-16 11:21:36 +02:00
Dario Sassi e560a513fe EgtMachKernel :
- in mortasatura aggiunto tipo Plunge=10 per lavorazione a Step senza approccio e retrazione se possinìbile.
2025-06-11 19:21:23 +02:00
Dario Sassi 0ef8c7f046 EgtMachKernel :
- corretta gestione valore default della feed di taglio di lama inclinato.
2025-06-10 20:08:07 +02:00
Dario Sassi 44193063e1 EgtMachKernel 2.7f2 :
- aggiunto utensile di tipo Probe
- aggiunta lavorazione Probing.
2025-06-10 18:27:51 +02:00
Riccardo Elitropi 9475e732e6 Merge commit '1178e479e3e6127f821e0c964afb66ca637a4f61' into feature/Svuotature 2025-06-10 16:27:58 +02:00
Dario Sassi 36eeb042a1 Merge commit '30f73c9bf44c4cb8d62726bcedef8dace9e2b9ab' 2025-06-09 16:59:53 +02:00
Riccardo Elitropi 30f73c9bf4 EgtMachKernel :
- in PocketingNT aggiunto richiamo alla funzione GetSideStep per CalcPocketing.
2025-06-09 11:36:50 +02:00
Dario Sassi 1178e479e3 EgtMachKernel 2.7f1 :
- modifiche per gestione traccia utensile in simulazione SP.
2025-06-08 19:12:04 +02:00
Dario Sassi a48fa50c85 EgtMachKernel :
- in simulazione SP prime sviluppi per tooltip trace.
2025-06-06 16:06:49 +02:00
Dario Sassi 124c9dbcbc Merge remote-tracking branch 'origin/feature/Svuotature' 2025-06-06 15:44:11 +02:00
Riccardo Elitropi b156731e1e Merge commit 'f80d776b79aba0579e1e599a3534f9b1f4ba1cb7' into feature/Svuotature 2025-06-05 07:45:39 +02:00
SaraP f80d776b79 EgtMachKernel :
- piccole correzioni WaterJet.
2025-06-04 16:34:00 +02:00
Riccardo Elitropi 1347f472bc EgtMachKernel :
- in PocketingNT migliorato il controllo sul raggio massimo per LeadIn ad Elica nel caso di percorsi SpiralCirle.
2025-06-04 16:29:09 +02:00
Riccardo Elitropi c6dea02b61 Merge commit 'b8fb4336cbc46ea32d1eafeb630a303bab7b2534' into feature/Svuotature 2025-06-03 07:39:47 +02:00
Dario Sassi b8fb4336cb EgtMachKernel :
- prime modifiche per gestione TipTrace in simulazione.
2025-05-31 12:32:20 +02:00
Dario Sassi 29214d1d1a Merge commit '24f1a214e2ea25111b008387b6a3c2bc9ab2c30d' 2025-05-30 12:25:13 +02:00
Riccardo Elitropi 24f1a214e2 EgtMachKernel :
- in PocketingNT e SurfFinishing aggiunto migliorato il ricalcolo automatico della lavorazione
- mofifica parametri per CalcPocketing.
2025-05-30 11:50:21 +02:00
Dario Sassi 2a81e2e663 Merge commit '1e3d46cab2e1cb4b08640871048e688e78e8b08a' 2025-05-29 18:47:29 +02:00
Riccardo Elitropi 1e3d46cab2 EgtMachKernel :
- In PocketingNT migliorata la gestione del punto di inizio della lavorazione e semplificazione del codice.
2025-05-29 17:40:02 +02:00
Riccardo Elitropi 2a98f7bb19 Merge commit '4e26f19263df3d8daf3f07a2b2934f7a656f6986' into feature/Svuotature 2025-05-29 08:38:28 +02:00
Dario Sassi 4e26f19263 Merge branch 'master' of https://gitlab.steamware.net/egalware-cadcam/libreriebase/EgtMachKernel 2025-05-28 18:41:30 +02:00
Riccardo Elitropi cdd9e14432 Merge commit 'b52a8a19611c0c1153fe647cac9d19908e4ea5db' into feature/Svuotature 2025-05-28 17:24:29 +02:00
SaraP b52a8a1961 EgtMachKernel :
- in WaterJet ripristinata estrusione della curva dopo l'offset.
2025-05-28 17:18:50 +02:00
Dario Sassi 9b33939103 Merge commit 'd26fcbc23dc94c50b4a0a4e31ebdece558fd3630' 2025-05-28 15:59:11 +02:00
Riccardo Elitropi d26fcbc23d EgtMachKernel :
- In PocketingNT aggiunta gestione di Step=0 per calcolo della Depth.
2025-05-28 12:48:53 +02:00
Dario Sassi 50912975bd Merge commit 'f8280502c4a911d2f51f223efa7601d5edcd30cb' 2025-05-27 15:15:03 +02:00
Riccardo Elitropi f8280502c4 EgtMachKernel :
- In PocketingNT aggiunta gestione dei percorsi di ritorno per curve SpiralCircle.
2025-05-27 14:30:20 +02:00
Dario Sassi 8c2edb8f82 EgtMachKernel 2.7e4 :
- ricompilazione con cambio versione.
2025-05-26 19:29:15 +02:00
Dario Sassi 7827558a75 Merge commit 'a9235ea92c6ed787f038262f20aff6cdde92cd67' 2025-05-26 17:42:35 +02:00
Riccardo Elitropi a9235ea92c EgtMachKernel :
- in PocketingNT piccola miglioria su Entrate/Uscite a scivolo.
2025-05-26 12:28:41 +02:00
Riccardo Elitropi 30ab372cf7 Merge commit 'cd853756aa70e5e98bee1226a79c4985c44bc83d' into feature/Svuotature 2025-05-26 12:26:31 +02:00
Dario Sassi cd853756aa EgtMachKernel 2.7e3 :
- cambio versione.
2025-05-23 09:58:12 +02:00
Dario Sassi b35086ab6d Merge commit '322336174b842fa1015a0679593525e9b3b44fab' 2025-05-23 09:46:29 +02:00
Riccardo Elitropi 322336174b EgtMachKernel :
- in PocketingNT aggiunto parametro da note utente "AdjustFeed" per il calcolo della Feed.
2025-05-23 09:32:05 +02:00
Dario Sassi 040ac8c333 Merge commit '348ecd74bd19d3924431f29cda43a275cf3405ea' 2025-05-22 19:33:27 +02:00
Riccardo Elitropi 348ecd74bd EgtMachKernel :
- in PocketingNT aggiunta funzione per scelta del punto iniziale di riferimento in base alla geometria.
2025-05-22 16:04:00 +02:00
Dario Sassi 7e36ba12ec Merge commit 'f813db1bc772df731ed9179b1ec60fcd82141dd4' 2025-05-22 13:08:30 +02:00
Riccardo Elitropi f813db1bc7 EgtMachKernel :
- In Pocketing aumentata la distanza di ricerca per il punto di ingresso da fuori.
2025-05-22 13:07:18 +02:00
Riccardo Elitropi b20cd3b6d8 EgtMachKernel :
- In PocketingNT rimossi commenti in eccesso.
2025-05-22 12:04:05 +02:00
Dario Sassi ddfa249469 Merge commit '1a15584126c1eb401c6bed1eabc35f314db92834' 2025-05-21 17:33:58 +02:00
Riccardo Elitropi 1a15584126 Merge commit '82e21c419fd8ef5176f588fb52424f96721b11d0' into feature/Svuotature 2025-05-21 16:50:06 +02:00
Riccardo Elitropi f4c8541922 EgtMachKernel :
- In PocketingNT gestiti gli step al di sotto del grezzo e migliorati i controlli sulle estensioni delle regioni di svuotatura alle proiezioni del grezzo.
2025-05-21 16:49:40 +02:00
Dario Sassi 82e21c419f Merge commit '47b251d0e95185be3c4faab04ae53c2f5212fdde' 2025-05-20 19:28:52 +02:00
Riccardo Elitropi 47b251d0e9 EgtMachKernel :
- in PocketingNT aggiunta funzione di Debug per Feed.
2025-05-20 17:05:43 +02:00
Riccardo Elitropi e4e9ac66c9 Merge commit '950d54f48678d9827b72979469086515f286913d' into feature/Svuotature 2025-05-20 09:09:18 +02:00
Dario Sassi 950d54f486 EgtMachKernel :
- modifiche quasi estetiche a PocketingNT.
2025-05-19 17:40:29 +02:00
Riccardo Elitropi 180c635752 Merge commit '76ef5453b01a948a1c191429362b0b2c6e8281a1' into feature/Svuotature 2025-05-19 08:18:51 +02:00
Dario Sassi 76ef5453b0 EgtMachKernel :
- modifica per migliorare compatibilità con versione precedente nella gestione link tra lavorazioni.
2025-05-19 08:16:18 +02:00
Dario Sassi 4f629ea069 Merge commit '2d217b307b41e0e235927ca71676d2944c52c355' 2025-05-16 18:04:11 +02:00
Riccardo Elitropi 2d217b307b EgtMachKernel :
- in PocketingNT modifica punto iniziale delle lavorazioni a seconda del raggio utensile.
2025-05-16 16:54:22 +02:00
Riccardo Elitropi 11076fde17 EgtMachKernel :
- in PocketingNT corretto errore su estensione lati aperti nel grezzo, uniformati i nomi delle funzioni di Debug e aggiunto controllo su MaxDepth per lavorazioni tutte Open a più Steps.
2025-05-16 15:47:50 +02:00
Dario Sassi 0146a0023d Merge commit 'a6a40e29731253e999424d40bebb7023209ba979' 2025-05-15 17:04:25 +02:00
Riccardo Elitropi a6a40e2973 EgtMachKernel :
- In Pocketing NT migliorate le entrate, i raccordi tra percorsi e aggiunto parametro MaxOptSize
- In Sgrossature, correzione su Open Edges ed Offset radiali per regioni Silhouettes.
2025-05-15 16:27:05 +02:00
Dario Sassi ba539e0c51 Merge commit 'f6d62372df90ae8b79cf2cb5d44a565ab29ef31a' 2025-05-14 17:58:32 +02:00
Riccardo Elitropi f6d62372df Merge commit '662241c8e1560612c1a74185bbf415707a9bdb71' into feature/Svuotature 2025-05-13 11:52:41 +02:00
Riccardo Elitropi 581a606740 EgtMachKernel :
- in PocketingNT migliorati i controlli di inversione utensili e di LeadIn/Out di tipo Glide.
2025-05-13 11:40:23 +02:00
Dario Sassi 662241c8e1 EgtMachKernel 2.7e2 :
- modifiche per gestione lavorazioni con percorsi vuoti.
2025-05-12 09:47:18 +02:00
Dario Sassi 39a03c7b93 Merge commit '15a8df7f30f14d069811ebf110b12c99bf410722' 2025-05-09 20:01:10 +02:00
Riccardo Elitropi 15a8df7f30 EgtMachKernel :
- In PocketingNT aggiunta la gestione dei lati aperti interni al grezzo.
- Rimozione parametro in eccesso per ModifyRawPart.
2025-05-09 16:11:45 +02:00
Riccardo Elitropi 785e9d8518 Merge commit '5f2c853d42aec0c985049ca01fb0c2065ee2e17c' into feature/Svuotature 2025-05-08 10:03:56 +02:00
Dario Sassi 5f2c853d42 EgtMachKernel :
- ulteriori miglioramenti a AddRawPart con grezzo da Trimesh.
2025-05-08 09:02:34 +02:00
Dario Sassi 2d00e94965 EgtMachKernel :
- in AddRawPart ora si usa il calcolo silhouette con ICAvParSilhouettesSurfTm per eliminare rallentamenti enormi con superfici complesse.
2025-05-07 20:10:01 +02:00
Dario Sassi 7c1ce50238 Merge commit '46aac18715bcc1154b25ca1133d97313812881eb' 2025-05-07 15:03:25 +02:00
Riccardo Elitropi 46aac18715 EgtMachKernel :
- in PockeitngNT aggiunto controllo per collegamenti lineari tra percorsi.
2025-05-07 15:01:09 +02:00
Dario Sassi 6c63817dbc Merge commit '9b5995a0737309cf73fc1ed1e7b35462691cb38c' 2025-05-07 08:44:30 +02:00
Riccardo Elitropi 9b5995a073 EgtMachKernel :
- piccole migliorie per PocketingNT
- migliorato il controllo per nStep alla funzione AddLinearMove in Operation.
2025-05-06 17:06:41 +02:00
Dario Sassi b102e9ea67 Merge commit '16970fff3c2d0a96dc01544b8d1cd0a5d64b3f11' 2025-05-05 17:07:57 +02:00
Riccardo Elitropi 16970fff3c EgtMachKernel :
- in PocketingNT aggiunta elevazione extra tra i percorsi di lavorazione.
2025-05-05 16:58:04 +02:00
Dario Sassi cd37b8282d Merge commit '156965315073c2c05d0674efa3896db455021f1d' 2025-05-05 16:19:16 +02:00
Riccardo Elitropi 1569653150 EgtMachKernel :
- in PocketingNT correzione errore.
2025-05-05 13:01:52 +02:00
Dario Sassi b8a47c00ef Merge commit '77bd37f9f7b28be9ad29558503b1a4a00b945f29' 2025-05-05 12:26:35 +02:00
Riccardo Elitropi 77bd37f9f7 EgtMachKernel :
- in PocketingNT aggiunto controllo per AddApproach.
2025-05-05 12:24:19 +02:00
Riccardo Elitropi 29a34528ce Merge commit '5104da23b09cf5da460740fb9ebaf227676208aa' into feature/Svuotature 2025-05-05 09:13:40 +02:00
Riccardo Elitropi 57acbc93b4 EgtMachKernel :
- piccola miglioria ad Apply in PocketingNT.
2025-05-05 09:13:02 +02:00
Dario Sassi 5104da23b0 EgtMachKernel 2.7e1 :
- possibilità di scegliere la classe di Pocketing da ini dell'eseguibile ([Mach] Pocketing=1/2)
- modifiche a PocketingNT per compatibilità con robot.
2025-05-02 19:08:38 +02:00
Dario Sassi 3b93e47fe7 EgtMachKernel :
- correzioni per movimenti in rapido con robot.
2025-04-30 11:21:23 +02:00
Riccardo Elitropi 939ca329a8 Merge commit 'af5522547c245470b7755d2ebf4b2972200fd378' into feature/Svuotature 2025-04-28 08:05:33 +02:00
Dario Sassi af5522547c EgtMachKernel :
- modifica per gestire visualizzazione frecce di lavorazioni 5assi.
2025-04-24 07:46:43 +02:00
Riccardo Elitropi 2dee4d8ded Merge commit '34e96d1f06dceb5c8b8eb22351ae87a7b87d8d8f' into feature/Svuotature 2025-04-23 14:50:04 +02:00
Dario Sassi 34e96d1f06 EgtMachKernel :
- corretta gestione inserimento/cancellazione punti intermedi aggiunti per cambio direzione utensile.
2025-04-23 12:20:03 +02:00
Dario Sassi fc03d2f737 Merge commit 'b33463117ff279203a0e9e1d3aff1578a05e3d58' 2025-04-22 11:26:25 +02:00
Riccardo Elitropi b33463117f EgtMachKernel :
- Piccola miglioria per Offset sgrossature.
2025-04-22 11:23:02 +02:00
Riccardo Elitropi 1951c517fa Merge commit 'f8258883ab14995cdfc22158a8a1bf177963a4da' into feature/Svuotature 2025-04-22 08:14:19 +02:00
Dario Sassi f8258883ab EgtMachKernel 2.7d3 :
- ricompilazione con cambio versione.
2025-04-21 11:19:48 +02:00
Dario Sassi 6bd14f9948 EgtMachKernel :
- aggiunto a assi macchina il dato Use per classificarli come generali, di disposizione o altro (solo i generali che non dipendono da una tavola possono essere usati per i movimenti di lavorazione).
2025-04-18 08:51:16 +02:00
Dario Sassi ddef3e7654 EgtMachKernel :
- correzione per gestire gruppi a forare da sotto.
2025-04-16 11:15:20 +02:00
Dario Sassi 848701033b EgtMachKernel 2.7d2 :
- aggiunta possibilità di definire ordine movimenti tra testa e tavola per i link tra lavorazioni (LinkAxesMoveOrder di EmtGeneral con valori LKAMO_*).
2025-04-15 11:48:33 +02:00
Dario Sassi ef28db40e1 EgtMachKernel :
- a fresatura aggiunta gestione lista di curve per FaceUse tramite "EdgesFaceUse" con valori a vettore di interi in UserNotes
- in tutte le lavorazioni sistemato ricalcolo con stato con bit MCH_ST_GEO_MODIF impostato
- in tutte le lavorazioni SetGeometry imposta bit MCH_ST_GEO_MODIF solo se gli Id e i SubId delle geometrie sono effettivamente variati.
2025-04-07 11:54:28 +02:00
Dario Sassi c944dd9893 EgtMachKernel 2.7d1 :
- in fresature e svuotature aggiunti nome "SI" ad approcci in feed e "SO" a retrazioni in feed.
2025-04-03 09:13:50 +02:00
Riccardo Elitropi bf968abc1c Merge commit '029ed15541dcfec1cde901ab33ed4fe4d62f7e19' into feature/Svuotature 2025-03-27 12:47:20 +01:00
Dario Sassi 029ed15541 EgtMachKernel :
- i punti intermedi aggiunti per garantire movimento punta utensile al cambio di orientamento sono ora basati su punti e non più su linee (potrebbero essere estremamente vicini).
2025-03-25 11:22:53 +01:00
Dario Sassi a8c366693e Merge commit '474a645e207a88a29d7e763bf0c7a31eb98dda7f' 2025-03-25 11:05:40 +01:00
Riccardo Elitropi 474a645e20 EgtMachKernel :
- in Sgrossature, aggiunta gestione per superfici di controllo.
2025-03-25 09:46:14 +01:00
Riccardo Elitropi 01fbdd9a50 Merge commit 'a127db39f0130a0a5d15a2262af1ea6f1b281c15' into feature/Svuotature 2025-03-25 09:44:49 +01:00
Dario Sassi a127db39f0 EgtMachKernel 2.7c3 :
- modifiche per poter costruire DB utensili e lavorazioni partendo da zero.
2025-03-21 19:09:01 +01:00
Dario Sassi 689cea1156 Merge commit '866c4dde45f04a01f445d358d799c053d602e82a' 2025-03-13 17:43:11 +01:00
Riccardo Elitropi 866c4dde45 Merge commit '6e6050ab13deb8c705f816102619f1d172992446' into feature/Svuotature 2025-03-13 12:34:15 +01:00
Riccardo Elitropi c513cd7440 EgtMachKernel :
- Aggiornamento PocketingNT.
2025-03-13 12:33:41 +01:00
Dario Sassi 6e6050ab13 EgtMachKernel :
- in FiveAxisMilling aggiunta inizializzazione m_bRunning alla creazione dell'oggetto
- nel controllo punto medio per calcolo angoli macchina accetto di non poter mediare direzioni Correzione.
2025-03-12 15:29:28 +01:00
Dario Sassi 546855a519 Merge commit '78ab2c2a52e0ac8fedd73bb15146c95398878d41' 2025-03-11 14:37:24 +01:00
Riccardo Elitropi 78ab2c2a52 Merge commit '156302009f166a0afb88e8113163ee1d246966c0' into feature/Svuotature 2025-03-11 11:19:05 +01:00
Riccardo Elitropi 09fd122b30 EgtMachKernel :
- Migliorie a finiture Optimal e ZConst.
- controllo validità curve per Sgrossature.
2025-03-11 11:18:51 +01:00
Dario Sassi 156302009f EgtMachKernel 2.7c2 :
- agli script ToolMaker passate anche le note di sistema (TOOL.SYSNOTES).
2025-03-07 10:36:19 +01:00
Dario Sassi 094bc252fe EgtMachKernel :
- in sgrossature superfici migliorata gestione massimo affondamento ed eventuale ultima passata appena oltre il grezzo.
2025-03-07 10:23:11 +01:00
Dario Sassi 9e5f78a549 EgtMachKernel 2.7c1 :
- ricompilazione con cambio versione.
2025-03-06 20:12:01 +01:00
Dario Sassi ca9b827a18 Merge commit 'fef634f7e873d5a176696b5635dde34fe10ba048' 2025-03-06 18:01:04 +01:00
Riccardo Elitropi fef634f7e8 EgtMachKernel :
- In finiture Optimal aggiunto parametro da note "SplitAngle"
2025-03-05 08:42:41 +01:00
Riccardo Elitropi ba3330edca EgtMachKernel :
- Semplificati i controlli per finiture Optimal.
- Aggiunto parametro alla funzione CalcPocketing.
2025-03-04 17:44:23 +01:00
Riccardo Elitropi aa74f23c63 Merge commit '727025d2311ce1b8d464fc85ebe52b713f3a7a53' into feature/Svuotature 2025-03-04 08:07:04 +01:00
Dario Sassi 727025d231 EgtMachKernel :
- ripristino stato progetto se non si riesce ad impostare il gruppo corrente causa errore in disposizione
- in finitura superfici modifica offset silhouette per eliminazione punti inutili a Zminima.
2025-03-03 17:24:57 +01:00
Dario Sassi f1cb57e084 Merge commit '9859428de5589f032662ef0b9227001c14855c1a' 2025-03-03 15:55:40 +01:00
Riccardo Elitropi 9859428de5 EgtMachKernel :
- in finiture Optimal, corretti casi ambigui di Marching Squares.
2025-03-03 15:26:00 +01:00
Riccardo Elitropi 22fe666cc1 Merge commit 'f8405a79708c3cf34845b927c2742463062ae05f' 2025-02-21 11:15:50 +01:00
85 changed files with 17159 additions and 5594 deletions
+6 -3
View File
@@ -50,6 +50,7 @@ Axis::Clone( void) const
pAx->m_bInvert = m_bInvert ;
pAx->m_dOffset = m_dOffset ;
pAx->m_nType = m_nType ;
pAx->m_nUse = m_nUse ;
pAx->m_ptPos = m_ptPos ;
pAx->m_vtDir = m_vtDir ;
pAx->m_Stroke = m_Stroke ;
@@ -74,6 +75,7 @@ Axis::Dump( string& sOut, bool bMM, const char* szNewLine) const
sOut += "Name=" + m_sName + szNewLine ;
sOut += "Token=" + m_sToken + szNewLine ;
sOut += "Type=" + ToString( m_nType) + szNewLine ;
sOut += "Use=" + ToString( m_nUse) + szNewLine ;
sOut += "Pos=" + ToString( GetInUiUnits( m_ptPos, bMM), 4) + szNewLine ;
sOut += "Dir=" + ToString( m_vtDir) + szNewLine ;
if ( m_nType == MCH_AT_LINEAR)
@@ -113,20 +115,21 @@ Axis::GetGeomDB( void) const
//----------------------------------------------------------------------------
Axis::Axis( void)
: m_nOwnerId( GDB_ID_NULL), m_pGeomDB( nullptr), m_bInvert( false), m_dOffset( 0),
m_nType( MCH_AT_NONE), m_Stroke( {{0,0}}), m_dHomeVal( 0), m_dCurrVal( 0)
m_nType( MCH_AT_NONE), m_nUse( MCH_AU_NONE), m_Stroke( {{0,0}}), m_dHomeVal( 0), m_dCurrVal( 0)
{
}
//----------------------------------------------------------------------------
bool
Axis::Set( const string& sName, const string& sToken, bool bInvert, double dOffset,
int nType, const Point3d& ptPos, const Vector3d& vtDir, const STROKE& Stroke, double dHome)
int nType, int nUse, const Point3d& ptPos, const Vector3d& vtDir, const STROKE& Stroke, double dHome)
{
m_sName = sName ;
m_sToken = sToken ;
m_bInvert = bInvert ;
m_dOffset = dOffset ;
m_nType = nType ;
m_nType = ( nType == MCH_AT_ROTARY ? MCH_AT_ROTARY : MCH_AT_LINEAR) ;
m_nUse = (( nUse == MCH_AU_DISPOSITION || nUse == MCH_AU_AUXILIAR) ? nUse : MCH_AU_GENERAL) ;
m_ptPos = ptPos ;
m_vtDir = vtDir ;
m_Stroke = Stroke ;
+7 -4
View File
@@ -1,13 +1,13 @@
//----------------------------------------------------------------------------
// EgalTech 2015-2022
// EgalTech 2015-2025
//----------------------------------------------------------------------------
// File : Axis.h Data : 21.09.22 Versione : 2.4i
// File : Axis.h Data : 17.04.25 Versione : 2.7d2
// Contenuto : Dichiarazione della classe Axis.
//
//
//
// Modifiche : 24.05.15 DS Creazione modulo.
//
// 17.04.25 DS Aggiunto campo Use.
//
//----------------------------------------------------------------------------
@@ -31,7 +31,7 @@ class Axis : public IUserObj
public :
Axis( void) ;
bool Set( const std::string& sName, const std::string& sToken, bool bInvert, double dOffset,
int nType, const Point3d& ptPos, const Vector3d& vtDir, const STROKE& Stroke, double dHome) ;
int nType, int nUse, const Point3d& ptPos, const Vector3d& vtDir, const STROKE& Stroke, double dHome) ;
bool Modify( const Point3d& ptPos, double dAxisMaxAdjust) ;
bool Modify( const Vector3d& vtDir, double dAxisMaxRotAdj) ;
bool Modify( const STROKE& Stroke) ;
@@ -48,6 +48,8 @@ class Axis : public IUserObj
{ return m_dOffset ; }
int GetType( void) const
{ return m_nType ; }
int GetUse( void) const
{ return m_nUse ; }
const Point3d& GetPos( void) const
{ return m_ptPos ; }
const Vector3d& GetDir( void) const
@@ -67,6 +69,7 @@ class Axis : public IUserObj
bool m_bInvert ;
double m_dOffset ;
int m_nType ;
int m_nUse ;
Point3d m_ptPos ;
Vector3d m_vtDir ;
STROKE m_Stroke ;
+2
View File
@@ -72,6 +72,8 @@ class CamData : public IUserObj
{ m_bToolShow = bShow ; return true ; }
int GetMoveType( void) const
{ return m_nMove ; }
bool IsRapid( void) const
{ return ( m_nMove == 0) ; }
bool IsLine( void) const
{ return ( m_nMove == 0 || m_nMove == 1) ; }
bool IsArc( void) const
+35 -20
View File
@@ -44,6 +44,7 @@ using namespace std ;
// 2910 = "Error in Chiseling : link movements not calculable"
// 2911 = "Error in Chiseling : link outstroke xx"
// 2912 = "Error in Chiseling : post apply not calculable"
// 2913 = "Error in Chiseling : special apply not calculable"
// 2951 = "Warning in Chiseling : Skipped entity (xx)"
// 2952 = "Warning in Chiseling : Plunges not found"
// 2953 = "Warning in Chiseling : Tool name changed (xx)"
@@ -397,7 +398,8 @@ Chiseling::SetGeometry( const SELVECTOR& vIds)
// verifico validità gestore DB geometrico
if ( m_pGeomDB == nullptr)
return false ;
// reset della geometria corrente
// copia temporanea e reset della geometria corrente
SELVECTOR vOldId = m_vId ;
m_vId.clear() ;
// verifico che gli identificativi rappresentino delle entità ammissibili (tutte curve o tutte facce)
int nType = GEO_NONE ;
@@ -413,7 +415,8 @@ Chiseling::SetGeometry( const SELVECTOR& vIds)
m_vId.emplace_back( Id) ;
}
// aggiorno lo stato
m_nStatus |= MCH_ST_GEO_MODIF ;
if ( m_vId != vOldId)
m_nStatus |= MCH_ST_GEO_MODIF ;
// restituisco presenza geometria da lavorare
return ( ! m_vId.empty() || vIds.empty()) ;
}
@@ -495,15 +498,17 @@ Chiseling::Apply( bool bRecalc, bool bPostApply)
return false ;
// aggiorno dati geometrici dell'utensile
bool bToolChanged = true ;
if ( ! UpdateToolData( &bToolChanged)) {
if ( ! UpdateToolData()) {
m_pMchMgr->SetLastError( 2901, "Error in Chiseling : UpdateToolData failed") ;
return false ;
}
// se modificata geometria, necessario ricalcolo
if ( ( m_nStatus & MCH_ST_GEO_MODIF) != 0)
bRecalc = true ;
// verifico se necessario continuare nell'aggiornamento
if ( ! bRecalc && ! bToolChanged &&
( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) {
if ( ! bRecalc && ( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) {
// confermo i percorsi di lavorazione
m_nChisels = nCurrChisels ;
string sLog = string( "Chiseling apply skipped : status ") + ( m_nStatus == MCH_ST_OK ? "already ok" : "no postapply") ;
@@ -616,6 +621,19 @@ Chiseling::Update( bool bPostApply)
return false ;
}
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
CalcAndSetAxesBBox() ;
// esecuzione eventuali personalizzazioni speciali
string sSpecErr ;
if ( bPostApply && ! SpecialApply( sSpecErr)) {
if ( ! IsEmptyOrSpaces( sSpecErr))
m_pMchMgr->SetLastError( 2913, sSpecErr) ;
else
m_pMchMgr->SetLastError( 2913, "Error in Chiseling : special apply not calculable") ;
return false ;
}
// gestione movimenti all'inizio di ogni singolo percorso di lavorazione e alla fine della lavorazione
if ( ! AdjustStartEndMovements()) {
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
@@ -626,14 +644,11 @@ Chiseling::Update( bool bPostApply)
return false ;
}
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
CalcAndSetAxesBBox() ;
// esecuzione eventuali personalizzazioni
string sErr ;
if ( bPostApply && ! PostApply( sErr)) {
if ( ! IsEmptyOrSpaces( sErr))
m_pMchMgr->SetLastError( 2912, sErr) ;
// esecuzione eventuali personalizzazioni finali
string sPostErr ;
if ( bPostApply && ! PostApply( sPostErr)) {
if ( ! IsEmptyOrSpaces( sPostErr))
m_pMchMgr->SetLastError( 2912, sPostErr) ;
else
m_pMchMgr->SetLastError( 2912, "Error in Chiseling : post apply not calculable") ;
return false ;
@@ -763,7 +778,7 @@ Chiseling::GetToolData( void) const
//----------------------------------------------------------------------------
bool
Chiseling::UpdateToolData( bool* pbChanged)
Chiseling::UpdateToolData( void)
{
// recupero il gestore DB utensili della macchina corrente
ToolsMgr* pTMgr = m_pMchMgr->GetCurrToolsMgr() ;
@@ -814,9 +829,9 @@ Chiseling::UpdateToolData( bool* pbChanged)
m_Params.m_sToolName + ")" ;
m_pMchMgr->SetWarning( 2954, sInfo) ;
}
// se definito parametro di ritorno, lo assegno
if ( pbChanged != nullptr)
*pbChanged = bChanged ;
// se modificato, aggiusto lo stato
if ( bChanged)
m_nStatus = MCH_ST_TO_VERIFY ;
return true ;
}
@@ -1016,7 +1031,7 @@ Chiseling::GetCurves( SelData Id, ICURVEPLIST& lstPC)
// la porto in globale
pCrvCompo->ToGlob( frGlob) ;
// sistemazioni varie
AdjustCurveFromSurf( pCrvCompo, TOOL_ORTHO, FACE_CONT, V_NULL, 0) ;
AdjustCurveFromSurf( pCrvCompo, TOOL_ORTHO, FACE_CONT, V_NULL, {}, 0) ;
// la restituisco
lstPC.emplace_back( Release( pCrvCompo)) ;
return true ;
@@ -1052,7 +1067,7 @@ Chiseling::GetCurves( SelData Id, ICURVEPLIST& lstPC)
// la porto in globale
pCrvCompo->ToGlob( frGlob) ;
// sistemazioni varie
AdjustCurveFromSurf( pCrvCompo, TOOL_ORTHO, FACE_CONT, V_NULL, 0) ;
AdjustCurveFromSurf( pCrvCompo, TOOL_ORTHO, FACE_CONT, V_NULL, {}, 0) ;
// la restituisco
lstPC.emplace_back( Release( pCrvCompo)) ;
}
+9 -3
View File
@@ -37,8 +37,14 @@ class Chiseling : public Machining
public : // Operation
int GetType( void) const override
{ return OPER_CHISELING ; }
bool IsEmpty( void) const override
{ return ( m_nChisels == 0) ; }
bool IsEmpty( int nEmptyType = NEED_GEOM) const override
{ if ( m_nChisels == 0)
return true ;
if ( nEmptyType == NEED_ONE_TP_OK)
return ( ! IsAtLeastOnePathOk()) ;
if ( nEmptyType == NEED_ALL_TP_OK)
return ( ! AreAllPathsOk()) ;
return false ; }
bool UpdateStatus( int nModif) override
{ m_nStatus |= nModif ; return true ; }
@@ -60,7 +66,7 @@ class Chiseling : public Machining
bool GetParam( int nType, int& nVal) const override ;
bool GetParam( int nType, double& dVal) const override ;
bool GetParam( int nType, std::string& sVal) const override ;
bool UpdateToolData( bool* pbChanged = nullptr) override ;
bool UpdateToolData( void) override ;
const ToolData& GetToolData( void) const override ;
bool GetGeometry( SELVECTOR& vIds) const override ;
+1 -1
View File
@@ -1639,7 +1639,7 @@ Disposition::SpecialUpdate( void)
return true ;
}
// calcolo assi macchina
if ( ! CalculateAxesValues( "", false)) {
if ( ! CalculateAxesValues( "")) {
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
if ( sInfo.empty())
m_pMchMgr->SetLastError( 2008, "Error in Disposition : axes values not calculable") ;
+10 -2
View File
@@ -73,8 +73,14 @@ class Disposition : public Operation
public : // Operation
int GetType( void) const override
{ return OPER_DISP ; }
bool IsEmpty( void) const override
{ return ( m_nShifts == 0) ; }
bool IsEmpty( int nEmptyType = NEED_GEOM) const override
{ if ( m_nShifts == 0)
return true ;
if ( nEmptyType == NEED_ONE_TP_OK)
return ( ! IsAtLeastOnePathOk()) ;
if ( nEmptyType == NEED_ALL_TP_OK)
return ( ! AreAllPathsOk()) ;
return false ; }
bool UpdateStatus( int nModif) override
{ m_nStatus |= nModif ; return true ; }
@@ -83,6 +89,8 @@ class Disposition : public Operation
const std::string& GetHeadName( void) const override ;
int GetExitNbr( void) const override ;
const std::string& GetToolTcPos( void) const override ;
bool GetDoubleToolData( std::string& sDblTool, std::string& sDblTcPos, std::string& sDblHead, int& nDblExit) const override
{ return false ; }
int GetSolCh( void) const override
{ return 0 ; }
bool NeedPrevHome( void) const override ;
+1 -1
View File
@@ -18,7 +18,7 @@
#include <string>
//-----------------------------------------------------------------------------
std::string GetEMkVer( void) ;
const std::string& GetEMkVer( void) ;
ILogger* GetEMkLogger( void) ;
const std::string& GetEMkKey( void) ;
bool GetEMkNetHwKey( void) ;
+171 -43
View File
@@ -18,6 +18,7 @@
#include "DllMain.h"
#include "Drilling.h"
#include "OperationConst.h"
#include "OperUserNotesConst.h"
#include "/EgtDev/Include/EXeCmdLogOff.h"
#include "/EgtDev/Include/EGkGeoPoint3d.h"
#include "/EgtDev/Include/EGkGeoVector3d.h"
@@ -26,10 +27,12 @@
#include "/EgtDev/Include/EGkCurveComposite.h"
#include "/EgtDev/Include/EGkChainCurves.h"
#include "/EgtDev/Include/EGkSfrCreate.h"
#include "/EgtDev/Include/EGkStringUtils3d.h"
#include "/EgtDev/Include/EGkUserObjFactory.h"
#include "/EgtDev/Include/EGnStringKeyVal.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
#include "/EgtDev/Include/EGkGeoFrame3d.h"
#include "/EgtDev/Include/EgtIniFile.h"
using namespace std ;
@@ -52,6 +55,7 @@ using namespace std ;
// 2116 = "Error in Drilling : multi drilling head without valid tools"
// 2117 = "Error in Drilling : incorrect multi drilling head"
// 2118 = "Error in Drilling : Tool loading failed"
// 2119 = "Error in Drilling : special apply not calculable"
// 2151 = "Warning in Drilling : Skipped entity (xx)"
// 2152 = "Warning in Drilling : No machinable path"
// 2153 = "Warning in Drilling : Tool name changed (xx)"
@@ -519,7 +523,8 @@ Drilling::SetGeometry( const SELVECTOR& vIds)
// verifico validità gestore generale e gestore DB geometrico
if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr)
return false ;
// reset della geometria corrente
// copia temporanea e reset della geometria corrente
SELVECTOR vOldId = m_vId ;
m_vId.clear() ;
// se lavorazione standard
if ( m_Params.m_nSubType == DRI_SUB_STD) {
@@ -550,7 +555,8 @@ Drilling::SetGeometry( const SELVECTOR& vIds)
}
}
// aggiorno lo stato
m_nStatus |= MCH_ST_GEO_MODIF ;
if ( m_vId != vOldId)
m_nStatus |= MCH_ST_GEO_MODIF ;
// restituisco presenza geometria da lavorare
return ( ! m_vId.empty()) ;
}
@@ -612,15 +618,17 @@ Drilling::Apply( bool bRecalc, bool bPostApply)
return false ;
// aggiorno dati geometrici dell'utensile
bool bToolChanged = true ;
if ( ! UpdateToolData( &bToolChanged)) {
if ( ! UpdateToolData()) {
m_pMchMgr->SetLastError( 2101, "Error in Drilling : UpdateToolData failed") ;
return false ;
}
// se modificata geometria, necessario ricalcolo
if ( ( m_nStatus & MCH_ST_GEO_MODIF) != 0)
bRecalc = true ;
// verifico se necessario continuare nell'aggiornamento
if ( ! bRecalc && ! bToolChanged &&
( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) {
if ( ! bRecalc && ( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) {
// confermo i percorsi di lavorazione e i fori non lavorati
m_nDrillings = nCurrDrillings ;
m_vUndrilledId = vCurrUndrilledId ;
@@ -662,6 +670,12 @@ Drilling::Apply( bool bRecalc, bool bPostApply)
return false ;
}
// verifico se tavola basculante
bool bTiltTab = false ;
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) ;
// se lavorazione standard
if ( m_Params.m_nSubType == DRI_SUB_STD) {
if ( ! StandardProcess( bRecalc, GDB_ID_NULL, nClId))
@@ -679,16 +693,16 @@ Drilling::Apply( bool bRecalc, bool bPostApply)
// assegno ingombri dei vari percorsi di lavorazione e della lavorazione nel suo complesso
CalcAndSetBBox( nClId) ;
// eseguo aggiornamento assi macchina e collegamento con operazione precedente
if ( ! Update( bPostApply))
return false ;
// 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 ;
}
// eseguo aggiornamento assi macchina e collegamento con operazione precedente
if ( ! Update( bPostApply))
return false ;
// aggiorno stato della lavorazione
m_nStatus = ( bPostApply ? MCH_ST_OK : MCH_ST_NO_POSTAPPL) ;
// dichiaro successiva da aggiornare
@@ -732,6 +746,47 @@ Drilling::Update( bool bPostApply)
return false ;
}
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
CalcAndSetAxesBBox() ;
// se lavorazione in doppio, calcolo assi e movimenti di approccio e retrazione relativi
if ( GetDoubleType( m_Params.m_sUserNotes) != 0) {
// elimino le entità CLIMB, RISE e HOME della lavorazione in doppio
RemoveClimbRiseHome( false) ;
// recupero i dati della testa in doppio e la imposto
string sDblTool ; string sDblTcPos ; string sDblHead ; int nDblExit ;
bool bOk = GetDoubleToolData( sDblTool, sDblTcPos, sDblHead, nDblExit) &&
m_pMchMgr->SetCalcTool( sDblTool, sDblHead, nDblExit) ;
// imposto eventuale asse bloccato da lavorazione
SetBlockedRotAxis( m_Params.m_sBlockedAxis, true) ;
// eseguo il calcolo
if ( bOk) {
if ( ! CalculateDoubleAxesValues( sHint)) {
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
if ( sInfo.empty())
m_pMchMgr->SetLastError( 2109, "Error in Drilling : axes values not calculable for double") ;
else
m_pMchMgr->SetLastError( 2110, "Error in Drilling : double outstroke ") ;
bOk = false ;
}
}
// ripristino testa principale
m_pMchMgr->SetCalcTool( GetToolName(), GetHeadName(), GetExitNbr()) ;
// in caso di errore, esco
if ( ! bOk)
return false ;
}
// esecuzione eventuali personalizzazioni speciali
string sSpecErr ;
if ( bPostApply && ! SpecialApply( sSpecErr)) {
if ( ! IsEmptyOrSpaces( sSpecErr))
m_pMchMgr->SetLastError( 2119, sSpecErr) ;
else
m_pMchMgr->SetLastError( 2119, "Error in Drilling : special apply not calculable") ;
return false ;
}
// gestione movimenti all'inizio di ogni singolo percorso di lavorazione e alla fine della lavorazione
if ( ! AdjustStartEndMovements()) {
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
@@ -742,14 +797,11 @@ Drilling::Update( bool bPostApply)
return false ;
}
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
CalcAndSetAxesBBox() ;
// esecuzione eventuali personalizzazioni
string sErr ;
if ( bPostApply && ! PostApply( sErr)) {
if ( ! IsEmptyOrSpaces( sErr))
m_pMchMgr->SetLastError( 2113, sErr) ;
string sPostErr ;
if ( bPostApply && ! PostApply( sPostErr)) {
if ( ! IsEmptyOrSpaces( sPostErr))
m_pMchMgr->SetLastError( 2113, sPostErr) ;
else
m_pMchMgr->SetLastError( 2113, "Error in Drilling : post apply not calculable") ;
return false ;
@@ -816,7 +868,11 @@ Drilling::StandardProcess( bool bRecalc, int nPvId, int nClId)
// eseguo la lavorazione richiesta
switch ( nDrillType) {
case DRILL_TYPE_STD :
{ // elaboro i singoli fori
{ // se vtAux impostato come parametro di lavorazione nelle UserNotes
Vector3d vtAux ;
if ( GetValInNotes( m_Params.m_sUserNotes, UN_VTAUXDIR, vtAux))
vtAux.Normalize() ;
// elaboro i singoli fori
for ( int i = 0 ; i < int( m_vId.size()) ; ++ i) {
const auto& vId = m_vId[i] ;
// se richiesto preview
@@ -829,7 +885,7 @@ Drilling::StandardProcess( bool bRecalc, int nPvId, int nClId)
}
// se richiesta lavorazione
if ( nClId != GDB_ID_NULL) {
if ( ! GenerateHoleCl( i, vId, MCH_PATH, nClId))
if ( ! GenerateHoleCl( i, vId, MCH_PATH, nClId, 0, vtAux))
return false ;
}
}
@@ -2336,7 +2392,7 @@ Drilling::MultiHeadVerifyHole( Hole& hole, const ToolData* Tool, double dDiamTol
// imposto elevazione da lunghezza foro con possibilità di sovrascrittura da info
double dElev = hole.dLen ;
double dMaxElev ;
if ( GetValInNotes( m_Params.m_sUserNotes, "MaxElev", dMaxElev) && dElev > dMaxElev) {
if ( GetValInNotes( m_Params.m_sUserNotes, UN_MAXELEV, dMaxElev) && dElev > dMaxElev) {
dElev = dMaxElev ;
hole.ptIni += hole.vtDir * ( dElev - hole.dLen) ;
hole.dLen = dElev ;
@@ -2702,7 +2758,7 @@ 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 ( GetValInNotes( m_Params.m_sUserNotes, "MaxElev", dMaxElev) && dElev > dMaxElev) {
if ( GetValInNotes( m_Params.m_sUserNotes, UN_MAXELEV, dMaxElev) && dElev > dMaxElev) {
dElev = dMaxElev ;
hole.ptIni += hole.vtDir * ( dElev - hole.dLen) ;
hole.dLen = ( hole.dLen > 10 * EPS_SMALL ? max( dElev, 10 * EPS_SMALL) : dElev) ;
@@ -2717,11 +2773,6 @@ Drilling::GenerateHoleCl( int nInd, const SelData& nCircId, const string& sPName
m_pMchMgr->SetWarning( 2155, sInfo) ;
}
}
// verifico se tavola basculante
bool bTiltTab = false ;
m_bTiltingTab = ( m_pMchMgr->GetCurrMachine()->GetCurrTableIsTilting( bTiltTab, m_vtTiltingAx) && bTiltTab) ;
// verifico se testa da sopra (Z+)
m_bAboveHead = m_pMchMgr->GetHeadAbove( currToolData.m_sHead) ;
// verifiche per foro verso il basso
m_bAggrBottom = false ;
if ( ! VerifyHoleFromBottom( hole, nCircId))
@@ -2734,8 +2785,8 @@ Drilling::GenerateHoleCl( int nInd, const SelData& nCircId, const string& sPName
// assegno l'elevazione massima
m_pGeomDB->SetInfo( nPathId, KEY_ELEV, hole.dLen) ;
// foro normale
if ( m_Params.m_dStep < EPS_SMALL ||
m_Params.m_dStep > hole.dLen - EPS_SMALL) {
if ( ( m_Params.m_dStep < EPS_SMALL || m_Params.m_dStep > hole.dLen - 10 * EPS_SMALL) &&
GetDoubleLastStep() > hole.dLen - 10 * EPS_SMALL) {
if ( DoStandardDrilling( hole, nCircId, nPathId, dMHOff, vtA, currToolData)) {
// aggiorno numero forature
++ m_nDrillings ;
@@ -3088,7 +3139,7 @@ Drilling::GetToolData( void) const
//----------------------------------------------------------------------------
bool
Drilling::UpdateToolData( bool* pbChanged)
Drilling::UpdateToolData( void)
{
// recupero il gestore DB utensili della macchina corrente
ToolsMgr* pTMgr = m_pMchMgr->GetCurrToolsMgr() ;
@@ -3139,9 +3190,9 @@ Drilling::UpdateToolData( bool* pbChanged)
m_Params.m_sToolName + ")" ;
m_pMchMgr->SetWarning( 2154, sInfo) ;
}
// se definito parametro di ritorno, lo assegno
if ( pbChanged != nullptr)
*pbChanged = bChanged ;
// se modificato, aggiusto lo stato
if ( bChanged)
m_nStatus = MCH_ST_TO_VERIFY ;
return true ;
}
@@ -3239,7 +3290,7 @@ Drilling::GetHoleData( SelData Id, Hole& hole)
hole.bBlind = true ;
// se dichiarato passante o no (1/0)
int nOpen ;
if ( GetValInNotes( m_Params.m_sUserNotes, "Open", nOpen))
if ( GetValInNotes( m_Params.m_sUserNotes, UN_OPEN, nOpen))
hole.bBlind = ( nOpen == 0) ;
// se verticale ed arriva fino al fondo grezzo, allora passante
else if ( hole.vtDir.IsZplus() && hole.dThick > dRbDist - EPS_SMALL)
@@ -3527,13 +3578,42 @@ Drilling::DoPeckDrilling( const Hole& hole, SelData Id, int nPathId, double dMHO
if ( AddRapidMove( ptP2, bSplitArcs) == GDB_ID_NULL)
return false ;
}
// parametri per foro in doppio
bool bDouble = ( GetDoubleType( m_Params.m_sUserNotes) != 0) ;
double dDoubleLastStep = GetDoubleLastStep() ;
bool dDoubleParallel = false ;
if ( bDouble) {
// nel caso di lavorazione in doppio con flag nel file .ini abilitato, prima della risalita finale, risalgo dell'ultimo step compiuto
// se il piano di mirror presenta una normale circa parallela alla direzione del foro ( da BTL 1 grado di tolleranza)
Machine* pMch = m_pMchMgr->GetCurrMachine() ;
if ( pMch != nullptr) {
string sMachIni = pMch->GetMachineDir() + "\\" + pMch->GetMachineName() + ".ini" ;
const char* SEC_MACH = "Customizations" ;
const char* KEY_DRILLING_DOUBLE = "DrillingDoubleNT" ;
int nDrillingDouble = GetPrivateProfileInt( SEC_MACH, KEY_DRILLING_DOUBLE, 0, sMachIni.c_str()) ;
if ( nDrillingDouble == 1) {
int nDouble = GetDoubleType( m_Params.m_sUserNotes) ;
Vector3d vtNorm = V_INVALID ;
switch ( nDouble) {
case 1 : vtNorm = X_AX ; break ;
case 2 : vtNorm = Y_AX ; break ;
case 3 : vtNorm = Z_AX ; break ;
}
dDoubleParallel = ( vtNorm.IsValid() && abs( hole.vtDir * vtNorm) > cos( 1. * DEGTORAD)) ;
}
}
}
// ciclo di affondamento a step
const double MIN_STEP = 1 ;
const double APPR_STEP = 1 ;
const double MIN_MOVE = 1 ;
double dStep = max( m_Params.m_dStep, MIN_STEP) ;
int nStep = int( ceil( hole.dLen / dStep)) ;
dStep = hole.dLen / nStep ;
double dOrigStep = max( m_Params.m_dStep, MIN_STEP) ;
double dSteppedLen = ( bDouble ? hole.dLen - dDoubleLastStep : hole.dLen) ;
int nStep = int( ceil( dSteppedLen / dOrigStep)) ;
double dStep = dSteppedLen / nStep ;
if ( bDouble)
++ nStep ;
double dLastStep = ( bDouble ? dDoubleLastStep : dStep) ;
if ( dReturnPos < - dStep + APPR_STEP + MIN_MOVE)
dReturnPos = - dStep + APPR_STEP + MIN_MOVE ;
double dCurrLen = 0 ;
@@ -3554,7 +3634,7 @@ Drilling::DoPeckDrilling( const Hole& hole, SelData Id, int nPathId, double dMHO
return false ;
}
// lunghezza di fine step
double dEndLen = dCurrLen + dStep ;
double dEndLen = dCurrLen + ( i == nStep ? dLastStep : dStep) ;
// 3 -> punto termine velocità ridotta iniziale (se previsto)
if ( bStartSlow && ( i == 1 || dCurrLen < dStartSlowLen + EPS_SMALL)) {
// lunghezza di esecuzione
@@ -3573,8 +3653,15 @@ Drilling::DoPeckDrilling( const Hole& hole, SelData Id, int nPathId, double dMHO
Point3d ptP3 = hole.ptIni - hole.vtDir * dLen ;
if ( bHoleEnd)
ptP3 -= hole.vtDir * dAddLen ;
if ( AddLinearMove( ptP3, bSplitArcs) == GDB_ID_NULL)
return false ;
if ( dDoubleParallel && i == nStep) {
SetFlag( 105) ; // movimento in doppio parallelo
if ( AddLinearMove( ptP3, bSplitArcs, MCH_CL_DBP) == GDB_ID_NULL)
return false ;
}
else {
if ( AddLinearMove( ptP3, bSplitArcs) == GDB_ID_NULL)
return false ;
}
// aggiorno posizione e verifico se step completato
dCurrLen = dLen ;
if ( bHoleEnd || bStepEnd)
@@ -3598,8 +3685,15 @@ Drilling::DoPeckDrilling( const Hole& hole, SelData Id, int nPathId, double dMHO
Point3d ptP4 = hole.ptIni - hole.vtDir * dLen ;
if ( bHoleEnd)
ptP4 -= hole.vtDir * dAddLen ;
if ( AddLinearMove( ptP4, bSplitArcs) == GDB_ID_NULL)
return false ;
if ( dDoubleParallel && i == nStep) {
SetFlag( 105) ; // movimento in doppio parallelo
if ( AddLinearMove( ptP4, bSplitArcs, MCH_CL_DBP) == GDB_ID_NULL)
return false ;
}
else {
if ( AddLinearMove( ptP4, bSplitArcs) == GDB_ID_NULL)
return false ;
}
// aggiorno posizione e verifico se step completato
dCurrLen = dLen ;
if ( bHoleEnd || bStepEnd)
@@ -3622,8 +3716,15 @@ Drilling::DoPeckDrilling( const Hole& hole, SelData Id, int nPathId, double dMHO
Point3d ptP5 = hole.ptIni - hole.vtDir * dLen ;
if ( bHoleEnd)
ptP5 -= hole.vtDir * dAddLen ;
if ( AddLinearMove( ptP5, bSplitArcs) == GDB_ID_NULL)
return false ;
if ( dDoubleParallel && i == nStep) {
SetFlag( 105) ; // movimento in doppio parallelo
if ( AddLinearMove( ptP5, bSplitArcs, MCH_CL_DBP) == GDB_ID_NULL)
return false ;
}
else {
if ( AddLinearMove( ptP5, bSplitArcs) == GDB_ID_NULL)
return false ;
}
// aggiorno posizione
dCurrLen = dLen ;
}
@@ -3631,6 +3732,17 @@ Drilling::DoPeckDrilling( const Hole& hole, SelData Id, int nPathId, double dMHO
// 6 -> ritorno all'approccio del foro
SetFeed( GetEndFeed()) ;
if ( dDoubleParallel) {
SetFlag( 105) ; // movimento in doppio parallelo
// aggiungo risalita aggiuntiva per lavorazione in doppio pari a due volte il LastStep
Point3d ptEnd ; GetCurrPos( ptEnd) ;
if ( AddLinearMove( ptEnd + min( 2. * dLastStep, dCurrLen) * hole.vtDir, bSplitArcs, MCH_CL_DBP) == GDB_ID_NULL)
return false ;
// aggiungo discensa di LastStep per simmetria con secondo utensile
GetCurrPos( ptEnd) ;
if ( AddLinearMove( ptEnd - dLastStep * hole.vtDir, bSplitArcs, MCH_CL_DBP) == GDB_ID_NULL)
return false ;
}
SetFlag( 104) ; // risalita sopra il foro
if ( AddLinearMove( ptP1, bSplitArcs) == GDB_ID_NULL)
return false ;
@@ -3666,6 +3778,22 @@ Drilling::DoPeckDrilling( const Hole& hole, SelData Id, int nPathId, double dMHO
return true ;
}
//----------------------------------------------------------------------------
double
Drilling::GetDoubleLastStep( void)
{
// se non è foratura in doppio, restituisco valore molto grande
const double FALSE_LASTSTEP = 10000 ;
if ( GetDoubleType( m_Params.m_sUserNotes) == 0)
return FALSE_LASTSTEP ;
// recupero valore
const double MIN_LASTSTEP = 15 ;
double dDoubleLastStep = m_Params.m_dStep ;
if ( GetValInNotes( m_Params.m_sUserNotes, UN_LASTSTEP, dDoubleLastStep))
dDoubleLastStep = max( dDoubleLastStep, MIN_LASTSTEP) ;
return dDoubleLastStep ;
}
//----------------------------------------------------------------------------
// Debug Functions
//----------------------------------------------------------------------------
+10 -3
View File
@@ -51,8 +51,14 @@ class Drilling : public Machining
public : // Operation
int GetType( void) const override
{ return OPER_DRILLING ; }
bool IsEmpty( void) const override
{ return ( m_nDrillings == 0) ; }
bool IsEmpty( int nEmptyType = NEED_GEOM) const override
{ if ( m_nDrillings == 0)
return true ;
if ( nEmptyType == NEED_ONE_TP_OK)
return ( ! IsAtLeastOnePathOk()) ;
if ( nEmptyType == NEED_ALL_TP_OK)
return ( ! AreAllPathsOk()) ;
return false ; }
bool UpdateStatus( int nModif) override
{ m_nStatus |= nModif ; return true ; }
@@ -74,7 +80,7 @@ class Drilling : public Machining
bool GetParam( int nType, int& nVal) const override ;
bool GetParam( int nType, double& dVal) const override ;
bool GetParam( int nType, std::string& sVal) const override ;
bool UpdateToolData( bool* pbChanged = nullptr) override ;
bool UpdateToolData( void) override ;
const ToolData& GetToolData( void) const override ;
bool GetGeometry( SELVECTOR& vIds) const override ;
bool GetSkippedGeometry( SELVECTOR& vIds) const override ;
@@ -122,6 +128,7 @@ class Drilling : public Machining
bool MultiHeadOrderConfig( TABMHDRILL& tabDrills, const VECTORHOLE& vHoles, const Vector3d& vtTool, const Vector3d& vtAux) ;
bool MultiHeadHoleToolsConfig( const VECTORHOLE& vHoles, int nConfig, INTINTVECTOR& vConfMask) ;
int VerifyMultiParallelDrills( void) ;
double GetDoubleLastStep( void) ;
/* debug functions */
void PrintConfigs( const VECTORHOLE& vHoles) ;
+12 -10
View File
@@ -31,8 +31,7 @@
const int STR_DIM = 40 ;
//-----------------------------------------------------------------------------
static HINSTANCE s_hModule = NULL ;
static char s_szEMkNameVer[STR_DIM] ;
static HINSTANCE s_hModule = NULL ;
//-----------------------------------------------------------------------------
extern "C" int APIENTRY
@@ -62,21 +61,24 @@ DllMain( HMODULE hModule, DWORD dwReason, LPVOID lpReserved)
const char*
GetEMkVersion( void)
{
std::string sVer ;
GetModuleVersion( s_hModule, sVer) ;
sprintf_s( s_szEMkNameVer, STR_DIM, "%s%s", EMK_STR, sVer.c_str()) ;
static char s_szEMkNameVer[STR_DIM] = "" ;
if ( s_szEMkNameVer[0] == '\0') {
static std::string sVer ;
GetModuleVersion( s_hModule, sVer) ;
sprintf_s( s_szEMkNameVer, STR_DIM, "%s%s", EMK_STR, sVer.c_str()) ;
}
return s_szEMkNameVer ;
}
//-----------------------------------------------------------------------------
std::string
const std::string&
GetEMkVer( void)
{
std::string sVer ;
GetModuleVersion( s_hModule, sVer) ;
return sVer ;
static std::string s_sVer ;
if ( s_sVer.empty())
GetModuleVersion( s_hModule, s_sVer) ;
return s_sVer ;
}
//-----------------------------------------------------------------------------
BIN
View File
Binary file not shown.
+10 -4
View File
@@ -105,7 +105,7 @@
<OpenMPSupport>false</OpenMPSupport>
<PrecompiledHeader>Use</PrecompiledHeader>
<CompileAs>CompileAsCpp</CompileAs>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard>stdcpp20</LanguageStandard>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
@@ -132,7 +132,7 @@ copy $(TargetPath) \EgtProg\DllD32</Command>
<OpenMPSupport>true</OpenMPSupport>
<PrecompiledHeader>Use</PrecompiledHeader>
<CompileAs>CompileAsCpp</CompileAs>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard>stdcpp20</LanguageStandard>
<AdditionalOptions>-Wno-tautological-undefined-compare</AdditionalOptions>
</ClCompile>
<Link>
@@ -167,7 +167,7 @@ copy $(TargetPath) \EgtProg\DllD64</Command>
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
<WholeProgramOptimization>false</WholeProgramOptimization>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard>stdcpp20</LanguageStandard>
</ClCompile>
<Link>
<GenerateDebugInformation>false</GenerateDebugInformation>
@@ -202,7 +202,7 @@ copy $(TargetPath) \EgtProg\Dll32</Command>
<EnableFiberSafeOptimizations>false</EnableFiberSafeOptimizations>
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
<WholeProgramOptimization>false</WholeProgramOptimization>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard>stdcpp20</LanguageStandard>
<AdditionalOptions>-Wno-tautological-undefined-compare</AdditionalOptions>
</ClCompile>
<Link>
@@ -276,6 +276,8 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClCompile Include="Pocketing.cpp" />
<ClCompile Include="PocketingData.cpp" />
<ClCompile Include="PocketingNT.cpp" />
<ClCompile Include="Probing.cpp" />
<ClCompile Include="ProbingData.cpp" />
<ClCompile Include="Processor.cpp" />
<ClCompile Include="SawFinishing.cpp" />
<ClCompile Include="SawFinishingData.cpp" />
@@ -438,6 +440,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClInclude Include="MachiningData.h" />
<ClInclude Include="MachiningDataFactory.h" />
<ClInclude Include="MachiningCreate.h" />
<ClInclude Include="MachiningRegister.h" />
<ClInclude Include="MachiningsMgr.h" />
<ClInclude Include="MachMgr.h" />
<ClInclude Include="Milling.h" />
@@ -446,10 +449,13 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClInclude Include="MortisingData.h" />
<ClInclude Include="Operation.h" />
<ClInclude Include="OperationConst.h" />
<ClInclude Include="OperUserNotesConst.h" />
<ClInclude Include="OutputConst.h" />
<ClInclude Include="Pocketing.h" />
<ClInclude Include="PocketingData.h" />
<ClInclude Include="PocketingNT.h" />
<ClInclude Include="Probing.h" />
<ClInclude Include="ProbingData.h" />
<ClInclude Include="Processor.h" />
<ClInclude Include="resource.h" />
<ClInclude Include="SawFinishing.h" />
+18
View File
@@ -252,6 +252,12 @@
<ClCompile Include="PocketingNT.cpp">
<Filter>Source Files\Operations</Filter>
</ClCompile>
<ClCompile Include="ProbingData.cpp">
<Filter>Source Files\Machinings</Filter>
</ClCompile>
<ClCompile Include="Probing.cpp">
<Filter>Source Files\Operations</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="DllMain.h">
@@ -767,6 +773,18 @@
<ClInclude Include="PocketingNT.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="MachiningRegister.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="ProbingData.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Probing.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="OperUserNotesConst.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="EgtMachKernel.rc">
+68 -62
View File
@@ -17,12 +17,14 @@
#include "DllMain.h"
#include "FiveAxisMilling.h"
#include "OperationConst.h"
#include "OperUserNotesConst.h"
#include "/EgtDev/Include/EGkCurveLine.h"
#include "/EgtDev/Include/EGkCurveArc.h"
#include "/EgtDev/Include/EGkCurveComposite.h"
#include "/EgtDev/Include/EGkArcSpecial.h"
#include "/EgtDev/Include/EGkSfrCreate.h"
#include "/EgtDev/Include/EGkSurfTriMesh.h"
#include "/EgtDev/Include/EGkSurfBezier.h"
#include "/EgtDev/Include/EGkUserObjFactory.h"
#include "/EgtDev/Include/EGnStringKeyVal.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
@@ -41,6 +43,7 @@ using namespace std ;
// 3308 = "Error in FiveAxisMilling : post apply not calculable"
// 3309 = "Error in FiveAxisMilling : Tool loading failed"
// 3310 = "Error in FiveAxisMilling : aggregate from bottom not allowed"
// 3311 = "Error in FiveAxisMilling : special apply not calculable"
// 3351 = "Warning in FiveAxisMilling : Skipped entity (xx)"
// 3352 = "Warning in FiveAxisMilling : No machinable path"
// 3353 = "Warning in FiveAxisMilling : Tool name changed (xx)"
@@ -49,7 +52,7 @@ using namespace std ;
//------------------------------ Constants -----------------------------------
static const string EMC_VAR = "EMC" ; // tabella variabili locali per calcolo
static const string EVAR_MACHID = ".MACHID" ; // IN (int) identificativo della lavorazione
static const string EVAR_GEOM = ".GEOM" ; // IN (table) tabella delle entità da lavorare
static const string EVAR_GEOM = ".GEOM" ; // IN (table) tabella delle entità da lavorare
static const string EVAR_DEPTH = ".DEPTH" ; // IN (string) affondamento (espressione numerica)
static const string EVAR_TINVERT = ".TOOLINVERT" ; // IN (bool) flag di inversione direzione utensile
static const string EVAR_INVERT = ".INVERT" ; // IN (bool) flag di inversione direzione lavorazione
@@ -67,14 +70,14 @@ 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_TTHICK = ".TTHICK" ; // IN (num) spessore per lame o altezza taglienti
static const string EVAR_TCORNRAD = ".TCORNRAD" ; // IN (num) raggio corner
static const string EVAR_TSIDEANG = ".TSIDEANG" ; // IN (num) angolo del fianco rispetto all'asse
static const string EVAR_FEED = ".FEED" ; // IN (num) feed dell'utensile
static const string EVAR_STARTFEED = ".STARTFEED" ;// IN (num) feed di inizio dell'utensile
static const string EVAR_ENDFEED = ".ENDFEED" ; // IN (num) feed di fine dell'utensile
static const string EVAR_TIPFEED = ".TIPFEED" ; // IN (num) feed di punta dell'utensile
static const string EVAR_ISROBOT = ".ISROBOT" ; // IN (bool) flag per indicare che la cinematica è di tipo robot
static const string EVAR_ISROBOT = ".ISROBOT" ; // IN (bool) flag per indicare che la cinematica è di tipo robot
static const string EVAR_ERROR = ".ERR" ; // OUT (int) codice di errore ( 0 = ok)
static const string EVAR_MILLS = ".MILLS" ; // OUT (int) numero di percorsi di lavoro
static const string ON_PREVIEW = "OnPreview_" ;
@@ -219,6 +222,7 @@ FiveAxisMilling::FiveAxisMilling( void)
m_TParams.m_sHead = "*" ;
m_nStatus = MCH_ST_TO_VERIFY ;
m_nMills = 0 ;
m_bRunning = false ;
}
//----------------------------------------------------------------------------
@@ -409,17 +413,17 @@ FiveAxisMilling::SetParam( int nType, const string& sVal)
bool
FiveAxisMilling::SetGeometry( const SELVECTOR& vIds)
{
// verifico validità gestore DB geometrico
// verifico validità gestore DB geometrico
if ( m_pGeomDB == nullptr)
return false ;
// reset della geometria corrente
// copia temporanea e reset della geometria corrente
SELVECTOR vOldId = m_vId ;
m_vId.clear() ;
// verifico che gli identificativi rappresentino delle entità ammissibili (tutte curve o tutte facce)
int nType = GEO_NONE ;
// verifico che gli identificativi rappresentino delle entità ammissibili (curve o superfici)
for ( const auto& Id : vIds) {
// test sull'entità
// test sull'entità
int nSubs ;
if ( ! VerifyGeometry( Id, nSubs, nType)) {
if ( ! VerifyGeometry( Id, nSubs)) {
string sInfo = "Warning in FiveAxisMilling : Skipped entity " + ToString( Id) ;
m_pMchMgr->SetWarning( 3351, sInfo) ;
continue ;
@@ -428,7 +432,8 @@ FiveAxisMilling::SetGeometry( const SELVECTOR& vIds)
m_vId.emplace_back( Id) ;
}
// aggiorno lo stato
m_nStatus |= MCH_ST_GEO_MODIF ;
if ( m_vId != vOldId)
m_nStatus |= MCH_ST_GEO_MODIF ;
// restituisco presenza geometria da lavorare
return ( ! m_vId.empty() || vIds.empty()) ;
}
@@ -440,7 +445,7 @@ FiveAxisMilling::Preview( bool bRecalc)
// reset numero percorsi di lavoro generati
m_nMills = 0 ;
// verifico validità gestore DB geometrico e Id del gruppo
// verifico validità gestore DB geometrico e Id del gruppo
if ( m_pGeomDB == nullptr || ! m_pGeomDB->ExistsObj( m_nOwnerId))
return false ;
@@ -458,7 +463,7 @@ FiveAxisMilling::Preview( bool bRecalc)
// recupero gruppo per geometria di Preview
int nPvId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_PV) ;
// se non c'è, lo aggiungo
// se non c'è, lo aggiungo
if ( nPvId == GDB_ID_NULL) {
nPvId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
if ( nPvId == GDB_ID_NULL)
@@ -541,7 +546,7 @@ FiveAxisMilling::Preview( bool bRecalc)
bool
FiveAxisMilling::Apply( bool bRecalc, bool bPostApply)
{
// se calcoli già in corso, esco
// se calcoli già in corso, esco
if ( m_bRunning) {
LOG_DBG_INFO( GetEMkLogger(), "FiveAxisMilling::Apply already running") ;
return true ;
@@ -560,26 +565,28 @@ FiveAxisMilling::MyApply( bool bRecalc, bool bPostApply)
int nCurrMills = m_nMills ;
m_nMills = 0 ;
// verifico validità gestore DB geometrico e Id del gruppo
// verifico validità gestore DB geometrico e Id del gruppo
if ( m_pGeomDB == nullptr || ! m_pGeomDB->ExistsObj( m_nOwnerId))
return false ;
// aggiorno dati geometrici dell'utensile
bool bToolChanged = true ;
if ( ! UpdateToolData( &bToolChanged)) {
if ( ! UpdateToolData()) {
m_pMchMgr->SetLastError( 3301, "Error in FiveAxisMilling : UpdateToolData failed") ;
return false ;
}
// non è prevista fresatura 5 assi con aggregato da sotto
// non è prevista fresatura 5 assi con aggregato da sotto
if ( IsAggrBottom( m_TParams.m_sHead)) {
m_pMchMgr->SetLastError( 3310, "Error in FiveAxisMilling : aggregate from bottom not allowed") ;
return false ;
}
// se modificata geometria, necessario ricalcolo
if ( ( m_nStatus & MCH_ST_GEO_MODIF) != 0)
bRecalc = true ;
// verifico se necessario continuare nell'aggiornamento
if ( ! bRecalc && ! bToolChanged &&
( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) {
if ( ! bRecalc && ( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) {
// confermo i percorsi di lavorazione
m_nMills = nCurrMills ;
string sLog = string( "FiveAxisMilling apply skipped : status ") + ( m_nStatus == MCH_ST_OK ? "already ok" : "no postapply") ;
@@ -602,7 +609,7 @@ FiveAxisMilling::MyApply( bool bRecalc, bool bPostApply)
// recupero gruppo per geometria di lavorazione (Cutter Location)
int nClId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_CL) ;
// se non c'è, lo aggiungo
// se non c'è, lo aggiungo
if ( nClId == GDB_ID_NULL) {
nClId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
if ( nClId == GDB_ID_NULL)
@@ -703,7 +710,7 @@ FiveAxisMilling::MyApply( bool bRecalc, bool bPostApply)
bool
FiveAxisMilling::Update( bool bPostApply)
{
// verifico validità gestore DB geometrico e Id del gruppo
// verifico validità gestore DB geometrico e Id del gruppo
if ( m_pGeomDB == nullptr || ! m_pGeomDB->ExistsObj( m_nOwnerId))
return false ;
@@ -713,7 +720,7 @@ FiveAxisMilling::Update( bool bPostApply)
return true ;
}
// elimino le entità CLIMB, RISE e HOME della lavorazione, potrebbero falsare i calcoli degli assi (in ogni casi vengono riaggiunte dopo)
// elimino le entità CLIMB, RISE e HOME della lavorazione, potrebbero falsare i calcoli degli assi (in ogni casi vengono riaggiunte dopo)
RemoveClimbRiseHome() ;
// imposto eventuale asse bloccato da lavorazione
@@ -723,7 +730,9 @@ FiveAxisMilling::Update( bool bPostApply)
string sHint = ExtractHint( m_Params.m_sUserNotes) ;
if ( ! m_Params.m_sInitAngs.empty())
sHint = m_Params.m_sInitAngs ;
if ( ! CalculateAxesValues( sHint)) {
double dSingConeAng = 0.1 ;
GetValInNotes( m_Params.m_sUserNotes, UN_SINGCONEANG, dSingConeAng) ;
if ( ! CalculateAxesValues( sHint, false, dSingConeAng)) {
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
if ( sInfo.empty())
m_pMchMgr->SetLastError( 3304, "Error in FiveAxisMilling : axes values not calculable") ;
@@ -732,11 +741,21 @@ FiveAxisMilling::Update( bool bPostApply)
return false ;
}
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
CalcAndSetAxesBBox() ;
// esecuzione eventuali personalizzazioni speciali
string sSpecErr ;
if ( bPostApply && ! PostApply( sSpecErr)) {
if ( ! IsEmptyOrSpaces( sSpecErr))
m_pMchMgr->SetLastError( 3311, sSpecErr) ;
else
m_pMchMgr->SetLastError( 3311, "Error in FiveAxisMilling : special apply not calculable") ;
return false ;
}
// gestione movimenti all'inizio di ogni singolo percorso di lavorazione e alla fine della lavorazione
bool bVpl ;
if ( ! FromString( ExtractInfo( m_Params.m_sUserNotes, "Vpl:"), bVpl))
bVpl = true ;
if ( ! AdjustStartEndMovements( bVpl)) {
if ( ! AdjustStartEndMovements()) {
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
if ( sInfo.empty())
m_pMchMgr->SetLastError( 3306, "Error in FiveAxisMilling : link movements not calculable") ;
@@ -745,14 +764,11 @@ FiveAxisMilling::Update( bool bPostApply)
return false ;
}
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
CalcAndSetAxesBBox() ;
// esecuzione eventuali personalizzazioni
string sErr ;
if ( bPostApply && ! PostApply( sErr)) {
if ( ! IsEmptyOrSpaces( sErr))
m_pMchMgr->SetLastError( 3308, sErr) ;
string sPostErr ;
if ( bPostApply && ! PostApply( sPostErr)) {
if ( ! IsEmptyOrSpaces( sPostErr))
m_pMchMgr->SetLastError( 3308, sPostErr) ;
else
m_pMchMgr->SetLastError( 3308, "Error in FiveAxisMilling : post apply not calculable") ;
return false ;
@@ -876,7 +892,7 @@ FiveAxisMilling::GetToolData( void) const
//----------------------------------------------------------------------------
bool
FiveAxisMilling::UpdateToolData( bool* pbChanged)
FiveAxisMilling::UpdateToolData( void)
{
// recupero il gestore DB utensili della macchina corrente
ToolsMgr* pTMgr = m_pMchMgr->GetCurrToolsMgr() ;
@@ -927,9 +943,9 @@ FiveAxisMilling::UpdateToolData( bool* pbChanged)
m_Params.m_sToolName + ")" ;
m_pMchMgr->SetWarning( 3354, sInfo) ;
}
// se definito parametro di ritorno, lo assegno
if ( pbChanged != nullptr)
*pbChanged = bChanged ;
// se modificato, aggiusto lo stato
if ( bChanged)
m_nStatus = MCH_ST_TO_VERIFY ;
return true ;
}
@@ -937,7 +953,7 @@ FiveAxisMilling::UpdateToolData( bool* pbChanged)
bool
FiveAxisMilling::GetGeometry( SELVECTOR& vIds) const
{
// restituisco l'elenco delle entità
// restituisco l'elenco delle entità
vIds = m_vId ;
return true ;
}
@@ -956,14 +972,14 @@ FiveAxisMilling::AdjustEndPointForAxesCalc( const CamData* pCamData, Point3d& pt
//----------------------------------------------------------------------------
bool
FiveAxisMilling::VerifyGeometry( SelData Id, int& nSubs, int& nType)
FiveAxisMilling::VerifyGeometry( SelData Id, int& nSubs)
{
// ammessi : tutte curve o tutte facce di trimesh
// ammessi : curve o superfici
const IGeoObj* pGObj = m_pGeomDB->GetGeoObj( Id.nId) ;
if ( pGObj == nullptr)
return false ;
// se ammesse curve ed è tale
if ( nType != GEO_SURF && ( pGObj->GetType() & GEO_CURVE) != 0) {
// se curva ed è tale
if ( ( pGObj->GetType() & GEO_CURVE) != 0) {
const ICurve* pCurve = nullptr ;
// se direttamente la curva
if ( Id.nSub == SEL_SUB_ALL) {
@@ -984,25 +1000,15 @@ FiveAxisMilling::VerifyGeometry( SelData Id, int& nSubs, int& nType)
}
return ( pCurve != nullptr) ;
}
// se altrimenti ammesse superfici trimesh ed è tale
else if ( nType != GEO_CURVE && ( pGObj->GetType() & GEO_SURF) != 0) {
// se altrimenti è superficie trimesh
else if ( pGObj->GetType() == SRF_TRIMESH) {
const ISurfTriMesh* pSurf = ::GetSurfTriMesh( pGObj) ;
if ( pSurf == nullptr)
return false ;
// se direttamente la superficie
if ( Id.nSub == SEL_SUB_ALL) {
nSubs = pSurf->GetFacetCount() ;
return true ;
}
// altrimenti faccia di superficie trimesh
else {
// se faccia non esistente
if ( Id.nSub > pSurf->GetFacetCount())
return false ;
// tutto bene
nSubs = 0 ;
return true ;
}
return ( pSurf != nullptr && pSurf->GetFacetCount() >= 1) ;
}
// se altrimenti è superficie Bezier
else if ( pGObj->GetType() == SRF_BEZIER) {
const ISurfBezier* pSurf = ::GetSurfBezier( pGObj) ;
return ( pSurf != nullptr && pSurf->IsValid()) ;
}
// altrimenti errore
else
@@ -1014,7 +1020,7 @@ double
FiveAxisMilling::GetApproxLinTol( void) const
{
double dLinTol ;
if ( GetValInNotes( m_Params.m_sUserNotes, "LinTol", dLinTol))
if ( GetValInNotes( m_Params.m_sUserNotes, UN_LINTOL, dLinTol))
return dLinTol ;
else
return Operation::GetApproxLinTol() ;
+10 -4
View File
@@ -35,8 +35,14 @@ class FiveAxisMilling : public Machining
public : // Operation
int GetType( void) const override
{ return OPER_FIVEAXISMILLING ; }
bool IsEmpty( void) const override
{ return ( m_nMills == 0) ; }
bool IsEmpty( int nEmptyType = NEED_GEOM) const override
{ if ( m_nMills == 0)
return true ;
if ( nEmptyType == NEED_ONE_TP_OK)
return ( ! IsAtLeastOnePathOk()) ;
if ( nEmptyType == NEED_ALL_TP_OK)
return ( ! AreAllPathsOk()) ;
return false ; }
bool UpdateStatus( int nModif) override
{ m_nStatus |= nModif ; return true ; }
@@ -59,7 +65,7 @@ class FiveAxisMilling : public Machining
bool GetParam( int nType, int& nVal) const override ;
bool GetParam( int nType, double& dVal) const override ;
bool GetParam( int nType, std::string& sVal) const override ;
bool UpdateToolData( bool* pbChanged = nullptr) override ;
bool UpdateToolData( void) override ;
const ToolData& GetToolData( void) const override ;
bool GetGeometry( SELVECTOR& vIds) const override ;
@@ -68,7 +74,7 @@ class FiveAxisMilling : public Machining
private :
bool MyApply( bool bRecalc, bool bPostApply) ;
bool VerifyGeometry( SelData Id, int& nSubs, int& nType) ;
bool VerifyGeometry( SelData Id, int& nSubs) ;
double GetApproxLinTol( void) const override ;
private :
+1 -1
View File
@@ -178,7 +178,7 @@ FiveAxisMillingData::GetTitle( void) const
}
//----------------------------------------------------------------------------
int
static int
FindFiveAxisMillingKey( const string& sKey)
{
auto TheRange = equal_range( sFiveAxisMillingKey.cbegin(), sFiveAxisMillingKey.cend(), sKey) ;
+36 -20
View File
@@ -17,6 +17,7 @@
#include "DllMain.h"
#include "GenMachining.h"
#include "OperationConst.h"
#include "OperUserNotesConst.h"
#include "/EgtDev/Include/EGkCurveLine.h"
#include "/EgtDev/Include/EGkCurveArc.h"
#include "/EgtDev/Include/EGkCurveComposite.h"
@@ -40,6 +41,7 @@ using namespace std ;
// 2807 = "Error in GenMachining : link outstroke xx"
// 2808 = "Error in GenMachining : post apply not calculable"
// 2809 = "Error in GenMachining : Tool loading failed"
// 2810 = "Error in GenMachining : special apply not calculable"
// 2851 = "Warning in GenMachining : Skipped entity (xx)"
// 2852 = "Warning in GenMachining : No machinable path"
// 2853 = "Warning in GenMachining : Tool name changed (xx)"
@@ -411,7 +413,8 @@ GenMachining::SetGeometry( const SELVECTOR& vIds)
// verifico validità gestore DB geometrico
if ( m_pGeomDB == nullptr)
return false ;
// reset della geometria corrente
// copia temporanea e reset della geometria corrente
SELVECTOR vOldId = m_vId ;
m_vId.clear() ;
// verifico che gli identificativi rappresentino delle entità ammissibili (tutte curve o tutte facce)
int nType = GEO_NONE ;
@@ -427,7 +430,8 @@ GenMachining::SetGeometry( const SELVECTOR& vIds)
m_vId.emplace_back( Id) ;
}
// aggiorno lo stato
m_nStatus |= MCH_ST_GEO_MODIF ;
if ( m_vId != vOldId)
m_nStatus |= MCH_ST_GEO_MODIF ;
// restituisco presenza geometria da lavorare
return ( ! m_vId.empty() || vIds.empty()) ;
}
@@ -549,15 +553,17 @@ GenMachining::Apply( bool bRecalc, bool bPostApply)
return false ;
// aggiorno dati geometrici dell'utensile
bool bToolChanged = true ;
if ( ! UpdateToolData( &bToolChanged)) {
if ( ! UpdateToolData()) {
m_pMchMgr->SetLastError( 2801, "Error in GenMachining : UpdateToolData failed") ;
return false ;
}
// se modificata geometria, necessario ricalcolo
if ( ( m_nStatus & MCH_ST_GEO_MODIF) != 0)
bRecalc = true ;
// verifico se necessario continuare nell'aggiornamento
if ( ! bRecalc && ! bToolChanged &&
( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) {
if ( ! bRecalc && ( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) {
// confermo i percorsi di lavorazione
m_nMills = nCurrMills ;
string sLog = string( "GenMachining apply skipped : status ") + ( m_nStatus == MCH_ST_OK ? "already ok" : "no postapply") ;
@@ -706,9 +712,22 @@ GenMachining::Update( bool bPostApply)
return false ;
}
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
CalcAndSetAxesBBox() ;
// esecuzione eventuali personalizzazioni speciali
string sSpecErr ;
if ( bPostApply && ! SpecialApply( sSpecErr)) {
if ( ! IsEmptyOrSpaces( sSpecErr))
m_pMchMgr->SetLastError( 2810, sSpecErr) ;
else
m_pMchMgr->SetLastError( 2810, "Error in GenMachining : special apply not calculable") ;
return false ;
}
// gestione movimenti all'inizio di ogni singolo percorso di lavorazione e alla fine della lavorazione
bool bVpl ;
if ( ! FromString( ExtractInfo( m_Params.m_sUserNotes, "Vpl:"), bVpl))
if ( ! FromString( ExtractInfo( m_Params.m_sUserNotes, UN_VPL_COLON), bVpl))
bVpl = true ;
if ( ! AdjustStartEndMovements( bVpl)) {
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
@@ -719,14 +738,11 @@ GenMachining::Update( bool bPostApply)
return false ;
}
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
CalcAndSetAxesBBox() ;
// esecuzione eventuali personalizzazioni
string sErr ;
if ( bPostApply && ! PostApply( sErr)) {
if ( ! IsEmptyOrSpaces( sErr))
m_pMchMgr->SetLastError( 2808, sErr) ;
// esecuzione eventuali personalizzazioni finali
string sPostErr ;
if ( bPostApply && ! PostApply( sPostErr)) {
if ( ! IsEmptyOrSpaces( sPostErr))
m_pMchMgr->SetLastError( 2808, sPostErr) ;
else
m_pMchMgr->SetLastError( 2808, "Error in GenMachining : post apply not calculable") ;
return false ;
@@ -850,7 +866,7 @@ GenMachining::GetToolData( void) const
//----------------------------------------------------------------------------
bool
GenMachining::UpdateToolData( bool* pbChanged)
GenMachining::UpdateToolData( void)
{
// recupero il gestore DB utensili della macchina corrente
ToolsMgr* pTMgr = m_pMchMgr->GetCurrToolsMgr() ;
@@ -901,9 +917,9 @@ GenMachining::UpdateToolData( bool* pbChanged)
m_Params.m_sToolName + ")" ;
m_pMchMgr->SetWarning( 2854, sInfo) ;
}
// se definito parametro di ritorno, lo assegno
if ( pbChanged != nullptr)
*pbChanged = bChanged ;
// se modificato, aggiusto lo stato
if ( bChanged)
m_nStatus = MCH_ST_TO_VERIFY ;
return true ;
}
@@ -976,7 +992,7 @@ double
GenMachining::GetApproxLinTol( void) const
{
double dLinTol ;
if ( GetValInNotes( m_Params.m_sUserNotes, "LinTol", dLinTol))
if ( GetValInNotes( m_Params.m_sUserNotes, UN_LINTOL, dLinTol))
return dLinTol ;
else
return Operation::GetApproxLinTol() ;
+9 -3
View File
@@ -35,8 +35,14 @@ class GenMachining : public Machining
public : // Operation
int GetType( void) const override
{ return OPER_GENMACHINING ; }
bool IsEmpty( void) const override
{ return ( m_nMills == 0) ; }
bool IsEmpty( int nEmptyType = NEED_GEOM) const override
{ if ( m_nMills == 0)
return true ;
if ( nEmptyType == NEED_ONE_TP_OK)
return ( ! IsAtLeastOnePathOk()) ;
if ( nEmptyType == NEED_ALL_TP_OK)
return ( ! AreAllPathsOk()) ;
return false ; }
bool UpdateStatus( int nModif) override
{ m_nStatus |= nModif ; return true ; }
@@ -58,7 +64,7 @@ class GenMachining : public Machining
bool GetParam( int nType, int& nVal) const override ;
bool GetParam( int nType, double& dVal) const override ;
bool GetParam( int nType, std::string& sVal) const override ;
bool UpdateToolData( bool* pbChanged = nullptr) override ;
bool UpdateToolData( void) override ;
const ToolData& GetToolData( void) const override ;
bool GetGeometry( SELVECTOR& vIds) const override ;
+1 -1
View File
@@ -178,7 +178,7 @@ GenMachiningData::GetTitle( void) const
}
//----------------------------------------------------------------------------
int
static int
FindGenMachiningKey( const string& sKey)
{
auto TheRange = equal_range( sGenMachiningKey.cbegin(), sGenMachiningKey.cend(), sKey) ;
+21 -2
View File
@@ -15,7 +15,6 @@
#include <string>
//----------------------------------------------------------------------------
// Radice della gestione delle lavorazioni
const std::string MACH_BASE = "MachBase" ;
@@ -78,6 +77,18 @@ const std::string MACHININGS_DIR = "Machinings" ;
// Nome file delle lavorazioni
const std::string MACHININGS_FILE = "Machinings.data" ;
//----------------------------------------------------------------------------
// Sezione Generale nel file INI di macchina
const std::string GENERAL_SEC = "General" ;
// Chiave per materiale caratteristico
const std::string MATERIAL_KEY = "Material" ;
//----------------------------------------------------------------------------
// Sezione tastature nel file INI di macchina
const std::string PROBING_SEC = "Probing" ;
// Chiave (radice) per nome tastatura i-esima
const std::string PROBING_SCRIPT_KEY = "PrbScript" ;
//----------------------------------------------------------------------------
// Sezione lavorazioni generiche nel file INI di macchina
const std::string GENMACHINING_SEC = "GenMachining" ;
@@ -111,6 +122,8 @@ const std::string MORTISEMAKER_KEY = "MortiseMaker" ;
const std::string CHISELMAKER_KEY = "ChiselMaker" ;
// Chiave per generatore disegno waterjet
const std::string WATERJETMAKER_KEY = "WaterJetMaker" ;
// Chiave per generatore disegno tastatori
const std::string PROBEMAKER_KEY = "ProbeMaker" ;
// Chiave per porta utensili punte a forare (marmo)
const std::string DRILLHOLDER_KEY = "DrillHolder" ;
// Chiave per porta utensili lame (marmo)
@@ -153,5 +166,11 @@ const std::string NST_PARTREG_LAYER = "Region" ;
//----------------------------------------------------------------------------
// Minima componente zeta di versore utensile per lavorazione da sopra (-45deg)
const double MIN_ZDIR_TOP_TOOL = -0.7072 ;
// Minima componente zeta di versose utensile èer mortasatura quasi verticale (45deg)
// Minima componente zeta di versore utensile per mortasatura quasi verticale (45deg)
const double MIN_ZDIR_VERT_CHSAW = 0.7072 ;
//----------------------------------------------------------------------------
// Valore di default del peso del primo asse rotante di macchina
static const double ROT1_WEIGHT_DFLT = 1 ;
// Valore di default per angolo di apertura del cono di direzioni coincidenti con singolarità
static const double SING_CONE_ANG_DFLT = 0.01 ;
+36 -20
View File
@@ -125,7 +125,7 @@ class MachMgr : public IMachMgr
int AddRawPart( const Point3d& ptOrig, double dLen, double dWidth, double dHeight, Color cCol) override ;
int AddRawPartWithPart( int nPartId, int nCrvSrfId, double dOverMat, Color cCol) override ;
bool ModifyRawPart( int nRawId, const Point3d& ptOrig, double dLen, double dWidth, double dHeight, Color cCol) override ;
bool ModifyRawPart( int nRawId, int nCrvId, double dOverMat, double dZmin, double dHeight, Color cCol) override ;
bool ModifyRawPart( int nRawId, int nCrvId, double dOverMat, double dHeight, Color cCol) override ;
bool ModifyRawPartSize( int nRawId, double dLength, double dWidth, double dHeight) override ;
bool ModifyRawPartHeight( int nRawId, double dHeight) override ;
bool KeepRawPart( int nRawId, int nSouPhase) override ;
@@ -214,10 +214,11 @@ class MachMgr : public IMachMgr
int GetCurrSetup( void) const override ;
bool GetDefaultSetupName( std::string& sName) const override ;
bool ImportSetup( const std::string& sName) override ;
bool ExistsCurrSetup( void) const override ;
bool VerifyCurrSetup( STRVECTOR& vsErrors) override ;
bool FindToolInCurrSetup( const std::string& sTool) override ;
bool GetToolSetupPosInCurrSetup( const std::string& sTool, std::string& sTcPos) override ;
bool GetToolsInCurrSetupPos( const std::string& sTcPos, STRVECTOR& vsTools) override ;
bool FindToolInCurrSetup( const std::string& sTool) const override ;
bool GetToolSetupPosInCurrSetup( const std::string& sTool, std::string& sTcPos) const override ;
bool GetToolsInCurrSetupPos( const std::string& sTcPos, STRVECTOR& vsTools) const override ;
bool UpdateCurrSetup( void) override ;
bool EraseCurrSetup( void) override ;
// Machinings DataBase
@@ -258,16 +259,16 @@ class MachMgr : public IMachMgr
int GetNextOperation( int nId) const override ;
int GetLastOperation( void) const override ;
int GetPrevOperation( int nId) const override ;
int GetFirstActiveOperation( void) const override ;
int GetNextActiveOperation( int nId) const override ;
int GetLastActiveOperation( void) const override ;
int GetPrevActiveOperation( int nId) const override ;
int GetFirstActiveOperation( bool bNeedMachNotEmpty = false) const override ;
int GetNextActiveOperation( int nId, bool bNeedMachNotEmpty = false) const override ;
int GetLastActiveOperation( bool bNeedMachNotEmpty = false) const override ;
int GetPrevActiveOperation( int nId, bool bNeedMachNotEmpty = false) const override ;
int GetOperationType( int nId) const override ;
int GetOperationPhase( int nId) const override ;
bool SetOperationName( int nId, const std::string& sName) override ;
std::string GetOperationName( int nId) const override ;
int GetOperationId( const std::string& sName) const override ;
bool IsOperationEmpty( int nId) const override ;
bool IsOperationEmpty( int nId, int nEmptyType = 0) const override ;
bool RemoveOperation( int nId) override ;
bool RemoveAllPhaseOperations( int nPhase) override ;
bool RemoveAllOperations( void) override ;
@@ -303,6 +304,7 @@ class MachMgr : public IMachMgr
bool RemoveMachiningPreview( void) override ;
bool MachiningApply( bool bRecalc, bool bPostApply = true) override ;
bool MachiningUpdate( bool bPostApply = true) override ;
bool ChangePreviewMachiningToolShow( int nLookFlag) override ;
bool PreparePreviewMachiningTool( void) const override ;
bool RemovePreviewMachiningTool( void) const override ;
int GetPreviewMachiningToolStepCount( void) const override ;
@@ -313,16 +315,22 @@ class MachMgr : public IMachMgr
bool GetMachiningParam( int nType, std::string& sVal) const override ;
bool GetMachiningGeometry( SELVECTOR& vIds) const override ;
bool GetMachiningSkippedGeometry( SELVECTOR& vIds) const override ;
bool IsMachiningEmpty( void) const override ;
bool IsMachiningEmpty( int nEmptyType = 0) const override ;
bool GetMachiningStartPoint( Point3d& ptStart) const override ;
bool GetMachiningEndPoint( Point3d& ptEnd) const override ;
bool GetMachiningStartAxes( bool bSkipClimb, DBLVECTOR& vAxVal) const override ;
bool GetMachiningEndAxes( bool bSkipRise, DBLVECTOR& vAxVal) const override ;
// CL Entities Interrogations
bool GetClEntMove( int nEntId, int& nMove) const override ;
bool GetClEntFlag( int nEntId, int& nFlag, int& nFlag2) const override ;
bool GetClEntIndex( int nEntId, int& nIndex) const override ;
bool GetClEntFeed( int nEntId, double& dFeed) const override ;
bool GetClEntAxesStatus( int nEntId, int& nStatus) const override ;
bool GetClEntAxesMask( int nEntId, int& nMask) const override ;
bool GetClEntAxesVal( int nEntId, DBLVECTOR& vAxes) const override ;
bool GetClEntTDir( int nEntId, Vector3d& vTDir) const override ;
bool GetClEntCDir( int nEntId, Vector3d& vCDir) const override ;
bool GetClEntADir( int nEntId, Vector3d& vADir) const override ;
// Simulation
bool SimInit( void) override ;
bool SimStart( bool bFirst) override ;
@@ -333,6 +341,7 @@ class MachMgr : public IMachMgr
bool SimGetMoveInfo( int& nGmove, double& dFeed) const override ;
bool SimSetStep( double dStep) override ;
bool SimSetUiStatus( int nUiStatus) override ;
bool SimEnableToolTipTrace( bool bEnable) override ;
bool SimGoHome( void) override ;
bool SimExit( void) override ;
// Generation
@@ -341,21 +350,25 @@ class MachMgr : public IMachMgr
// Machine Calc
bool SetCalcTable( const std::string& sTable) override ;
bool SetCalcTool( const std::string& sTool, const std::string& sHead, int nExit) override ;
bool GetAllCurrAxesNames( STRVECTOR& vAxName) const override ;
bool SetCalcSolCh( int nScc, bool bExact) override ;
bool SetRotAxisBlock( const std::string& sAxis, double dVal) override ;
bool GetRotAxisBlocked( int nInd, std::string& sAxis, double& dVal) const override ;
bool GetCalcTable( std::string& sTable) const override ;
bool GetCalcTool( std::string& sTool) const override ;
bool GetCalcHead( std::string& sHead) const override ;
bool GetCalcExit( int& nExit) const override ;
bool GetCalcSolCh( int& nScc, bool& bExact) const override ;
bool GetAllCurrAxesNames( STRVECTOR& vAxName) const override ;
bool GetRotAxisBlocked( int nInd, std::string& sAxis, double& dVal) const override ;
bool GetCalcAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
int& nStat, double& dAngA1, double& dAngB1, double& dAngA2, double& dAngB2) const override ;
bool GetCalcAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
int& nStat, DBLVECTOR& vAng1, DBLVECTOR& vAng2) const override ;
bool GetCalcPositions( const Point3d& ptP, double dAngA, double dAngB,
int& nStat, double& dX, double& dY, double& dZ) const override ;
double& dX, double& dY, double& dZ) const override ;
bool GetCalcPositions( const Point3d& ptP, const DBLVECTOR& vAng,
int& nStat, double& dX, double& dY, double& dZ) const override ;
double& dX, double& dY, double& dZ) const override ;
bool GetRobotAngles( const Point3d& ptP, const Vector3d& vtDirT, const Vector3d& vtDirA,
DBLVECTOR& vAng1, DBLVECTOR& vAng2) const override ;
bool GetCalcTipFromPositions( double dX, double dY, double dZ, double dAngA, double dAngB,
bool bOverall, bool bBottom, Point3d& ptTip) const override ;
bool GetCalcTipFromPositions( double dX, double dY, double dZ, const DBLVECTOR& vAng,
@@ -365,6 +378,7 @@ class MachMgr : public IMachMgr
bool GetNearestAngleInStroke( int nInd, double dAngRef, double& dAng) const override ;
bool LimitAngleToStroke( int nInd, double& dAng) const override ;
bool VerifyOutstroke( double dX, double dY, double dZ, double dAngA, double dAngB, int& nStat) const override ;
bool VerifyOutstroke( double dX, double dY, double dZ, const DBLVECTOR& vAng, bool bClear, int& nStat) const override ;
std::string GetOutstrokeInfo( bool bMM = true) const override ;
// Machine
int GetBaseId( const std::string& sBase) const override ;
@@ -460,7 +474,7 @@ class MachMgr : public IMachMgr
bool GetCurrAxisMax( int nInd, double& dHome) const ;
bool GetCurrAxisMin( int nInd, double& dHome) const ;
const Frame3d& GetCurrLinAxesFrame( void) const ;
bool GetCurrIsCenter( void) const ;
bool GetCurrIsMcent( void) const ;
bool GetCurrIsRobot( void) const ;
bool ApplyRotAxisBlock( void) ;
void ClearRotAxisBlock( void)
@@ -472,19 +486,21 @@ class MachMgr : public IMachMgr
double GetCalcRot1W( void) const ;
bool GetCalcMaxDeltaR2OnFirst( void) const ;
bool GetCalcPartDirFromAngles( const Vector3d& vtPart, const DBLVECTOR& vAng, Vector3d& vtDir) const ;
bool SetCalcSolCh( int nScc, bool bExact) ;
bool VerifyAngleOutstroke( int nInd, double dAng) const ;
bool VerifyOutstroke( double dX, double dY, double dZ, const DBLVECTOR& vAng, bool bClear, int& nStat) const ;
bool ExistProtectedAreas( void) const ;
// Operations
bool GetOperationNewName( std::string& sName) const ;
const ToolData* GetMachiningToolData( void) const ;
// Simulation
bool SimAddCollisionObj( int nInd, bool bToolOn, int nFrameId, int nType, const Vector3d& vtMove, double dPar1, double dPar2, double dPar3) ;
bool SimAddCollisionObj( int nInd, bool bToolOn, int nFrameId, int nType,
const Vector3d& vtMove, double dPar1, double dPar2, double dPar3) ;
bool SimRemoveCollisionObj( int nFrameId) ;
bool SimGetCollisionObj( int nPos, int& nInd, bool& bToolOn, int& nFrameId, int& nType,
Vector3d& vtMove, double& dPar1, double& dPar2, double& dPar3) const ;
bool SimExecCollisionCheck( int& nCdInd, int& nObjInd, int nMoveType) ;
bool SimOnCollision( int nCdInd, int nObjInd, int& nErr) ;
bool SimSetToolForVmill( const std::string& sTool, const std::string& sHead, int nExit, int nFlag, double dPar1, double dPar2,
const INTVECTOR& vVmill, bool bFirst) ;
bool SimSetToolForVmill( const std::string& sTool, const std::string& sHead, int nExit, int nFlag,
double dPar1, double dPar2, const INTVECTOR& vVmill, bool bFirst) ;
bool SimEnableToolsForVmill( bool bEnable) ;
int SimMoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt) ;
bool SimSaveCmd( int nType, int nPar, const std::string& sPar, const std::string& sPar2) ;
+3
View File
@@ -16,6 +16,7 @@
#include "MachMgr.h"
#include "MachConst.h"
#include "DllMain.h"
#include "MachiningRegister.h"
#include "/EgtDev/Include/EMkDllMain.h"
#include "/EgtDev/Include/EGnStringUtils.h"
#include "/EgtDev/Include/EGnFileUtils.h"
@@ -32,6 +33,8 @@ CreateMachMgr( void)
// verifico la chiave e le opzioni
if ( ! GetEMkNetHwKey() && ! TestKeyForEMk( GetEMkKey(), 0, GetEMkLogger()))
return nullptr ;
// registro classe operazione per pocketing
RegisterPocketing() ;
// creo il MachMgr
return static_cast<IMachMgr*> ( new(nothrow) MachMgr) ;
}
+73 -1
View File
@@ -2,7 +2,7 @@
// EgalTech 2019-2023
//----------------------------------------------------------------------------
// File : MachMgrClEntities.cpp Data : 27.10.23 Versione : 2.5j4
// Contenuto : Implementazione interrogazione entità CL della classe MachMgr.
// Contenuto : Implementazione interrogazione entità CL della classe MachMgr.
//
//
//
@@ -76,6 +76,24 @@ MachMgr::GetClEntIndex( int nEntId, int& nIndex) const
return true ;
}
//----------------------------------------------------------------------------
bool
MachMgr::GetClEntFeed( int nEntId, double& dFeed) const
{
// default
dFeed = 0 ;
// verifico validita GeomDB
if ( m_pGeomDB == nullptr)
return false ;
// recupero l'oggetto CamData
const CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nEntId)) ;
if ( pCamData == nullptr)
return false ;
// recupero la feed
dFeed = pCamData->GetFeed() ;
return true ;
}
//----------------------------------------------------------------------------
bool
MachMgr::GetClEntAxesStatus( int nEntId, int& nStatus) const
@@ -129,3 +147,57 @@ MachMgr::GetClEntAxesVal( int nEntId, DBLVECTOR& vAxes) const
vAxes = pCamData->GetAxesVal() ;
return true ;
}
//----------------------------------------------------------------------------
bool
MachMgr::GetClEntTDir( int nEntId, Vector3d& vTDir) const
{
// default
vTDir = V_NULL ;
// verifico validità GeomBD
if ( m_pGeomDB == nullptr)
return false ;
// recupero l'oggetto CamData
const CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nEntId)) ;
if ( pCamData == nullptr)
return false ;
// recupero vTDir
vTDir = pCamData->GetToolDir() ;
return true ;
}
//----------------------------------------------------------------------------
bool
MachMgr::GetClEntCDir( int nEntId, Vector3d& vCDir) const
{
// default
vCDir = V_NULL ;
// verifico validità GeomDB
if ( m_pGeomDB == nullptr)
return false ;
// recupero l'oggetto CamData
const CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nEntId)) ;
if ( pCamData == nullptr)
return false ;
// recupero vCDir
vCDir = pCamData->GetCorrDir() ;
return true ;
}
//----------------------------------------------------------------------------
bool
MachMgr::GetClEntADir( int nEntId, Vector3d& vADir) const
{
// default
vADir = V_NULL ;
// verifico validità GeomDB
if ( m_pGeomDB == nullptr)
return false ;
// recupero l'oggetto CamData
const CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nEntId)) ;
if ( pCamData == nullptr)
return false ;
// recupero ADir
vADir = pCamData->GetAuxDir() ;
return true ;
}
+18
View File
@@ -651,6 +651,8 @@ MachMgr::UpdateStandardToolDraw( const ToolData* pTdata, int nGenCtx, int nToolC
pTdata->GetParam( TPA_TIPFEED, dTipFeed) ;
string sUserNotes ;
pTdata->GetParam( TPA_USERNOTES, sUserNotes) ;
string sSysNotes ;
pTdata->GetParam( TPA_SYSNOTES, sSysNotes) ;
// Recupero la path dell'eventuale portautensile
string sThPath = GetToolHolderPath( sHeadName, nExit, nType, sUserNotes) ;
// Carico generatore disegno utensile
@@ -668,6 +670,7 @@ MachMgr::UpdateStandardToolDraw( const ToolData* pTdata, int nGenCtx, int nToolC
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.SPEED", dSpeed) ;
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.TIPFEED", dTipFeed) ;
bOk = bOk && ExeLuaSetGlobStringVar( "TOOL.USERNOTES", sUserNotes) ;
bOk = bOk && ExeLuaSetGlobStringVar( "TOOL.SYSNOTES", sSysNotes) ;
switch ( nType) {
case TT_DRILL_STD :
case TT_DRILL_LONG :
@@ -712,6 +715,15 @@ MachMgr::UpdateStandardToolDraw( const ToolData* pTdata, int nGenCtx, int nToolC
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.THICK", dThick) ;
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.CORNRAD", dCornRad) ;
break ;
case TT_PROBE :
bOk = bOk && ExeLuaSetGlobStringVar( "TOOL.TOOLHOLDER", sThPath) ;
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.TOTLEN", dTotLen) ;
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.LEN", dLen) ;
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.DIAM", dDiam) ;
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.STEMDIAM", dStemDiam) ;
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.HEIGHT", dThick) ;
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.CORNRAD", dCornRad) ;
break ;
default :
return TD_INT_ERR ;
}
@@ -808,6 +820,8 @@ MachMgr::GetToolMakerKeyFromType( int nType) const
return WATERJETMAKER_KEY ;
case TT_COMPO :
return "" ;
case TT_PROBE :
return PROBEMAKER_KEY ;
}
return "" ;
}
@@ -849,6 +863,10 @@ MachMgr::GetToolHolderPath( const string& sHeadName, int nExit, int nType, const
string sKey2 = sKey + ":MILL_POLISHING" ;
sToolHolder = GetPrivateProfileStringUtf8( TOOLHOLDER_SEC.c_str(), sKey2.c_str(), "", sMachIni.c_str()) ;
}
else if ( nType == TT_PROBE) {
string sKey2 = sKey + ":PROBE" ;
sToolHolder = GetPrivateProfileStringUtf8( TOOLHOLDER_SEC.c_str(), sKey2.c_str(), "", sMachIni.c_str()) ;
}
if ( sToolHolder.empty())
sToolHolder = GetPrivateProfileStringUtf8( TOOLHOLDER_SEC.c_str(), sKey.c_str(), "", sMachIni.c_str()) ;
// Se non trovato, provo da sezione Tools di Ini di macchina
+3 -1
View File
@@ -387,8 +387,10 @@ MachMgr::SetCurrMachGroup( int nId)
// aggiorno attrezzaggio attivo
UpdateCurrSetup() ;
// imposto la prima fase come corrente
if ( ! SetCurrPhase( 1))
if ( ! SetCurrPhase( 1)) {
ResetCurrMachGroup() ;
return false ;
}
// nascondo i pezzi rimasti sotto la radice
ShowRootParts( false) ;
// rendo visibile il nuovo gruppo corrente e la relativa macchina
+43 -11
View File
@@ -210,8 +210,8 @@ MachMgr::GetCurrMachiningsMgr( void) const
// se DB lavorazioni non esiste, provo a crearlo e caricarlo
if ( m_vMachines[m_nCurrMch].pMsMgr == nullptr) {
PtrOwner<MachiningsMgr> pMsMgr( new( nothrow) MachiningsMgr) ;
string sMachsFile = m_vMachines[m_nCurrMch].sDir + "\\" + MACHININGS_DIR + "\\" + MACHININGS_FILE ;
if ( IsNull( pMsMgr) || ! pMsMgr->Load( sMachsFile, GetCurrToolsMgr()))
string sMachsDir = m_vMachines[m_nCurrMch].sDir + "\\" + MACHININGS_DIR ;
if ( IsNull( pMsMgr) || ! pMsMgr->Load( sMachsDir, MACHININGS_FILE, GetCurrToolsMgr()))
return nullptr ;
// salvo nel vettore
const_cast<MachineData&>( m_vMachines[m_nCurrMch]).pMsMgr = Release( pMsMgr) ;
@@ -555,6 +555,17 @@ MachMgr::SetCalcSolCh( int nScc, bool bExact)
return pMch->SetSolCh( nScc, bExact) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::GetCalcSolCh( int& nScc, bool& bExact) const
{
Machine* pMch = GetCurrMachine() ;
if ( pMch == nullptr)
return false ;
// recupero il criterio di scelta della soluzione
return pMch->GetSolCh( nScc, bExact) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::GetCalcTable( string& sTable) const
@@ -624,7 +635,7 @@ bool
MachMgr::GetCalcMaxDeltaR2OnFirst( void) const
{
Machine* pMch = GetCurrMachine() ;
return ( ( pMch != nullptr) ? pMch->GetCurrMaxDeltaR2OnFirst() : true) ;
return ( ( pMch != nullptr) ? pMch->GetCurrCalcMaxDeltaR2OnFirst() : true) ;
}
//----------------------------------------------------------------------------
@@ -741,12 +752,12 @@ MachMgr::GetCurrLinAxesFrame( void) const
//----------------------------------------------------------------------------
bool
MachMgr::GetCurrIsCenter( void) const
MachMgr::GetCurrIsMcent( void) const
{
Machine* pMch = GetCurrMachine() ;
if ( pMch == nullptr)
return false ;
return ( pMch->GetCurrKinematicChainType() == KIN_CHAIN_CENTER) ;
return ( pMch->GetCurrKinematicChainType() == KIN_CHAIN_MCENT) ;
}
//----------------------------------------------------------------------------
@@ -764,8 +775,19 @@ bool
MachMgr::GetCalcAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
int& nStat, double& dAngA1, double& dAngB1, double& dAngA2, double& dAngB2) const
{
Machine* pMch = GetCurrMachine() ;
return ( ( pMch != nullptr) ? pMch->GetAngles( vtDirT, vtDirA, nStat, dAngA1, dAngB1, dAngA2, dAngB2) : false) ;
nStat = 0 ; dAngA1 = 0 ; dAngB1 = 0 ; dAngA2 = 0 ; dAngB2 = 0 ;
DBLVECTOR vAng1, vAng2 ;
if ( ! GetCalcAngles( vtDirT, vtDirA, nStat, vAng1, vAng2))
return false ;
if ( vAng1.size() >= 1) {
dAngA1 = vAng1[0] ;
dAngA2 = vAng2[0] ;
if ( vAng1.size() >= 2) {
dAngB1 = vAng1[1] ;
dAngB2 = vAng2[1] ;
}
}
return true ;
}
//----------------------------------------------------------------------------
@@ -773,6 +795,7 @@ bool
MachMgr::GetCalcAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
int& nStat, DBLVECTOR& vAng1, DBLVECTOR& vAng2) const
{
const_cast<MachMgr*>(this)->ApplyRotAxisBlock() ;
Machine* pMch = GetCurrMachine() ;
return ( ( pMch != nullptr) ? pMch->GetAngles( vtDirT, vtDirA, nStat, vAng1, vAng2) : false) ;
}
@@ -780,20 +803,29 @@ MachMgr::GetCalcAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
//----------------------------------------------------------------------------
bool
MachMgr::GetCalcPositions( const Point3d& ptP, double dAngA, double dAngB,
int& nStat, double& dX, double& dY, double& dZ) const
double& dX, double& dY, double& dZ) const
{
DBLVECTOR vAng( 2) ; vAng[0] = dAngA ; vAng[1] = dAngB ;
Machine* pMch = GetCurrMachine() ;
return ( ( pMch != nullptr) ? pMch->GetPositions( ptP, vAng, nStat, dX, dY, dZ) : false) ;
return ( ( pMch != nullptr) ? pMch->GetPositions( ptP, vAng, dX, dY, dZ) : false) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::GetCalcPositions( const Point3d& ptP, const DBLVECTOR& vAng,
int& nStat, double& dX, double& dY, double& dZ) const
double& dX, double& dY, double& dZ) const
{
Machine* pMch = GetCurrMachine() ;
return ( ( pMch != nullptr) ? pMch->GetPositions( ptP, vAng, nStat, dX, dY, dZ) : false) ;
return ( ( pMch != nullptr) ? pMch->GetPositions( ptP, vAng, dX, dY, dZ) : false) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::GetRobotAngles( const Point3d& ptP, const Vector3d& vtDirT, const Vector3d& vtDirA,
DBLVECTOR& vAng1, DBLVECTOR& vAng2) const
{
Machine* pMch = GetCurrMachine() ;
return ( ( pMch != nullptr) ? pMch->GetRobotAngles( ptP, vtDirT, vtDirA, vAng1, vAng2) : false) ;
}
//----------------------------------------------------------------------------
+73 -21
View File
@@ -100,48 +100,52 @@ MachMgr::GetPrevOperation( int nId) const
//----------------------------------------------------------------------------
int
MachMgr::GetFirstActiveOperation( void) const
MachMgr::GetFirstActiveOperation( bool bNeedMachNotEmpty) const
{
int nId = GetFirstOperation() ;
int nMode ;
while ( nId != GDB_ID_NULL &&
m_pGeomDB->GetCalcMode( nId, nMode) && nMode == GDB_MD_HIDDEN)
(( m_pGeomDB->GetCalcMode( nId, nMode) && nMode == GDB_MD_HIDDEN) ||
( bNeedMachNotEmpty && IsValidMachiningType( GetOperationType( nId)) && IsOperationEmpty( nId, NEED_ONE_TP_OK))))
nId = GetNextOperation( nId) ;
return nId ;
}
//----------------------------------------------------------------------------
int
MachMgr::GetNextActiveOperation( int nId) const
MachMgr::GetNextActiveOperation( int nId, bool bNeedMachNotEmpty) const
{
int nNextId = GetNextOperation( nId) ;
int nMode ;
while ( nNextId != GDB_ID_NULL &&
m_pGeomDB->GetCalcMode( nNextId, nMode) && nMode == GDB_MD_HIDDEN)
(( m_pGeomDB->GetCalcMode( nNextId, nMode) && nMode == GDB_MD_HIDDEN) ||
( bNeedMachNotEmpty && IsValidMachiningType( GetOperationType( nNextId)) && IsOperationEmpty( nNextId, NEED_ONE_TP_OK))))
nNextId = GetNextOperation( nNextId) ;
return nNextId ;
}
//----------------------------------------------------------------------------
int
MachMgr::GetLastActiveOperation( void) const
MachMgr::GetLastActiveOperation( bool bNeedMachNotEmpty) const
{
int nId = GetLastOperation() ;
int nMode ;
while ( nId != GDB_ID_NULL &&
m_pGeomDB->GetCalcMode( nId, nMode) && nMode == GDB_MD_HIDDEN)
(( m_pGeomDB->GetCalcMode( nId, nMode) && nMode == GDB_MD_HIDDEN) ||
( bNeedMachNotEmpty && IsValidMachiningType( GetOperationType( nId)) && IsOperationEmpty( nId, NEED_ONE_TP_OK))))
nId = GetPrevOperation( nId) ;
return nId ;
}
//----------------------------------------------------------------------------
int
MachMgr::GetPrevActiveOperation( int nId) const
MachMgr::GetPrevActiveOperation( int nId, bool bNeedMachNotEmpty) const
{
int nPrevId = GetPrevOperation( nId) ;
int nMode ;
while ( nPrevId != GDB_ID_NULL &&
m_pGeomDB->GetCalcMode( nPrevId, nMode) && nMode == GDB_MD_HIDDEN)
(( m_pGeomDB->GetCalcMode( nPrevId, nMode) && nMode == GDB_MD_HIDDEN) ||
( bNeedMachNotEmpty && IsValidMachiningType( GetOperationType( nPrevId)) && IsOperationEmpty( nPrevId, NEED_ONE_TP_OK))))
nPrevId = GetPrevOperation( nPrevId) ;
return nPrevId ;
}
@@ -180,14 +184,11 @@ MachMgr::GetOperationPhase( int nId) const
bool
MachMgr::GetOperationNewName( string& sName) const
{
// il parametro nome deve essere valido
if ( &sName == nullptr)
return false ;
// il gruppo per le operazioni deve essere presente nella macchinata corrente
if ( GetCurrOperId() == GDB_ID_NULL)
return false ;
// se nome vuoto, assegno radice standard
if ( sName.empty())
if ( ! IsValidVal( sName))
sName = "Oper" ;
// se presenti caratteri vietati, li sostituisco
ValidateVal( sName) ;
@@ -214,6 +215,9 @@ MachMgr::SetOperationName( int nId, const string& sName)
// verifico che faccia parte del gruppo delle operazioni
if ( pIter->GetParentId() != GetCurrOperId())
return false ;
// verifico che il nome sia valido
if ( ! IsValidVal( sName))
return false ;
// verifico che il nome non sia già usato da una operazione
if ( GetOperationId( sName) != GDB_ID_NULL)
return false ;
@@ -228,10 +232,10 @@ MachMgr::GetOperationName( int nId) const
// recupero l'operazione
PtrOwner<IGdbIterator> pIter( CreateGdbIterator( m_pGeomDB)) ;
if ( IsNull( pIter) || ! pIter->GoTo( nId))
return 0 ;
return "" ;
// verifico che faccia parte del gruppo delle operazioni
if ( pIter->GetParentId() != GetCurrOperId())
return 0 ;
return "" ;
// recupero il nome dell'operazione riferita
string sName ;
pIter->GetName( sName) ;
@@ -243,12 +247,12 @@ int
MachMgr::GetOperationId( const string& sName) const
{
// verifica dei parametri
if ( &sName == nullptr || sName.empty())
return false ;
if ( ! IsValidVal( sName))
return GDB_ID_NULL ;
// recupero l'identificativo dell'operazione con il nome indicato
PtrOwner<IGdbIterator> pIter( CreateGdbIterator( m_pGeomDB)) ;
if ( IsNull( pIter))
return false ;
return GDB_ID_NULL ;
bool bIter = pIter->GoToFirstInGroup( GetCurrOperId()) ;
while ( bIter) {
// verifico il nome
@@ -263,7 +267,7 @@ MachMgr::GetOperationId( const string& sName) const
//----------------------------------------------------------------------------
bool
MachMgr::IsOperationEmpty( int nId) const
MachMgr::IsOperationEmpty( int nId, int nEmptyType) const
{
// verifiche
if ( m_pGeomDB == nullptr || m_pGeomDB->GetParentId( nId) != GetCurrOperId())
@@ -273,7 +277,7 @@ MachMgr::IsOperationEmpty( int nId) const
if ( pOpe == nullptr)
return true ;
// restituisco se vuota
return pOpe->IsEmpty() ;
return pOpe->IsEmpty( nEmptyType) ;
}
//----------------------------------------------------------------------------
@@ -1102,6 +1106,22 @@ MachMgr::MachiningUpdate( bool bPostApply)
return pMch->Update( bPostApply) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::ChangePreviewMachiningToolShow( int nLookFlag)
{
// recupero la lavorazione corrente
int nCurrMchId = GetCurrMachining() ;
if ( nCurrMchId == GDB_ID_NULL)
return false ;
// ne recupero il gestore
Machining* pMch = GetMachining( m_pGeomDB->GetUserObj( nCurrMchId)) ;
if ( pMch == nullptr)
return false ;
// eseguo
return pMch->ChangeToolPreviewShow( nLookFlag) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::PreparePreviewMachiningTool( void) const
@@ -1279,7 +1299,7 @@ MachMgr::GetMachiningSkippedGeometry( SELVECTOR& vIds) const
//----------------------------------------------------------------------------
bool
MachMgr::IsMachiningEmpty( void) const
MachMgr::IsMachiningEmpty( int nEmptyType) const
{
// recupero la lavorazione corrente
int nCurrMchId = GetCurrMachining() ;
@@ -1290,7 +1310,7 @@ MachMgr::IsMachiningEmpty( void) const
if ( pMch == nullptr)
return true ;
// restituisco lo stato
return pMch->IsEmpty() ;
return pMch->IsEmpty( nEmptyType) ;
}
//----------------------------------------------------------------------------
@@ -1324,3 +1344,35 @@ MachMgr::GetMachiningEndPoint( Point3d& ptEnd) const
// restituisco il punto finale dell'ultimo percorso di lavorazione
return pMch->GetEndPoint( ptEnd) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::GetMachiningStartAxes( bool bSkipClimb, DBLVECTOR& vAxVal) const
{
// recupero la lavorazione corrente
int nCurrMchId = GetCurrMachining() ;
if ( nCurrMchId == GDB_ID_NULL)
return false ;
// ne recupero il gestore
Machining* pMch = GetMachining( m_pGeomDB->GetUserObj( nCurrMchId)) ;
if ( pMch == nullptr)
return false ;
// recupero i valori
return pMch->GetInitialAxesValues( bSkipClimb, true, vAxVal) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::GetMachiningEndAxes( bool bSkipRise, DBLVECTOR& vAxVal) const
{
// recupero la lavorazione corrente
int nCurrMchId = GetCurrMachining() ;
if ( nCurrMchId == GDB_ID_NULL)
return false ;
// ne recupero il gestore
Machining* pMch = GetMachining( m_pGeomDB->GetUserObj( nCurrMchId)) ;
if ( pMch == nullptr)
return false ;
// recupero i valori
return pMch->GetFinalAxesValues( bSkipRise, true, vAxVal) ;
}
+86 -30
View File
@@ -28,6 +28,8 @@
#include "/EgtDev/Include/EGkSfrCreate.h"
#include "/EgtDev/Include/EGkStmStandard.h"
#include "/EgtDev/Include/EGkStmFromCurves.h"
#include "/EgtDev/Include/EGkSurfBezier.h"
#include "/EgtDev/Include/EGkCAvSilhouetteSurfTm.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
#include "/EgtDev/Include/EXeConst.h"
@@ -284,7 +286,7 @@ MachMgr::AddRawPart( int nCrvId, double dOverMat, double dZmin, double dHeight,
// assegno la fase al gruppo
m_pGeomDB->SetInfo( nRawId, MACH_RAW_PHASE, m_nCurrPhase) ;
// creo solido e outline
bOk = bOk && ModifyRawPart( nRawId, nCrvId, dOverMat, dZmin, dHeight, cCol) ;
bOk = bOk && ModifyRawPart( nRawId, nCrvId, dOverMat, dHeight, cCol) ;
// se qualcosa è andato storto, cancello tutto
if ( ! bOk) {
m_pGeomDB->Erase( nRawId) ;
@@ -296,7 +298,7 @@ MachMgr::AddRawPart( int nCrvId, double dOverMat, double dZmin, double dHeight,
//----------------------------------------------------------------------------
bool
MachMgr::ModifyRawPart( int nRawId, int nCrvId, double dOverMat, double dZmin, double dHeight, Color cCol)
MachMgr::ModifyRawPart( int nRawId, int nCrvId, double dOverMat, double dHeight, Color cCol)
{
// verifica validità grezzo
if ( ! VerifyRawPart( nRawId))
@@ -337,7 +339,7 @@ MachMgr::ModifyRawPart( int nRawId, int nCrvId, double dOverMat, double dZmin, d
if ( IsNull( pOffsCrv))
return false ;
// creo il solido
PtrOwner<ISurfTriMesh> pStm( GetSurfTriMeshByExtrusion( pOffsCrv, Vector3d(0,0,dHeight), true)) ;
PtrOwner<ISurfTriMesh> pStm( GetSurfTriMeshByExtrusion( pOffsCrv, Vector3d( 0, 0, dHeight), true)) ;
if ( IsNull( pStm))
return false ;
// cancello eventuali vecchi solidi e curve di outline
@@ -375,6 +377,10 @@ MachMgr::AddRawPart( int nSurfId, Color cCol)
int nRawGroupId = GetCurrRawGroupId() ;
if ( nRawGroupId == GDB_ID_NULL)
return GDB_ID_NULL ;
// verifico che la superficie sia chiusa
const ISurf* pSurf = GetSurf( m_pGeomDB->GetGeoObj( nSurfId)) ;
if ( pSurf == nullptr || ! pSurf->IsClosed())
return GDB_ID_NULL ;
// recupero l'ingombro della superficie in globale
BBox3d b3Surf ;
if ( ! m_pGeomDB->GetGlobalBBox( nSurfId, b3Surf))
@@ -388,8 +394,23 @@ MachMgr::AddRawPart( int nSurfId, Color cCol)
bool bOk = m_pGeomDB->SetName( nRawId, MACH_RAW_PART) ;
// assegno la fase al gruppo
m_pGeomDB->SetInfo( nRawId, MACH_RAW_PHASE, m_nCurrPhase) ;
// copio la superficie nel gruppo
int nId = m_pGeomDB->CopyGlob( nSurfId, GDB_ID_NULL, nRawId) ;
// creo il grezzo
int nId = GDB_ID_NULL ;
// partendo da superficie Trimesh copio
if ( pSurf->GetType() == SRF_TRIMESH)
nId = m_pGeomDB->CopyGlob( nSurfId, GDB_ID_NULL, nRawId) ;
// partendo da superficie Bezier devo recuperare la Trimesh ausiliaria e copiarla
else if ( pSurf->GetType() == SRF_BEZIER) {
const ISurfBezier* pSbez = GetSurfBezier( pSurf) ;
const ISurfTriMesh* pAuxStm = ( pSbez != nullptr ? pSbez->GetAuxSurf() : nullptr) ;
PtrOwner<ISurfTriMesh> pStm( pAuxStm != nullptr ? pAuxStm->Clone() : nullptr) ;
if ( ! IsNull( pStm)) {
Frame3d frSbez ;
m_pGeomDB->GetGlobFrame( nSurfId, frSbez) ;
pStm->LocToLoc( frSbez, frRaw) ;
nId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nRawId, Release( pStm)) ;
}
}
bOk = bOk && ( nId != GDB_ID_NULL) ;
// assegno il nome al solido
bOk = bOk && m_pGeomDB->SetName( nId, MACH_RAW_SOLID) ;
@@ -406,37 +427,70 @@ MachMgr::AddRawPart( int nSurfId, Color cCol)
if ( IsNull( pCrvCompo))
return GDB_ID_NULL ;
// recupero la superficie trimesh
ISurfTriMesh* pStm = GetSurfTriMesh( m_pGeomDB->GetGeoObj( nId)) ;
const ISurfTriMesh* pStm = GetSurfTriMesh( m_pGeomDB->GetGeoObj( nId)) ;
if ( pStm == nullptr)
return GDB_ID_NULL ;
// recupero l'ingombro della superficie in locale
BBox3d b3Srf ;
pStm->GetLocalBBox( b3Srf) ;
// ne calcolo la silhouette secondo Z+
POLYLINEVECTOR vPL ;
bool bSilh = false ;
if ( pStm->GetSilhouette( Z_AX, 10.0, vPL) && vPL.size() > 0) {
// cerco il contorno esterno
int nInd = - 1 ;
double dMaxArea = 0 ;
for ( int i = 0 ; i < int( vPL.size()) ; ++ i) {
double dArea ;
if ( vPL[i].GetAreaXY( dArea) && abs( dArea) > dMaxArea) {
if ( dArea < 0)
vPL[i].Invert() ;
dMaxArea = abs( dArea) ;
nInd = i ;
const int NUM_TRIA_LIM = 500 ;
if ( pStm->GetTriangleCount() < NUM_TRIA_LIM) {
POLYLINEVECTOR vPL ;
if ( pStm->GetSilhouette( Z_AX, 10.0, vPL) && ! vPL.empty()) {
// cerco il contorno esterno
int nInd = - 1 ;
double dMaxArea = 0 ;
for ( int i = 0 ; i < int( vPL.size()) ; ++ i) {
double dArea ;
if ( vPL[i].GetAreaXY( dArea) && abs( dArea) > dMaxArea) {
if ( dArea < 0)
vPL[i].Invert() ;
dMaxArea = abs( dArea) ;
nInd = i ;
}
}
// ne deduco la curva
PtrOwner<ICurveComposite> pCrvSilh( CreateCurveComposite()) ;
if ( nInd >= 0 && pCrvSilh->FromPolyLine( vPL[nInd])) {
pCrvSilh->SetExtrusion( Z_AX) ;
Plane3d plProj ;
plProj.Set( b3Srf.GetMin(), Z_AX) ;
pCrvCompo.Set( GetCurveComposite( ProjectCurveOnPlane( *pCrvSilh, plProj))) ;
if ( ! IsNull( pCrvCompo)) {
pCrvCompo->MergeCurves( 10 * EPS_SMALL, 10 * EPS_ANG_SMALL) ;
bSilh = true ;
}
}
}
// ne deduco la curva
PtrOwner<ICurveComposite> pCrvSilh( CreateCurveComposite()) ;
if ( nInd >= 0 && pCrvSilh->FromPolyLine( vPL[nInd])) {
pCrvSilh->SetExtrusion( Z_AX) ;
Plane3d plProj ;
plProj.Set( b3Srf.GetMin(), Z_AX) ;
pCrvCompo.Set( GetCurveComposite( ProjectCurveOnPlane( *pCrvSilh, plProj))) ;
pCrvCompo->MergeCurves( 10 * EPS_SMALL, 10 * EPS_ANG_SMALL) ;
bSilh = ( ! IsNull( pCrvCompo)) ;
}
else {
PtrOwner<ICAvParSilhouettesSurfTm> pCavParSilh( CreateCAvParSilhouettesSurfTm()) ;
if ( ! IsNull( pCavParSilh)) {
Frame3d frSrf( b3Srf.GetMin()) ;
const double SILH_TOL = 1.0 ;
POLYLINEVECTOR vPL ;
if ( pCavParSilh->SetData( { pStm}, frSrf, SILH_TOL) &&
pCavParSilh->GetSilhouette( 0, vPL)) {
// cerco il contorno esterno
int nInd = - 1 ;
double dMaxArea = 0 ;
for ( int i = 0 ; i < int( vPL.size()) ; ++ i) {
double dArea ;
if ( vPL[i].GetAreaXY( dArea) && abs( dArea) > dMaxArea) {
if ( dArea < 0)
vPL[i].Invert() ;
dMaxArea = abs( dArea) ;
nInd = i ;
}
}
// ne deduco la curva
if ( nInd >= 0 && pCrvCompo->FromPolyLine( vPL[nInd])) {
pCrvCompo->SetExtrusion( Z_AX) ;
bSilh = true ;
}
}
}
}
// non riuscita, la calcolo come contorno del box
@@ -450,7 +504,9 @@ MachMgr::AddRawPart( int nSurfId, Color cCol)
PL.AddUPoint( 2, ptMin + Vector3d( dDimX, dDimY,0)) ;
PL.AddUPoint( 3, ptMin + Vector3d( 0, dDimY,0)) ;
PL.AddUPoint( 4, ptMin) ;
if ( ! pCrvCompo->FromPolyLine( PL) && ! pCrvCompo->SetExtrusion( Z_AX))
if ( pCrvCompo->FromPolyLine( PL))
pCrvCompo->SetExtrusion( Z_AX) ;
else
bOk = false ;
}
// inserisco la curva composita nel DB
@@ -604,12 +660,12 @@ MachMgr::AddRawPart( int nSfrUpId, int nSfrDownId, double dHeight, Color cCol)
bOk = bOk && ( nSurfUpId != GDB_ID_NULL) ;
bOk = bOk && m_pGeomDB->SetName( nSurfUpId, MACH_RAW_UP_REG) ;
bOk = bOk && m_pGeomDB->SetMaterial( nSurfUpId, cCol) ;
bOk = bOk && m_pGeomDB->SetStatus( nSurfUpId, GDB_ST_OFF) ;
bOk = bOk && m_pGeomDB->SetMode( nSurfUpId, GDB_MD_HIDDEN) ;
int nSurfDownId = ( bOk ? m_pGeomDB->CopyGlob( nSfrDownId, GDB_ID_NULL, nRawId) : GDB_ID_NULL) ;
bOk = bOk && ( nSurfDownId != GDB_ID_NULL) ;
bOk = bOk && m_pGeomDB->SetName( nSurfDownId, MACH_RAW_DOWN_REG) ;
bOk = bOk && m_pGeomDB->SetMaterial( nSurfDownId, cCol) ;
bOk = bOk && m_pGeomDB->SetStatus( nSurfDownId, GDB_ST_OFF) ;
bOk = bOk && m_pGeomDB->SetMode( nSurfDownId, GDB_MD_HIDDEN) ;
}
// se qualcosa è andato storto, cancello tutto
+10 -3
View File
@@ -71,6 +71,13 @@ MachMgr::ImportSetup( const string& sName)
return m_stuMgr.Save() ;
}
//----------------------------------------------------------------------------
bool
MachMgr::ExistsCurrSetup( void) const
{
return m_stuMgr.Exists() ;
}
//----------------------------------------------------------------------------
bool
MachMgr::VerifyCurrSetup( STRVECTOR& vsErrors)
@@ -125,21 +132,21 @@ MachMgr::VerifyCurrSetup( STRVECTOR& vsErrors)
//----------------------------------------------------------------------------
bool
MachMgr::FindToolInCurrSetup( const string& sTool)
MachMgr::FindToolInCurrSetup( const string& sTool) const
{
return m_stuMgr.FindTool( sTool) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::GetToolSetupPosInCurrSetup( const string& sTool, string& sTcPos)
MachMgr::GetToolSetupPosInCurrSetup( const string& sTool, string& sTcPos) const
{
return m_stuMgr.GetToolSetupPos( sTool, sTcPos) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::GetToolsInCurrSetupPos( const string& sTcPos, STRVECTOR& vsTools)
MachMgr::GetToolsInCurrSetupPos( const string& sTcPos, STRVECTOR& vsTools) const
{
return m_stuMgr.GetToolsInSetupPos( sTcPos, vsTools) ;
}
+34
View File
@@ -130,6 +130,17 @@ MachMgr::SimSetUiStatus( int nUiStatus)
return m_pSimul->SetUiStatus( nUiStatus) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::SimEnableToolTipTrace( bool bEnable)
{
// verifico simulatore
if ( m_pSimul == nullptr)
return false ;
// imposto abilitazione disegno traccia della punta utensile
return m_pSimul->EnableToolTipTrace( bEnable) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::SimGoHome( void)
@@ -165,6 +176,29 @@ MachMgr::SimAddCollisionObj( int nInd, bool bToolOn, int nFrameId, int nType, co
return m_pSimul->AddCollisionObj( nInd, bToolOn, nFrameId, nType, vtMove, dPar1, dPar2, dPar3) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::SimRemoveCollisionObj( int nFrameId)
{
// verifico simulatore
if ( m_pSimul == nullptr)
return false ;
// rimuovo gli oggetti da verificare per la collisione con il grezzo con FrameId indicato
return m_pSimul->RemoveCollisionObj( nFrameId) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::SimGetCollisionObj( int nPos, int& nInd, bool& bToolOn, int& nFrameId, int& nType,
Vector3d& vtMove, double& dPar1, double& dPar2, double& dPar3) const
{
// verifico simulatore
if ( m_pSimul == nullptr)
return false ;
// recupero i dati dell'oggetto di collisione di posizione indicata nel relativo vettore
return m_pSimul->GetCollisionObj( nPos, nInd, bToolOn, nFrameId, nType, vtMove, dPar1, dPar2, dPar3) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::SimExecCollisionCheck( int& nCdInd, int& nObjInd, int nMoveType)
+10 -6
View File
@@ -34,6 +34,7 @@ Machine::Machine( void)
{
m_pMchMgr = nullptr ;
m_pGeomDB = nullptr ;
m_nContextId = 0 ;
m_nGroupId = GDB_ID_NULL ;
m_nTempGroupId = GDB_ID_NULL ;
m_dAxisMaxAdjust = EPS_SMALL ;
@@ -42,14 +43,17 @@ Machine::Machine( void)
m_dExitMaxRotAdj = 10 * EPS_ANG_SMALL ;
m_dAngDeltaMinForHome = INFINITO ;
m_nMultiProcess = 0 ;
m_nLinkAxesMoveOrder = 0 ;
m_nNewLinkMgr = 0 ;
m_nCalcTabId = GDB_ID_NULL ;
m_nCalcHeadId = GDB_ID_NULL ;
m_nCalcExitId = GDB_ID_NULL ;
m_nCalcToolId = GDB_ID_NULL ;
m_dCalcRot1W = 1 ;
m_dCalcRot1W = ROT1_WEIGHT_DFLT ;
m_dSingConeAng = SING_CONE_ANG_DFLT ;
m_bCalcMaxDeltaR2On1 = true ;
m_nCalcSolCh = MCH_SCC_NONE ;
m_bSolChExact = false ;
m_dCalcTLen = 0 ;
m_dCalcTRad = 0 ;
m_dCalcTOvLen = 0 ;
@@ -87,6 +91,7 @@ Machine::Clear( void)
// reset membri
m_pMchMgr = nullptr ;
m_pGeomDB = nullptr ;
m_nContextId = 0 ;
m_sName.clear() ;
m_sMachineDir.clear() ;
m_nGroupId = GDB_ID_NULL ;
@@ -106,6 +111,7 @@ Machine::Init( const string& sMachineName, const string& sMachineDir, MachMgr* p
return false ;
m_pMchMgr = pMchMgr ;
m_pGeomDB = m_pMchMgr->GetGeomDB() ;
m_nContextId = m_pMchMgr->GetContextId() ;
// verifico direttorio dati macchina
m_sMachineDir = sMachineDir ;
if ( ! ExistsDirectory( m_sMachineDir))
@@ -135,9 +141,7 @@ Machine::Init( const string& sMachineName, const string& sMachineDir, MachMgr* p
// in caso di errore, cancello tutta la geometria
if ( ! bOk) {
m_pGeomDB->Erase( m_nGroupId) ;
m_pGeomDB->Erase( m_nTempGroupId) ;
m_nGroupId = GDB_ID_NULL ;
m_nTempGroupId = GDB_ID_NULL ;
m_sName.clear() ;
m_sMachineDir.clear() ;
}
@@ -293,8 +297,8 @@ Machine::AdjustTable( int nLay, const Point3d& ptRef1)
//----------------------------------------------------------------------------
bool
Machine::LoadMachineAxis( const string& sName, const string& sParent, const string& sToken, bool bInvert,
double dOffset, int nType, const Point3d& ptPos, const Vector3d& vtDir, const STROKE& Stroke,
double dHome, bool bAdjustAux, const string& sGeo, const STRVECTOR& vsAux)
double dOffset, int nType, int nUse, const Point3d& ptPos, const Vector3d& vtDir,
const STROKE& Stroke, double dHome, bool bAdjustAux, const string& sGeo, const STRVECTOR& vsAux)
{
// verifico sia di tipo ammesso
if ( nType != MCH_AT_LINEAR && nType != MCH_AT_ROTARY) {
@@ -334,7 +338,7 @@ Machine::LoadMachineAxis( const string& sName, const string& sParent, const stri
Axis* pAxis = new(nothrow) Axis ;
if ( pAxis == nullptr)
return false ;
pAxis->Set( sName, sToken, bInvert, dOffset, nType, ptPos, vtDir, Stroke, dHome) ;
pAxis->Set( sName, sToken, bInvert, dOffset, nType, nUse, ptPos, vtDir, Stroke, dHome) ;
m_pGeomDB->SetUserObj( nLay, pAxis) ;
// verifico il vettore rappresentativo dell'asse
if ( ! AdjustAxis( nLay, sPart, sName, nType, ptPos, vtDir, bAdjustAux))
+37 -15
View File
@@ -88,8 +88,10 @@ class Machine
{ return m_dAngDeltaMinForHome ; }
bool GetMultiProcess( int nOpt = 1) const
{ return ( m_nMultiProcess >= nOpt) ; }
int GetLinkAxesMoveOrder( void) const
{ return m_nLinkAxesMoveOrder ; }
bool GetNewLinkMgr( int nOpt = 1) const
{ return ( m_nNewLinkMgr >= nOpt) ; }
{ return ( m_nNewLinkMgr >= nOpt || m_nCalcChainType == KIN_CHAIN_ROBOT) ; }
bool LoadTool( const std::string& sHead, int nExit, const std::string& sTool) ;
bool GetLoadedTool( const std::string& sHead, int nExit, std::string& sTool) const ;
bool UnloadTool( const std::string& sHead, int nExit) ;
@@ -98,6 +100,7 @@ class Machine
bool LoadAllTools( void) ;
bool UnloadAllTools( void) ;
bool ResetHeadSet( const std::string& sHead) ;
const STRVECTOR& GetHSet( const std::string& sHead) const ;
bool GetAxisToken( const std::string& sAxis, std::string& sToken) const ;
bool GetAxisInvert( const std::string& sAxis, bool& bInvert) const ;
bool GetAxisOffset( const std::string& sAxis, double& dOffset) const ;
@@ -133,7 +136,11 @@ class Machine
bool IsCurrToolFloating( void) const ;
double GetCurrRot1W( void) const
{ return m_dCalcRot1W ; }
bool GetCurrMaxDeltaR2OnFirst( void) const
bool SetSingConeAng( double dAng)
{ m_dSingConeAng = dAng ; return true ;}
double GetCurrSingConeAng( void) const
{ return m_dSingConeAng ; }
bool GetCurrCalcMaxDeltaR2OnFirst( void) const
{ return m_bCalcMaxDeltaR2On1 ; }
std::string GetKinematicAxis( int nInd) const ;
bool BlockKinematicRotAxis( const std::string& sName, double dVal) ;
@@ -143,6 +150,8 @@ class Machine
bool IsKinematicRotAxisBlocked( int nInd) const ;
bool GetKinematicRotAxisBlocked( int nInd, std::string& sName, double& dVal) const ;
bool SetSolCh( int nScc, bool bExact) ;
bool GetSolCh( int& nScc, bool& bExact)
{ nScc = m_nCalcSolCh ; bExact = m_bSolChExact ; return true ; }
int GetCurrLinAxes( void) const ;
int GetCurrRotAxes( void) const ;
bool GetCurrAxisName( int nInd, std::string& sAxName) const ;
@@ -160,12 +169,10 @@ class Machine
{ 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 ;
double& dX, double& dY, double& dZ) const ;
bool GetRobotAngles( const Point3d& ptP, const Vector3d& vtDirT, const Vector3d& vtDirA,
DBLVECTOR& vAng1, DBLVECTOR& vAng2) const ;
bool GetNoseFromPositions( double dX, double dY, double dZ, const DBLVECTOR& vAng,
@@ -182,7 +189,7 @@ class Machine
bool VerifyAngleOutstroke( int nInd, double dAng) const ;
bool VerifyOutstroke( double dX, double dY, double dZ, const DBLVECTOR& vAng, bool bClear, int& nStat) const ;
bool ExistProtectedAreas( void) const ;
bool VerifyProtectedAreas( double dX, double dY, double dZ, const DBLVECTOR& vAng, int nLinkType, int& nStat) ;
bool VerifyProtectedAreas( double dX, double dY, double dZ, const DBLVECTOR& vAng, int& nStat) ;
bool VerifyOutstroke( const std::string& sAxName, double dVal) const ;
std::string GetOutstrokeInfo( bool bMM = true) const ;
void ResetOutstrokeInfo( void) const
@@ -226,8 +233,8 @@ class Machine
const STRVECTOR& vsColl, const std::string& sGeo, const STRVECTOR& vsAux) ;
bool AdjustTable( int nLay, const Point3d& ptRef1) ;
bool LoadMachineAxis( const std::string& sName, const std::string& sParent, const std::string& sToken, bool bInvert,
double dOffset, int nType, const Point3d& ptPos, const Vector3d& vtDir, const STROKE& Stroke,
double dHome, bool bAdjustAux, const std::string& sGeo, const STRVECTOR& vsAux) ;
double dOffset, int nType, int nUse, const Point3d& ptPos, const Vector3d& vtDir,
const STROKE& Stroke, double dHome, bool bAdjustAux, const std::string& sGeo, const STRVECTOR& vsAux) ;
bool AdjustAxis( int nLay, const std::string& sPart, const std::string& sName,
int nType, const Point3d& ptPos, const Vector3d& vtDir, bool bAdjustAux) ;
bool ModifyMachineAxisPosition( const std::string& sName, const Point3d& ptPos) ;
@@ -259,7 +266,6 @@ class Machine
TcPos* GetTcPos( int nGroup) const ;
Exit* GetExit( int nGroup) const ;
bool AddHeadToSet( const std::string& sHSet, const std::string& sName) ;
const STRVECTOR& GetHSet( const std::string& sHead) const ;
bool EnableHeadInSet( const std::string& sHead) ;
bool LoadTool( Exit* pExit, const std::string& sTool) ;
bool ModifyMachineHeadAuxDirection( const std::string& sHead, const Vector3d& vtADir) ;
@@ -273,6 +279,10 @@ class Machine
const Vector3d& vtDirH, const Vector3d& vtDirI,
int nNumRotAx, const KinAxis& RotAx1, const KinAxis& RotAx2,
int& nStat, double& dAngA1, double& dAngB1, double& dAngA2, double& dAngB2) const ;
bool GetMyAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
const Vector3d& vtDirH, const Vector3d& vtDirI,
const KinAxis& RotAx1, const KinAxis& RotAx2, const KinAxis& RotAx3,
int& nStat, double& dAngA1, double& dAngB1, double& dAngC1, double& dAngA2, double& dAngB2, double& dAngC2) const ;
bool GetDirection( const Vector3d& vtDir, const DBLVECTOR& vAng, Vector3d& vtNew) const ;
bool GetBackDirection( const Vector3d& vtDir, const DBLVECTOR& vAng, Vector3d& vtNew) const ;
bool GetSccDir( int nSolCh, const Vector3d& vtDirA, Vector3d& vtDirScc) const ;
@@ -289,6 +299,7 @@ class Machine
// generali
MachMgr* m_pMchMgr ; // puntatore al gestore di tutte le lavorazioni
IGeomDB* m_pGeomDB ; // puntatore al DB geometrico
int m_nContextId ; // indice contesto corrente (1-based)
LuaMgr m_LuaMgr ; // interprete lua della macchina
Writer m_Writer ; // scrittore di file di testo
// dati macchina
@@ -303,6 +314,7 @@ class Machine
double m_dExitMaxRotAdj ; // massima rotazione di aggiustamento uscita da geometria a descrizione cinematica
double m_dAngDeltaMinForHome ; // minima differenza angolare da valore precedente per scegliere di stare vicino a home
int m_nMultiProcess ; // codice di macchina multi-processo (con stima speciale e simulazione ad hoc)
int m_nLinkAxesMoveOrder ; // codice ordine interpolazione assi nei collegamenti (0=interpolati, ...)
int m_nNewLinkMgr ; // codice del nuovo gestore link tra lavorazioni (0=vecchio, 1=nuovo)
INTVECTOR m_vLinkedRawParts ; // elenco dei grezzi agganciati a gruppi della macchina
INTVECTOR m_vLinkedFixtures ; // elenco dei bloccaggi agganciati a gruppi della macchina
@@ -313,6 +325,7 @@ class Machine
int m_nCalcExitId ; // uscita corrente per calcoli
int m_nCalcToolId ; // utensile corrente per calcoli
double m_dCalcRot1W ; // peso del primo asse rotante per i confronti
double m_dSingConeAng ; // angolo di apertura del cono di direzioni considerate coincidenti con asse singolare
bool m_bCalcMaxDeltaR2On1 ; // flag utilizzo controllo massimo delta secondo asse rotante su inizio lavorazione
int m_nCalcSolCh ; // criterio di scelta della soluzione
bool m_bSolChExact ; // flag per scelta soluzione da soddisfare esattamente
@@ -365,9 +378,16 @@ class Machine
static int LuaEmtAddRapidMove( lua_State* L) ;
static int LuaEmtAddLinearMove( lua_State* L) ;
static int LuaEmtAddArcMove( lua_State* L) ;
static int LuaEmtAddClimb( lua_State* L) ;
static int LuaEmtRemoveClimb( lua_State* L) ;
static int LuaEmtAddRise( lua_State* L) ;
static int LuaEmtRemoveRise( lua_State* L) ;
static int LuaEmtGetMoveType( lua_State* L) ;
static int LuaEmtGetAxesPos( lua_State* L) ;
static int LuaEmtGetBackAuxDir( lua_State* L) ;
static int LuaEmtGetInitialAxesPos( lua_State* L) ;
static int LuaEmtGetFinalAxesPos( lua_State* L) ;
static int LuaEmtGetCurrAxesHomePos( lua_State* L) ;
static int LuaEmtLinkRawPartToGroup( lua_State* L) ;
static int LuaEmtGetAllLinkedRawParts( lua_State* L) ;
static int LuaEmtUnlinkRawPartFromGroup( lua_State* L) ;
@@ -384,6 +404,8 @@ class Machine
static int LuaEmtSetWarning( lua_State* L) ;
static int LuaEmtAddCollisionObj( lua_State* L) ;
static int LuaEmtAddCollisionObjEx( lua_State* L) ;
static int LuaEmtRemoveCollisionObj( lua_State* L) ;
static int LuaEmtGetCollisionObj( lua_State* L) ;
static int LuaEmtExecCollisionCheck( lua_State* L) ;
static int LuaEmtOnCollision( lua_State* L) ;
static int LuaEmtSetToolForVmill( lua_State* L) ;
@@ -400,15 +422,15 @@ Machine::LuaSetGlobVar( const std::string& sVar, const T& Val)
{
// imposto contesto corretto
int nOldCtx = ExeGetCurrentContext() ;
if ( nOldCtx != m_pMchMgr->GetContextId())
ExeSetCurrentContext( m_pMchMgr->GetContextId()) ;
if ( nOldCtx != m_nContextId)
ExeSetCurrentContext( m_nContextId) ;
// imposto l'oggetto corrente per Lua
Machine* pOldMchLua = m_pMchLua ;
m_pMchLua = this ;
// eseguo l'assegnamento
bool bOk = ::LuaSetGlobVar( m_LuaMgr.GetLuaState(), sVar, Val) ;
// ripristino contesto originale
if ( nOldCtx != m_pMchMgr->GetContextId())
if ( nOldCtx != m_nContextId)
ExeSetCurrentContext( nOldCtx) ;
// ripristino dell'oggetto corrente per Lua
m_pMchLua = pOldMchLua ;
@@ -422,15 +444,15 @@ Machine::LuaGetGlobVar( const std::string& sVar, T& Val)
{
// imposto contesto corretto
int nOldCtx = ExeGetCurrentContext() ;
if ( nOldCtx != m_pMchMgr->GetContextId())
ExeSetCurrentContext( m_pMchMgr->GetContextId()) ;
if ( nOldCtx != m_nContextId)
ExeSetCurrentContext( m_nContextId) ;
// imposto l'oggetto corrente per Lua
Machine* pOldMchLua = m_pMchLua ;
m_pMchLua = this ;
// eseguo la lettura
bool bOk = ::LuaGetGlobVar( m_LuaMgr.GetLuaState(), sVar, Val) ;
// ripristino contesto originale
if ( nOldCtx != m_pMchMgr->GetContextId())
if ( nOldCtx != m_nContextId)
ExeSetCurrentContext( nOldCtx) ;
// ripristino dell'oggetto corrente per Lua
m_pMchLua = pOldMchLua ;
+8
View File
@@ -266,6 +266,14 @@ Machine::GetAxisHomePos( const string& sAxis, double& dHomeVal) const
bool
Machine::IsDispositionAxis( int nAxisId, int nTableId) const
{
// se non dichiarato o ausiliario
const Axis* pAx = GetAxis( nAxisId) ;
if ( pAx == nullptr || pAx->GetUse() == MCH_AU_AUXILIAR)
return false ;
// se dichiarato di disposizione
if ( pAx->GetUse() == MCH_AU_DISPOSITION)
return true ;
// altrimenti è di tipo generale e va bene solo se dipende direttamente o indirettamente dalla tavola
// se direttamente dipendente dalla tavola
int nParentId = m_pGeomDB->GetParentId( nAxisId) ;
if ( ( nTableId != GDB_ID_NULL && nParentId == nTableId) || IsTableGroup( nParentId))
+451 -191
View File
File diff suppressed because it is too large Load Diff
+81 -1
View File
@@ -37,6 +37,7 @@ static const string FLD_EXITMAXADJUST = "ExitMaxAdjust" ;
static const string FLD_EXITMAXROTADJ = "ExitMaxRotAdj" ;
static const string FLD_ANGDELTAMINFORHOME = "AngDeltaMinForHome" ;
static const string FLD_MULTIPROCESS = "MultiProcess" ;
static const string FLD_LINKAXESMOVEORDER = "LinkAxesMoveOrder" ;
static const string FLD_NEWLINKMGR = "NewLinkMgr" ;
static const string FLD_NAME = "Name" ;
static const string FLD_PARENT = "Parent" ;
@@ -44,6 +45,7 @@ static const string FLD_GEO = "Geo" ;
static const string FLD_AUX = "Aux" ;
static const string FLD_TOKEN = "Token" ;
static const string FLD_TYPE = "Type" ;
static const string FLD_USE = "Use" ;
static const string FLD_INVERT = "Invert" ;
static const string FLD_AXIS_OFFSET = "Offset" ;
static const string FLD_REF1 = "Ref1" ;
@@ -119,6 +121,13 @@ Machine::LuaInit( const string& sMachineName)
m_LuaMgr.RegisterFunction( "EmtAddRapidMove", Machine::LuaEmtAddRapidMove) ;
m_LuaMgr.RegisterFunction( "EmtAddLinearMove", Machine::LuaEmtAddLinearMove) ;
m_LuaMgr.RegisterFunction( "EmtAddArcMove", Machine::LuaEmtAddArcMove) ;
m_LuaMgr.RegisterFunction( "EmtAddClimb", Machine::LuaEmtAddClimb) ;
m_LuaMgr.RegisterFunction( "EmtRemoveClimb", Machine::LuaEmtRemoveClimb) ;
m_LuaMgr.RegisterFunction( "EmtAddRise", Machine::LuaEmtAddRise) ;
m_LuaMgr.RegisterFunction( "EmtRemoveRise", Machine::LuaEmtRemoveRise) ;
m_LuaMgr.RegisterFunction( "EmtGetInitialAxesPos", Machine::LuaEmtGetInitialAxesPos) ;
m_LuaMgr.RegisterFunction( "EmtGetFinalAxesPos", Machine::LuaEmtGetFinalAxesPos) ;
m_LuaMgr.RegisterFunction( "EmtGetCurrAxesHomePos", Machine::LuaEmtGetCurrAxesHomePos) ;
// registro le funzioni di lettura entità CL per lua
m_LuaMgr.RegisterFunction( "EmtGetMoveType", Machine::LuaEmtGetMoveType) ;
m_LuaMgr.RegisterFunction( "EmtGetAxesPos", Machine::LuaEmtGetAxesPos) ;
@@ -135,6 +144,10 @@ Machine::LuaInit( const string& sMachineName)
m_LuaMgr.RegisterFunction( "EmtAddCollisionObj", Machine::LuaEmtAddCollisionObj) ;
// registro la funzione estesa per aggiungere un oggetto da verificare per la collisione in simulazione
m_LuaMgr.RegisterFunction( "EmtAddCollisionObjEx", Machine::LuaEmtAddCollisionObjEx) ;
// registro la funzione per rimuovere oggetti con dato FrameId da verificare per la collisione in simulazione
m_LuaMgr.RegisterFunction( "EmtRemoveCollisionObj", Machine::LuaEmtRemoveCollisionObj) ;
// registro la funzione per avere i dati dell'oggetto con posizione indicata nel vettore da verificare per la collisione in simulazione
m_LuaMgr.RegisterFunction( "EmtGetCollisionObj", Machine::LuaEmtGetCollisionObj) ;
// registro la funzione di esecuzione della verifica di collisione in simulazione
m_LuaMgr.RegisterFunction( "EmtExecCollisionCheck", Machine::LuaEmtExecCollisionCheck) ;
// registro la funzione di gestione della collisione in simulazione
@@ -351,6 +364,9 @@ Machine::LuaEmtGeneral( lua_State* L)
// lettura eventuale campo 'MultiProcess' dalla tabella (0=no, 1=si, 2=si con simulazione MP)
int nMultiProcess = 0 ;
LuaGetTabFieldParam( L, 1, FLD_MULTIPROCESS, nMultiProcess) ;
// lettura eventuale campo "LinkAxesMoveOrder" dalla tabella(0=interpolati, ...)
int nLinkAxesMoveOrder = 0 ;
LuaGetTabFieldParam( L, 1, FLD_LINKAXESMOVEORDER, nLinkAxesMoveOrder) ;
// lettura eventuale campo 'NewLinkMgr' dalla tabella (0=old, 1 =new)
int nNewLinkMgr = 0 ;
LuaGetTabFieldParam( L, 1, FLD_NEWLINKMGR, nNewLinkMgr) ;
@@ -406,6 +422,8 @@ Machine::LuaEmtGeneral( lua_State* L)
// imposto codice per macchina multiprocesso
m_pMchLua->m_nMultiProcess = nMultiProcess ;
// imposto codice per ordine interpolazione assi nei collegamenti
m_pMchLua->m_nLinkAxesMoveOrder = nLinkAxesMoveOrder ;
// imposto codice per gestione link tra lavorazioni
m_pMchLua->m_nNewLinkMgr = nNewLinkMgr ;
@@ -530,6 +548,9 @@ Machine::LuaEmtAxis( lua_State* L)
// lettura campo 'Type' dalla tabella
int nType ;
LuaCheckTabFieldParam( L, 1, FLD_TYPE, nType)
// lettura eventuale campo 'Use' della tabella (default General)
int nUse = MCH_AU_GENERAL ;
LuaGetTabFieldParam( L, 1, FLD_USE, nUse) ;
// lettura campo 'Pos' dalla tabella
Point3d ptPos ;
LuaCheckTabFieldParam( L, 1, FLD_POS, ptPos)
@@ -563,7 +584,7 @@ Machine::LuaEmtAxis( lua_State* L)
// carico i dati dell'asse
if ( ! m_pMchLua->LoadMachineAxis( sName, sParent, sToken, bInvert, dOffset,
nType, ptPos, vtDir, Stroke, dHome, bAdjustAux, sGeo, vsAux))
nType, nUse, ptPos, vtDir, Stroke, dHome, bAdjustAux, sGeo, vsAux))
return luaL_error( L, " Load Machine Axis failed") ;
// restituisco l'indice dell'asse
@@ -1411,6 +1432,65 @@ Machine::LuaEmtAddCollisionObjEx( lua_State* L)
return 1 ;
}
//----------------------------------------------------------------------------
int
Machine::LuaEmtRemoveCollisionObj( lua_State* L)
{
// 1 parametro : nFrameId
int nFrameId ;
LuaCheckParam( L, 1, nFrameId)
LuaClearStack( L) ;
// verifico ci sia una macchina attiva
if ( m_pMchLua == nullptr)
return luaL_error( L, " Unknown Machine") ;
// assegno i dati
bool bOk = ( m_pMchLua->m_pMchMgr != nullptr && m_pMchLua->m_pMchMgr->SimRemoveCollisionObj( nFrameId)) ;
// assegno risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//----------------------------------------------------------------------------
int
Machine::LuaEmtGetCollisionObj( lua_State* L)
{
// 1 parametro : nPos
int nPos ;
LuaCheckParam( L, 1, nPos)
LuaClearStack( L) ;
// verifico ci sia una macchina attiva
if ( m_pMchLua == nullptr)
return luaL_error( L, " Unknown Machine") ;
// recupero i dati
int nInd ;
bool bToolOn ;
int nFrameId ;
int nType ;
Vector3d vtMove ;
double dPar1 ;
double dPar2 ;
double dPar3 ;
bool bOk = ( m_pMchLua->m_pMchMgr != nullptr &&
m_pMchLua->m_pMchMgr->SimGetCollisionObj( nPos, nInd, bToolOn, nFrameId, nType, vtMove, dPar1, dPar2, dPar3)) ;
// assegno risultato
if ( bOk) {
LuaSetParam( L, true) ;
LuaSetParam( L, nInd) ;
LuaSetParam( L, bToolOn) ;
LuaSetParam( L, nFrameId) ;
LuaSetParam( L, nType) ;
LuaSetParam( L, vtMove) ;
LuaSetParam( L, dPar1) ;
LuaSetParam( L, dPar2) ;
LuaSetParam( L, dPar3) ;
return 9 ;
}
else {
LuaSetParam( L, false) ;
return 1 ;
}
}
//----------------------------------------------------------------------------
int
Machine::LuaEmtExecCollisionCheck( lua_State* L)
+223 -6
View File
@@ -16,6 +16,7 @@
#include "MachMgr.h"
#include "DllMain.h"
#include "CamData.h"
#include "Operation.h"
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EGkGeoPoint3d.h"
#include "/EgtDev/Include/EGkCurveLine.h"
@@ -32,7 +33,7 @@ using namespace std ;
int
Machine::LuaEmtAddRapidStart( lua_State* L)
{
// 6 o 7 parametri : nPathId, ptP, vtTool, vtCorr, vtAux, nFlag [, bToolShow]
// 6, 7 o 8 parametri : nPathId, ptP, vtTool, vtCorr, vtAux, nFlag [, nFlag2] [, bToolShow]
int nPathId ;
LuaCheckParam( L, 1, nPathId)
Point3d ptP ;
@@ -45,8 +46,12 @@ Machine::LuaEmtAddRapidStart( lua_State* L)
LuaCheckParam( L, 5, vtAux)
int nFlag ;
LuaCheckParam( L, 6, nFlag)
int nFlag2 = 0 ;
bool bToolShow = false ;
LuaGetParam( L, 7, bToolShow) ;
if ( LuaGetParam( L, 7, nFlag2))
LuaGetParam( L, 8, bToolShow) ;
else
LuaGetParam( L, 7, bToolShow) ;
LuaClearStack( L) ;
// verifico ci sia una macchina attiva valida
if ( m_pMchLua == nullptr ||
@@ -72,6 +77,7 @@ Machine::LuaEmtAddRapidStart( lua_State* L)
pCam->SetEndPoint( ptP) ;
pCam->SetFeed( 0) ;
pCam->SetFlag( nFlag) ;
pCam->SetFlag2( nFlag2) ;
pCam->SetToolShow( bToolShow) ;
// associo questo oggetto a quello geometrico
m_pMchLua->m_pGeomDB->SetUserObj( nId, Release( pCam)) ;
@@ -88,7 +94,7 @@ Machine::LuaEmtAddRapidStart( lua_State* L)
int
Machine::LuaEmtAddRapidMove( lua_State* L)
{
// 7 o 8 parametri : nPathId, ptIni, ptFin, vtTool, vtCorr, vtAux, nFlag [, bToolShow]
// 7, 8 o 9 parametri : nPathId, ptIni, ptFin, vtTool, vtCorr, vtAux, nFlag [, nFlag2] [, bToolShow]
int nPathId ;
LuaCheckParam( L, 1, nPathId)
Point3d ptIni ;
@@ -103,8 +109,12 @@ Machine::LuaEmtAddRapidMove( lua_State* L)
LuaCheckParam( L, 6, vtAux)
int nFlag ;
LuaCheckParam( L, 7, nFlag)
int nFlag2 = 0 ;
bool bToolShow = false ;
LuaGetParam( L, 8, bToolShow) ;
if ( LuaGetParam( L, 8, nFlag2))
LuaGetParam( L, 9, bToolShow) ;
else
LuaGetParam( L, 8, bToolShow) ;
LuaClearStack( L) ;
// verifico ci sia una macchina attiva valida
if ( m_pMchLua == nullptr ||
@@ -130,6 +140,7 @@ Machine::LuaEmtAddRapidMove( lua_State* L)
pCam->SetEndPoint( ptFin) ;
pCam->SetFeed( 0) ;
pCam->SetFlag( nFlag) ;
pCam->SetFlag2( nFlag2) ;
pCam->SetToolShow( bToolShow) ;
// associo questo oggetto a quello geometrico
m_pMchLua->m_pGeomDB->SetUserObj( nId, Release( pCam)) ;
@@ -146,7 +157,7 @@ Machine::LuaEmtAddRapidMove( lua_State* L)
int
Machine::LuaEmtAddLinearMove( lua_State* L)
{
// 8 o 9 parametri : nPathId, ptIni, ptFin, vtTool, vtCorr, vtAux, dFeed, nFlag [, bToolShow]
// 8, 9 o 10 parametri : nPathId, ptIni, ptFin, vtTool, vtCorr, vtAux, dFeed, nFlag [, nFlag2] [, bToolShow]
int nPathId ;
LuaCheckParam( L, 1, nPathId)
Point3d ptIni ;
@@ -163,8 +174,12 @@ Machine::LuaEmtAddLinearMove( lua_State* L)
LuaCheckParam( L, 7, dFeed)
int nFlag ;
LuaCheckParam( L, 8, nFlag)
int nFlag2 = 0 ;
bool bToolShow = false ;
LuaGetParam( L, 9, bToolShow) ;
if ( LuaGetParam( L, 9, nFlag2))
LuaGetParam( L, 10, bToolShow) ;
else
LuaGetParam( L, 9, bToolShow) ;
LuaClearStack( L) ;
// verifico ci sia una macchina attiva valida
if ( m_pMchLua == nullptr ||
@@ -190,6 +205,7 @@ Machine::LuaEmtAddLinearMove( lua_State* L)
pCam->SetEndPoint( ptFin) ;
pCam->SetFeed( dFeed) ;
pCam->SetFlag( nFlag) ;
pCam->SetFlag2( nFlag2) ;
pCam->SetToolShow( bToolShow) ;
// associo questo oggetto a quello geometrico
m_pMchLua->m_pGeomDB->SetUserObj( nId, Release( pCam)) ;
@@ -276,6 +292,207 @@ Machine::LuaEmtAddArcMove( lua_State* L)
return 1 ;
}
//----------------------------------------------------------------------------
int
Machine::LuaEmtAddClimb( lua_State* L)
{
// 5 o 6 o 7 parametri : nMachId [, sMain], vAxVal, nMask, nFlag, nFlag2 [, sInfo]
int nMachId ;
LuaCheckParam( L, 1, nMachId)
string sMain = MCH_CL ;
int nOffs = ( LuaGetParam( L, 2, sMain) ? 1 : 0) ;
bool bMain = ( ! EqualNoCase( sMain, MCH_DBL)) ;
DBLVECTOR vAxVal ;
LuaCheckParam( L, 2 + nOffs, vAxVal)
int nMask ;
LuaCheckParam( L, 3 + nOffs, nMask)
int nFlag ;
LuaCheckParam( L, 4 + nOffs, nFlag)
int nFlag2 ;
LuaCheckParam( L, 5 + nOffs, nFlag2)
string sInfo = "" ;
LuaGetParam( L, 6 + nOffs, sInfo) ;
LuaClearStack( L) ;
// verifico ci sia una macchina attiva valida
if ( m_pMchLua == nullptr ||
m_pMchLua->m_pMchMgr == nullptr || m_pMchLua->m_pGeomDB == nullptr)
return luaL_error( L, " Unknown Machine") ;
// recupero l'operazione
Operation* pOper = GetOperation( m_pMchLua->m_pGeomDB->GetUserObj( nMachId)) ;
// imposto la discesa (primo movimento del primo percorso della lavorazione)
bool bOk = ( pOper != nullptr && pOper->AddSpecialClimb( vAxVal, ( nMask >= 0), GDB_ID_NULL, bMain, nFlag, nFlag2, nMask, sInfo, false)) ;
if ( ! bOk)
return luaL_error( L, " Error in EmtAddClimb") ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//----------------------------------------------------------------------------
int
Machine::LuaEmtRemoveClimb( lua_State* L)
{
// 1 o 2 parametri : nMachId [, sMain]
int nMachId ;
LuaCheckParam( L, 1, nMachId)
string sMain = MCH_CL ;
LuaGetParam( L, 2, sMain) ;
bool bMain = ( ! EqualNoCase( sMain, MCH_DBL)) ;
LuaClearStack( L) ;
// verifico ci sia una macchina attiva valida
if ( m_pMchLua == nullptr ||
m_pMchLua->m_pMchMgr == nullptr || m_pMchLua->m_pGeomDB == nullptr)
return luaL_error( L, " Unknown Machine") ;
// recupero l'operazione
Operation* pOper = GetOperation( m_pMchLua->m_pGeomDB->GetUserObj( nMachId)) ;
// elimino le discese (primi movimenti "CLIMB" del primo percorso della lavorazione)
bool bOk = ( pOper != nullptr && pOper->RemoveClimb( GDB_ID_NULL, bMain)) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//----------------------------------------------------------------------------
int
Machine::LuaEmtAddRise( lua_State* L)
{
// 5 o 6 o 7 parametri : nMachId [, sMain], vAxVal, nMask, nFlag, nFlag2 [, sInfo]
int nMachId ;
LuaCheckParam( L, 1, nMachId)
string sMain = MCH_CL ;
int nOffs = ( LuaGetParam( L, 2, sMain) ? 1 : 0) ;
bool bMain = ( ! EqualNoCase( sMain, MCH_DBL)) ;
DBLVECTOR vAxVal ;
LuaCheckParam( L, 2 + nOffs, vAxVal)
int nMask ;
LuaCheckParam( L, 3 + nOffs, nMask)
int nFlag ;
LuaCheckParam( L, 4 + nOffs, nFlag)
int nFlag2 ;
LuaCheckParam( L, 5 + nOffs, nFlag2)
string sInfo = "" ;
LuaGetParam( L, 6 + nOffs, sInfo) ;
LuaClearStack( L) ;
// verifico ci sia una macchina attiva valida
if ( m_pMchLua == nullptr ||
m_pMchLua->m_pMchMgr == nullptr || m_pMchLua->m_pGeomDB == nullptr)
return luaL_error( L, " Unknown Machine") ;
// recupero l'operazione
Operation* pOper = GetOperation( m_pMchLua->m_pGeomDB->GetUserObj( nMachId)) ;
// aggiungo la risalita (ultimo movimento dell'ultimo percorso della lavorazione)
bool bOk = ( pOper != nullptr && pOper->AddSpecialRise( vAxVal, ( nMask >= 0), GDB_ID_NULL, bMain, nFlag, nFlag2, nMask, sInfo)) ;
if ( ! bOk)
return luaL_error( L, " Error in EmtAddRise") ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//----------------------------------------------------------------------------
int
Machine::LuaEmtRemoveRise( lua_State* L)
{
// 1 o 2 parametri : nMachId [, bMain]
int nMachId ;
LuaCheckParam( L, 1, nMachId)
string sMain = MCH_CL ;
LuaGetParam( L, 2, sMain) ;
bool bMain = ( ! EqualNoCase( sMain, MCH_DBL)) ;
LuaClearStack( L) ;
// verifico ci sia una macchina attiva valida
if ( m_pMchLua == nullptr ||
m_pMchLua->m_pMchMgr == nullptr || m_pMchLua->m_pGeomDB == nullptr)
return luaL_error( L, " Unknown Machine") ;
// recupero l'operazione
Operation* pOper = GetOperation( m_pMchLua->m_pGeomDB->GetUserObj( nMachId)) ;
// elimino le risalite (ultimi movimenti "RISE" dell'ultimo percorso della lavorazione)
bool bOk = ( pOper != nullptr && pOper->RemoveRise( GDB_ID_NULL, bMain)) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//----------------------------------------------------------------------------
int
Machine::LuaEmtGetInitialAxesPos( lua_State* L)
{
// 1 o 2 o 3 parametri : nMachId [, sMain] [, bSkipClimb]
int nMachId ;
LuaCheckParam( L, 1, nMachId)
string sMain = MCH_CL ;
int nOffs = ( LuaGetParam( L, 2, sMain) ? 1 : 0) ;
bool bMain = ( ! EqualNoCase( sMain, MCH_DBL)) ;
bool bSkipClimb = true ;
LuaGetParam( L, 2 + nOffs, bSkipClimb) ;
LuaClearStack( L) ;
// verifico ci sia una macchina attiva valida
if ( m_pMchLua == nullptr ||
m_pMchLua->m_pMchMgr == nullptr || m_pMchLua->m_pGeomDB == nullptr)
return luaL_error( L, " Unknown Machine") ;
// recupero l'operazione
Operation* pOper = GetOperation( m_pMchLua->m_pGeomDB->GetUserObj( nMachId)) ;
// acquisico il valore iniziale degli assi macchina
DBLVECTOR vAxesVal ;
bool bOk = ( pOper != nullptr && pOper->GetInitialAxesValues( bSkipClimb, bMain, vAxesVal)) ;
if ( bOk)
LuaSetParam( L, vAxesVal) ;
else
LuaSetParam( L) ;
return 1 ;
}
//----------------------------------------------------------------------------
int
Machine::LuaEmtGetFinalAxesPos( lua_State* L)
{
// 1 o 2 o 3 parametri : nMachId [, sMain] [, bSkipRise]
int nMachId ;
LuaCheckParam( L, 1, nMachId)
bool bSkipRise = true ;
string sMain = MCH_CL ;
int nOffs = ( LuaGetParam( L, 2, sMain) ? 1 : 0) ;
bool bMain = ( ! EqualNoCase( sMain, MCH_DBL)) ;
LuaGetParam( L, 2 + nOffs, bSkipRise) ;
LuaClearStack( L) ;
// verifico ci sia una macchina attiva valida
if ( m_pMchLua == nullptr ||
m_pMchLua->m_pMchMgr == nullptr || m_pMchLua->m_pGeomDB == nullptr)
return luaL_error( L, " Unknown Machine") ;
// recupero l'operazione
Operation* pOper = GetOperation( m_pMchLua->m_pGeomDB->GetUserObj( nMachId)) ;
// acquisico il valore finale degli assi macchina
DBLVECTOR vAxesVal ;
bool bOk = ( pOper != nullptr && pOper->GetFinalAxesValues( bSkipRise, bMain, vAxesVal)) ;
if ( bOk)
LuaSetParam( L, vAxesVal) ;
else
LuaSetParam( L) ;
return 1 ;
}
//----------------------------------------------------------------------------
int
Machine::LuaEmtGetCurrAxesHomePos( lua_State* L)
{
// nessun parametro
LuaClearStack( L) ;
// verifico ci sia una macchina attiva valida
if ( m_pMchLua == nullptr ||
m_pMchLua->m_pMchMgr == nullptr || m_pMchLua->m_pGeomDB == nullptr)
return luaL_error( L, " Unknown Machine") ;
// acquisisco la posizione di home degli assi della catena cinematica corrente
DBLVECTOR vAxHomeVal ;
bool bOk = m_pMchLua->GetAllCurrAxesHomePos( vAxHomeVal) ;
if ( bOk)
LuaSetParam( L, vAxHomeVal) ;
else
LuaSetParam( L) ;
return 1 ;
}
//----------------------------------------------------------------------------
int
Machine::LuaEmtGetMoveType( lua_State* L)
+8 -1
View File
@@ -81,6 +81,13 @@ enum MchAxisType { MCH_AT_NONE = 0,
MCH_AT_LINEAR = 1,
MCH_AT_ROTARY = 2} ;
//----------------------------------------------------------------------------
// Uso di assi della macchina
enum MchAxisUse { MCH_AU_NONE = 0,
MCH_AU_GENERAL = 1,
MCH_AU_DISPOSITION = 2,
MCH_AU_AUXILIAR = 3} ;
//----------------------------------------------------------------------------
// Tipo di testa della macchina
enum MchHeadType { MCH_HT_NONE = 0,
@@ -97,7 +104,7 @@ enum MchSelType { MCH_SLT_FIXEDEXITS = 0,
//----------------------------------------------------------------------------
// Tipo della catena cinematica
enum KinChainType { KIN_CHAIN_NONE = 0,
KIN_CHAIN_CENTER = 1,
KIN_CHAIN_MCENT = 1,
KIN_CHAIN_ROBOT = 2} ;
//----------------------------------------------------------------------------
+1001 -102
View File
File diff suppressed because it is too large Load Diff
+28 -4
View File
@@ -8,6 +8,7 @@
//
//
// Modifiche : 07.06.15 DS Creazione modulo.
// 24.02.26 RE Aggiunta Gestione Preview per Utensile e Testa
//
//
//----------------------------------------------------------------------------
@@ -40,7 +41,7 @@ class Machining : public Operation
virtual bool GetParam( int nType, int& nVal) const = 0 ;
virtual bool GetParam( int nType, double& dVal) const = 0 ;
virtual bool GetParam( int nType, std::string& sVal) const = 0 ;
virtual bool UpdateToolData( bool* pbChanged = nullptr) = 0 ;
virtual bool UpdateToolData( void) = 0 ;
virtual const ToolData& GetToolData( void) const = 0 ;
virtual bool GetGeometry( SELVECTOR& vIds) const = 0 ;
virtual bool GetSkippedGeometry( SELVECTOR& vIds) const
@@ -49,19 +50,42 @@ class Machining : public Operation
public :
bool GetStartPoint( Point3d& ptStart) const ;
bool GetEndPoint( Point3d& ptEnd) const ;
bool PrepareToolPreview( void) const ;
bool RemoveToolPreview( void) const ;
bool ChangeToolPreviewShow( int nFlag) ;
bool PrepareToolPreview( void) ;
bool RemoveToolPreview( void) ;
int GetToolPreviewStepCount( void) const ;
int ToolPreview( int nEntId, int nStep) const ;
bool ActivateDrillingUnit( int nHeadId, const INTVECTOR& vActExit) const ;
protected :
Machining( void) ;
~Machining( void) ;
bool SpecialApply( std::string& sErr) ;
bool PostApply( std::string& sErr) ;
int GetDoubleType( const std::string& sUserNotes) ;
bool GetDoubleToolData( std::string& sDblTool, std::string& sDblTcPos, std::string& sDblHead, int& nDblExit) const override ;
bool CalcMirrorByDouble( int nClId, const std::string& sUserNotes) ;
bool ActivateDrillingUnit( int nHeadId, const INTVECTOR& vActExit) const ;
private :
int GetToolPreviewNext( int nEntId, int nParentId, int nStId) const ;
int GetToolPreviewPrev( int nEntId, int nParentId, int nStId) const ;
bool MyPrepareToolPreview( bool bDouble) ;
bool MyChangeToolPreviewShow( int nLookFlag, bool bDouble) ;
bool MyToolPreview( int nEntId, bool bDouble) const ;
bool MyShowMultiDrillingTool( const INTVECTOR& vActExit) const ;
private :
int m_nLookFlag ; // flag di Visualizzazione per Preview
// lavorazione singola
int m_nPreviewHeadId ; // Id del gruppo della testa di Preview
int m_nPreviewExitId ; // Id del gruppo dell'uscita di Preview
int m_nPreviewToolTip ; // Id del gruppo contenente il punto ToolTip
INTVECTOR m_vPreviewAxisIds ; // indici degli assi di Preview
// lavorazione in doppio
int m_nPreviewHeadIdDBL ; // Id del gruppo della testa di Preview
int m_nPreviewExitIdDBL ; // Id del gruppo dell'uscita di Preview
int m_nPreviewToolTipDBL ; // Id del gruppo contenente il punto di ToolTip
INTVECTOR m_vPreviewAxisIdsDBL ; // indici degli assi di Preview
} ;
//----------------------------------------------------------------------------
+3 -2
View File
@@ -107,7 +107,8 @@ GetMachiningTitle( int nMchType)
"SurfRoughing",
"SurfFinishing",
"Waterjetting",
"5AxisMilling"} ;
"5AxisMilling",
"Probing"} ;
switch ( nMchType) {
case MT_DRILLING : return MchTitle[1] ;
case MT_SAWING : return MchTitle[2] ;
@@ -122,7 +123,7 @@ GetMachiningTitle( int nMchType)
case MT_SURFFINISHING : return MchTitle[11] ;
case MT_WATERJETTING : return MchTitle[12] ;
case MT_FIVEAXISMILLING : return MchTitle[13] ;
case MT_PROBING : return MchTitle[14] ;
}
return MchTitle[0] ;
}
+31 -31
View File
@@ -1,7 +1,7 @@
//----------------------------------------------------------------------------
// EgalTech 2015-2015
// EgalTech 2015-2025
//----------------------------------------------------------------------------
// File : MachiningDataFactory.h Data : 05.06.15 Versione : 1.6f1
// File : MachiningDataFactory.h Data : 31.10.25 Versione : 2.7k1
// Contenuto : Factory della classe MachiningData.
//
//
@@ -26,35 +26,6 @@
#define MCHDATA_CREATE( nType) MachiningDataFactory::Create( nType)
#define MCHDATA_GETLIST( vsList) MachiningDataFactory::GetList( vsList)
//----------------------------------------------------------------------------
template <typename T>
class MachiningDataRegister
{
public :
static bool DoRegister( int nType, const std::string& sName)
{ if ( ! MachiningDataFactory::Register( nType, sName, Create))
return false ;
GetTypePrivate() = nType ;
GetNamePrivate() = sName ;
return true ; }
static MachiningData* Create( void)
{ return new(nothrow) T ; }
static int GetType( void)
{ return GetTypePrivate() ; }
static const std::string& GetName( void)
{ return GetNamePrivate() ; }
private :
MachiningDataRegister( void) {}
~MachiningDataRegister( void) {}
static int& GetTypePrivate( void)
{ static int s_nType ;
return s_nType ; }
static std::string& GetNamePrivate( void)
{ static std::string s_sName ;
return s_sName ; }
} ;
//----------------------------------------------------------------------------
class MachiningDataFactory
{
@@ -108,3 +79,32 @@ class MachiningDataFactory
return s_CreatorMap ;
}
} ;
//----------------------------------------------------------------------------
template <typename T>
class MachiningDataRegister
{
public :
static bool DoRegister( int nType, const std::string& sName)
{ if ( ! MachiningDataFactory::Register( nType, sName, Create))
return false ;
GetTypePrivate() = nType ;
GetNamePrivate() = sName ;
return true ; }
static MachiningData* Create( void)
{ return new( std::nothrow) T ; }
static int GetType( void)
{ return GetTypePrivate() ; }
static const std::string& GetName( void)
{ return GetNamePrivate() ; }
private :
MachiningDataRegister( void) {}
~MachiningDataRegister( void) {}
static int& GetTypePrivate( void)
{ static int s_nType ;
return s_nType ; }
static std::string& GetNamePrivate( void)
{ static std::string s_sName ;
return s_sName ; }
} ;
+43
View File
@@ -0,0 +1,43 @@
//----------------------------------------------------------------------------
// EgalTech 2025-2025
//----------------------------------------------------------------------------
// File : MachiningRegister.h Data : 02.05.25 Versione : 2.7e1
// Contenuto : Funzioni per registrazione dinamica oggetti delle lavorazioni
// (per decidere tra versioni diverse di una lavorazione).
//
//
// Modifiche : 02.05.25 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
#pragma once
#include "OperationConst.h"
#include "Pocketing.h"
#include "PocketingNT.h"
#include "/EgtDev/Include/EGkUserObjFactory.h"
#include "/EgtDev/Include/EgtIniFile.h"
//----------------------------------------------------------------------------
// Registrazione dinamica delle svuotature da parametro nel file Ini dell'eseguibile
inline bool
RegisterPocketing( void)
{
const char* SEC_MACH = "Mach" ;
const char* KEY_POCKETING = "Pocketing" ;
static bool bFirst = true ;
if ( bFirst) {
std::string sIniPath ;
ExeGetIniFile( sIniPath) ;
int nPockType = GetPrivateProfileInt( SEC_MACH, KEY_POCKETING, 2, sIniPath.c_str()) ;
if ( nPockType == 2)
UserObjRegister<PocketingNT>::DoRegister( GetOperationClass( OPER_POCKETING)) ;
else
UserObjRegister<Pocketing>::DoRegister( GetOperationClass( OPER_POCKETING)) ;
std::string sInfo = "Mach-Pocketing=" + ToString( nPockType) ;
LOG_INFO( GetEMkLogger(), sInfo.c_str())
bFirst = false ;
}
return true ;
}
+20 -12
View File
@@ -1,7 +1,7 @@
//----------------------------------------------------------------------------
// EgalTech 2015-2024
// EgalTech 2015-2025
//----------------------------------------------------------------------------
// File : MachiningsMgr.cpp Data : 29.03.24 Versione : 2.6d1
// File : MachiningsMgr.cpp Data : 09.06.25 Versione : 2.7f2
// Contenuto : Implementazione gestore database lavorazioni.
//
//
@@ -17,6 +17,7 @@
// 09.11.20 DS Agg. per nuovi parametri tagli di lama (MF_CURR_VER = 1011).
// 04.02.22 DS Agg. per nuovi parametri svuotature con epicicli (MF_CURR_VER = 1012).
// 29.03.24 DS Agg. parametro APPROX_LINTOL (MF_CURR_VER = 1013).
// 29.03.24 DS Agg. tastatura (MF_CURR_VER = 1014).
//
//----------------------------------------------------------------------------
@@ -43,7 +44,7 @@ const string MF_HEADER = "[HEADER]" ;
const string MF_VERSION = "VERSION" ;
const string MF_TOTAL = "TOTAL" ;
const string MF_SIZE = "SIZE" ;
const int MF_CURR_VER = 1013 ;
const int MF_CURR_VER = 1014 ;
const string MF_GENERAL = "[GENERAL]" ;
const string MF_3AXCOMP = "3AXCOMP" ;
const bool MF_CURR_3AXCOMP = false ;
@@ -125,11 +126,12 @@ MachiningsMgr::Clear( bool bReset)
//----------------------------------------------------------------------------
bool
MachiningsMgr::Load( const string& sMachsFile, const ToolsMgr* pTsMgr)
MachiningsMgr::Load( const string& sMachsDir, const string& sMachsFile, const ToolsMgr* pTsMgr)
{
// Salvo la path del file con i dati
m_sMachsFile = sMachsFile ;
string sOut = "MachiningsMgr Init : " + m_sMachsFile ;
m_sMachsDir = sMachsDir ;
m_sMachsPath = m_sMachsDir + "\\" + sMachsFile ;
string sOut = "MachiningsMgr Init : " + m_sMachsPath ;
LOG_INFO( GetEMkLogger(), sOut.c_str())
// Verifico il gestore degli utensili
@@ -158,9 +160,15 @@ MachiningsMgr::Reload( void)
// Inizializzo lo scanner
Scanner TheScanner ;
if ( ! TheScanner.Init( m_sMachsFile, ";")) {
if ( ! TheScanner.Init( m_sMachsPath, ";")) {
LOG_ERROR( GetEMkLogger(), "ReloadMachinings : Error on Init")
return false ;
if ( ExistsDirectory( m_sMachsDir) && ! ExistsFile( m_sMachsPath)) {
m_nDbVer = MF_CURR_VER ;
m_bModified = true ;
return true ;
}
else
return false ;
}
// variabili di stato della lettura
@@ -399,17 +407,17 @@ MachiningsMgr::Save( bool bCompressed) const
return true ;
// Faccio copia di backup del file originale
CopyFileEgt( m_sMachsFile, m_sMachsFile + ".bak") ;
CopyFileEgt( m_sMachsPath, m_sMachsPath + ".bak") ;
// Inizializzo il writer
Writer TheWriter ;
if ( ! TheWriter.Init( m_sMachsFile, bCompressed)) {
if ( ! TheWriter.Init( m_sMachsPath, bCompressed)) {
LOG_ERROR( GetEMkLogger(), "SaveMachinings : Error on Init")
return false ;
}
// Scrivo linea di inizio file
string sOut = "; --- " + m_sMachsFile + " " + CurrDateTime() + " ---" ;
string sOut = "; --- " + m_sMachsPath + " " + CurrDateTime() + " ---" ;
if ( ! TheWriter.OutText( sOut)) {
LOG_ERROR( GetEMkLogger(), "SaveMachinings : Error on Start")
return false ;
@@ -848,7 +856,7 @@ MachiningsMgr::SetCurrMachiningParam( int nType, double dVal)
}
// se feed
else if ( nType == MPA_FEED || nType == MPA_STARTFEED || nType == MPA_ENDFEED ||
nType == MPA_TIPFEED || nType == MPA_VERTFEED || nType == MPA_BACKFEED) {
nType == MPA_TIPFEED || nType == MPA_VERTFEED || nType == MPA_BACKFEED || nType == MPA_SIDEANGFEED) {
// recupero valore da utensile
const ToolData* pTdata ;
if ( ! m_pCurrMach->GetTool( m_pTsMgr, pTdata))
+4 -3
View File
@@ -27,7 +27,7 @@ class MachiningsMgr
public :
MachiningsMgr( void) ;
~MachiningsMgr( void) ;
bool Load( const std::string& sMachsFile, const ToolsMgr* pTsMgr) ;
bool Load( const std::string& sMachsDir, const std::string& sMachsFile, const ToolsMgr* pTsMgr) ;
bool Reload( void) ;
bool Save( bool bCompressed = true) const ;
bool GetMachiningNewName( std::string& sName) const ;
@@ -108,8 +108,9 @@ class MachiningsMgr
typedef STRUUID_MAP::const_iterator STRUUID_CITER ;
private :
// path file lavorazioni
std::string m_sMachsFile ;
// dir e path file lavorazioni
std::string m_sMachsDir ;
std::string m_sMachsPath ;
// flag di dati modificati
mutable bool m_bModified ;
// versione DB caricato
+203 -59
View File
@@ -21,6 +21,7 @@
#include "Milling.h"
#include "GeoConst.h"
#include "OperationConst.h"
#include "OperUserNotesConst.h"
#include "/EgtDev/Include/EXeCmdLogOff.h"
#include "/EgtDev/Include/EGkCurveLine.h"
#include "/EgtDev/Include/EGkCurveArc.h"
@@ -76,6 +77,7 @@ const double LIM_SIN_DIFF_DIR = 0.175 ;
// 2323 = "Error in Milling : machining depth (xxx) bigger than MaxDepth (yyy)"
// 2324 = "Error in Milling : LeadOut must be out of rawpart"
// 2325 = "Error in Milling : Mirror for Double calculation failed"
// 2326 = "Error in Milling : special apply not calculable"
// 2351 = "Warning in Milling : Skipped entity (xx)"
// 2352 = "Warning in Milling : No machinable path"
// 2353 = "Warning in Milling : Tool name changed (xx)"
@@ -377,7 +379,7 @@ Milling::SetParam( int nType, int nVal)
if ( ! m_Params.VerifyFaceUse( nVal))
return false ;
if ( nVal != m_Params.m_nFaceUse)
m_nStatus |= MCH_ST_PARAM_MODIF ;
m_nStatus |= ( MCH_ST_PARAM_MODIF | MCH_ST_GEO_MODIF) ;
m_Params.m_nFaceUse = nVal ;
return true ;
}
@@ -576,8 +578,17 @@ Milling::SetParam( int nType, const string& sVal)
m_Params.m_sSysNotes = sVal ;
return true ;
case MPA_USERNOTES :
if ( sVal != m_Params.m_sUserNotes)
if ( sVal != m_Params.m_sUserNotes) {
m_nStatus |= MCH_ST_PARAM_MODIF ;
Vector3d vtNew ; GetValInNotes( sVal, UN_VTFACEUSE, vtNew) ;
Vector3d vtOri ; GetValInNotes( m_Params.m_sUserNotes, UN_VTFACEUSE, vtOri) ;
if ( ! AreSameVectorApprox( vtNew, vtOri))
m_nStatus |= MCH_ST_GEO_MODIF ;
INTVECTOR vnNew ; GetValInNotes( sVal, UN_EDGESFACEUSE, vnNew) ;
INTVECTOR vnOri ; GetValInNotes( m_Params.m_sUserNotes, UN_EDGESFACEUSE, vnOri) ;
if ( vnNew != vnOri)
m_nStatus |= MCH_ST_GEO_MODIF ;
}
m_Params.m_sUserNotes = sVal ;
return true ;
case MPA_INITANGS :
@@ -601,7 +612,8 @@ Milling::SetGeometry( const SELVECTOR& vIds)
// verifico validità gestore DB geometrico
if ( m_pGeomDB == nullptr)
return false ;
// reset della geometria corrente
// copia temporanea e reset della geometria corrente
SELVECTOR vOldId = m_vId ;
m_vId.clear() ;
// verifico che gli identificativi rappresentino delle entità ammissibili (tutte curve, tutti testi o tutte facce)
int nType = GEO_NONE ;
@@ -617,7 +629,8 @@ Milling::SetGeometry( const SELVECTOR& vIds)
m_vId.emplace_back( Id) ;
}
// aggiorno lo stato
m_nStatus |= MCH_ST_GEO_MODIF ;
if ( m_vId != vOldId)
m_nStatus |= MCH_ST_GEO_MODIF ;
// restituisco presenza geometria da lavorare
return ( ! m_vId.empty() || vIds.empty()) ;
}
@@ -718,16 +731,18 @@ Milling::Apply( bool bRecalc, bool bPostApply)
return false ;
// aggiorno dati geometrici dell'utensile
bool bToolChanged = true ;
if ( ! UpdateToolData( &bToolChanged)) {
if ( ! UpdateToolData()) {
m_pMchMgr->SetLastError( 2301, "Error in Milling : UpdateToolData failed") ;
return false ;
}
m_nHeadSolCh = m_pMchMgr->GetCurrMachine()->GetHeadSolCh( m_TParams.m_sHead) ;
// se modificata geometria, necessario ricalcolo
if ( ( m_nStatus & MCH_ST_GEO_MODIF) != 0)
bRecalc = true ;
// verifico se necessario continuare nell'aggiornamento
if ( ! bRecalc && ! bToolChanged &&
( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) {
if ( ! bRecalc && ( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) {
// confermo i percorsi di lavorazione
m_nMills = nCurrMills ;
string sLog = string( "Milling apply skipped : status ") + ( m_nStatus == MCH_ST_OK ? "already ok" : "no postapply") ;
@@ -834,16 +849,16 @@ Milling::Apply( bool bRecalc, bool bPostApply)
// assegno ingombri dei vari percorsi di lavorazione e della lavorazione nel suo complesso
CalcAndSetBBox( nClId) ;
// eseguo aggiornamento assi macchina e collegamento con operazione precedente
if ( ! Update( bPostApply))
return false ;
// se lavorazione in doppio, aggiungo geometria della parte simmetrica
if ( ! CalcMirrorByDouble( nClId, m_Params.m_sUserNotes)) {
m_pMchMgr->SetLastError( 2325, "Error in Milling : Mirror for Double calculation failed") ;
return false ;
}
// eseguo aggiornamento assi macchina e collegamento con operazione precedente
if ( ! Update( bPostApply))
return false ;
// aggiorno stato della lavorazione
m_nStatus = ( bPostApply ? MCH_ST_OK : MCH_ST_NO_POSTAPPL) ;
// dichiaro successiva da aggiornare
@@ -887,7 +902,48 @@ Milling::Update( bool bPostApply)
return false ;
}
// gestione movimenti all'inizio di ogni singolo percorso di lavorazione e alla fine della lavorazione
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
CalcAndSetAxesBBox() ;
// se lavorazione in doppio, calcolo assi e movimenti di approccio e retrazione relativi
if ( GetDoubleType( m_Params.m_sUserNotes) != 0) {
// elimino le entità CLIMB, RISE e HOME della lavorazione in doppio
RemoveClimbRiseHome( false) ;
// recupero i dati della testa in doppio e la imposto
string sDblTool ; string sTcPos; string sDblHead ; int nDblExit ;
bool bOk = GetDoubleToolData( sDblTool, sTcPos, sDblHead, nDblExit) &&
m_pMchMgr->SetCalcTool( sDblTool, sDblHead, nDblExit) ;
// imposto eventuale asse bloccato da lavorazione
SetBlockedRotAxis( m_Params.m_sBlockedAxis, true) ;
// eseguo il calcolo
if ( bOk) {
if ( ! CalculateDoubleAxesValues( sHint)) {
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
if ( sInfo.empty())
m_pMchMgr->SetLastError( 2317, "Error in Milling : axes values not calculable for double") ;
else
m_pMchMgr->SetLastError( 2318, "Error in Milling : double outstroke ") ;
bOk = false ;
}
}
// ripristino testa principale
m_pMchMgr->SetCalcTool( GetToolName(), GetHeadName(), GetExitNbr()) ;
// in caso di errore, esco
if ( ! bOk)
return false ;
}
// esecuzione eventuali personalizzazioni speciali
string sSpecErr ;
if ( bPostApply && ! SpecialApply( sSpecErr)) {
if ( ! IsEmptyOrSpaces( sSpecErr))
m_pMchMgr->SetLastError( 2326, sSpecErr) ;
else
m_pMchMgr->SetLastError( 2326, "Error in Milling : special apply not calculable") ;
return false ;
}
// gestione movimenti all'inizio e fine di ogni singolo percorso di lavorazione
if ( ! AdjustStartEndMovements()) {
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
if ( sInfo.empty())
@@ -897,14 +953,11 @@ Milling::Update( bool bPostApply)
return false ;
}
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
CalcAndSetAxesBBox() ;
// esecuzione eventuali personalizzazioni
string sErr ;
if ( bPostApply && ! PostApply( sErr)) {
if ( ! IsEmptyOrSpaces( sErr))
m_pMchMgr->SetLastError( 2321, sErr) ;
// esecuzione eventuali personalizzazioni finali
string sPostErr ;
if ( bPostApply && ! PostApply( sPostErr)) {
if ( ! IsEmptyOrSpaces( sPostErr))
m_pMchMgr->SetLastError( 2321, sPostErr) ;
else
m_pMchMgr->SetLastError( 2321, "Error in Milling : post apply not calculable") ;
return false ;
@@ -1109,7 +1162,7 @@ Milling::GetToolData( void) const
//----------------------------------------------------------------------------
bool
Milling::UpdateToolData( bool* pbChanged)
Milling::UpdateToolData( void)
{
// recupero il gestore DB utensili della macchina corrente
ToolsMgr* pTMgr = m_pMchMgr->GetCurrToolsMgr() ;
@@ -1160,9 +1213,9 @@ Milling::UpdateToolData( bool* pbChanged)
m_Params.m_sToolName + ")" ;
m_pMchMgr->SetWarning( 2354, sInfo) ;
}
// se definito parametro di ritorno, lo assegno
if ( pbChanged != nullptr)
*pbChanged = bChanged ;
// se modificato, aggiusto lo stato
if ( bChanged)
m_nStatus = MCH_ST_TO_VERIFY ;
return true ;
}
@@ -1376,10 +1429,14 @@ Milling::GetCurves( SelData Id, ICURVEPLIST& lstPC)
nToolDir = TOOL_PARAL ;
int nFaceUse = ( m_Params.m_nFaceUse & 31) ;
Vector3d vtFaceUse ;
if ( GetValInNotes( m_Params.m_sUserNotes, "VtFaceUse", vtFaceUse) && ! vtFaceUse.IsSmall())
if ( GetValInNotes( m_Params.m_sUserNotes, UN_VTFACEUSE, vtFaceUse) && ! vtFaceUse.IsSmall())
nFaceUse = FACE_VERSOR ;
INTVECTOR vnEdgesFaceUse ;
if ( GetValInNotes( m_Params.m_sUserNotes, UN_EDGESFACEUSE, vnEdgesFaceUse) && ! vnEdgesFaceUse.empty())
nFaceUse = FACE_EDGES ;
double dSawThick = ( ( m_TParams.m_nType & TF_SAWBLADE) != 0 ? m_TParams.m_dThick : 0) ;
AdjustCurveFromSurf( pCrvCompo, nToolDir, nFaceUse, vtFaceUse, dSawThick) ;
if ( ! AdjustCurveFromSurf( pCrvCompo, nToolDir, nFaceUse, vtFaceUse, vnEdgesFaceUse, dSawThick))
return false ;
// la restituisco
lstPC.emplace_back( Release( pCrvCompo)) ;
return true ;
@@ -1404,8 +1461,11 @@ Milling::GetCurves( SelData Id, ICURVEPLIST& lstPC)
nToolDir = TOOL_PARAL ;
int nFaceUse = ( m_Params.m_nFaceUse & 31) ;
Vector3d vtFaceUse ;
if ( GetValInNotes( m_Params.m_sUserNotes, "VtFaceUse", vtFaceUse) && ! vtFaceUse.IsSmall())
if ( GetValInNotes( m_Params.m_sUserNotes, UN_VTFACEUSE, vtFaceUse) && ! vtFaceUse.IsSmall())
nFaceUse = FACE_VERSOR ;
INTVECTOR vnEdgesFaceUse ;
if ( GetValInNotes( m_Params.m_sUserNotes, UN_EDGESFACEUSE, vnEdgesFaceUse) && ! vnEdgesFaceUse.empty())
nFaceUse = FACE_EDGES ;
double dSawThick = ( ( m_TParams.m_nType & TF_SAWBLADE) != 0 ? m_TParams.m_dThick : 0) ;
// determino intervallo di chunk
int nCstart = 0 ;
@@ -1414,6 +1474,10 @@ Milling::GetCurves( SelData Id, ICURVEPLIST& lstPC)
nCstart = Id.nSub ;
nCend = nCstart + 1 ;
}
else if ( nFaceUse == FACE_EDGES) {
nCstart = 0 ;
nCend = nCstart + 1 ;
}
// ciclo sui chunk
for ( int nC = nCstart ; nC < nCend ; ++ nC) {
// recupero i contorni del chunk
@@ -1428,7 +1492,8 @@ Milling::GetCurves( SelData Id, ICURVEPLIST& lstPC)
// la porto in globale
pCrvCompo->ToGlob( frGlob) ;
// sistemazioni varie
AdjustCurveFromSurf( pCrvCompo, nToolDir, nFaceUse, vtFaceUse, dSawThick) ;
if ( ! AdjustCurveFromSurf( pCrvCompo, nToolDir, nFaceUse, vtFaceUse, vnEdgesFaceUse, dSawThick))
return false ;
// la restituisco
lstPC.emplace_back( Release( pCrvCompo)) ;
}
@@ -1834,13 +1899,13 @@ Milling::ProcessPath( int nPathId, int nPvId, int nClId)
return false ;
// eventuale imposizione massima elevazione da note utente
double dMaxElev ;
if ( GetValInNotes( m_Params.m_sUserNotes, "MaxElev", dMaxElev) && dElev > dMaxElev)
if ( GetValInNotes( m_Params.m_sUserNotes, UN_MAXELEV, dMaxElev) && dElev > dMaxElev)
dElev = dMaxElev ;
// eventuale aggiuntivo all'elevazione per l'oscillazione
double dAddElev = ( bPathOscEnable ? abs( m_Params.m_dOscHeight) : 0) ;
// eventuale elevazione di fianco (solo per lama)
double dSideElev = 0 ;
GetValInNotes( m_Params.m_sUserNotes, "SideElev", dSideElev) ;
GetValInNotes( m_Params.m_sUserNotes, UN_SIDEELEV, dSideElev) ;
// verifico che lo step dell'utensile sia sensato
double dOkStep = 0 ;
@@ -1960,7 +2025,7 @@ Milling::ProcessPath( int nPathId, int nPvId, int nClId)
// recupero eventuale flag di inizio forzato fuori dal grezzo
int nStartOutRaw = 0 ;
GetValInNotes( m_Params.m_sUserNotes, "OutRaw", nStartOutRaw) ;
GetValInNotes( m_Params.m_sUserNotes, UN_OUTRAW, nStartOutRaw) ;
m_bStartOutRaw = (( nStartOutRaw & 1) != 0) ;
m_bEndOutRaw = (( nStartOutRaw & 2) != 0) ;
@@ -1972,6 +2037,15 @@ Milling::ProcessPath( int nPathId, int nPvId, int nClId)
return false ;
m_pGeomDB->SetName( nPxId, sPathName) ;
m_pGeomDB->SetMaterial( nPxId, GREEN) ;
// assegno il vettore estrazione al gruppo del percorso
m_pGeomDB->SetInfo( nPxId, KEY_EXTR, vtTool) ;
// assegno i punti di inizio e fine al gruppo del percorso
m_pGeomDB->SetInfo( nPxId, KEY_START, ptStart) ;
m_pGeomDB->SetInfo( nPxId, KEY_END, ptEnd) ;
// assegno l'elevazione massima
m_pGeomDB->SetInfo( nPxId, KEY_ELEV, dElev) ;
// creo l'anteprima del percorso
if ( ! GenerateMillingPv( nPxId, pCompo, dRbDist, dDepth))
return false ;
@@ -2841,11 +2915,11 @@ Milling::AddZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
return false ;
Vector3d vtToolOrt = OrthoCompo( ptP1 - ptCurr, vtTool) ;
if ( vtToolOrt.Len() > 100 * EPS_SMALL) {
if ( AddLinearMove( ptP1 - vtToolOrt, bSplitArcs) == GDB_ID_NULL)
if ( AddLinearMove( ptP1 - vtToolOrt, bSplitArcs, MCH_CL_SAFEIN) == GDB_ID_NULL)
return false ;
}
// movimento standard
if ( AddLinearMove( ptP1, bSplitArcs) == GDB_ID_NULL)
if ( AddLinearMove( ptP1, bSplitArcs, MCH_CL_SAFEIN) == GDB_ID_NULL)
return false ;
}
// se attacco a zigzag o a spirale, non affondo
@@ -2857,7 +2931,7 @@ Milling::AddZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
else {
bool bStartFeed = ( bOutStart || m_TParams.m_nType == TT_MILL_POLISHING) ;
SetFeed( bStartFeed ? GetStartFeed() : GetTipFeed()) ;
if ( ! SameAsCurrPos( ptP1) && AddLinearMove( ptP1, bSplitArcs) == GDB_ID_NULL)
if ( ! SameAsCurrPos( ptP1) && AddLinearMove( ptP1, bSplitArcs, MCH_CL_SAFEIN) == GDB_ID_NULL)
return false ;
}
}
@@ -3282,7 +3356,9 @@ Milling::AddOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
dSawStartElev = dSawStartElev2 ;
bSideStart = true ;
}
}
}
if ( bSideStart)
bMidRetract = true ;
if ( ! bGeomAboveStart && ! bAhUnderStart && ! bUhAboveStart && ! bSideStart && bOk) {
m_pMchMgr->SetLastError( 2314, "Error in Milling : LeadIn must be out of rawpart") ;
bOk = false ;
@@ -3473,6 +3549,8 @@ Milling::AddOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
bSideEnd = true ;
}
}
if ( bSideEnd)
bMidRetract = true ;
if ( ! bGeomAboveEnd && ! bAhUnderEnd && ! bUhAboveEnd && ! bSideEnd && bOk) {
m_pMchMgr->SetLastError( 2324, "Error in Milling : LeadOut must be out of rawpart") ;
bOk = false ;
@@ -3936,7 +4014,7 @@ Milling::AddSawZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtT
// recupero eventuale superficie trimesh chiusa per trim/extend
int nTriExtCstm = GDB_ID_NULL ;
int nTesId ;
if ( GetValInNotes( m_Params.m_sUserNotes, "TrimExt", nTesId)) {
if ( GetValInNotes( m_Params.m_sUserNotes, UN_TRIMEXT, nTesId)) {
const ISurfTriMesh* pTes = GetSurfTriMesh( m_pGeomDB->GetGeoObj( nTesId)) ;
if ( pTes != nullptr && pTes->IsClosed())
nTriExtCstm = nTesId ;
@@ -4034,7 +4112,7 @@ Milling::AddSawZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtT
else {
bool bStartFeed = ( bOutStart || m_TParams.m_nType == TT_MILL_NOTIP || m_TParams.m_nType == TT_MILL_POLISHING) ;
SetFeed( bStartFeed ? GetStartFeed() : GetTipFeed()) ;
if ( AddLinearMove( ptP1, bSplitArcs) == GDB_ID_NULL)
if ( AddLinearMove( ptP1, bSplitArcs, MCH_CL_SAFEIN) == GDB_ID_NULL)
return false ;
}
// aggiungo attacco
@@ -4112,7 +4190,7 @@ Milling::AddSawOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtT
// recupero eventuale superficie trimesh chiusa per trim/extend
int nTriExtCstm = GDB_ID_NULL ;
int nTesId ;
if ( GetValInNotes( m_Params.m_sUserNotes, "TrimExt", nTesId)) {
if ( GetValInNotes( m_Params.m_sUserNotes, UN_TRIMEXT, nTesId)) {
const ISurfTriMesh* pTes = GetSurfTriMesh( m_pGeomDB->GetGeoObj( nTesId)) ;
if ( pTes != nullptr && pTes->IsClosed())
nTriExtCstm = nTesId ;
@@ -4213,7 +4291,7 @@ Milling::AddSawOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtT
else {
bool bStartFeed = ( bOutStart || m_TParams.m_nType == TT_MILL_NOTIP || m_TParams.m_nType == TT_MILL_POLISHING) ;
SetFeed( bReturn ? GetEndFeed() : ( bStartFeed ? GetStartFeed() : GetTipFeed())) ;
if ( AddLinearMove( ptP1, bSplitArcs) == GDB_ID_NULL)
if ( AddLinearMove( ptP1, bSplitArcs, MCH_CL_SAFEIN) == GDB_ID_NULL)
return false ;
}
// aggiungo attacco
@@ -4381,7 +4459,7 @@ Milling::AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ,
SetFlag( 0) ;
bool bStartFeed = ( bOutStart || m_TParams.m_nType == TT_MILL_NOTIP || m_TParams.m_nType == TT_MILL_POLISHING) ;
SetFeed( bStartFeed ? GetStartFeed() : GetTipFeed()) ;
if ( ! AreSamePointApprox( ptP1, ptP) && AddLinearMove( ptP, bSplitArcs) == GDB_ID_NULL)
if ( ! AreSamePointApprox( ptP1, ptP) && AddLinearMove( ptP, bSplitArcs, MCH_CL_SAFEIN) == GDB_ID_NULL)
return false ;
}
// sono sopra il pezzo ma non abbastanza
@@ -4394,7 +4472,7 @@ Milling::AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ,
SetFlag( 0) ;
bool bStartFeed = ( bOutStart || m_TParams.m_nType == TT_MILL_NOTIP || m_TParams.m_nType == TT_MILL_POLISHING) ;
SetFeed( bStartFeed ? GetStartFeed() : GetTipFeed()) ;
if ( AddLinearMove( ptP, bSplitArcs) == GDB_ID_NULL)
if ( AddLinearMove( ptP, bSplitArcs, MCH_CL_SAFEIN) == GDB_ID_NULL)
return false ;
}
// altrimenti
@@ -4498,7 +4576,7 @@ Milling::AddSawBladeSideApproach( const Point3d& ptP, const Vector3d& vtAppr, co
}
// affondo al punto iniziale in feed
SetFeed( GetStartFeed()) ;
if ( AddLinearMove( ptP, bSplitArcs) == GDB_ID_NULL)
if ( AddLinearMove( ptP, bSplitArcs, MCH_CL_SAFEIN) == GDB_ID_NULL)
return false ;
return true ;
@@ -4511,7 +4589,7 @@ Milling::AddDirectApproach( const Point3d& ptP, bool bSplitArcs)
// affondo diretto al punto iniziale
SetFlag( 0) ;
SetFeed( GetStartFeed()) ;
if ( AddLinearMove( ptP, bSplitArcs) == GDB_ID_NULL)
if ( AddLinearMove( ptP, bSplitArcs, MCH_CL_SAFEIN) == GDB_ID_NULL)
return false ;
return true ;
}
@@ -4545,7 +4623,7 @@ Milling::AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ,
// 4 -> movimento di risalita sopra il punto finale
SetFeed( GetEndFeed()) ;
Point3d ptP4 = ptP + vtAppr * ( dElev + dAppr) ;
if ( AddLinearMove( ptP4, bSplitArcs) == GDB_ID_NULL)
if ( AddLinearMove( ptP4, bSplitArcs, MCH_CL_SAFEOUT) == GDB_ID_NULL)
return false ;
}
else {
@@ -4553,7 +4631,7 @@ Milling::AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ,
Point3d ptP4a = ptP + vtAppr * ( dElev + dAppr) ;
if ( dElev + dAppr > EPS_SMALL) {
SetFeed( GetEndFeed()) ;
if ( AddLinearMove( ptP4a, bSplitArcs) == GDB_ID_NULL)
if ( AddLinearMove( ptP4a, bSplitArcs, MCH_CL_SAFEOUT) == GDB_ID_NULL)
return false ;
}
// 4b -> movimento di risalita sopra il punto finale
@@ -4568,7 +4646,7 @@ Milling::AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ,
// 4 -> movimento di risalita sopra il punto finale
SetFeed( GetEndFeed()) ;
Point3d ptP4 = ptP + Z_AX * ( min( dElevZ, 0.) + dAppr) ;
if ( AddLinearMove( ptP4, bSplitArcs) == GDB_ID_NULL)
if ( AddLinearMove( ptP4, bSplitArcs, MCH_CL_SAFEOUT) == GDB_ID_NULL)
return false ;
}
else {
@@ -4576,7 +4654,7 @@ Milling::AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ,
Point3d ptP4a = ptP + Z_AX * ( min( dElevZ, 0.) + dAppr) ;
if ( dElev + dAppr > EPS_SMALL) {
SetFeed( GetEndFeed()) ;
if ( AddLinearMove( ptP4a, bSplitArcs) == GDB_ID_NULL)
if ( AddLinearMove( ptP4a, bSplitArcs, MCH_CL_SAFEOUT) == GDB_ID_NULL)
return false ;
}
// 4b -> movimento di risalita sopra il punto finale
@@ -4624,7 +4702,7 @@ Milling::AddSawBladeSideRetract( const Point3d& ptP, const Vector3d& vtRetr, con
if ( dSawEndElev + dAppr > 10 * EPS_SMALL) {
SetFeed( GetEndFeed()) ;
ptP4 = ptP + vtRetr * ( dSawEndElev + dAppr) ;
if ( AddLinearMove( ptP4) == GDB_ID_NULL)
if ( AddLinearMove( ptP4, MCH_CL_SAFEOUT) == GDB_ID_NULL)
return false ;
}
// se sopra uscita c'è spazio per sicurezza
@@ -4710,7 +4788,9 @@ Milling::CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const
int nType = GetLeadInType() ;
double dTang = m_Params.m_dLiTang ;
double dPerp = m_Params.m_dLiPerp ;
double dElev = min( m_Params.m_dLiElev, dStElev + GetLeadInOutToler()) ;
double dElev = m_Params.m_dLiElev ;
if ( m_TParams.m_nType != TT_MILL_POLISHING)
dElev = min( m_Params.m_dLiElev, dStElev + GetLeadInOutToler()) ;
// se step invertito
if ( bInvert) {
// va aggiustato se non zigzag o spirale
@@ -4726,7 +4806,9 @@ Milling::CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const
if ( m_Params.m_nLeadOutType != MILL_LO_AS_LI) {
dTang = m_Params.m_dLoTang ;
dPerp = m_Params.m_dLoPerp ;
dElev = min( m_Params.m_dLoElev, dStElev + GetLeadInOutToler()) ;
dElev = m_Params.m_dLoElev ;
if ( m_TParams.m_nType != TT_MILL_POLISHING)
dElev = min( m_Params.m_dLoElev, dStElev + GetLeadInOutToler()) ;
}
}
}
@@ -4832,7 +4914,9 @@ Milling::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d&
int nType = GetLeadInType() ;
double dTang = m_Params.m_dLiTang ;
double dPerp = m_Params.m_dLiPerp ;
double dElev = min( m_Params.m_dLiElev, dStElev + GetLeadInOutToler()) ;
double dElev = m_Params.m_dLiElev ;
if ( m_TParams.m_nType != TT_MILL_POLISHING)
dElev = min( m_Params.m_dLiElev, dStElev + GetLeadInOutToler()) ;
// se step invertito
if ( bInvert) {
// va aggiustato se non zigzag o spirale
@@ -4848,7 +4932,9 @@ Milling::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d&
if ( m_Params.m_nLeadOutType != MILL_LO_AS_LI) {
dTang = m_Params.m_dLoTang ;
dPerp = m_Params.m_dLoPerp ;
dElev = min( m_Params.m_dLoElev, dStElev + GetLeadInOutToler()) ;
dElev = m_Params.m_dLoElev ;
if ( m_TParams.m_nType != TT_MILL_POLISHING)
dElev = min( m_Params.m_dLoElev, dStElev + GetLeadInOutToler()) ;
}
}
}
@@ -5070,7 +5156,9 @@ Milling::CalcLeadOutEnd( const Point3d& ptEnd, const Vector3d& vtEnd, const Vect
int nType = GetLeadOutType() ;
double dTang = m_Params.m_dLoTang ;
double dPerp = m_Params.m_dLoPerp ;
double dElev = min( m_Params.m_dLoElev, dEndElev + GetLeadInOutToler()) ;
double dElev = m_Params.m_dLoElev ;
if ( m_TParams.m_nType != TT_MILL_POLISHING)
dElev = min( m_Params.m_dLoElev, dEndElev + GetLeadInOutToler()) ;
// se uscita come ingresso o step invertito
if ( nType == MILL_LO_AS_LI || bInvert) {
int nLiType = GetLeadInType() ;
@@ -5089,7 +5177,9 @@ Milling::CalcLeadOutEnd( const Point3d& ptEnd, const Vector3d& vtEnd, const Vect
dTang = 0.5 * min( m_Params.m_dLiTang, m_TParams.m_dDiam) ;
dPerp = dTang ;
}
dElev = min( m_Params.m_dLiElev, dEndElev + GetLeadInOutToler()) ;
dElev = m_Params.m_dLiElev ;
if ( m_TParams.m_nType != TT_MILL_POLISHING)
dElev = min( m_Params.m_dLiElev, dEndElev + GetLeadInOutToler()) ;
}
// senso di rotazione da dir tg a dir esterna
bool bCcwRot = (( ! bInvert && m_Params.m_nWorkSide == MILL_WS_LEFT) ||
@@ -5201,7 +5291,9 @@ Milling::AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d
int nType = GetLeadOutType() ;
double dTang = m_Params.m_dLoTang ;
double dPerp = m_Params.m_dLoPerp ;
double dElev = min( m_Params.m_dLoElev, dEndElev + GetLeadInOutToler()) ;
double dElev = m_Params.m_dLoElev ;
if ( m_TParams.m_nType != TT_MILL_POLISHING)
dElev = min( m_Params.m_dLoElev, dEndElev + GetLeadInOutToler()) ;
// se uscita come ingresso o step invertito
if ( nType == MILL_LO_AS_LI || bInvert) {
int nLiType = GetLeadInType() ;
@@ -5220,7 +5312,9 @@ Milling::AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d
dTang = 0.5 * min( m_Params.m_dLiTang, m_TParams.m_dDiam) ;
dPerp = dTang ;
}
dElev = min( m_Params.m_dLiElev, dEndElev + GetLeadInOutToler()) ;
dElev = m_Params.m_dLiElev ;
if ( m_TParams.m_nType != TT_MILL_POLISHING)
dElev = min( m_Params.m_dLiElev, dEndElev + GetLeadInOutToler()) ;
}
// senso di rotazione da dir tg a dir esterna
bool bCcwRot = (( ! bInvert && m_Params.m_nWorkSide == MILL_WS_LEFT) ||
@@ -6427,14 +6521,24 @@ Milling::CalcAndSetCorrAuxDir( const ICurveComposite* pCompo, double dU, bool bI
if ( m_bAggrBottom)
return true ;
// se impostato uso direttamente da lavorazione, imposto anche come versore aux
if ( m_Params.m_nSolCh == MCH_SCC_ADIR_NEAR || m_Params.m_nSolCh == MCH_SCC_ADIR_FAR)
if ( m_Params.m_nSolCh == MCH_SCC_ADIR_NEAR || m_Params.m_nSolCh == MCH_SCC_ADIR_FAR) {
SetAuxDir( vtCorr) ;
return true ;
}
// se standard o nullo o suo opposto
if ( m_Params.m_nSolCh == MCH_SCC_STD || m_Params.m_nSolCh == MCH_SCC_NONE || m_Params.m_nSolCh == MCH_SCC_OPPOSITE) {
// verifico se richiesto dalla testa
if ( m_nHeadSolCh == MCH_SCC_ADIR_NEAR || m_nHeadSolCh == MCH_SCC_ADIR_FAR)
if ( m_nHeadSolCh == MCH_SCC_ADIR_NEAR || m_nHeadSolCh == MCH_SCC_ADIR_FAR) {
SetAuxDir( vtCorr) ;
return true ;
}
}
// reset o assegnamento da parametro di lavorazione nelle UserNotes
Vector3d vtAux ;
if ( GetValInNotes( m_Params.m_sUserNotes, UN_VTAUXDIR, vtAux))
vtAux.Normalize() ;
SetAuxDir( vtAux) ;
return true ;
}
@@ -6543,6 +6647,46 @@ Milling::CalcOffset( ICurveComposite* pCompo, double dSignOffs) const
pCompo->ArcsBezierCurvesToArcsPerpExtr( LIN_TOL_MID, ANG_TOL_STD_DEG) ;
return true ;
}
else {
Point3d ptOffs ;
Vector3d vtOut ;
if ( OffsCrv.GetPointOffset( ptOffs, vtOut)) {
const double MIN_MOVE = 1 ;
Vector3d vtStart = vtOut ;
double dStaLen = 10 ;
Point3d ptStart ;
if ( pCompo->GetStartPoint( ptStart)) {
Vector3d vtTmp = ptOffs - ptStart ;
if ( vtTmp.Normalize()) {
double dCosA = abs( vtTmp * vtOut) ;
dStaLen = max( m_TParams.m_dDiam / 2 * sqrt( ( 1 - dCosA) / ( 1 + dCosA)), MIN_MOVE) ;
vtTmp.Rotate( vtExtr, 0, 1) ;
if ( vtTmp * vtOut < 0)
vtTmp.Invert() ;
vtStart = vtTmp ;
}
}
Vector3d vtEnd = vtOut ;
double dEndLen = 10 ;
Point3d ptEnd ;
if ( pCompo->GetEndPoint( ptEnd)) {
Vector3d vtTmp = ptOffs - ptEnd ;
if ( vtTmp.Normalize()) {
double dCosA = abs( vtTmp * vtOut) ;
dEndLen = max( m_TParams.m_dDiam / 2 * sqrt( ( 1 - dCosA) / ( 1 + dCosA)), MIN_MOVE) ;
vtTmp.Rotate( vtExtr, 0, 1) ;
if ( vtTmp * vtOut < 0)
vtTmp.Invert() ;
vtEnd = vtTmp ;
}
}
pCompo->Clear() ;
pCompo->AddPoint( ptOffs) ;
pCompo->AddLine( ptOffs + dStaLen * vtStart, false) ;
pCompo->AddLine( ptOffs + dEndLen * vtEnd) ;
return true ;
}
}
}
}
return false ;
+9 -3
View File
@@ -37,8 +37,14 @@ class Milling : public Machining
public : // Operation
int GetType( void) const override
{ return OPER_MILLING ; }
bool IsEmpty( void) const override
{ return ( m_nMills == 0) ; }
bool IsEmpty( int nEmptyType = NEED_GEOM) const override
{ if ( m_nMills == 0)
return true ;
if ( nEmptyType == NEED_ONE_TP_OK)
return ( ! IsAtLeastOnePathOk()) ;
if ( nEmptyType == NEED_ALL_TP_OK)
return ( ! AreAllPathsOk()) ;
return false ; }
bool UpdateStatus( int nModif) override
{ m_nStatus |= nModif ; return true ; }
@@ -62,7 +68,7 @@ class Milling : public Machining
bool GetParam( int nType, int& nVal) const override ;
bool GetParam( int nType, double& dVal) const override ;
bool GetParam( int nType, std::string& sVal) const override ;
bool UpdateToolData( bool* pbChanged = nullptr) override ;
bool UpdateToolData( void) override ;
const ToolData& GetToolData( void) const override ;
bool GetGeometry( SELVECTOR& vIds) const override ;
+97 -57
View File
@@ -17,6 +17,7 @@
#include "DllMain.h"
#include "Mortising.h"
#include "OperationConst.h"
#include "OperUserNotesConst.h"
#include "/EgtDev/Include/EGkCurveLine.h"
#include "/EgtDev/Include/EGkCurveArc.h"
#include "/EgtDev/Include/EGkCurveComposite.h"
@@ -45,6 +46,7 @@ using namespace std ;
// 2511 = "Error in Mortising : post apply not calculable"
// 2512 = "Error in Mortising : Tool MaxMaterial too small (xx)"
// 2513 = "Error in Mortising : Closed path not allowed"
// 2514 = "Error in Mortising : special apply not calculable"
// 2551 = "Warning in Mortising : Skipped entity (xx)"
// 2552 = "Warning in Mortising : Plunges not found"
// 2553 = "Warning in Mortising : Tool name changed (xx)"
@@ -273,7 +275,7 @@ Mortising::SetParam( int nType, int nVal)
if ( ! m_Params.VerifyFaceUse( nVal))
return false ;
if ( nVal != m_Params.m_nFaceUse)
m_nStatus |= MCH_ST_PARAM_MODIF ;
m_nStatus |= ( MCH_ST_PARAM_MODIF | MCH_ST_GEO_MODIF) ;
m_Params.m_nFaceUse = nVal ;
return true ;
}
@@ -414,15 +416,16 @@ Mortising::SetParam( int nType, const string& sVal)
bool
Mortising::SetGeometry( const SELVECTOR& vIds)
{
// verifico validità gestore DB geometrico
// verifico validità gestore DB geometrico
if ( m_pGeomDB == nullptr)
return false ;
// reset della geometria corrente
// copia temporanea e reset della geometria corrente
SELVECTOR vOldId = m_vId ;
m_vId.clear() ;
// verifico che gli identificativi rappresentino delle entità ammissibili (tutte curve o tutte facce)
// verifico che gli identificativi rappresentino delle entità ammissibili (tutte curve o tutte facce)
int nType = GEO_NONE ;
for ( const auto& Id : vIds) {
// test sull'entità
// test sull'entità
int nSubs ;
if ( ! VerifyGeometry( Id, nSubs, nType)) {
string sInfo = "Warning in Mortising : Skipped entity " + ToString( Id) ;
@@ -433,7 +436,8 @@ Mortising::SetGeometry( const SELVECTOR& vIds)
m_vId.emplace_back( Id) ;
}
// aggiorno lo stato
m_nStatus |= MCH_ST_GEO_MODIF ;
if ( m_vId != vOldId)
m_nStatus |= MCH_ST_GEO_MODIF ;
// restituisco presenza geometria da lavorare
return ( ! m_vId.empty() || vIds.empty()) ;
}
@@ -445,14 +449,14 @@ Mortising::Preview( bool bRecalc)
// reset numero percorsi di lavoro generati
m_nMortises = 0 ;
// verifico validità gestore DB geometrico e Id del gruppo
// verifico validità gestore DB geometrico e Id del gruppo
if ( m_pGeomDB == nullptr || ! m_pGeomDB->ExistsObj( m_nOwnerId))
return false ;
// recupero gruppo per geometria ausiliaria
int nAuxId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_AUX) ;
bool bChain = false ;
// se non c'è, lo aggiungo
// se non c'è, lo aggiungo
if ( nAuxId == GDB_ID_NULL) {
nAuxId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
if ( nAuxId == GDB_ID_NULL)
@@ -480,7 +484,7 @@ Mortising::Preview( bool bRecalc)
}
// recupero gruppo per geometria di Preview
int nPvId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_PV) ;
// se non c'è, lo aggiungo
// se non c'è, lo aggiungo
if ( nPvId == GDB_ID_NULL) {
nPvId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
if ( nPvId == GDB_ID_NULL)
@@ -510,20 +514,22 @@ Mortising::Apply( bool bRecalc, bool bPostApply)
int nCurrMortises = m_nMortises ;
m_nMortises = 0 ;
// verifico validità gestore DB geometrico e Id del gruppo
// verifico validità gestore DB geometrico e Id del gruppo
if ( m_pGeomDB == nullptr || ! m_pGeomDB->ExistsObj( m_nOwnerId))
return false ;
// aggiorno dati geometrici dell'utensile
bool bToolChanged = true ;
if ( ! UpdateToolData( &bToolChanged)) {
if ( ! UpdateToolData()) {
m_pMchMgr->SetLastError( 2501, "Error in Mortising : UpdateToolData failed") ;
return false ;
}
// se modificata geometria, necessario ricalcolo
if ( ( m_nStatus & MCH_ST_GEO_MODIF) != 0)
bRecalc = true ;
// verifico se necessario continuare nell'aggiornamento
if ( ! bRecalc && ! bToolChanged &&
( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) {
if ( ! bRecalc && ( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) {
// confermo i percorsi di lavorazione
m_nMortises = nCurrMortises ;
string sLog = string( "Mortising apply skipped : status ") + ( m_nStatus == MCH_ST_OK ? "already ok" : "no postapply") ;
@@ -541,7 +547,7 @@ Mortising::Apply( bool bRecalc, bool bPostApply)
// recupero gruppo per geometria ausiliaria
int nAuxId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_AUX) ;
bool bChain = false ;
// se non c'è, lo aggiungo
// se non c'è, lo aggiungo
if ( nAuxId == GDB_ID_NULL) {
nAuxId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
if ( nAuxId == GDB_ID_NULL)
@@ -558,7 +564,7 @@ Mortising::Apply( bool bRecalc, bool bPostApply)
// recupero gruppo per vista ausiliaria
int nAuxViewId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_AUXVIEW) ;
// se non c'è, lo aggiungo
// se non c'è, lo aggiungo
if ( nAuxViewId == GDB_ID_NULL) {
nAuxViewId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
if ( nAuxViewId == GDB_ID_NULL)
@@ -574,7 +580,7 @@ Mortising::Apply( bool bRecalc, bool bPostApply)
// recupero gruppo per geometria di lavorazione (Cutter Location)
int nClId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_CL) ;
// se non c'è, lo aggiungo
// se non c'è, lo aggiungo
if ( nClId == GDB_ID_NULL) {
nClId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
if ( nClId == GDB_ID_NULL)
@@ -626,7 +632,7 @@ Mortising::Apply( bool bRecalc, bool bPostApply)
bool
Mortising::Update( bool bPostApply)
{
// verifico validità gestore DB geometrico e Id del gruppo
// verifico validità gestore DB geometrico e Id del gruppo
if ( m_pGeomDB == nullptr || ! m_pGeomDB->ExistsObj( m_nOwnerId))
return false ;
@@ -636,7 +642,7 @@ 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)
// 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
@@ -646,7 +652,7 @@ Mortising::Update( bool bPostApply)
string sHint = ExtractHint( m_Params.m_sUserNotes) ;
if ( ! m_Params.m_sInitAngs.empty())
sHint = m_Params.m_sInitAngs ;
if ( ! CalculateAxesValues( sHint, true, true)) {
if ( ! CalculateAxesValues( sHint, true)) {
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
if ( sInfo.empty())
m_pMchMgr->SetLastError( 2507, "Error in Mortising : axes values not calculable") ;
@@ -655,6 +661,19 @@ Mortising::Update( bool bPostApply)
return false ;
}
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
CalcAndSetAxesBBox() ;
// esecuzione eventuali personalizzazioni speciali
string sSpecErr ;
if ( bPostApply && ! SpecialApply( sSpecErr)) {
if ( ! IsEmptyOrSpaces( sSpecErr))
m_pMchMgr->SetLastError( 2514, sSpecErr) ;
else
m_pMchMgr->SetLastError( 2514, "Error in Mortising : special apply not calculable") ;
return false ;
}
// gestione movimenti all'inizio di ogni singolo percorso di lavorazione e alla fine della lavorazione
if ( ! AdjustStartEndMovements()) {
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
@@ -665,14 +684,11 @@ Mortising::Update( bool bPostApply)
return false ;
}
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
CalcAndSetAxesBBox() ;
// esecuzione eventuali personalizzazioni
string sErr ;
if ( bPostApply && ! PostApply( sErr)) {
if ( ! IsEmptyOrSpaces( sErr))
m_pMchMgr->SetLastError( 2511, sErr) ;
// esecuzione eventuali personalizzazioni finali
string sPostErr ;
if ( bPostApply && ! PostApply( sPostErr)) {
if ( ! IsEmptyOrSpaces( sPostErr))
m_pMchMgr->SetLastError( 2511, sPostErr) ;
else
m_pMchMgr->SetLastError( 2511, "Error in Mortising : post apply not calculable") ;
return false ;
@@ -811,7 +827,7 @@ Mortising::GetToolData( void) const
//----------------------------------------------------------------------------
bool
Mortising::UpdateToolData( bool* pbChanged)
Mortising::UpdateToolData( void)
{
// recupero il gestore DB utensili della macchina corrente
ToolsMgr* pTMgr = m_pMchMgr->GetCurrToolsMgr() ;
@@ -862,9 +878,9 @@ Mortising::UpdateToolData( bool* pbChanged)
m_Params.m_sToolName + ")" ;
m_pMchMgr->SetWarning( 2554, sInfo) ;
}
// se definito parametro di ritorno, lo assegno
if ( pbChanged != nullptr)
*pbChanged = bChanged ;
// se modificato, aggiusto lo stato
if ( bChanged)
m_nStatus = MCH_ST_TO_VERIFY ;
return true ;
}
@@ -872,7 +888,7 @@ Mortising::UpdateToolData( bool* pbChanged)
bool
Mortising::GetGeometry( SELVECTOR& vIds) const
{
// restituisco l'elenco delle entità
// restituisco l'elenco delle entità
vIds = m_vId ;
return true ;
}
@@ -885,7 +901,7 @@ Mortising::VerifyGeometry( SelData Id, int& nSubs, int& nType)
const IGeoObj* pGObj = m_pGeomDB->GetGeoObj( Id.nId) ;
if ( pGObj == nullptr)
return false ;
// se ammesse curve ed è tale
// se ammesse curve ed è tale
if ( nType != GEO_SURF && ( pGObj->GetType() & GEO_CURVE) != 0) {
const ICurve* pCurve = nullptr ;
// se direttamente la curva
@@ -907,7 +923,7 @@ Mortising::VerifyGeometry( SelData Id, int& nSubs, int& nType)
}
return ( pCurve != nullptr) ;
}
// se altrimenti ammesse superfici trimesh ed è tale
// se altrimenti ammesse superfici trimesh ed è tale
else if ( nType != GEO_CURVE && ( pGObj->GetType() & GEO_SURF) != 0) {
const ISurfTriMesh* pSurf = ::GetSurfTriMesh( pGObj) ;
if ( pSurf == nullptr)
@@ -1022,7 +1038,7 @@ Mortising::GetCurve( SelData Id)
else
nToolDir = TOOL_PAR_SLANT ;
int nFaceUse = ( m_Params.m_nFaceUse & 31) ;
AdjustCurveFromSurf( pCrvCompo, nToolDir, nFaceUse, V_NULL, m_TParams.m_dThick, 2) ;
AdjustCurveFromSurf( pCrvCompo, nToolDir, nFaceUse, V_NULL, {}, m_TParams.m_dThick, 2) ;
// la restituisco
return Release( pCrvCompo) ;
}
@@ -1042,7 +1058,7 @@ Mortising::Chain( int nGrpDestId)
for ( const auto& Id : m_vId) {
// prendo curva
vpCrvs.emplace_back( GetCurve( Id)) ;
// ne verifico la validità
// ne verifico la validità
if ( IsNull( vpCrvs.back())) {
string sInfo = "Warning in Mortising : Skipped entity " + ToString( Id) ;
m_pMchMgr->SetWarning( 2551, sInfo) ;
@@ -1161,7 +1177,7 @@ Mortising::ProcessPath( int nPathId, int nPvId, int nClId)
// recupero gruppo per geometria temporanea
const string GRP_TEMP = "Temp" ;
int nTempId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, GRP_TEMP) ;
// se non c'è, lo aggiungo
// se non c'è, lo aggiungo
if ( nTempId == GDB_ID_NULL) {
nTempId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
if ( nTempId == GDB_ID_NULL)
@@ -1225,7 +1241,7 @@ Mortising::ProcessPath( int nPathId, int nPvId, int nClId)
m_pMchMgr->SetWarning( 2555, "Warning in Mortising : skipped Path too short") ;
return true ;
}
// se una sola entità circonferenza completa, la divido in due per poterla allungare
// se una sola entità circonferenza completa, la divido in due per poterla allungare
if ( pCompo->GetCurveCount() == 1 && pCompo->IsClosed())
pCompo->AddJoint( 0.5) ;
// eventuali allungamenti
@@ -1325,7 +1341,7 @@ Mortising::ProcessPath( int nPathId, int nPvId, int nClId)
return false ;
// eventuale imposizione massima elevazione da note utente
double dMaxElev ;
if ( GetValInNotes( m_Params.m_sUserNotes, "MaxElev", dMaxElev) && dElev > dMaxElev)
if ( GetValInNotes( m_Params.m_sUserNotes, UN_MAXELEV, dMaxElev) && dElev > dMaxElev)
dElev = dMaxElev ;
// ingombro aggiuntivo da larghezza sega a catena quando inclinata rispetto al movimento
@@ -1336,10 +1352,10 @@ Mortising::ProcessPath( int nPathId, int nPvId, int nClId)
// affondamento speciale da note utente (!!! da trasformare in parametro come gli altri !!!)
int nPlunge = 0 ;
GetValInNotes( m_Params.m_sUserNotes, "Plunge", nPlunge) ;
GetValInNotes( m_Params.m_sUserNotes, UN_PLUNGE, nPlunge) ;
// verifico che lo step dell'utensile sia sensato
double dOkStep = ( nPlunge == MORTISE_PLUNGE_STEP ? m_Params.m_dStep : 0) ;
double dOkStep = ( nPlunge == MORTISE_PLUNGE_STEP || nPlunge == MORTISE_PLUNGE_STEP_NO_SAFEZ ? m_Params.m_dStep : 0) ;
const double MIN_ZSTEP = 1.0 ;
if ( dOkStep >= EPS_SMALL && dOkStep < MIN_ZSTEP) {
dOkStep = MIN_ZSTEP ;
@@ -1357,7 +1373,7 @@ Mortising::ProcessPath( int nPathId, int nPvId, int nClId)
return false ;
}
// se lo step supera la capacità dell'utensile
// se lo step supera la capacità dell'utensile
if ( dOkStep > m_TParams.m_dMaxMat + EPS_SMALL) {
dOkStep = m_TParams.m_dMaxMat ;
string sInfo = "Warning in Mortising : machining step (" + ToString( m_Params.m_dStep, 1) +
@@ -1505,7 +1521,7 @@ Mortising::GenerateMortisingCl( const ICurveComposite* pCompo, const Vector3d& v
Point3d ptStart ; pCompo->GetStartPoint( ptStart) ;
Point3d ptEnd ; pCompo->GetEndPoint( ptEnd) ;
// verifico se affondamento ripetuto è veramente tale
// verifico se affondamento ripetuto è veramente tale
if ( ( nPlunge == MORTISE_PLUNGE_START_END || nPlunge == MORTISE_PLUNGE_START_TO_END) && Dist( ptStart, ptEnd) < 10 * EPS_SMALL)
nPlunge = MORTISE_PLUNGE_START ;
@@ -1529,7 +1545,7 @@ Mortising::GenerateMortisingCl( const ICurveComposite* pCompo, const Vector3d& v
int kMax = ( int) floor( dLen / m_TParams.m_dDiam) ;
for ( int k = 0 ; k <= kMax ; ++ k) {
Point3d ptNewStart = ptStart + vtDir * k * m_TParams.m_dDiam ;
// se non è finale
// se non è finale
if ( k != kMax || ! AreSamePointEpsilon( ptNewStart, ptEnd, 10 * EPS_SMALL)) {
if ( ! GenerateOnePlungeCl( ptNewStart, ptEnd, vtTool, dDepth, dElev, dOkStep, MORTISE_PLUNGE_START, k == 0))
return false ;
@@ -1561,8 +1577,17 @@ Mortising::GenerateOnePlungeCl( const Point3d& ptStart, const Point3d& ptEnd, co
{
// compensazione elevazione/affondamento
double dDelta = dElev - dDepth ;
// pre-calcolo step per modalità con step
int nStep = 1 ;
double dStep = dElev ;
if ( nPlunge == MORTISE_PLUNGE_STEP || nPlunge == MORTISE_PLUNGE_STEP_NO_SAFEZ) {
if ( dOkStep < EPS_SMALL)
dOkStep = dElev ;
nStep = max( 1, static_cast<int>( ceil( ( dElev - 10 * EPS_SMALL) / dOkStep))) ;
dStep = dElev / nStep ;
}
// determino se l'inizio dell'attacco è esattamente sotto il grezzo, nel qual caso ricalcolo l'elevazione
// determino se l'inizio dell'attacco è esattamente sotto il grezzo, nel qual caso ricalcolo l'elevazione
double dSafeZ = GetSafeZ() + GetDeltaSafeZ( vtTool) ;
double dStartElev = 0 ;
Point3d ptLi = ( nPlunge != MORTISE_PLUNGE_END ? ptStart : ptEnd) + vtTool * dDelta ;
@@ -1572,17 +1597,26 @@ Mortising::GenerateOnePlungeCl( const Point3d& ptStart, const Point3d& ptEnd, co
if ( ! bUnderStart)
GetElevation( m_nPhase, ptLi, vtTool, GetRadiusForStartEndElevation(), vtTool, dStartElev) ;
// sicurezza su punto iniziale
double dAppr = dStartElev + dSafeZ ;
if ( nPlunge == MORTISE_PLUNGE_STEP_NO_SAFEZ) {
double dStartDownElev ;
if ( ! GetElevation( m_nPhase, ptStart, vtTool, GetRadiusForStartEndElevation(), vtTool, dStartDownElev))
dStartDownElev = dDelta ;
if ( dStartDownElev < EPS_SMALL)
dAppr = -dStep ;
}
// 1 -> punto approccio
int nFirstFlag = ( bFirst ? 1 : 0) ;
SetFlag( nFirstFlag) ;
Point3d ptP1 = ( nPlunge != MORTISE_PLUNGE_END ? ptStart : ptEnd) + vtTool * ( dDelta + dStartElev + dSafeZ) ;
int nStart = AddRapidStartOrMove( ptP1, bFirst) ;
if ( nStart == GDB_ID_NULL)
Point3d ptP1 = ( nPlunge != MORTISE_PLUNGE_END ? ptStart : ptEnd) + vtTool * ( dDelta + dAppr) ;
if ( AddRapidStartOrMove( ptP1, bFirst) == GDB_ID_NULL)
return false ;
SetFlag( 0) ;
// 2 -> punto fuori (se diverso dal precedente)
if ( m_Params.m_dStartPos < dSafeZ - 10 * EPS_SMALL) {
if ( m_Params.m_dStartPos < dAppr - 10 * EPS_SMALL) {
Point3d ptP2 = ( nPlunge != MORTISE_PLUNGE_END ? ptStart : ptEnd) + vtTool * ( dDelta + m_Params.m_dStartPos) ;
if ( AddRapidMove( ptP2) == GDB_ID_NULL)
return false ;
@@ -1610,10 +1644,6 @@ Mortising::GenerateOnePlungeCl( const Point3d& ptStart, const Point3d& ptEnd, co
}
else {
// determino numero e affondamento degli step
if ( dOkStep < EPS_SMALL)
dOkStep = dElev ;
int nStep = max( 1, static_cast<int>( ceil( ( dElev - 10 * EPS_SMALL) / dOkStep))) ;
double dStep = dElev / nStep ;
const double RETURN_DIST = 10 ;
// a seconda del tipo
switch ( m_Params.m_nStepType) {
@@ -1623,7 +1653,7 @@ Mortising::GenerateOnePlungeCl( const Point3d& ptStart, const Point3d& ptEnd, co
SetFeed( GetStartFeed()) ;
SetFlag( 0) ;
Point3d ptP3 = (( i % 2 == 1) ? ptStart : ptEnd) + ( dDelta - i * dStep) * vtTool ;
if ( AddLinearMove( ptP3) == GDB_ID_NULL)
if ( AddLinearMove( ptP3) == GDB_ID_NULL && ! ( i == 1 && nPlunge == MORTISE_PLUNGE_STEP_NO_SAFEZ))
return false ;
// 4 -> punto termine
SetFeed( GetFeed()) ;
@@ -1669,7 +1699,7 @@ Mortising::GenerateOnePlungeCl( const Point3d& ptStart, const Point3d& ptEnd, co
}
}
// determino se la fine dell'uscita è esattamente sotto il grezzo, nel qual caso ricalcolo l'elevazione
// determino se la fine dell'uscita è esattamente sotto il grezzo, nel qual caso ricalcolo l'elevazione
double dEndElev = 0 ;
Point3d ptLo = ptLast + vtTool * dDelta ;
bool bUnderEnd = GetAhPointUnderRaw( ptLo, vtTool, 0,
@@ -1677,11 +1707,21 @@ Mortising::GenerateOnePlungeCl( const Point3d& ptStart, const Point3d& ptEnd, co
// altrimenti ridetermino elevazione su fine percorso di lavoro
if ( ! bUnderEnd)
GetElevation( m_nPhase, ptLo, vtTool, GetRadiusForStartEndElevation(), vtTool, dEndElev) ;
// sicurezza su punto finale
double dRetr = dEndElev + dSafeZ ;
if ( nPlunge == MORTISE_PLUNGE_STEP_NO_SAFEZ) {
double dEndDownElev ;
if ( ! GetElevation( m_nPhase, ptStart, vtTool, GetRadiusForStartEndElevation(), vtTool, dEndDownElev))
dEndDownElev = dDelta ;
if ( dEndDownElev < EPS_SMALL)
dRetr = dEndElev - dStep ;
}
// 6 -> ritorno all'approccio
SetFeed( GetEndFeed()) ;
SetFlag( 104) ; // risalita sopra la fine
Point3d ptP6 = ptLast + vtTool * ( dDelta + dEndElev + dSafeZ) ;
Point3d ptP6 = ptLast + vtTool * ( dDelta + dRetr) ;
if ( AddLinearMove( ptP6) == GDB_ID_NULL)
return false ;
+9 -3
View File
@@ -36,8 +36,14 @@ class Mortising : public Machining
public : // Operation
int GetType( void) const override
{ return OPER_MORTISING ; }
bool IsEmpty( void) const override
{ return ( m_nMortises == 0) ; }
bool IsEmpty( int nEmptyType = NEED_GEOM) const override
{ if ( m_nMortises == 0)
return true ;
if ( nEmptyType == NEED_ONE_TP_OK)
return ( ! IsAtLeastOnePathOk()) ;
if ( nEmptyType == NEED_ALL_TP_OK)
return ( ! AreAllPathsOk()) ;
return false ; }
bool UpdateStatus( int nModif) override
{ m_nStatus |= nModif ; return true ; }
@@ -59,7 +65,7 @@ class Mortising : public Machining
bool GetParam( int nType, int& nVal) const override ;
bool GetParam( int nType, double& dVal) const override ;
bool GetParam( int nType, std::string& sVal) const override ;
bool UpdateToolData( bool* pbChanged = nullptr) override ;
bool UpdateToolData( void) override ;
const ToolData& GetToolData( void) const override ;
bool GetGeometry( SELVECTOR& vIds) const override ;
+77
View File
@@ -0,0 +1,77 @@
//----------------------------------------------------------------------------
// EgalTech 2025-2025
//----------------------------------------------------------------------------
// File : OperUserNotesConst.h Data : 10.11.25 Versione : 2.7k3
// Contenuto : Costanti per le note utente delle operazioni.
//
//
//
// Modifiche : 10.11.25 DS Creazione modulo.
//
//
//
//----------------------------------------------------------------------------
#pragma once
#include <string>
//----------------------------------------------------------------------------
// Generali
static const std::string UN_MAXELEV = "MaxElev" ;
static const std::string UN_TRIMEXT = "TrimExt" ;
static const std::string UN_OPEN = "Open" ;
static const std::string UN_LINTOL = "LinTol" ;
static const std::string UN_DOUBLE = "DOUBLE" ;
static const std::string UN_MIRRORAX = "MirrorAx" ;
static const std::string UN_DELTAZ = "DeltaZ" ;
static const std::string UN_VTAUXDIR = "VtAuxDir" ;
// Solo per Drilling
static const std::string UN_LASTSTEP = "LastStep" ;
// Solo per FiveAxisMilling
static const std::string UN_SINGCONEANG = "SingConeAng" ;
// Solo per GenMachining
static const std::string UN_VPL_COLON = "Vpl:" ;
// Solo per Milling
static const std::string UN_OUTRAW = "OutRaw" ;
static const std::string UN_SIDEELEV = "SideElev" ;
static const std::string UN_VTFACEUSE = "VtFaceUse" ;
static const std::string UN_EDGESFACEUSE = "EdgesFaceUse" ;
// Solo per Mortising
static const std::string UN_PLUNGE = "Plunge" ;
// Solo per Pocketing o PocketingNT
static const std::string UN_OPENOUTRAW = "OpenOutRaw" ;
static const std::string UN_OPENMINSAFE = "OpenMinSafe" ;
static const std::string UN_MAXOPTSIZE = "MaxOptSize" ;
static const std::string UN_PROJEXT = "ExtProj" ;
static const std::string UN_ADJUSTFEED = "AdjustFeed" ;
// Solo per Sawing
static const std::string UN_DOWNSE = "DownSE" ;
static const std::string UN_FSTA = "Fsta" ;
static const std::string UN_FEND = "Fend" ;
static const std::string UN_SWE = "SWE" ;
static const std::string UN_EWE = "EWE" ;
// Solo per SurfFinishing
static const std::string UN_SKIPMAXDOWN = "SkipMaxDown" ;
static const std::string UN_SPLITANGLE = "SplitAngle" ;
static const std::string UN_TYPE = "Type" ;
static const std::string UN_STEPNUMBER = "StepNumber" ;
static const std::string UN_BITANGANG = "BiTangAng" ;
static const std::string UN_OPTIMALTYPE = "OptimalType" ;
static const std::string UN_ANGLETOL = "AngleTol" ;
// Solo per SurfRoughing
static const std::string UN_PLANEZ = "PlaneZ" ;
static const std::string UN_ORDER = "Order" ;
static const std::string UN_SUPP_RAD_OFFS = "SuppRadOffs" ;
// Solo per Waterjetting
static const std::string UN_START = "START" ;
+1997 -829
View File
File diff suppressed because it is too large Load Diff
+102 -69
View File
@@ -1,14 +1,14 @@
//----------------------------------------------------------------------------
// EgalTech 2016-2019
// EgalTech 2016-2025
//----------------------------------------------------------------------------
// File : Operation.h Data : 17.06.19 Versione : 2.1f2
// File : Operation.h Data : 09.05.25 Versione : 2.7e2
// Contenuto : Dichiarazione della classe Operation da cui derivano
// Disposition e Machining.
//
//
//
// Modifiche : 29.04.16 DS Creazione modulo.
//
// 09.05.25 DS Generalizzazionee funzione IsEmpty con tipo (EMPTY_*).
//
//----------------------------------------------------------------------------
@@ -30,6 +30,8 @@ class ICurveComposite ;
//----------------------------------------------------------------------------
class Operation : public IUserObj
{
friend class Machine ;
public : // IUserObj
bool SetOwner( int nId, IGeomDB* pGDB) override ;
int GetOwner( void) const override ;
@@ -43,20 +45,25 @@ class Operation : public IUserObj
{ m_nPhase = nPhase ; return true ; }
virtual int GetPhase( void) const
{ return m_nPhase ; }
virtual bool RemoveHome( void) ;
virtual bool RemoveHome( bool bMain = true) ;
std::string GetName( void) const ;
public :
virtual int GetType( void) const = 0 ;
virtual bool IsEmpty( void) const = 0 ;
virtual bool IsEmpty( int nEmptyType = 0) const = 0 ;
virtual bool UpdateStatus( int nModif) = 0 ;
public :
bool GetInitialAxesValues( bool bSkipClimb, bool bMain, DBLVECTOR& vAxVal) const ;
bool GetFinalAxesValues( bool bSkipRise, bool bMain, DBLVECTOR& vAxVal) const ;
protected :
virtual const std::string& GetToolName( void) const = 0 ;
virtual const std::string& GetHeadName( void) const = 0 ;
virtual int GetExitNbr( void) const = 0 ;
virtual int GetSolCh( void) const = 0 ;
virtual const std::string& GetToolTcPos( void) const = 0 ;
virtual bool GetDoubleToolData( std::string& sDblTool, std::string& sDblTcPos, std::string& sDblHead, int& nDblExit) const = 0 ;
virtual bool NeedPrevHome( void) const = 0 ;
virtual bool AdjustEndPointForAxesCalc( const CamData* pCamData, Point3d& ptP) const
{ return true ; }
@@ -115,18 +122,13 @@ class Operation : public IUserObj
Operation( void) ;
protected :
struct Position {
int nSide ;
DBLVECTOR vAxis ;
int nFlag ;
int nFlag2 ;
int nMask ;
std::string sInfo ;
Position() : nSide( 0), nFlag( 0), nFlag2( 0), nMask( -1) {}
} ;
typedef std::vector<Position> POSVECTOR ;
protected :
bool IsAtLeastOnePathOk( void) const ;
bool AreAllPathsOk( void) const ;
bool GetToolpathsStatus( int& nCnt, int& nEmpty) const ;
int GetFirstFullToolpath( bool bMain = true) const ;
int GetNextFullToolpath( int nClPathId, bool bMain = true) const ;
int GetLastFullToolpath( bool bMain = true) const ;
int GetPrevFullToolpath( int nClPathId, bool bMain = true) const ;
bool UpdateFollowingOperationsStatus( int nModif) ;
bool GetElevation( int nPhase, const Point3d& ptP,
const Vector3d& vtDir, double& dElev) const ;
@@ -168,7 +170,7 @@ class Operation : public IUserObj
bool GetCurrRawsGlobBox( BBox3d& b3Raw) const ;
bool AdjustCurveFromSurf( ICurveComposite* pCrvCompo, int nToolDir, int nFaceUse, const Vector3d& vtFaceUse,
double dToolThick, int nGrade = 3) ;
const INTVECTOR& vnEdgesFaceUse, double dToolThick, int nGrade = 3) ;
bool ApproxWithArcsIfUseful( ICurveComposite* pCompo, bool bCareTempProp = false) const ;
bool ApproxWithLines( ICurveComposite* pCompo, bool bFeed = true) const ;
bool VerifyArcs( ICurveComposite* pCompo, double dMaxAngCen = MAX_ANG_CEN) const ;
@@ -176,52 +178,87 @@ class Operation : public IUserObj
bool CalcAndSetBBox( int nClId) ;
bool CalcAndSetAxesBBox( void) ;
bool CalcMirrorByDouble( int nClId, const std::string& sUserNotes) ;
std::string ExtractInfo( const std::string& sNotes, const std::string& sKey) const ;
std::string ExtractHint( const std::string& sNotes) const ;
bool SetBlockedRotAxis( const std::string& sBlockedAxis, bool bToolSetOk = false) const ;
bool CalculateAxesValues( const std::string& sHint, bool bSolChExact = false, double dSingConeAng = 0) ;
bool CalculateDoubleAxesValues( const std::string& sHint, bool bSolChExact = false, double dSingConeAng = 0) ;
bool AdjustStartEndMovements( bool bVerifyPreviousLink = true) ;
bool RemoveClimbRiseHome( bool bMain = true) ;
double GetDeltaSafeZ( const Vector3d& vtTool) const ;
bool TestCollisionAvoid( const DBLVECTOR& vAxStart, double dStartOffsX, const DBLVECTOR& vAxEnd, int* pnLKAMO = nullptr) const ;
bool GetAggrBottomData( const std::string& sHead, AggrBottom& agbData) const ;
bool IsAggrBottom( const std::string& sHead) const ;
bool GetInitialAxesValues( bool bSkipClimb, DBLVECTOR& vAxVal) const ;
private :
struct Position {
int nSide ;
DBLVECTOR vAxis ;
int nFlag ;
int nFlag2 ;
int nMask ;
std::string sInfo ;
Position() : nSide( 0), nFlag( 0), nFlag2( 0), nMask( -1) {}
} ;
typedef std::vector<Position> POSVECTOR ;
private :
bool GetClPathInitialAxesValues( int nClPathId, bool bSkipClimb, DBLVECTOR& vAxVal) const ;
bool GetFinalAxesValues( bool bSkipRise, DBLVECTOR& vAxVal) const ;
bool GetClPathFinalAxesValues( int nClPathId, bool bSkipRise, DBLVECTOR& vAxVal) const ;
bool GetInitialToolDir( bool bSkipClimb, Vector3d& vtTool) const ;
bool GetClPathInitialToolDir( int nClPathId, bool bSkipClimb, Vector3d& vtTool) const ;
bool GetFinalToolDir( bool bSkipRise, Vector3d& vtTool) const ;
bool GetClPathFinalToolDir( int nClPathId, bool bSkipRise, Vector3d& vtTool) const ;
const CamData* GetInitialCamData( bool bSkipClimb) const ;
const CamData* GetInitialCamData( bool bSkipClimb, bool bMain = true) const ;
const CamData* GetClPathInitialCamData( int nClPathId, bool bSkipClimb) const ;
const CamData* GetFinalCamData( bool bSkipRise) const ;
const CamData* GetFinalCamData( bool bSkipRise, bool bMain = true) const ;
const CamData* GetClPathFinalCamData( int nClPathId, bool bSkipRise) const ;
std::string ExtractInfo( const std::string& sNotes, const std::string& sKey) const ;
std::string ExtractHint( const std::string& sNotes) const ;
bool SetBlockedRotAxis( const std::string& sBlockedAxis) const ;
bool CalculateAxesValues( const std::string& sHint, bool bRotContOnNext = true, bool bSolChExact = false) ;
bool 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,
bool bMaxDeltaR2OnFirst, bool bRotContOnNext, double dAngDeltaMinForHome,
const DBLVECTOR& vAxRotHome, DBLVECTOR& vAxRotPrec, int& nOutStrC) ;
bool CalculateRotAxesValues( bool bFirst, const Vector3d& vtTool, const Vector3d& vtAux,
double dRot1W, bool bMaxDeltaR2OnFirst, bool bRotContOnNext, double dAngDeltaMinForHome,
const DBLVECTOR& vAxRotHome, const DBLVECTOR& vAxRotPrec, DBLVECTOR& vAxRot) ;
bool VerifyLineMidPoint( const Point3d& ptPrec, const Vector3d& vtDirPrec, const Vector3d& vtAuxPrec, const Vector3d& vtCorrPrec, const DBLVECTOR& vAxPrec,
const Point3d& ptP, const Vector3d& vtDir, const Vector3d& vtAux, const Vector3d& vtCorr, const DBLVECTOR& vAxVal,
int nCnt, int nEntId, double dRot1W, int nMoveType, bool& bAdded, bool& bAxError) ;
bool CalculateClPathRobotAxesValues( int nClPathId, int nLinAxes, int nRotAxes, double dRot1W,
bool bMaxDeltaR2OnFirst, bool bRotContOnNext, double dAngDeltaMinForHome,
const DBLVECTOR& vAxRotHome, DBLVECTOR& vAxRotPrec) ;
bool AdjustStartEndMovements( bool bVerifyPreviousLink = true) ;
bool ManageProtectedAreas( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, Operation* pPrevOp, Operation* pNextOp, bool& bClimbDone) ;
bool AdjustOneStartEndMovement( int nClPathId, int nPrevClPathId, Operation* pPrevOp, const DBLVECTOR& vAxPrev, bool bMaxZ) ;
bool ToolChangeNeeded( const Operation& Op1, const Operation& Op2) const ;
bool AddSpecialClimb( const DBLVECTOR& vAxVal, bool bOk = true, int nClPathId = GDB_ID_NULL,
int nFlag = 0, int nFlag2 = 0, int nMask = -1, const std::string& sInfo = "") ;
bool RemoveClimb( int nClPathId = GDB_ID_NULL) ;
bool AddRise( DBLVECTOR& vAxVal, double dDelta = NAN, int nClPathId = GDB_ID_NULL, int nToMinMaxZ = 0) ;
bool AddSpecialRise( const DBLVECTOR& vAxVal, bool bOk = true, int nClPathId = GDB_ID_NULL,
bool ApplyHintToPrevAxRot( const std::string& sHint, const Machine* pMch, DBLVECTOR& vAxRotPrec) ;
bool CalculateClPathMcentAxesValues( int nClPathId, double dAngDeltaMinForHome, const DBLVECTOR& vAxRotHome,
DBLVECTOR& vAxRotPrec) ;
bool EraseAddedPoints( int nClPathId) ;
bool MyCalculateClPathMcentAxesValues( int nClPathId, double dAngDeltaMinForHome, const DBLVECTOR& vAxRotHome,
DBLVECTOR& vAxRotPrec, bool bFirstTry, int& nOutStrC) ;
bool CalculateMcentRotAxesValues( bool bFirst, const Vector3d& vtTool, const Vector3d& vtAux,
double dAngDeltaMinForHome, const DBLVECTOR& vAxRotHome, const DBLVECTOR& vAxRotPrec,
DBLVECTOR& vAxRot) ;
bool VerifyMcentLineMidPoint( const Point3d& ptPrec, const Vector3d& vtDirPrec, const Vector3d& vtAuxPrec, const Vector3d& vtCorrPrec, const DBLVECTOR& vAxPrec,
const Point3d& ptP, const Vector3d& vtDir, const Vector3d& vtAux, const Vector3d& vtCorr, const DBLVECTOR& vAxVal,
int nCnt, int nEntId, int nMoveType, bool bToolShow, bool& bAdded, bool& bAxError) ;
bool CalculateClPathRobotAxesValues( int nClPathId, double dAngDeltaMinForHome, const DBLVECTOR& vAxRotHome,
DBLVECTOR& vAxRotPrec) ;
bool CalculateRobotAxesValues( bool bFirst, const Point3d& ptP, const Vector3d& vtTool, const Vector3d& vtAux,
double dAngDeltaMinForHome, const DBLVECTOR& vAxRotHome, const DBLVECTOR& vAxRotPrec,
DBLVECTOR& vAxRot) ;
bool VerifyRobotLineMidPoint( const Point3d& ptPrec, const Vector3d& vtDirPrec, const Vector3d& vtAuxPrec, const Vector3d& vtCorrPrec, const DBLVECTOR& vAxPrec,
const Point3d& ptP, const Vector3d& vtDir, const Vector3d& vtAux, const Vector3d& vtCorr, const DBLVECTOR& vAxVal,
int nCnt, int nEntId, int nMoveType, bool bToolShow, bool& bAdded, bool& bAxError) ;
bool GetAxisMidForTestCollisionAvoid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, int nAxisOrder, Machine* pMch,
DBLVECTOR& vAxMid) const ;
bool OneMoveTestCollisionAvoid( const STRVECTOR& vAxName, const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd,
Machine* pMch, const INTVECTOR& vRawId, const INTVECTOR& vFxtId) const ;
bool AdjustStartEndMovementsStd( bool bVerifyPreviousLink) ;
bool AdjustOneStartEndMovement( int nClPathId, int nPrevClPathId, Operation* pPrevOpe, const DBLVECTOR& vAxPrev, double dPrevOffsX, bool bMaxZ) ;
bool AdjustStartEndMovementsNew( void) ;
bool MoveHeadFromHomeToMach( bool bMain, const std::string& sToolName, const std::string& sHeadName, int nExitNbr, int nStartZMax) ;
bool MoveHeadFromMachToMach( Operation* pPrevOpe,
bool bPrevMain, const std::string& sPrevToolName, const std::string& sPrevHeadName, int nPrevExitNbr,
bool bCurrMain, const std::string& sCurrToolName, const std::string& sCurrHeadName, int nCurrExitNbr,
bool bToolChange, int nStartZMax) ;
bool MoveHeadFromMachToHome( Operation* pPrevOpe, bool bCurrMain, const std::string& sCurrToolName, const std::string& sCurrHeadName, int nCurrExitNbr,
int nStartZMax) ;
bool ManageDoubleOperNew( Operation* pPrevOpe) ;
bool ManageSpecialLink( Operation* pPrevOpe, int nPrevClPathId, bool bPrevMain, Operation* pNextOpe, int nNextClPathId, bool bNextMain,
int nStartZMax) ;
bool ToolChangeNeeded( const Operation& Ope1, bool bMain1, const Operation& Ope2, bool bMain2) const ;
bool AddSpecialClimb( const DBLVECTOR& vAxVal, bool bOk = true, int nClPathId = GDB_ID_NULL, bool bMain = true,
int nFlag = 0, int nFlag2 = 0, int nMask = -1, const std::string& sInfo = "", bool bFirst = true) ;
bool RemoveClimb( int nClPathId = GDB_ID_NULL, bool bMain = true) ;
bool AddRise( DBLVECTOR& vAxVal, double dDelta = NAN, int nClPathId = GDB_ID_NULL, bool bMain = true, int nToMinMaxZ = 0) ;
bool AddSpecialRise( const DBLVECTOR& vAxVal, bool bOk = true, int nClPathId = GDB_ID_NULL, bool bMain = true,
int nFlag = 0, int nFlag2 = 0, int nMask = -1, const std::string& sInfo = "") ;
bool RemoveRise( int nClPathId = GDB_ID_NULL) ;
bool AddHome( void) ;
bool RemoveClimbRiseHome( void) ;
bool RemoveRise( int nClPathId = GDB_ID_NULL, bool bMain = true) ;
bool AddHome( bool bMain = true) ;
bool AddRobotClimb( int nEntId, double dDeltaZ = NAN) ;
bool CalcRobotAxesAbovePos( const Point3d& ptP, const Vector3d& vtT, const Vector3d& vtA, double dDeltaZ,
DBLVECTOR& vAx, double* pdNewDeltaZ = nullptr) const ;
@@ -235,22 +272,14 @@ class Operation : public IUserObj
bool GetRotationAtZmax( void) const ;
bool ForcedZmax( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, const BBox3d& b3Raws) const ;
int GetUserNotesZmax( void) const ;
double GetDeltaSafeZ( const Vector3d& vtTool) const ;
bool GetZHomeDown( void) const ;
bool TestCollisionAvoid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd) const ;
int SpecialTestCollisionAvoid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd) const ;
bool SpecialMoveZup( DBLVECTOR& vAx, Vector3d& vtTool, int& nFlag, int& nFlag2, bool& bModif) ;
bool SpecialMoveRapid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, int nOutstroke, int nLinkType,
POSVECTOR& vNewPos) ;
bool GetAggrBottomData( const std::string& sHead, AggrBottom& agbData) const ;
bool IsAggrBottom( const std::string& sHead) const ;
private :
bool GetAxisMidForTestCollisionAvoid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, int nAxisOrder, Machine* pMch,
DBLVECTOR& vAxMid) const ;
bool OneMoveTestCollisionAvoid( const STRVECTOR& vAxName, const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd,
Machine* pMch, const INTVECTOR& vRawId, const INTVECTOR& vFxtId) const ;
bool SpecialMoveRapid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, DBLVECTOR& vAxNew, bool& bModif) ;
bool SpecialLink( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, int nLinkType,
const Operation* pPrevOpe, bool bPrevMain, const Operation* pNextOpe, bool bNextMain,
int nStartZMax) ;
bool SpecialPrevMachiningOffset( const Operation* pPrevOpe, double& dOffsetX) ;
protected :
int m_nOwnerId ; // identificativo dell'oggetto geometrico possessore
@@ -323,11 +352,15 @@ inline Operation* GetOperation( IUserObj* pUserObj)
{ return dynamic_cast< Operation*>( pUserObj) ; }
//----------------------------------------------------------------------------
// Tipo di controllo per lavorazione vuota
enum { NEED_GEOM = 0, NEED_ONE_TP_OK = 1, NEED_ALL_TP_OK = 2} ;
// tipo posizione utensile
enum { TOOL_PARAL = 1, TOOL_ORTHO = 2, TOOL_ORTUP = 3, TOOL_PAR_SLANT= 4} ;
// tipo di utilizzo contorno faccia
enum { FACE_DOWN = 1, FACE_TOP = 2, FACE_FRONT = 3, FACE_BACK = 4, FACE_LEFT = 5, FACE_RIGHT = 6, FACE_CONT = 7, FACE_VERSOR = 8} ;
enum { FACE_DOWN = 1, FACE_TOP = 2, FACE_FRONT = 3, FACE_BACK = 4, FACE_LEFT = 5, FACE_RIGHT = 6,
FACE_CONT = 7, FACE_VERSOR = 8, FACE_EDGES = 9} ;
// risultato di SpecialTestCollisionAvoid
enum { SCAV_ERROR = -1, SCAV_COLLIDE = 0, SCAV_AVOID = 1, SCAV_TOTEST = 2} ;
// ordine di movimento assi nei link
enum { LKAO_INTERP = 0, LKAO_HEAD_BEFORE = -1, LKAO_HEAD_AFTER = +1, LKAO_HEAD_BOTH = 11} ;
enum { LKAMO_INTERP = 0, LKAMO_HEAD_BEFORE = -1, LKAMO_HEAD_AFTER = +1,
LKAMO_HEAD_BEFORE_IF_SAME_ANG = -2, LKAMO_HEAD_AFTER_IF_SAME_ANG = +2} ;
+1 -1
View File
@@ -323,7 +323,7 @@ Operation::AddLinearMove( const Point3d& ptP, bool bSplit)
return GDB_ID_NULL ;
double dLen = Dist( ptS, ptP) ;
double dStep = GetMaxSplitLen( true, true) ;
int nStep = int( dLen / dStep + 0.999) ;
int nStep = int( ceil( ( dLen - EPS_ZERO) / dStep)) ;
int nFirstId = GDB_ID_NULL ;
for ( int i = 1 ; i <= nStep ; ++ i) {
int nId = AddLinearMove( Media( ptS, ptP, i * 1.0 / nStep)) ;
+5 -3
View File
@@ -18,8 +18,6 @@
#include "/EgtDev/Include/EMkOperationConst.h"
#include <string>
#define POCKETING_NT 0
//----------------------------------------------------------------------------
static const std::string s_OpeClass[] = {"",
"EMkDisposition",
@@ -35,7 +33,8 @@ static const std::string s_OpeClass[] = {"",
"EMkSurfRoughing",
"EMkSurfFinishing",
"EMkWaterJetting",
"EMkFiveAxisMilling"} ;
"EMkFiveAxisMilling",
"EMkProbing"} ;
//----------------------------------------------------------------------------
// Dal tipo numerico restituisce la classe della operazione
@@ -57,6 +56,7 @@ GetOperationClass( int nOpeType)
case OPER_SURFFINISHING : return s_OpeClass[12] ;
case OPER_WATERJETTING : return s_OpeClass[13] ;
case OPER_FIVEAXISMILLING : return s_OpeClass[14] ;
case OPER_PROBING : return s_OpeClass[15] ;
}
return s_OpeClass[0] ;
}
@@ -94,6 +94,8 @@ GetOperationType( const std::string& sOpeClass)
return OPER_WATERJETTING ;
else if ( sOpeClass == s_OpeClass[14])
return OPER_FIVEAXISMILLING ;
else if ( sOpeClass == s_OpeClass[15])
return OPER_PROBING ;
else
return OPER_NULL ;
}
+2
View File
@@ -88,6 +88,7 @@ static const std::string GVAR_MAXMIN = ".MAXMIN" ; // (double/s) minimo di
static const std::string GVAR_MAXMAX = ".MAXMAX" ; // (double/s) massimo di ingombro degli assi della lavorazione
static const std::string GVAR_PATHID = ".PATHID" ; // (int) identificativo percorso di lavorazione
static const std::string GVAR_PATHIND = ".PATHIND" ; // (int) indice percorso di lavorazione
static const std::string GVAR_DBLPATHID = ".DBLPATHID" ; // (int) identificativo eventuale percorso di lavorazione in doppio
static const std::string GVAR_START = ".START" ; // (Point3d) punto iniziale del percorso originale
static const std::string GVAR_END = ".END" ; // (Point3d) punto finale del percorso originale
static const std::string GVAR_EXTR = ".EXTR" ; // (Vector3d) versore estrusione
@@ -191,6 +192,7 @@ static const std::string GVAR_SIMUISTAT = ".SIMUISTAT" ; // (num) stato sim
static const std::string GVAR_SAFEDIST = ".SAFEDIST" ; // (num) distanza di sicurezza per verifica di collisione
static const std::string GVAR_SIMVMID = ".SIMVMID" ; // (int) identificativo grezzo Vmill in collisione
static const std::string GVAR_SIMCOBIND = ".SIMCOBIND" ; // (int) indice oggetto in collisione
static const std::string GVAR_TOOLTRACE = ".TOOLTRACE" ; // (int) identificativo gruppo di tracciatura utensile
static const std::string GVAR_MPSIM = ".MPSIM" ; // (bool) flag simulazione multiprocesso
static const std::string GVAR_MPSEST = ".MPSEST" ; // (string) path del file di stima speciale per simulazione multiprocesso
static const std::string GVAR_RECORD = ".RECORD" ; // (bool) flag modalità registrazione comandi in simulazione
+114 -50
View File
@@ -18,6 +18,7 @@
#include "DllMain.h"
#include "Pocketing.h"
#include "OperationConst.h"
#include "OperUserNotesConst.h"
#include "MachiningConst.h"
#include "GeoConst.h"
#include "/EgtDev/Include/EGkCurveLine.h"
@@ -43,6 +44,10 @@
using namespace std ;
//------------------------------ Constants ------------------------------------
static int LINK_CURVE_PROP = -3 ;
static string KEY_OPEN = "OPEN" ;
//------------------------------ Errors --------------------------------------
// 2401 = "Error in Pocketing : UpdateToolData failed"
// 2402 = "Error in Pocketing : Open Contour"
@@ -75,23 +80,17 @@ using namespace std ;
// 2430 = "Error in Pocketing : adjust open edges failed"
// 2431 = "Error in Pocketing : LeadIn with Mill NoTip in material"
// 2432 = "Error in Pocketing : Mirror for Double calculation failed"
// 2433 = "Error in Pocketing : special apply not calculable"
// 2451 = "Warning in Pocketing : Skipped entity (xx)"
// 2452 = "Warning in Pocketing : No machinable pocket"
// 2453 = "Warning in Pocketing : Tool name changed (xx)"
// 2454 = "Warning in Pocketing : Tool data changed (xx)"
// 2455 = "Warning in Pocketing : skipped Path too short"
// 2456 = "Warning in Pocketing : machining step too small (xx)"
// 2457 = "Warning in Pocketing : machining step (xxx) bigger than MaxMaterial (yyy)"
// 2458 = "Warning in Pocketing : machining depth (xxx) bigger than MaxMaterial (yyy)"
//----------------------------------------------------------------------------
static string KEY_OPEN = "OPEN" ;
static int LINK_CURVE_PROP = -3 ;
//----------------------------------------------------------------------------
#if POCKETING_NT != 1
USEROBJ_REGISTER( GetOperationClass( OPER_POCKETING), Pocketing) ;
#endif
// USEROBJ_REGISTER( GetOperationClass( OPER_POCKETING), Pocketing) ;
//----------------------------------------------------------------------------
const string&
@@ -506,7 +505,8 @@ Pocketing::SetGeometry( const SELVECTOR& vIds)
// verifico validità gestore DB geometrico
if ( m_pGeomDB == nullptr)
return false ;
// reset della geometria corrente
// copia temporanea e reset della geometria corrente
SELVECTOR vOldId = m_vId ;
m_vId.clear() ;
// verifico che gli identificativi rappresentino delle entità ammissibili (tutte curve o tutte facce)
int nType = GEO_NONE ;
@@ -522,7 +522,8 @@ Pocketing::SetGeometry( const SELVECTOR& vIds)
m_vId.emplace_back( Id) ;
}
// aggiorno lo stato
m_nStatus |= MCH_ST_GEO_MODIF ;
if ( m_vId != vOldId)
m_nStatus |= MCH_ST_GEO_MODIF ;
// restituisco presenza geometria da lavorare
return ( ! m_vId.empty() || vIds.empty()) ;
}
@@ -622,15 +623,17 @@ Pocketing::Apply( bool bRecalc, bool bPostApply)
return false ;
// aggiorno dati geometrici dell'utensile
bool bToolChanged = true ;
if ( ! UpdateToolData( &bToolChanged)) {
if ( ! UpdateToolData()) {
m_pMchMgr->SetLastError( 2401, "Error in Pocketing : UpdateToolData failed") ;
return false ;
}
// se modificata geometria, necessario ricalcolo
if ( ( m_nStatus & MCH_ST_GEO_MODIF) != 0)
bRecalc = true ;
// verifico se necessario continuare nell'aggiornamento
if ( ! bRecalc && ! bToolChanged &&
( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) {
if ( ! bRecalc && ( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) {
// confermo i percorsi di lavorazione
m_nPockets = nCurrPockets ;
string sLog = string( "Pocketing apply skipped : status ") + ( m_nStatus == MCH_ST_OK ? "already ok" : "no postapply") ;
@@ -717,15 +720,15 @@ Pocketing::Apply( bool bRecalc, bool bPostApply)
// assegno ingombri dei vari percorsi di lavorazione e della lavorazione nel suo complesso
CalcAndSetBBox( nClId) ;
// eseguo aggiornamento assi macchina e collegamento con operazione precedente
if ( ! Update( bPostApply))
return false ;
// se lavorazione in doppio, aggiungo geometria della parte simmetrica
if ( ! CalcMirrorByDouble( nClId, m_Params.m_sUserNotes)) {
m_pMchMgr->SetLastError( 2432, "Error in Pocketing : Mirror for Double calculation failed") ;
return false ;
}
// eseguo aggiornamento assi macchina e collegamento con operazione precedente
if ( ! Update( bPostApply))
return false ;
// aggiorno stato della lavorazione
m_nStatus = ( bPostApply ? MCH_ST_OK : MCH_ST_NO_POSTAPPL) ;
@@ -770,6 +773,47 @@ Pocketing::Update( bool bPostApply)
return false ;
}
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
CalcAndSetAxesBBox() ;
// se lavorazione in doppio, calcolo assi e movimenti di approccio e retrazione relativi
if ( GetDoubleType( m_Params.m_sUserNotes) != 0) {
// elimino le entità CLIMB, RISE e HOME della lavorazione in doppio
RemoveClimbRiseHome( false) ;
// recupero i dati della testa in doppio e la imposto
string sDblTool ; string sDblTcPos ; string sDblHead ; int nDblExit ;
bool bOk = GetDoubleToolData( sDblTool, sDblTcPos, sDblHead, nDblExit) &&
m_pMchMgr->SetCalcTool( sDblTool, sDblHead, nDblExit) ;
// imposto eventuale asse bloccato da lavorazione
SetBlockedRotAxis( m_Params.m_sBlockedAxis, true) ;
// eseguo il calcolo
if ( bOk) {
if ( ! CalculateDoubleAxesValues( sHint)) {
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
if ( sInfo.empty())
m_pMchMgr->SetLastError( 2423, "Error in Pocketing : axes values not calculable for double") ;
else
m_pMchMgr->SetLastError( 2424, "Error in Pocketing : double outstroke ") ;
bOk = false ;
}
}
// ripristino testa principale
m_pMchMgr->SetCalcTool( GetToolName(), GetHeadName(), GetExitNbr()) ;
// in caso di errore, esco
if ( ! bOk)
return false ;
}
// esecuzione eventuali personalizzazioni speciali
string sSpecErr ;
if ( bPostApply && ! SpecialApply( sSpecErr)) {
if ( ! IsEmptyOrSpaces( sSpecErr))
m_pMchMgr->SetLastError( 2433, sSpecErr) ;
else
m_pMchMgr->SetLastError( 2433, "Error in Pocketing : special apply not calculable") ;
return false ;
}
// gestione movimenti all'inizio di ogni singolo percorso di lavorazione e alla fine della lavorazione
if ( ! AdjustStartEndMovements()) {
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
@@ -780,14 +824,11 @@ Pocketing::Update( bool bPostApply)
return false ;
}
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
CalcAndSetAxesBBox() ;
// esecuzione eventuali personalizzazioni
string sErr ;
if ( bPostApply && ! PostApply( sErr)) {
if ( ! IsEmptyOrSpaces( sErr))
m_pMchMgr->SetLastError( 2427, sErr) ;
// esecuzione eventuali personalizzazioni finali
string sPostErr ;
if ( bPostApply && ! PostApply( sPostErr)) {
if ( ! IsEmptyOrSpaces( sPostErr))
m_pMchMgr->SetLastError( 2427, sPostErr) ;
else
m_pMchMgr->SetLastError( 2427, "Error in Pocketing : post apply not calculable") ;
return false ;
@@ -941,7 +982,7 @@ Pocketing::GetToolData( void) const
//----------------------------------------------------------------------------
bool
Pocketing::UpdateToolData( bool* pbChanged)
Pocketing::UpdateToolData( void)
{
// recupero il gestore DB utensili della macchina corrente
ToolsMgr* pTMgr = m_pMchMgr->GetCurrToolsMgr() ;
@@ -992,9 +1033,9 @@ Pocketing::UpdateToolData( bool* pbChanged)
m_Params.m_sToolName + ")" ;
m_pMchMgr->SetWarning( 2454, sInfo) ;
}
// se definito parametro di ritorno, lo assegno
if ( pbChanged != nullptr)
*pbChanged = bChanged ;
// se modificato, aggiusto lo stato
if ( bChanged)
m_nStatus = MCH_ST_TO_VERIFY ;
return true ;
}
@@ -1229,7 +1270,7 @@ Pocketing::GetCurves( SelData Id, ICURVEPLIST& lstPC)
// la porto in globale
pCrvCompo->ToGlob( frGlob) ;
// sistemazioni varie
AdjustCurveFromSurf( pCrvCompo, TOOL_ORTHO, FACE_CONT, V_NULL, 0) ;
AdjustCurveFromSurf( pCrvCompo, TOOL_ORTHO, FACE_CONT, V_NULL, {}, 0) ;
// la restituisco
lstPC.emplace_back( Release( pCrvCompo)) ;
return true ;
@@ -1267,7 +1308,7 @@ Pocketing::GetCurves( SelData Id, ICURVEPLIST& lstPC)
// la porto in globale
pCrvCompo->ToGlob( frGlob) ;
// sistemazioni varie
AdjustCurveFromSurf( pCrvCompo, TOOL_ORTHO, FACE_CONT, V_NULL, 0) ;
AdjustCurveFromSurf( pCrvCompo, TOOL_ORTHO, FACE_CONT, V_NULL, {}, 0) ;
// la restituisco
lstPC.emplace_back( Release( pCrvCompo)) ;
}
@@ -1549,7 +1590,7 @@ Pocketing::ProcessPath( int nPathId, int nPvId, int nClId)
// sposto l'inizio a metà del tratto più lungo ( o aperto più lungo)
if ( bMidOpen) {
const double LEN_OUT = 5 ;
const double LEN_OUT = 5. + ( m_TParams.m_dDiam / 2.) ;
double dPar ; int nFlag ;
bMidOpen = ( DistPointCurve( ptMidOpen + LEN_OUT * vtMidOut, *pCompo).GetParamAtMinDistPoint( 0, dPar, nFlag) && pCompo->ChangeStartPoint( dPar)) ;
}
@@ -1608,7 +1649,7 @@ Pocketing::ProcessPath( int nPathId, int nPvId, int nClId)
return false ;
// eventuale imposizione massima elevazione da note utente
double dMaxElev ;
if ( GetValInNotes( m_Params.m_sUserNotes, "MaxElev", dMaxElev) && dElev > dMaxElev)
if ( GetValInNotes( m_Params.m_sUserNotes, UN_MAXELEV, dMaxElev) && dElev > dMaxElev)
dElev = dMaxElev ;
// verifico che lo step dell'utensile sia sensato
@@ -1679,11 +1720,11 @@ Pocketing::ProcessPath( int nPathId, int nPvId, int nClId)
// recupero eventuale flag di lato aperto forzato fuori dal grezzo
int nOpenOutRaw ;
m_bOpenOutRaw = ( GetValInNotes( m_Params.m_sUserNotes, "OpenOutRaw", nOpenOutRaw) && nOpenOutRaw != 0) ;
m_bOpenOutRaw = ( GetValInNotes( m_Params.m_sUserNotes, UN_OPENOUTRAW, nOpenOutRaw) && nOpenOutRaw != 0) ;
// recupero eventuale minima lunghezza di attacco su lato aperto
m_dOpenMinSafe = 0 ;
GetValInNotes( m_Params.m_sUserNotes, "OpenMinSafe", m_dOpenMinSafe) ;
GetValInNotes( m_Params.m_sUserNotes, UN_OPENMINSAFE, m_dOpenMinSafe) ;
// se richiesta anteprima
if ( nPvId != GDB_ID_NULL) {
@@ -2609,7 +2650,7 @@ Pocketing::OptimizedZigZag( int nPathId, const Vector3d& vtTool, double dDepth,
// recupero gli id dei lati chiusi
INTVECTOR vnInfoClosed ;
for( int i = 0 ; i < pCrvPocket->GetCurveCount() ; i ++) {
for ( int i = 0 ; i < pCrvPocket->GetCurveCount() ; i ++) {
int nProp ;
if ( pCrvPocket->GetCurveTempProp( i, nProp) && nProp == 0)
vnInfoClosed.push_back( i) ;
@@ -3459,7 +3500,7 @@ Pocketing::AddSpiralIn( const ICurveComposite* pCompo, const Vector3d& vtTool, c
int nMaxInd = pMCrv->GetCurveCount() - 1 ;
int nMaxRInd = pRCrv->GetCurveCount() - 1 ;
// ciclo sugli step
Point3d ptP1 ;
for ( int j = 1 ; j <= nStep ; ++ j) {
@@ -3505,8 +3546,15 @@ Pocketing::AddSpiralIn( const ICurveComposite* pCompo, const Vector3d& vtTool, c
if ( GetLeadInType() == POCKET_LI_ZIGZAG ||
GetLeadInType() == POCKET_LI_HELIX ||
GetLeadInType() == POCKET_LI_GLIDE) {
ptP1 += vtExtr * ( dStElev + LIO_ELEV_TOL) ;
dStElev = -LIO_ELEV_TOL ;
// se lucidatura forzo il valore al parametro di elevazione in ingresso
if ( m_TParams.m_nType == TT_MILL_POLISHING) {
ptP1 += vtExtr * max( m_Params.m_dLiElev, dStElev + LIO_ELEV_TOL) ;
dStElev = 0 ;
}
else {
ptP1 += vtExtr * ( dStElev + LIO_ELEV_TOL) ;
dStElev = -LIO_ELEV_TOL ;
}
}
// approccio al punto iniziale
if ( ! AddApproach( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dStElev, dAppr, bSplitArcs, bOutStart || bForcedOutStart)) {
@@ -3881,7 +3929,7 @@ Pocketing::CalcSpiral( const ICurveComposite* pCompo, int nReg, bool bSplitArcs,
Vector3d vtOrtho = OrthoCompo( vtOtherDir, vtDir) ;
double dPocketSize = vtOrtho.Len() ;
double dMaxOptSize = m_Params.m_dSideStep ;
GetValInNotes( m_Params.m_sUserNotes, "MaxOptSize", dMaxOptSize) ;
GetValInNotes( m_Params.m_sUserNotes, UN_MAXOPTSIZE, dMaxOptSize) ;
if ( ( ( bSomeOpen && dPocketSize < m_TParams.m_dDiam + EPS_SMALL) || abs( dPocketSize - m_TParams.m_dDiam) < EPS_SMALL) &&
dPocketSize < dMaxOptSize + 10 * EPS_SMALL) {
if ( nReg == 0) {
@@ -5117,6 +5165,14 @@ Pocketing::AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafe
SetFlag( 0) ;
}
}
// altrimenti
else {
// se impostato come parametro di lavorazione nelle UserNotes
Vector3d vtAux ;
if ( GetValInNotes( m_Params.m_sUserNotes, UN_VTAUXDIR, vtAux))
vtAux.Normalize() ;
SetAuxDir( vtAux) ;
}
// se sopra attacco c'è spazio per sicurezza o approccio
double dSafeDist = ( m_bAggrBottom ? dSafeAggrBottZ : dSafeZ) ;
if ( ! bBottomOutStart && dElev + max( dSafeDist, dAppr) > 10 * EPS_SMALL) {
@@ -5145,7 +5201,7 @@ Pocketing::AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafe
SetFlag( 0) ;
bool bStartFeed = ( bOutStart || m_TParams.m_nType == TT_MILL_NOTIP) ;
SetFeed( bStartFeed ? GetStartFeed() : GetTipFeed()) ;
if ( ! AreSamePointApprox( ptP1, ptP) && AddLinearMove( ptP, bSplitArcs) == GDB_ID_NULL)
if ( ! AreSamePointApprox( ptP1, ptP) && AddLinearMove( ptP, bSplitArcs, MCH_CL_SAFEIN) == GDB_ID_NULL)
return false ;
}
else {
@@ -5223,7 +5279,7 @@ Pocketing::AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ
// 4 -> movimento di risalita sopra il punto finale
SetFeed( GetEndFeed()) ;
Point3d ptP4 = ptP + vtTool * ( dElev + dAppr) ;
if ( AddLinearMove( ptP4, bSplitArcs) == GDB_ID_NULL)
if ( AddLinearMove( ptP4, bSplitArcs, MCH_CL_SAFEOUT) == GDB_ID_NULL)
return false ;
}
else {
@@ -5231,7 +5287,7 @@ Pocketing::AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ
Point3d ptP4a = ptP + vtTool * ( dElev + dAppr) ;
if ( dElev + dAppr > EPS_SMALL) {
SetFeed( GetEndFeed()) ;
if ( AddLinearMove( ptP4a, bSplitArcs) == GDB_ID_NULL)
if ( AddLinearMove( ptP4a, bSplitArcs, MCH_CL_SAFEOUT) == GDB_ID_NULL)
return false ;
}
// 4b -> movimento di risalita sopra il punto finale
@@ -5466,8 +5522,19 @@ Pocketing::AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector
Vector3d vtMove = ptEnd - ptIni ;
pCrv->Translate( vtMove) ;
Point3d ptFin ; pCrv->GetEndPoint( ptFin) ;
ptFin += vtN * 1.0 ;
pCrv->ModifyEnd( ptFin) ;
// se lucidatura forzo la stessa quota dell'ingresso
if ( m_TParams.m_nType == TT_MILL_POLISHING) {
double dExtraElev = max( m_Params.m_dLiElev, 1.0) ;
double dNini = ( ptEnd - ORIG) * vtN ;
double dNfin = dNini + dExtraElev ;
ptFin += vtN * dExtraElev ;
// distribuisco l'elevazione extra uniformemente su tutta la curva
AdjustCurveSlope( pCrv, dNini, dNfin) ;
}
else {
ptFin += vtN * 1.0 ;
pCrv->ModifyEnd( ptFin) ;
}
// emetto (con eventuale spezzatura)
AddCurveMove( pCrv, bSplitArcs, MCH_CL_LEADOUT) ;
// determino elevazione su fine uscita
@@ -5507,10 +5574,7 @@ bool
Pocketing::GetForcedClosed( void)
{
int nOpen ;
if ( GetValInNotes( m_Params.m_sUserNotes, "Open", nOpen) && nOpen == 0)
return true ;
else
return false ;
return ( GetValInNotes( m_Params.m_sUserNotes, UN_OPEN, nOpen) && nOpen == 0) ;
}
//----------------------------------------------------------------------------
+9 -3
View File
@@ -35,8 +35,14 @@ class Pocketing : public Machining
public : // Operation
int GetType( void) const override
{ return OPER_POCKETING ; }
bool IsEmpty( void) const override
{ return ( m_nPockets == 0) ; }
bool IsEmpty( int nEmptyType = NEED_GEOM) const override
{ if ( m_nPockets == 0)
return true ;
if ( nEmptyType == NEED_ONE_TP_OK)
return ( ! IsAtLeastOnePathOk()) ;
if ( nEmptyType == NEED_ALL_TP_OK)
return ( ! AreAllPathsOk()) ;
return false ; }
bool UpdateStatus( int nModif) override
{ m_nStatus |= nModif ; return true ; }
@@ -58,7 +64,7 @@ class Pocketing : public Machining
bool GetParam( int nType, int& nVal) const override ;
bool GetParam( int nType, double& dVal) const override ;
bool GetParam( int nType, std::string& sVal) const override ;
bool UpdateToolData( bool* pbChanged = nullptr) override ;
bool UpdateToolData( void) override ;
const ToolData& GetToolData( void) const override ;
bool GetGeometry( SELVECTOR& vIds) const override ;
+2847 -841
View File
File diff suppressed because it is too large Load Diff
+76 -38
View File
@@ -25,11 +25,15 @@
// struttura informazioni sui singoli percorsi
struct PathInfoPO {
bool bOutStart ; // flag per entrata da fuori
bool bOutEnd ; // flag per uscita da fuori
bool bSingleCrv ; // se percorso formato da una curva singola ( in generale per SubSteps)
bool bOptTrap ; // flag per casi ottimizzati a trapezio ( per Spiral)
bool bOptCirle ; // flag per casi ottimizzati a Spirale ( per Spiral)
bool bIsZigZagOneWayBorder ; // curve di bordo dei lati chiusi ( per ZigZag e OneWay)
PtrOwner<ICurveComposite> pCrvPath ; // percorso del centro utensile
PtrOwner<ICurveComposite> pCrvRet ; // curva di ritorno per LeadIn/Out a guida
PtrOwner<ICurveComposite> pCrvGlideIn ; // curva per LeadIn a guida
PtrOwner<ICurveComposite> pCrvGlideOut ; // curva per LeadOut a guida
PtrOwner<ICurveComposite> pCrvRet ; // curva di ritorno ( per ora solo caso fori)
} ;
// tipo percorso
typedef std::vector<PathInfoPO> PATHINFOPOVECTOR ;
@@ -60,8 +64,14 @@ class PocketingNT : public Machining
public : // Operation
int GetType( void) const override
{ return OPER_POCKETING ; }
bool IsEmpty( void) const override
{ return ( m_nPockets == 0) ; }
bool IsEmpty( int nEmptyType = NEED_GEOM) const override
{ if ( m_nPockets == 0)
return true ;
if ( nEmptyType == NEED_ONE_TP_OK)
return ( ! IsAtLeastOnePathOk()) ;
if ( nEmptyType == NEED_ALL_TP_OK)
return ( ! AreAllPathsOk()) ;
return false ; }
bool UpdateStatus( int nModif) override
{ m_nStatus |= nModif ; return true ; }
@@ -83,7 +93,7 @@ class PocketingNT : public Machining
bool GetParam( int nType, int& nVal) const override ;
bool GetParam( int nType, double& dVal) const override ;
bool GetParam( int nType, std::string& sVal) const override ;
bool UpdateToolData( bool* pbChanged = nullptr) override ;
bool UpdateToolData( void) override ;
const ToolData& GetToolData( void) const override ;
bool GetGeometry( SELVECTOR& vIds) const override ;
@@ -91,23 +101,39 @@ class PocketingNT : public Machining
PocketingNT( void) ;
private :
bool MyApply( bool bRecalc, bool bPostApply) ;
bool VerifyGeometry( SelData Id, int& nSubs, int& nType) ;
bool GetCurves( SelData Id, ICURVEPLIST& lstPC) ;
bool AdjustCurvesByStmTopology( const ISurfTriMesh* pSurf, const Frame3d& frGlob, const ISurfTriMesh* pStmTrim, ICURVEPLIST& lstPC) ;
bool GetCurves( const SelData& Id, const ISurfTriMesh* pStmRaw, const ISurfTriMesh* pStmTrim, ICURVEPLIST& lstPC) ;
bool SetCurveAllTempProp( int nCrvId, bool bForcedClose, ICurve* pCurve, bool* pbSomeOpen = nullptr) ;
bool SetSfrLoopsAllTempProp( int nSfrId, ISurfFlatRegion* pSfr) ;
bool ResetCurveAllTempProp( ICurve* pCurve) ;
bool Chain( int nGrpDestId) ;
ISurfTriMesh* GetRaw( void) ;
ISurfTriMesh* GetExtrusionStm( const ISurfFlatRegion* pSfr, const Vector3d& vtTrasl, const Vector3d& vtExtr) ;
ISurfTriMesh* GetStmTrim( void) ;
ISurfTriMesh* GetExtrusionStm( const ISurfFlatRegion* pSfr, const Vector3d& vtExtr) ;
ISurfFlatRegion* GetSfrByStmIntersection( const IntersParPlanesSurfTm& IPPStm, double dDist, double dSmallOffs = 0) ;
ISurfFlatRegion* GetSfrRawProjection( const ISurfTriMesh* pStmRaw, const ISurfFlatRegion* pSfr, const Vector3d& vtTool) ;
Point3d GetStartPointsByHead( const STEPINFOPOVECTOR& vStepInfo) const ;
Point3d GetStartPointsFromSteps( const STEPINFOPOVECTOR& vStepInfo, int nCrvType) const ;
bool ChooseRawPart( const ISurfFlatRegion* pSfrChunk, ISurfTriMesh* pStm) const ;
bool ManageOpenEdges( ISurfFlatRegion* pSfr, const ISurfTriMesh* pStmPart) ;
bool GetHomogeneousParts( const ICurveComposite* pCrvCompo, ICRVCOMPOPOVECTOR& vpCrvs) const ;
bool ExtendOpenEdges( ISurfFlatRegion* pSfr, const ISurfTriMesh* pStm) ;
bool ChooseCloseOrOpenEdge( ISurfFlatRegion* pSfr, const ISurfTriMesh* pStmExtrusion) ;
bool CalcLimitRegion( const ISurfFlatRegion* pSfrPock, const ISurfFlatRegion* pSfrRaw, ISurfFlatRegion* pSfrLimit) ;
bool CheckMaxDepth( const ISurfFlatRegion* pSfr, double dDepth, const Vector3d& vtTool,
const ISurfTriMesh* pStmRaw, const ISurfTriMesh* pStmExtrusion,
const IntersParPlanesSurfTm& IPPStm, bool& bSkipMaxDepth) ;
bool ProcessPath( int nPathId, int nPvId, int nClId) ;
bool CalcRegionElevation( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dRad, double dLen, double& dElev) ;
bool CalcRegionElevation( const ISurfFlatRegion* pSfr, const Vector3d& vtTool, double dDepth,
double dRad, double dLen, double& dElev) ;
bool VerifyPathFromBottom( const ICurveComposite* pCompo, const Vector3d& vtTool) ;
bool GeneratePocketingPv( int nPathId, const ICurveComposite* pCompo) ;
bool CalcLimitRegion( const ISurfFlatRegion* pSfrPock, const ISurfFlatRegion* pSfrRaw, ISurfFlatRegion* pSfrLimit) ;
bool CalcPaths( STEPINFOPOVECTOR& vStepInfo) ;
bool AddPocket( STEPINFOPOVECTOR& vStepInfo, const Vector3d& vtTool, double dElev, double dStep, bool bSplitArcs) ;
bool CalcRetCurve( PathInfoPO& PathInfo, const StepInfoPO& StepInfo, const ICurveComposite* pCrvPath,
const Vector3d& vtTool, bool bHolePocketing, bool bInVsOut, ICurveComposite* pCrvGlide) ;
bool AddPocket( STEPINFOPOVECTOR& vStepInfo, const Vector3d& vtTool, double dStep, bool bSplitArcs, Point3d& ptPockStart, Point3d& ptPockEnd) ;
double GetRightFeed( const Vector3d& vtMove, const Vector3d& vtTool) ;
bool CutCurveWithLine( ICurveComposite* pCrvA, const ICurveLine* pCrvB) ;
bool ComputePolishingPath( ICurveComposite* pMCrv, ICurveComposite* pRCrv, bool bSplitArcs) ;
@@ -122,25 +148,36 @@ class PocketingNT : public Machining
double dElev, double dAppr, bool bSplitArcs) ;
bool AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
double dElev, double dAppr, bool bSplitArcs) ;
bool CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtTool, const ICurveComposite* pCrvPath, Point3d& ptP1) ;
bool CalcFirstElevation( const Point3d& ptStart, const Point3d& ptP1, const Vector3d& vtTool,
const StepInfoPO& currStep, double dSafeZ, double dStep, double& dCurrElev,
double& dEscapeElev, Vector3d& vtEscape) const ;
bool CalcLastElevation( const Point3d& ptStart, const Point3d& ptP1, const Vector3d& vtTool,
const StepInfoPO& currStep, double dSafeZ, double dStep, double& dCurrElev,
double& dEscapeElev, Vector3d& vtEscape) const ;
bool CalcLeadInStart( Point3d& ptStart, const Vector3d& vtTool, const ICurveComposite* pCrvPath, Point3d& ptP1) ;
bool AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtN,
const ISurfFlatRegion* pSfr, const ICurveComposite* pRCrv, bool bAtLeft, bool bSplitArcs,
bool bNoneForced, bool bSkipControl) ;
bool AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d& vtN,
bool AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d& vtN, const ISurfFlatRegion* pSfr,
const ICurveComposite* pRCrv, bool bSplitArcs, bool bNoneForced, Point3d& ptP1) ;
double GetRadiusForStartEndElevation( void) ;
double GetRadiusForStartEndElevation( void) const ;
bool GetForcedClosed( void) ;
bool GetMidOfLongestOpenSide( const ICurveComposite* pCompo, Point3d& ptMid, Vector3d& vtMidOut) ;
bool AdjustContourWithOpenEdges( ICurveComposite* pCompo) ;
bool AdjustContourStart( ICurveComposite* pCompo) ;
bool CheckSafetyLinearLink( const Point3d& ptCurr, const ISurfFlatRegion* pSfrLimit, const Vector3d& vtTool,
const Point3d& ptDest, bool& bSafe) ;
bool ManageSmoothLink( const PathInfoPO& currPath, const PathInfoPO& nextPath, bool bSamePlane,
bool& bSmoothEnd, bool& bForceLinear) ;
bool CheckSafetyLink( const Point3d& ptCurr, const Vector3d& vtCurr,
const Point3d& ptDest, const Vector3d& vtDest,
const ISurfFlatRegion* pSfrLimit, const Vector3d& vtTool,
bool bSmoothEnd, bool& bSafeLimit, ICurveComposite* pCrvSafeLink) ;
bool VerifyLeadInHelix( const ISurfFlatRegion* pSfr, const Point3d& ptStart, const Point3d& ptCen, double dHelixRad) ;
bool VerifyLeadInZigZag( const ISurfFlatRegion* pSfr, const Point3d& ptStart, const Point3d& ptPa, const Point3d& ptPb) ;
bool VerifyLeadInOutGlide( const ISurfFlatRegion* pSfr, ICurveComposite* pCrvGlide) ;
bool CalcDistanceFromRawSurface( int nPhase, const Point3d& ptP, const Vector3d& vtDir, double& dDist, Vector3d& vtNorm) ;
// debug
void _debug_draw_sfr( const ISurfFlatRegion* pSfr, bool bUniform) ;
void _debug_draw_loop( const ICurveComposite* pCrvCompo, bool bUniform) ;
void DebugDrawSfr( const ISurfFlatRegion* pSfr, bool bUniform, int nlayer = GDB_ID_ROOT) ;
void DebugDrawLoop( const ICurveComposite* pCrvCompo, int nLayer, bool bUniform) ;
void DebugDrawBox( const BBox3d& BBox, const Frame3d& FrBox, int nlayer) ;
void DebugDrawOpenEdgesInRaw( const ICRVCOMPOPOVECTOR& vpCrvsm, int nlayer) ;
void DebugDrawFeed( const ICurve* pCrv, double dFeed, int nlayer) ;
private :
double GetSpeed( void) const
@@ -176,23 +213,24 @@ class PocketingNT : public Machining
return m_Params.m_nLeadOutType ; }
private :
SELVECTOR m_vId ; // identificativi entità geometriche da lavorare
PocketingData m_Params ; // parametri lavorazione
ToolData m_TParams ; // parametri utensile
double m_dTHoldBase ; // posizione base del porta-utensile
double m_dTHoldLen ; // lunghezza del porta-utensile
double m_dTHoldDiam ; // diametro del porta-utensile
double m_dMaxHelixRad ; // raggio massimo attacco ad elica nel caso di cerchi
int m_nStatus ; // stato di aggiornamento della lavorazione
int m_nPockets ; // numero di percorsi di svuotatura generati
bool m_bTiltingTab ; // flag utilizzo tavola basculante
Vector3d m_vtTiltingAx ; // versore direzione eventuale asse basculante
bool m_bAboveHead ; // flag utilizzo testa da sopra
bool m_bAggrBottom ; // flag di utilizzo dell'aggregato da sotto
Vector3d m_vtAggrBottom ; // vettore direzione ausiliaria aggregato da sotto
AggrBottom m_AggrBottom ; // dati eventuale aggregato da sotto
bool m_bOpenOutRaw ; // flag forzatura lati aperti sempre fuori dal grezzo
double m_dOpenMinSafe ; // minima distanza di sicurezza di attacco su lato aperto
bool _m_Debug = false ; // _debug
SELVECTOR m_vId ; // identificativi entità geometriche da lavorare
PocketingData m_Params ; // parametri lavorazione
ToolData m_TParams ; // parametri utensile
double m_dTHoldBase ; // posizione base del porta-utensile
double m_dTHoldLen ; // lunghezza del porta-utensile
double m_dTHoldDiam ; // diametro del porta-utensile
double m_dMaxHelixRad ; // raggio massimo attacco ad elica nel caso di cerchi
int m_nStatus ; // stato di aggiornamento della lavorazione
int m_nPockets ; // numero di percorsi di svuotatura generati
bool m_bTiltingTab ; // flag utilizzo tavola basculante
Vector3d m_vtTiltingAx ; // versore direzione eventuale asse basculante
bool m_bAboveHead ; // flag utilizzo testa da sopra
bool m_bAggrBottom ; // flag di utilizzo dell'aggregato da sotto
Vector3d m_vtAggrBottom ; // vettore direzione ausiliaria aggregato da sotto
AggrBottom m_AggrBottom ; // dati eventuale aggregato da sotto
bool m_bOpenOutRaw ; // flag forzatura lati aperti sempre fuori dal grezzo
double m_dOpenMinSafe ; // minima distanza di sicurezza di attacco su lato aperto
double m_dOpenInRawExtension ; // estensione dei tratti aperti dentro al grezzo
bool m_bAllClose ; // flag per forzare i lati come tutti chiusi
bool m_bRunning ; // flag di calcoli in corso
} ;
+955
View File
@@ -0,0 +1,955 @@
//----------------------------------------------------------------------------
// EgalTech 2025-2025
//----------------------------------------------------------------------------
// File : Probing.cpp Data : 10.06.25 Versione : 2.7f2
// Contenuto : Implementazione gestione tastatura.
//
//
//
// Modifiche : 10.06.25 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "MachMgr.h"
#include "DllMain.h"
#include "Probing.h"
#include "OperationConst.h"
#include "OperUserNotesConst.h"
#include "/EgtDev/Include/EGkCurveLine.h"
#include "/EgtDev/Include/EGkCurveArc.h"
#include "/EgtDev/Include/EGkCurveComposite.h"
#include "/EgtDev/Include/EGkArcSpecial.h"
#include "/EgtDev/Include/EGkSfrCreate.h"
#include "/EgtDev/Include/EGkSurfTriMesh.h"
#include "/EgtDev/Include/EGkUserObjFactory.h"
#include "/EgtDev/Include/EGnStringKeyVal.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
#include "/EgtDev/Include/EgtIniFile.h"
using namespace std ;
//------------------------------ Errors --------------------------------------
// 3401 = "Error in Probing : UpdateToolData failed"
// 3402 = "Error in Probing : missing Script (xxx)"
// 3403 = "Error in Probing : Error in xxx (nnn)"
// 3404 = "Error in Probing : axes values not calculable"
// 3405 = "Error in Probing : outstroke xx"
// 3406 = "Error in Probing : link movements not calculable"
// 3407 = "Error in Probing : link outstroke xx"
// 3408 = "Error in Probing : post apply not calculable"
// 3409 = "Error in Probing : Tool loading failed"
// 3410 = "Error in Probing : special apply not calculable"
// 3451 = "Warning in Probing : Skipped entity (xx)"
// 3452 = "Warning in Probing : No machinable path"
// 3453 = "Warning in Probing : Tool name changed (xx)"
// 3454 = "Warning in Probing : Tool data changed (xx)"
//------------------------------ Constants -----------------------------------
static const string EMC_VAR = "EMC" ; // tabella variabili locali per calcolo
static const string EVAR_MACHID = ".MACHID" ; // IN (int) identificativo della lavorazione
static const string EVAR_GEOM = ".GEOM" ; // IN (table) tabella delle entità da lavorare
static const string EVAR_DEPTH = ".DEPTH" ; // IN (string) affondamento (espressione numerica)
static const string EVAR_TINVERT = ".TOOLINVERT" ; // IN (bool) flag di inversione direzione utensile
static const string EVAR_INVERT = ".INVERT" ; // IN (bool) flag di inversione direzione lavorazione
static const string EVAR_STARTPOS = ".STARTPOS" ; // IN (num) quota di inizio lavorazione (sempre >= 0)
static const string EVAR_SYSNOTES = ".SYSNOTES" ; // IN (string) note interne
static const string EVAR_USERNOTES = ".USERNOTES" ;// IN (string) note dell'utente
static const string EVAR_TOOL = ".TOOL" ; // IN (string) nome dell'utensile
static const string EVAR_HEAD = ".HEAD" ; // IN (string) nome testa
static const string EVAR_EXIT = ".EXIT" ; // IN (int) indice uscita
static const string EVAR_TTYPE = ".TTYPE" ; // IN (int) tipo utensile
static const string EVAR_TDIAM = ".TDIAM" ; // IN (num) diametro utensile
static const string EVAR_TTOTDIAM = ".TTOTDIAM" ; // IN (num) diametro totale utensile
static const string EVAR_TLEN = ".TLEN" ; // IN (num) lunghezza utensile
static const string EVAR_TTOTLEN = ".TTOTLEN" ; // IN (num) lunghezza totale utensile
static const string EVAR_TTHICK = ".THICK" ; // IN (num) spessore per lame o altezza taglienti
static const string EVAR_TCORNRAD = ".TCORNRAD" ; // IN (num) raggio corner
static const string EVAR_FEED = ".FEED" ; // IN (num) feed dell'utensile
static const string EVAR_STARTFEED = ".STARTFEED" ;// IN (num) feed di inizio dell'utensile
static const string EVAR_ENDFEED = ".ENDFEED" ; // IN (num) feed di fine dell'utensile
static const string EVAR_TIPFEED = ".TIPFEED" ; // IN (num) feed di punta dell'utensile
static const string EVAR_ISROBOT = ".ISROBOT" ; // IN (bool) flag per indicare che la cinematica è di tipo robot
static const string EVAR_ERROR = ".ERR" ; // OUT (int) codice di errore ( 0 = ok)
static const string EVAR_MILLS = ".MILLS" ; // OUT (int) numero di percorsi di lavoro
static const string ON_PREVIEW = "OnPreview_" ;
static const string ON_APPLY = "OnApply_" ;
//----------------------------------------------------------------------------
USEROBJ_REGISTER( GetOperationClass( OPER_PROBING), Probing) ;
//----------------------------------------------------------------------------
const string&
Probing::GetClassName( void) const
{
return USEROBJ_GETNAME( Probing) ;
}
//----------------------------------------------------------------------------
Probing*
Probing::Clone( void) const
{
// alloco oggetto
Probing* pGenM = new(nothrow) Probing ;
// eseguo copia dei dati
if ( pGenM != nullptr) {
try {
pGenM->m_vId = m_vId ;
pGenM->m_pMchMgr = m_pMchMgr ;
pGenM->m_nPhase = m_nPhase ;
pGenM->m_Params = m_Params ;
pGenM->m_TParams = m_TParams ;
pGenM->m_nStatus = m_nStatus ;
pGenM->m_nMills = m_nMills ;
}
catch( ...) {
delete pGenM ;
return nullptr ;
}
}
// ritorno l'oggetto
return pGenM ;
}
//----------------------------------------------------------------------------
bool
Probing::Dump( string& sOut, bool bMM, const char* szNewLine) const
{
sOut += GetClassName() + "[mm]" + szNewLine ;
sOut += KEY_PHASE + EQUAL + ToString( m_nPhase) + szNewLine ;
sOut += KEY_IDS + EQUAL + ToString( m_vId) + szNewLine ;
for ( int i = 0 ; i < m_Params.GetSize() ; ++ i)
sOut += m_Params.ToString( i) + szNewLine ;
for ( int i = 0 ; i < m_TParams.GetSize() ; ++ i)
sOut += m_TParams.ToString( i) + szNewLine ;
sOut += KEY_NUM + EQUAL + ToString( m_nMills) + szNewLine ;
sOut += KEY_STAT + EQUAL + ToString( m_nStatus) + szNewLine ;
return true ;
}
//----------------------------------------------------------------------------
bool
Probing::Save( int nBaseId, STRVECTOR& vString) const
{
try {
int nSize = 1 + m_Params.GetSize() + m_TParams.GetSize() + 3 ;
vString.insert( vString.begin(), nSize, "") ;
int k = - 1 ;
if ( ! SetVal( KEY_IDS, m_vId, vString[++k]))
return false ;
for ( int i = 0 ; i < m_Params.GetSize() ; ++ i)
vString[++k] = m_Params.ToString( i) ;
for ( int i = 0 ; i < m_TParams.GetSize() ; ++ i)
vString[++k] = m_TParams.ToString( i) ;
if ( ! SetVal( KEY_PHASE, m_nPhase, vString[++k]))
return false ;
if ( ! SetVal( KEY_NUM, m_nMills, vString[++k]))
return false ;
if ( ! SetVal( KEY_STAT, m_nStatus, vString[++k]))
return false ;
}
catch( ...) {
return false ;
}
return true ;
}
//----------------------------------------------------------------------------
bool
Probing::Load( const STRVECTOR& vString, int nBaseGdbId)
{
int nSize = int( vString.size()) ;
// lista identificativi geometrie da lavorare
int k = - 1 ;
if ( k >= nSize - 1 || ! GetVal( vString[++k], KEY_IDS, m_vId))
return false ;
for ( auto& Sel : m_vId)
Sel.nId += nBaseGdbId ;
// parametri lavorazione
for ( int i = 0 ; i < m_Params.GetSize() ; ++ i) {
int nKey ;
if ( k >= nSize - 1 || ! m_Params.FromString( vString[++k], nKey) || nKey != i) {
if ( m_Params.IsOptional( i))
-- k ;
else
return false ;
}
}
// parametri utensile
for ( int i = 0 ; i < m_TParams.GetSize() ; ++ i) {
int nKey ;
if ( k >= nSize - 1 || ! m_TParams.FromString( vString[++k], nKey) || nKey != i)
return false ;
}
// parametri di stato
while ( k < nSize - 1) {
// separo chiave da valore
string sKey, sVal ;
SplitFirst( vString[++k], "=", sKey, sVal) ;
// leggo
if ( sKey == KEY_PHASE) {
if ( ! FromString( sVal, m_nPhase))
return false ;
}
else if ( sKey == KEY_NUM) {
if ( ! FromString( sVal, m_nMills))
return false ;
}
else if ( sKey == KEY_STAT) {
if ( ! FromString( sVal, m_nStatus))
return false ;
}
}
return true ;
}
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
Probing::Probing( void)
{
m_Params.m_sName = "*" ;
m_Params.m_sToolName = "*" ;
m_TParams.m_sName = "*" ;
m_TParams.m_sHead = "*" ;
m_nStatus = MCH_ST_TO_VERIFY ;
m_nMills = 0 ;
}
//----------------------------------------------------------------------------
bool
Probing::Prepare( const string& sGenMchName)
{
// verifico il gestore lavorazioni
if ( m_pMchMgr == nullptr)
return false ;
// recupero il gestore DB utensili della macchina corrente
ToolsMgr* pTMgr = m_pMchMgr->GetCurrToolsMgr() ;
if ( pTMgr == nullptr)
return false ;
// recupero il gestore DB lavorazioni della macchina corrente
MachiningsMgr* pMMgr = m_pMchMgr->GetCurrMachiningsMgr() ;
if ( pMMgr == nullptr)
return false ;
// ricerca della lavorazione di libreria con il nome indicato
const ProbingData* pDdata = GetProbingData( pMMgr->GetMachining( sGenMchName)) ;
if ( pDdata == nullptr)
return false ;
m_Params = *pDdata ;
// ricerca dell'utensile usato dalla lavorazione
const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ;
if ( pTdata == nullptr)
return false ;
m_TParams = *pTdata ;
m_Params.m_sToolName = m_TParams.m_sName ;
return true ;
}
//----------------------------------------------------------------------------
bool
Probing::SetParam( int nType, bool bVal)
{
switch ( nType) {
case MPA_INVERT :
if ( bVal != m_Params.m_bInvert)
m_nStatus |= MCH_ST_PARAM_MODIF ;
m_Params.m_bInvert = bVal ;
return true ;
case MPA_TOOLINVERT :
if ( bVal != m_Params.m_bToolInvert)
m_nStatus |= MCH_ST_PARAM_MODIF ;
m_Params.m_bToolInvert = bVal ;
return true ;
}
return false ;
}
//----------------------------------------------------------------------------
bool
Probing::SetParam( int nType, int nVal)
{
switch ( nType) {
case MPA_SCC :
if ( ! m_Params.VerifySolCh( nVal))
return false ;
if ( nVal != m_Params.m_nSolCh)
m_nStatus |= MCH_ST_PARAM_MODIF ;
m_Params.m_nSolCh = nVal ;
return true ;
case MPA_SUBTYPE :
if ( nVal != m_Params.m_nSubType)
m_nStatus |= MCH_ST_PARAM_MODIF ;
m_Params.m_nSubType = nVal ;
return true ;
}
return false ;
}
//----------------------------------------------------------------------------
bool
Probing::SetParam( int nType, double dVal)
{
switch ( nType) {
case MPA_FEED :
if ( abs( m_TParams.m_dFeed - dVal) < EPS_MACH_LEN_PAR)
dVal = 0 ;
if ( abs( dVal - m_Params.m_dFeed) > EPS_MACH_LEN_PAR)
m_nStatus |= MCH_ST_PARAM_MODIF ;
m_Params.m_dFeed = dVal ;
return true ;
case MPA_STARTFEED :
if ( abs( m_TParams.m_dStartFeed - dVal) < EPS_MACH_LEN_PAR)
dVal = 0 ;
if ( abs( dVal - m_Params.m_dStartFeed) > EPS_MACH_LEN_PAR)
m_nStatus |= MCH_ST_PARAM_MODIF ;
m_Params.m_dStartFeed = dVal ;
return true ;
case MPA_ENDFEED :
if ( abs( m_TParams.m_dEndFeed - dVal) < EPS_MACH_LEN_PAR)
dVal = 0 ;
if ( abs( dVal - m_Params.m_dEndFeed) > EPS_MACH_LEN_PAR)
m_nStatus |= MCH_ST_PARAM_MODIF ;
m_Params.m_dEndFeed = dVal ;
return true ;
case MPA_TIPFEED :
if ( abs( m_TParams.m_dTipFeed - dVal) < EPS_MACH_LEN_PAR)
dVal = 0 ;
if ( abs( dVal - m_Params.m_dTipFeed) > EPS_MACH_LEN_PAR)
m_nStatus |= MCH_ST_PARAM_MODIF ;
m_Params.m_dTipFeed = dVal ;
return true ;
case MPA_DEPTH: {
string sVal = ToString( dVal) ;
if ( sVal != m_Params.m_sDepth)
m_nStatus |= MCH_ST_PARAM_MODIF ;
m_Params.m_sDepth = sVal ;
} return true ;
case MPA_STARTPOS :
if ( abs( dVal - m_Params.m_dStartPos) > EPS_MACH_LEN_PAR)
m_nStatus |= MCH_ST_PARAM_MODIF ;
m_Params.m_dStartPos = dVal ;
return true ;
}
return false ;
}
//----------------------------------------------------------------------------
bool
Probing::SetParam( int nType, const string& sVal)
{
switch ( nType) {
case MPA_TOOL : {
const ToolData* pTdata ;
if ( ! m_Params.VerifyTool( m_pMchMgr->GetCurrToolsMgr(), sVal, pTdata))
return false ;
if ( ! SameTool( m_TParams, *pTdata))
m_nStatus |= MCH_ST_PARAM_MODIF ;
m_Params.m_sToolName = sVal ;
m_Params.m_ToolUuid = pTdata->m_Uuid ;
m_TParams = *pTdata ;
} return true ;
case MPA_DEPTH_STR :
if ( sVal != m_Params.m_sDepth)
m_nStatus |= MCH_ST_PARAM_MODIF ;
m_Params.m_sDepth = sVal ;
return true ;
case MPA_SYSNOTES :
if ( sVal != m_Params.m_sSysNotes)
m_nStatus |= MCH_ST_PARAM_MODIF ;
m_Params.m_sSysNotes = sVal ;
return true ;
case MPA_USERNOTES :
if ( sVal != m_Params.m_sUserNotes)
m_nStatus |= MCH_ST_PARAM_MODIF ;
m_Params.m_sUserNotes = sVal ;
return true ;
case MPA_INITANGS :
if ( sVal != m_Params.m_sInitAngs)
m_nStatus |= MCH_ST_PARAM_MODIF ;
m_Params.m_sInitAngs = sVal ;
return true ;
case MPA_BLOCKEDAXIS :
if ( sVal != m_Params.m_sBlockedAxis)
m_nStatus |= MCH_ST_PARAM_MODIF ;
m_Params.m_sBlockedAxis = sVal ;
return true ;
}
return false ;
}
//----------------------------------------------------------------------------
bool
Probing::SetGeometry( const SELVECTOR& vIds)
{
// verifico validità gestore DB geometrico
if ( m_pGeomDB == nullptr)
return false ;
// copia temporanea e reset della geometria corrente
SELVECTOR vOldId = m_vId ;
m_vId.clear() ;
// verifico che gli identificativi rappresentino delle entità ammissibili (tutte curve o tutte facce)
int nType = GEO_NONE ;
for ( const auto& Id : vIds) {
// test sull'entità
int nSubs ;
if ( ! VerifyGeometry( Id, nSubs, nType)) {
string sInfo = "Warning in Probing : Skipped entity " + ToString( Id) ;
m_pMchMgr->SetWarning( 3451, sInfo) ;
continue ;
}
// posso aggiungere alla lista
m_vId.emplace_back( Id) ;
}
// aggiorno lo stato
if ( m_vId != vOldId)
m_nStatus |= MCH_ST_GEO_MODIF ;
// restituisco presenza geometria da lavorare
return ( ! m_vId.empty() || vIds.empty()) ;
}
//----------------------------------------------------------------------------
bool
Probing::Preview( bool bRecalc)
{
// reset numero percorsi di lavoro generati
m_nMills = 0 ;
// verifico validità gestore DB geometrico e Id del gruppo
if ( m_pGeomDB == nullptr || ! m_pGeomDB->ExistsObj( m_nOwnerId))
return false ;
// aggiorno dati geometrici dell'utensile
if ( ! UpdateToolData()) {
m_pMchMgr->SetLastError( 3401, "Error in Probing : UpdateToolData failed") ;
return false ;
}
// rendo corrente l'utensile usato nella lavorazione
if ( ! m_pMchMgr->SetCalcTool( m_TParams.m_sName, m_TParams.m_sHead, m_TParams.m_nExit)) {
m_pMchMgr->SetLastError( 3409, "Error in Probing : Tool loading failed") ;
return false ;
}
// recupero gruppo per geometria di Preview
int nPvId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_PV) ;
// se non c'è, lo aggiungo
if ( nPvId == GDB_ID_NULL) {
nPvId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
if ( nPvId == GDB_ID_NULL)
return false ;
m_pGeomDB->SetName( nPvId, MCH_PV) ;
}
// altrimenti lo svuoto
else
m_pGeomDB->EmptyGroup( nPvId) ;
// recupero la macchina corrente
Machine* pMch = m_pMchMgr->GetCurrMachine() ;
if ( pMch == nullptr)
return false ;
// nome della funzione lua da Ini della macchina
string sMachIni = pMch->GetMachineDir() + "\\" + pMch->GetMachineName() + ".ini" ;
string sKey = PROBING_SCRIPT_KEY + ToString( m_Params.m_nSubType) ;
string sName = GetPrivateProfileStringUtf8( PROBING_SEC.c_str(), sKey.c_str(), "", sMachIni.c_str()) ;
string sPreview = ON_PREVIEW + sName ;
// verifico esistenza funzione
if ( ! pMch->LuaExistsFunction( sPreview)) {
string sErr = "Error in Probing : missing Script " + sPreview ;
m_pMchMgr->SetLastError( 3402, sErr) ;
return false ;
}
// imposto stato
bool bOk = true ;
int nErr = 99 ;
// imposto valori parametri
bOk = bOk && pMch->LuaCreateGlobTable( EMC_VAR) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_MACHID, m_nOwnerId) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_GEOM, m_vId) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_DEPTH, m_Params.m_sDepth) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TINVERT, m_Params.m_bToolInvert) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_INVERT, m_Params.m_bInvert) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_STARTPOS, m_Params.m_dStartPos) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_SYSNOTES, m_Params.m_sSysNotes) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_USERNOTES, m_Params.m_sUserNotes) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TOOL, m_TParams.m_sName) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_HEAD, m_TParams.m_sHead) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_EXIT, m_TParams.m_nExit) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TTYPE, m_TParams.m_nType) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TDIAM, m_TParams.m_dDiam) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TTOTDIAM, m_TParams.m_dTDiam) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TLEN, m_TParams.m_dLen) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TTOTLEN, m_TParams.m_dTLen) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TTHICK, m_TParams.m_dThick) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TCORNRAD, m_TParams.m_dCornRad) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_FEED, GetFeed()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_STARTFEED, GetStartFeed()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_ENDFEED, GetEndFeed()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TIPFEED, GetTipFeed()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_ISROBOT, m_pMchMgr->GetCurrIsRobot()) ;
// eseguo
bOk = bOk && pMch->LuaCallFunction( sPreview, false) ;
// recupero valori parametri obbligatori
bOk = bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_ERROR, nErr) ;
bOk = bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_MILLS, m_nMills) ;
// reset
bOk = bOk && pMch->LuaResetGlobVar( EMC_VAR) ;
// segnalo errori
if ( ! bOk || nErr != 0) {
m_nMills = 0 ;
string sErr = "Error in Probing : Error in " + sPreview + " (" + ToString( nErr) + ")" ;
m_pMchMgr->SetLastError( 3403, sErr) ;
return false ;
}
return true ;
}
//----------------------------------------------------------------------------
bool
Probing::Apply( bool bRecalc, bool bPostApply)
{
// reset numero percorsi di lavoro generati
int nCurrMills = m_nMills ;
m_nMills = 0 ;
// verifico validità gestore DB geometrico e Id del gruppo
if ( m_pGeomDB == nullptr || ! m_pGeomDB->ExistsObj( m_nOwnerId))
return false ;
// aggiorno dati geometrici dell'utensile
if ( ! UpdateToolData()) {
m_pMchMgr->SetLastError( 3401, "Error in Probing : UpdateToolData failed") ;
return false ;
}
// se modificata geometria, necessario ricalcolo
if ( ( m_nStatus & MCH_ST_GEO_MODIF) != 0)
bRecalc = true ;
// verifico se necessario continuare nell'aggiornamento
if ( ! bRecalc && ( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) {
// confermo i percorsi di lavorazione
m_nMills = nCurrMills ;
string sLog = string( "Probing apply skipped : status ") + ( m_nStatus == MCH_ST_OK ? "already ok" : "no postapply") ;
LOG_DBG_INFO( GetEMkLogger(), sLog.c_str()) ;
// eseguo aggiornamento assi macchina e collegamento con operazione precedente
if ( ! Update( bPostApply))
return false ;
m_nStatus = ( bPostApply ? MCH_ST_OK : MCH_ST_NO_POSTAPPL) ;
LOG_DBG_INFO( GetEMkLogger(), "Update done") ;
// esco con successo
return true ;
}
m_nStatus = MCH_ST_TO_VERIFY ;
// rendo corrente l'utensile usato nella lavorazione
if ( ! m_pMchMgr->SetCalcTool( m_TParams.m_sName, m_TParams.m_sHead, m_TParams.m_nExit)) {
m_pMchMgr->SetLastError( 3409, "Error in Probing : Tool loading failed") ;
return false ;
}
// recupero gruppo per geometria di lavorazione (Cutter Location)
int nClId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_CL) ;
// se non c'è, lo aggiungo
if ( nClId == GDB_ID_NULL) {
nClId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
if ( nClId == GDB_ID_NULL)
return false ;
m_pGeomDB->SetName( nClId, MCH_CL) ;
}
// altrimenti lo svuoto
else
m_pGeomDB->EmptyGroup( nClId) ;
// recupero la macchina corrente
Machine* pMch = m_pMchMgr->GetCurrMachine() ;
if ( pMch == nullptr)
return false ;
// nome della funzione lua da Ini della macchina
string sMachIni = pMch->GetMachineDir() + "\\" + pMch->GetMachineName() + ".ini" ;
string sKey = PROBING_SCRIPT_KEY + ToString( m_Params.m_nSubType) ;
string sName = GetPrivateProfileStringUtf8( PROBING_SEC.c_str(), sKey.c_str(), "", sMachIni.c_str()) ;
string sApply = ON_APPLY + sName ;
// verifico esistenza funzione
if ( ! pMch->LuaExistsFunction( sApply)) {
string sErr = "Error in Probing : missing Script " + sApply ;
m_pMchMgr->SetLastError( 3402, sErr) ;
return false ;
}
// imposto stato
bool bOk = true ;
int nErr = 99 ;
// imposto valori parametri
bOk = bOk && pMch->LuaCreateGlobTable( EMC_VAR) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_MACHID, m_nOwnerId) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_GEOM, m_vId) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_DEPTH, m_Params.m_sDepth) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TINVERT, m_Params.m_bToolInvert) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_INVERT, m_Params.m_bInvert) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_STARTPOS, m_Params.m_dStartPos) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_SYSNOTES, m_Params.m_sSysNotes) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_USERNOTES, m_Params.m_sUserNotes) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TOOL, m_TParams.m_sName) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_HEAD, m_TParams.m_sHead) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_EXIT, m_TParams.m_nExit) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TTYPE, m_TParams.m_nType) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TDIAM, m_TParams.m_dDiam) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TTOTDIAM, m_TParams.m_dTDiam) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TLEN, m_TParams.m_dLen) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TTOTLEN, m_TParams.m_dTLen) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TTHICK, m_TParams.m_dThick) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TCORNRAD, m_TParams.m_dCornRad) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_FEED, GetFeed()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_STARTFEED, GetStartFeed()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_ENDFEED, GetEndFeed()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TIPFEED, GetTipFeed()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_ISROBOT, m_pMchMgr->GetCurrIsRobot()) ;
// eseguo
bOk = bOk && pMch->LuaCallFunction( sApply, false) ;
// recupero valori parametri obbligatori
bOk = bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_ERROR, nErr) ;
bOk = bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_MILLS, m_nMills) ;
// reset
bOk = bOk && pMch->LuaResetGlobVar( EMC_VAR) ;
// segnalo errori
if ( ! bOk || nErr != 0) {
m_nMills = 0 ;
string sErr = "Error in Probing : Error in " + sApply + " (" + ToString( nErr) + ")" ;
m_pMchMgr->SetLastError( 3403, sErr) ;
return false ;
}
// assegno ingombri dei vari percorsi di lavorazione e della lavorazione nel suo complesso
CalcAndSetBBox( nClId) ;
// eseguo aggiornamento assi macchina e collegamento con operazione precedente
if ( ! Update( bPostApply))
return false ;
// aggiorno stato della lavorazione
m_nStatus = ( bPostApply ? MCH_ST_OK : MCH_ST_NO_POSTAPPL) ;
// dichiaro successiva da aggiornare
UpdateFollowingOperationsStatus( MCH_ST_OTH_MODIF) ;
LOG_DBG_INFO( GetEMkLogger(), "Probing apply done") ;
return true ;
}
//----------------------------------------------------------------------------
bool
Probing::Update( bool bPostApply)
{
// verifico validità gestore DB geometrico e Id del gruppo
if ( m_pGeomDB == nullptr || ! m_pGeomDB->ExistsObj( m_nOwnerId))
return false ;
// se lavorazione vuota, esco
if ( m_nMills == 0) {
m_pMchMgr->SetWarning( 3452, "Warning in Probing : No machinable path") ;
return true ;
}
// elimino le entità CLIMB, RISE e HOME della lavorazione, potrebbero falsare i calcoli degli assi (in ogni casi vengono riaggiunte dopo)
RemoveClimbRiseHome() ;
// imposto eventuale asse bloccato da lavorazione
SetBlockedRotAxis( m_Params.m_sBlockedAxis) ;
// calcolo gli assi macchina
string sHint = ExtractHint( m_Params.m_sUserNotes) ;
if ( ! m_Params.m_sInitAngs.empty())
sHint = m_Params.m_sInitAngs ;
if ( ! CalculateAxesValues( sHint)) {
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
if ( sInfo.empty())
m_pMchMgr->SetLastError( 3404, "Error in Probing : axes values not calculable") ;
else
m_pMchMgr->SetLastError( 3405, "Error in Probing : outstroke ") ;
return false ;
}
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
CalcAndSetAxesBBox() ;
// esecuzione eventuali personalizzazioni speciali
string sSpecErr ;
if ( bPostApply && ! SpecialApply( sSpecErr)) {
if ( ! IsEmptyOrSpaces( sSpecErr))
m_pMchMgr->SetLastError( 3410, sSpecErr) ;
else
m_pMchMgr->SetLastError( 3410, "Error in Probing : special apply not calculable") ;
return false ;
}
// gestione movimenti all'inizio di ogni singolo percorso di lavorazione e alla fine della lavorazione
if ( ! AdjustStartEndMovements()) {
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
if ( sInfo.empty())
m_pMchMgr->SetLastError( 3406, "Error in Probing : link movements not calculable") ;
else
m_pMchMgr->SetLastError( 3407, "Error in Probing : link outstroke ") ;
return false ;
}
// esecuzione eventuali personalizzazioni finali
string sPostErr ;
if ( bPostApply && ! PostApply( sPostErr)) {
if ( ! IsEmptyOrSpaces( sPostErr))
m_pMchMgr->SetLastError( 3408, sPostErr) ;
else
m_pMchMgr->SetLastError( 3408, "Error in Probing : post apply not calculable") ;
return false ;
}
return true ;
}
//----------------------------------------------------------------------------
bool
Probing::GetParam( int nType, bool& bVal) const
{
switch ( nType) {
case MPA_INVERT :
bVal = m_Params.m_bInvert ;
return true ;
case MPA_TOOLINVERT :
bVal = m_Params.m_bToolInvert ;
return true ;
}
bVal = false ;
return false ;
}
//----------------------------------------------------------------------------
bool
Probing::GetParam( int nType, int& nVal) const
{
switch ( nType) {
case MPA_TYPE :
nVal = MT_PROBING ;
return true ;
case MPA_SCC :
nVal = m_Params.m_nSolCh ;
return true ;
case MPA_SUBTYPE :
nVal = m_Params.m_nSubType ;
return true ;
}
nVal = 0 ;
return false ;
}
//----------------------------------------------------------------------------
bool
Probing::GetParam( int nType, double& dVal) const
{
switch ( nType) {
case MPA_SPEED :
dVal = 0 ;
return true ;
case MPA_FEED :
dVal = GetFeed() ;
return true ;
case MPA_STARTFEED :
dVal = GetStartFeed() ;
return true ;
case MPA_ENDFEED :
dVal = GetEndFeed() ;
return true ;
case MPA_TIPFEED :
dVal = GetTipFeed() ;
return true ;
case MPA_STARTPOS :
dVal = m_Params.m_dStartPos ;
return true ;
}
dVal = 0 ;
return false ;
}
//----------------------------------------------------------------------------
bool
Probing::GetParam( int nType, string& sVal) const
{
switch ( nType) {
case MPA_NAME :
sVal = m_Params.m_sName ;
return true ;
case MPA_TOOL :
sVal = m_Params.m_sToolName ;
return true ;
case MPA_DEPTH_STR :
sVal = m_Params.m_sDepth ;
return true ;
case MPA_TUUID :
sVal = ToString( m_Params.m_ToolUuid) ;
return true ;
case MPA_UUID :
sVal = ToString( m_Params.m_Uuid) ;
return true ;
case MPA_SYSNOTES :
sVal = m_Params.m_sSysNotes ;
return true ;
case MPA_USERNOTES :
sVal = m_Params.m_sUserNotes ;
return true ;
case MPA_INITANGS :
sVal = m_Params.m_sInitAngs ;
return true ;
case MPA_BLOCKEDAXIS :
sVal = m_Params.m_sBlockedAxis ;
return true ;
}
sVal = "" ;
return false ;
}
//----------------------------------------------------------------------------
const ToolData&
Probing::GetToolData( void) const
{
return m_TParams ;
}
//----------------------------------------------------------------------------
bool
Probing::UpdateToolData( void)
{
// recupero il gestore DB utensili della macchina corrente
ToolsMgr* pTMgr = m_pMchMgr->GetCurrToolsMgr() ;
if ( pTMgr == nullptr)
return false ;
// recupero l'utensile nel DB utensili (se fallisce con UUID provo con il nome)
const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ;
if ( pTdata == nullptr) {
pTdata = pTMgr->GetTool( m_Params.m_sToolName) ;
if ( pTdata == nullptr)
return false ;
m_Params.m_ToolUuid = m_TParams.m_Uuid ;
}
// salvo posizione TC, testa e uscita originali
string sOrigTcPos = m_TParams.m_sTcPos ;
string sOrigHead = m_TParams.m_sHead ;
int nOrigExit = m_TParams.m_nExit ;
// verifico se sono diversi (ad esclusione di nome, posizione TC, testa e uscita)
bool bChanged = ( ! SameTool( m_TParams, *pTdata, false)) ;
// aggiorno comunque i parametri
m_TParams = *pTdata ;
// se definito attrezzaggio, aggiorno i parametri che ne possono derivare
string sTcPos ; string sHead ; int nExit ;
if ( m_pMchMgr->GetCurrSetupMgr().GetToolData( m_TParams.m_sName, sTcPos, sHead, nExit)) {
if ( sOrigTcPos != sTcPos ||
sOrigHead != sHead ||
nOrigExit != nExit)
bChanged = true ;
m_TParams.m_sTcPos = sTcPos ;
m_TParams.m_sHead = sHead ;
m_TParams.m_nExit = nExit ;
}
else {
if ( sOrigTcPos != pTdata->m_sTcPos ||
sOrigHead != pTdata->m_sHead ||
nOrigExit != pTdata->m_nExit)
bChanged = true ;
}
// eventuali segnalazioni
if ( ! EqualNoCase( m_Params.m_sToolName, m_TParams.m_sName)) {
string sInfo = "Warning in Probing : tool name changed (" +
m_Params.m_sToolName + "->" + m_TParams.m_sName + ")" ;
m_pMchMgr->SetWarning( 3453, sInfo) ;
m_Params.m_sToolName = m_TParams.m_sName ;
}
if ( bChanged) {
string sInfo = "Warning in Probing : tool data changed (" +
m_Params.m_sToolName + ")" ;
m_pMchMgr->SetWarning( 3454, sInfo) ;
}
// se modificato, aggiusto lo stato
if ( bChanged)
m_nStatus = MCH_ST_TO_VERIFY ;
return true ;
}
//----------------------------------------------------------------------------
bool
Probing::GetGeometry( SELVECTOR& vIds) const
{
// restituisco l'elenco delle entità
vIds = m_vId ;
return true ;
}
//----------------------------------------------------------------------------
bool
Probing::VerifyGeometry( SelData Id, int& nSubs, int& nType)
{
// ammessi : tutte curve o tutte facce di trimesh
const IGeoObj* pGObj = m_pGeomDB->GetGeoObj( Id.nId) ;
if ( pGObj == nullptr)
return false ;
// se ammesse curve ed è tale
if ( nType != GEO_SURF && ( pGObj->GetType() & GEO_CURVE) != 0) {
const ICurve* pCurve = nullptr ;
// se direttamente la curva
if ( Id.nSub == SEL_SUB_ALL) {
pCurve = ::GetCurve( pGObj) ;
if ( pCurve != nullptr) {
if ( pCurve->GetType() == CRV_COMPO)
nSubs = ::GetCurveComposite( pCurve)->GetCurveCount() ;
else
nSubs = 0 ;
}
}
// altrimenti sottocurva di composita
else {
const ICurveComposite* pCompo = GetCurveComposite( pGObj) ;
if ( pCompo != nullptr)
pCurve = pCompo->GetCurve( Id.nSub) ;
nSubs = 0 ;
}
return ( pCurve != nullptr) ;
}
// se altrimenti ammesse superfici trimesh ed è tale
else if ( nType != GEO_CURVE && ( pGObj->GetType() & GEO_SURF) != 0) {
const ISurfTriMesh* pSurf = ::GetSurfTriMesh( pGObj) ;
if ( pSurf == nullptr)
return false ;
// se direttamente la superficie
if ( Id.nSub == SEL_SUB_ALL) {
nSubs = pSurf->GetFacetCount() ;
return true ;
}
// altrimenti faccia di superficie trimesh
else {
// se faccia non esistente
if ( Id.nSub > pSurf->GetFacetCount())
return false ;
// tutto bene
nSubs = 0 ;
return true ;
}
}
// altrimenti errore
else
return false ;
}
//----------------------------------------------------------------------------
double
Probing::GetApproxLinTol( void) const
{
double dLinTol ;
if ( GetValInNotes( m_Params.m_sUserNotes, UN_LINTOL, dLinTol))
return dLinTol ;
else
return Operation::GetApproxLinTol() ;
}
+94
View File
@@ -0,0 +1,94 @@
//----------------------------------------------------------------------------
// EgalTech 2025-2025
//----------------------------------------------------------------------------
// File : Probing.h Data : 10.06.25 Versione : 2.7f2
// Contenuto : Dichiarazione della classe Probing.
//
//
//
// Modifiche : 10.06.25 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
#pragma once
#include "Machining.h"
#include "ProbingData.h"
#include "ToolData.h"
class ICurve ;
class ICurveComposite ;
//----------------------------------------------------------------------------
class Probing : public Machining
{
public : // IUserObj
Probing* Clone( void) const override ;
const std::string& GetClassName( void) const override ;
bool Dump( std::string& sOut, bool bMM = true, const char* szNewLine = "\n") const override ;
bool ToSave( void) const override
{ return true ; }
bool Save( int nBaseId, STRVECTOR& vString) const override ;
bool Load( const STRVECTOR& vString, int nBaseGdbId) override ;
public : // Operation
int GetType( void) const override
{ return OPER_PROBING ; }
bool IsEmpty( int nEmptyType = NEED_GEOM) const override
{ if ( m_nMills == 0)
return true ;
if ( nEmptyType == NEED_ONE_TP_OK)
return ( ! IsAtLeastOnePathOk()) ;
if ( nEmptyType == NEED_ALL_TP_OK)
return ( ! AreAllPathsOk()) ;
return false ; }
bool UpdateStatus( int nModif) override
{ m_nStatus |= nModif ; return true ; }
protected : // Operation
int GetSolCh( void) const override
{ return m_Params.m_nSolCh ; }
public : // Machining
bool Prepare( const std::string& sMillName) override ;
bool SetParam( int nType, bool bVal) override ;
bool SetParam( int nType, int nVal) override ;
bool SetParam( int nType, double dVal) override ;
bool SetParam( int nType, const std::string& sVal) override ;
bool SetGeometry( const SELVECTOR& vIds) override ;
bool Preview( bool bRecalc) override ;
bool Apply( bool bRecalc, bool bPostApply) override ;
bool Update( bool bPostApply) override ;
bool GetParam( int nType, bool& bVal) const override ;
bool GetParam( int nType, int& nVal) const override ;
bool GetParam( int nType, double& dVal) const override ;
bool GetParam( int nType, std::string& sVal) const override ;
bool UpdateToolData( void) override ;
const ToolData& GetToolData( void) const override ;
bool GetGeometry( SELVECTOR& vIds) const override ;
public :
Probing( void) ;
private :
bool VerifyGeometry( SelData Id, int& nSubs, int& nType) ;
double GetApproxLinTol( void) const override ;
private :
double GetFeed() const
{ return ( IsNullLenValue( m_Params.m_dFeed) ? m_TParams.m_dFeed : m_Params.m_dFeed) ; }
double GetStartFeed() const
{ return ( IsNullLenValue( m_Params.m_dStartFeed) ? m_TParams.m_dStartFeed : m_Params.m_dStartFeed) ; }
double GetEndFeed() const
{ return ( IsNullLenValue( m_Params.m_dEndFeed) ? m_TParams.m_dEndFeed : m_Params.m_dEndFeed) ; }
double GetTipFeed() const
{ return ( IsNullLenValue( m_Params.m_dTipFeed) ? m_TParams.m_dTipFeed : m_Params.m_dTipFeed) ; }
private :
SELVECTOR m_vId ; // identificativi entità geometriche da lavorare
ProbingData m_Params ; // parametri lavorazione
ToolData m_TParams ; // parametri utensile
int m_nStatus ; // stato di aggiornamento della lavorazione
int m_nMills ; // numero di percorsi di lavoro generati
} ;
+515
View File
@@ -0,0 +1,515 @@
//----------------------------------------------------------------------------
// EgalTech 2025-2025
//----------------------------------------------------------------------------
// File : ProbingData.cpp Data : 09.06.25 Versione : 2.7f2
// Contenuto : Implementazione struttura dati tastatura.
//
//
//
// Modifiche : 09.06.25 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "ProbingData.h"
#include "MachiningDataFactory.h"
#include "MachiningConst.h"
#include "/EgtDev/Include/EmkToolConst.h"
#include "/EgtDev/Include/EmkSimuGenConst.h"
#include "/EgtDev/Include/EGnStringUtils.h"
#include <array>
#include <cassert>
using namespace std ;
//----------------------------------------------------------------------------
enum nProbingKey {
KEY_AB = 0,
KEY_AI,
KEY_DH,
KEY_F,
KEY_FE,
KEY_FS,
KEY_FT,
KEY_INV,
KEY_NAME,
KEY_NNS,
KEY_NNU,
KEY_PS,
KEY_SCC,
KEY_SUBTYPE,
KEY_TI,
KEY_TNAME,
KEY_TUUID,
KEY_UUID,
KEY_ZZZ} ; // rappresenta il numero di elementi
static const array<string,KEY_ZZZ> sProbingKey = {
"AB",
"AI",
"DH",
"F",
"FE",
"FS",
"FT",
"INV",
"NAME",
"NNS",
"NNU",
"PS",
"SCC",
"SUB",
"TI",
"TN",
"TU",
"UUID"} ;
//----------------------------------------------------------------------------
MCHDATA_REGISTER( MT_PROBING, "PROBING", ProbingData) ;
//----------------------------------------------------------------------------
ProbingData*
ProbingData::Clone( void) const
{
// alloco oggetto
ProbingData* pDdata = new(nothrow) ProbingData ;
// copio i dati
if ( pDdata != nullptr) {
if ( ! pDdata->CopyFrom( this)) {
delete pDdata ;
return nullptr ;
}
}
return pDdata ;
}
//----------------------------------------------------------------------------
bool
ProbingData::CopyFrom( const MachiningData* pMdata)
{
// è inutile copiare se sorgente coincide con destinazione
if ( pMdata == this)
return true ;
// la sorgente deve essere dello stesso tipo
const ProbingData* pGdata = GetProbingData( pMdata) ;
if ( pGdata == nullptr)
return false ;
// eseguo copia
m_Uuid = pGdata->m_Uuid ;
m_sName = pGdata->m_sName ;
m_ToolUuid = pGdata->m_ToolUuid ;
m_sToolName = pGdata->m_sToolName ;
m_sBlockedAxis = pGdata->m_sBlockedAxis ;
m_sInitAngs = pGdata->m_sInitAngs ;
m_nSolCh = pGdata->m_nSolCh ;
m_dFeed = pGdata->m_dFeed ;
m_dStartFeed = pGdata->m_dStartFeed ;
m_dEndFeed = pGdata->m_dEndFeed ;
m_dTipFeed = pGdata->m_dTipFeed ;
m_bToolInvert = pGdata->m_bToolInvert ;
m_bInvert = pGdata->m_bInvert ;
m_sDepth = pGdata->m_sDepth ;
m_dStartPos = pGdata->m_dStartPos ;
m_nSubType = pGdata->m_nSubType ;
m_sSysNotes = pGdata->m_sSysNotes ;
m_sUserNotes = pGdata->m_sUserNotes ;
return true ;
}
//----------------------------------------------------------------------------
bool
ProbingData::SameAs(const MachiningData* pMdata) const
{
// se coincide con altro -> uguali
if ( pMdata == this)
return true ;
// se sono di tipo diverso -> diversi
const ProbingData* pGdata = GetProbingData( pMdata) ;
if ( pGdata == nullptr)
return false ;
// confronto termine a termine
return ( m_Uuid == pGdata->m_Uuid &&
m_sName == pGdata->m_sName &&
m_ToolUuid == pGdata->m_ToolUuid &&
m_sToolName == pGdata->m_sToolName &&
m_sBlockedAxis == pGdata->m_sBlockedAxis &&
m_sInitAngs == pGdata->m_sInitAngs &&
m_nSolCh == pGdata->m_nSolCh &&
abs( m_dFeed - pGdata->m_dFeed) < EPS_MACH_LEN_PAR &&
abs( m_dStartFeed - pGdata->m_dStartFeed) < EPS_MACH_LEN_PAR &&
abs( m_dEndFeed - pGdata->m_dEndFeed) < EPS_MACH_LEN_PAR &&
abs( m_dTipFeed - pGdata->m_dTipFeed) < EPS_MACH_LEN_PAR &&
m_bToolInvert == pGdata->m_bToolInvert &&
m_bInvert == pGdata->m_bInvert &&
m_sDepth == pGdata->m_sDepth &&
abs( m_dStartPos - pGdata->m_dStartPos) < EPS_MACH_LEN_PAR &&
m_nSubType == pGdata->m_nSubType &&
m_sSysNotes == pGdata->m_sSysNotes &&
m_sUserNotes == pGdata->m_sUserNotes) ;
}
//----------------------------------------------------------------------------
int
ProbingData::GetSize( void) const
{
// in debug verifico validità ultimo campo
assert( sProbingKey[KEY_UUID] == "UUID") ;
return KEY_ZZZ ;
}
//----------------------------------------------------------------------------
string
ProbingData::GetTitle( void) const
{
return MCHDATA_GETNAME( ProbingData) ;
}
//----------------------------------------------------------------------------
static int
FindProbingKey( const string& sKey)
{
auto TheRange = equal_range( sProbingKey.cbegin(), sProbingKey.cend(), sKey) ;
if ( TheRange.first == TheRange.second)
return - 1 ;
return int( TheRange.first - sProbingKey.cbegin()) ;
}
//----------------------------------------------------------------------------
bool
ProbingData::FromString( const string& sString, int& nKey)
{
// separo chiave da valore
string sKey, sVal ;
SplitFirst( sString, "=", sKey, sVal) ;
// riconosco la chiave
nKey = FindProbingKey( ToUpper( sKey)) ;
bool bOk = ( nKey >= 0) ;
switch ( nKey) {
case KEY_AB :
m_sBlockedAxis = sVal ;
break ;
case KEY_AI :
m_sInitAngs = sVal ;
break ;
case KEY_DH :
m_sDepth = sVal ;
if ( m_sDepth.empty())
m_sDepth = "0" ;
break ;
case KEY_F :
bOk = ::FromString( sVal, m_dFeed) ;
break ;
case KEY_FE :
bOk = ::FromString( sVal, m_dEndFeed) ;
break ;
case KEY_FS :
bOk = ::FromString( sVal, m_dStartFeed) ;
break ;
case KEY_FT :
bOk = ::FromString( sVal, m_dTipFeed) ;
break ;
case KEY_INV :
bOk = ::FromString( sVal, m_bInvert) ;
break ;
case KEY_NAME :
m_sName = sVal ;
bOk = ! m_sName.empty() ;
break ;
case KEY_NNS :
m_sSysNotes = sVal ;
break ;
case KEY_NNU :
m_sUserNotes = sVal ;
break ;
case KEY_PS :
bOk = ::FromString( sVal, m_dStartPos) ;
break ;
case KEY_SCC :
bOk = ::FromString( sVal, m_nSolCh) ;
break ;
case KEY_SUBTYPE :
bOk = ::FromString( sVal, m_nSubType) ;
break ;
case KEY_TNAME :
m_sToolName = sVal ;
break ;
case KEY_TI :
bOk = ::FromString( sVal, m_bToolInvert) ;
break ;
case KEY_TUUID :
bOk = ::FromString( sVal, m_ToolUuid) ;
break ;
case KEY_UUID :
bOk = ::FromString( sVal, m_Uuid) ;
break ;
default :
bOk = false ;
break ;
}
return bOk ;
}
//----------------------------------------------------------------------------
string
ProbingData::ToString( int nKey) const
{
switch ( nKey) {
case KEY_AB : return ( sProbingKey[KEY_AB] + "=" + m_sBlockedAxis) ;
case KEY_AI : return ( sProbingKey[KEY_AI] + "=" + m_sInitAngs) ;
case KEY_DH : return ( sProbingKey[KEY_DH] + "=" + m_sDepth) ;
case KEY_F : return ( sProbingKey[KEY_F] + "=" + ::ToString( m_dFeed)) ;
case KEY_FE : return ( sProbingKey[KEY_FE] + "=" + ::ToString( m_dEndFeed)) ;
case KEY_FS : return ( sProbingKey[KEY_FS] + "=" + ::ToString( m_dStartFeed)) ;
case KEY_FT : return ( sProbingKey[KEY_FT] + "=" + ::ToString( m_dTipFeed)) ;
case KEY_INV : return ( sProbingKey[KEY_INV] + "=" + ::ToString( m_bInvert)) ;
case KEY_NAME : return ( sProbingKey[KEY_NAME] + "=" + m_sName) ;
case KEY_NNS : return ( sProbingKey[KEY_NNS] + "=" + m_sSysNotes) ;
case KEY_NNU : return ( sProbingKey[KEY_NNU] + "=" + m_sUserNotes) ;
case KEY_PS : return ( sProbingKey[KEY_PS] + "=" + ::ToString( m_dStartPos)) ;
case KEY_SCC : return ( sProbingKey[KEY_SCC] + "=" + ::ToString( m_nSolCh)) ;
case KEY_SUBTYPE : return ( sProbingKey[KEY_SUBTYPE] + "=" + ::ToString( m_nSubType)) ;
case KEY_TI : return ( sProbingKey[KEY_TI] + "=" + ::ToString( m_bToolInvert)) ;
case KEY_TNAME : return ( sProbingKey[KEY_TNAME] + "=" + m_sToolName) ;
case KEY_TUUID : return ( sProbingKey[KEY_TUUID] + "=" + ::ToString( m_ToolUuid)) ;
case KEY_UUID : return ( sProbingKey[KEY_UUID] + "=" + ::ToString( m_Uuid)) ;
default : return "" ;
}
}
//----------------------------------------------------------------------------
bool
ProbingData::IsOptional( int nKey) const
{
return ( nKey == KEY_AB || nKey == KEY_AI || nKey == KEY_TI) ;
}
//----------------------------------------------------------------------------
bool
ProbingData::VerifySolCh( int nVal) const
{
return IsValidOperationScc( nVal) ;
}
//----------------------------------------------------------------------------
bool
ProbingData::VerifyTool( const ToolsMgr* pToolsMgr, const string& sVal, const ToolData*& pTdata) const
{
if ( pToolsMgr == nullptr)
return false ;
pTdata = pToolsMgr->GetTool( sVal) ;
if ( pTdata == nullptr)
return false ;
if ( ( pTdata->m_nType & TF_PROBE) == 0)
return false ;
return true ;
}
//----------------------------------------------------------------------------
bool
ProbingData::GetTool( const ToolsMgr* pToolsMgr, const ToolData*& pTdata) const
{
if ( pToolsMgr == nullptr)
return false ;
pTdata = pToolsMgr->GetTool( m_ToolUuid) ;
return ( pTdata != nullptr) ;
}
//----------------------------------------------------------------------------
bool
ProbingData::SetParam( int nType, bool bVal)
{
switch ( nType) {
case MPA_INVERT :
m_bInvert = bVal ;
return true ;
case MPA_TOOLINVERT :
m_bToolInvert = bVal ;
return true ;
}
return false ;
}
//----------------------------------------------------------------------------
bool
ProbingData::SetParam( int nType, int nVal)
{
switch ( nType) {
case MPA_SCC :
if ( ! VerifySolCh( nVal))
return false ;
m_nSolCh = nVal ;
return true ;
case MPA_SUBTYPE :
m_nSubType = nVal ;
return true ;
}
return false ;
}
//----------------------------------------------------------------------------
bool
ProbingData::SetParam( int nType, double dVal)
{
switch ( nType) {
case MPA_FEED :
m_dFeed = dVal ;
return true ;
case MPA_STARTFEED :
m_dStartFeed = dVal ;
return true ;
case MPA_ENDFEED :
m_dEndFeed = dVal ;
return true ;
case MPA_TIPFEED :
m_dTipFeed = dVal ;
return true ;
case MPA_DEPTH :
m_sDepth = ::ToString( dVal) ;
return true ;
case MPA_STARTPOS :
m_dStartPos = dVal ;
return true ;
}
return false ;
}
//----------------------------------------------------------------------------
bool
ProbingData::SetParam( int nType, const string& sVal)
{
switch ( nType) {
case MPA_NAME :
m_sName = sVal ;
return true ;
case MPA_TOOL :
m_sToolName = sVal ;
return true ;
case MPA_DEPTH_STR :
m_sDepth = sVal ;
return true ;
case MPA_TUUID :
return ::FromString( sVal, m_ToolUuid) ;
case MPA_UUID :
return ::FromString( sVal, m_Uuid) ;
case MPA_SYSNOTES :
m_sSysNotes = sVal ;
return true ;
case MPA_USERNOTES :
m_sUserNotes = sVal ;
return true ;
case MPA_INITANGS :
m_sInitAngs = sVal ;
return true ;
case MPA_BLOCKEDAXIS :
m_sBlockedAxis = sVal ;
return true ;
}
return false ;
}
//----------------------------------------------------------------------------
bool
ProbingData::ResetTool( void)
{
m_sToolName.clear() ;
m_ToolUuid.Clear() ;
return true ;
}
//----------------------------------------------------------------------------
bool
ProbingData::GetParam( int nType, bool& bVal) const
{
switch ( nType) {
case MPA_INVERT :
bVal = m_bInvert ;
return true ;
case MPA_TOOLINVERT :
bVal = m_bToolInvert ;
return true ;
}
bVal = false ;
return false ;
}
//----------------------------------------------------------------------------
bool
ProbingData::GetParam( int nType, int& nVal) const
{
switch ( nType) {
case MPA_TYPE :
nVal = MT_PROBING ;
return true ;
case MPA_SCC :
nVal = m_nSolCh ;
return true ;
case MPA_SUBTYPE :
nVal = m_nSubType ;
return true ;
}
nVal = 0 ;
return false ;
}
//----------------------------------------------------------------------------
bool
ProbingData::GetParam( int nType, double& dVal) const
{
switch ( nType) {
case MPA_FEED :
dVal = m_dFeed ;
return true ;
case MPA_STARTFEED :
dVal = m_dStartFeed ;
return true ;
case MPA_ENDFEED :
dVal = m_dEndFeed ;
return true ;
case MPA_TIPFEED :
dVal = m_dTipFeed ;
return true ;
case MPA_STARTPOS :
dVal = m_dStartPos ;
return true ;
}
dVal = 0 ;
return false ;
}
//----------------------------------------------------------------------------
bool
ProbingData::GetParam( int nType, string& sVal) const
{
switch ( nType) {
case MPA_NAME :
sVal = m_sName ;
return true ;
case MPA_TOOL :
sVal = m_sToolName ;
return true ;
case MPA_DEPTH_STR :
sVal = m_sDepth ;
return true ;
case MPA_TUUID :
sVal = ::ToString( m_ToolUuid) ;
return true ;
case MPA_UUID :
sVal = ::ToString( m_Uuid) ;
return true ;
case MPA_SYSNOTES :
sVal = m_sSysNotes ;
return true ;
case MPA_USERNOTES :
sVal = m_sUserNotes ;
return true ;
case MPA_INITANGS :
sVal = m_sInitAngs ;
return true ;
case MPA_BLOCKEDAXIS :
sVal = m_sBlockedAxis ;
return true ;
}
sVal = "" ;
return false ;
}
+73
View File
@@ -0,0 +1,73 @@
//----------------------------------------------------------------------------
// EgalTech 2025-2025
//----------------------------------------------------------------------------
// File : ProbingData.h Data : 09.06.25 Versione : 2.7f2
// Contenuto : Dichiarazione della struct ProbingData e costanti associate.
//
//
//
// Modifiche : 09.06.25 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
#pragma once
#include "MachiningData.h"
//----------------------------------------------------------------------------
struct ProbingData : public MachiningData
{
EgtUUID m_ToolUuid ; // identificativo universale dell'utensile
std::string m_sToolName ; // nome dell'utensile
std::string m_sInitAngs ; // angoli iniziali suggeriti (Nome1=val1,Nome2=val2)
std::string m_sBlockedAxis ; // eventuale asse rotante bloccato (Nome=val)
int m_nSolCh ; // criterio scelta soluzione (quando possibili molteplici)
double m_dFeed ; // velocità di lavorazione normale ( se 0 da utensile)
double m_dStartFeed ; // velocità di lavorazione iniziale ( se 0 da utensile)
double m_dEndFeed ; // velocità di lavorazione finale ( se 0 da utensile)
double m_dTipFeed ; // velocità di lavorazione di sfondamento ( se 0 da utensile)
bool m_bToolInvert ; // flag per inversione direzione utensile da geometria
bool m_bInvert ; // flag di inversione direzione lavorazione
std::string m_sDepth ; // affondamento (espressione numerica)
double m_dStartPos ; // quota di inizio lavorazione (sempre >= 0)
int m_nSubType ; // da [Probing] di Ini di macchina
std::string m_sSysNotes ; // note interne
std::string m_sUserNotes ; // note dell'utente
ProbingData( void)
: m_ToolUuid(), m_nSolCh( 0), m_dFeed( 0), m_dStartFeed( 0), m_dEndFeed( 0), m_dTipFeed( 0),
m_bToolInvert( false), m_bInvert( false), m_dStartPos( 0), m_nSubType( 0) {}
ProbingData* Clone( void) const override ;
bool CopyFrom( const MachiningData* pMdata) override ;
bool SameAs(const MachiningData* pMdata) const override ;
int GetType( void) const override
{ return MT_PROBING ; }
int GetSize( void) const override ;
std::string GetTitle( void) const override ;
bool FromString( const std::string& sString, int& nKey) override ;
std::string ToString( int nKey) const override ;
bool IsOptional( int nKey) const override ;
bool SetParam( int nType, bool bVal) override ;
bool SetParam( int nType, int nVal) override ;
bool SetParam( int nType, double dVal) override ;
bool SetParam( int nType, const std::string& sVal) override ;
bool ResetTool( void) override ;
bool GetParam( int nType, bool& bVal) const override ;
bool GetParam( int nType, int& nVal) const override ;
bool GetParam( int nType, double& dVal) const override ;
bool GetParam( int nType, std::string& sVal) const override ;
bool GetTool( const ToolsMgr* pToolsMgr, const ToolData*& pTdata) const override ;
bool VerifyTool( const ToolsMgr* pToolsMgr, const std::string& sVal, const ToolData*& pTdata) const override ;
bool VerifySolCh( int nVal) const ;
} ;
//----------------------------------------------------------------------------
inline const ProbingData* GetProbingData( const MachiningData* pMdata)
{ if ( pMdata == nullptr || pMdata->GetType() != MT_PROBING)
return nullptr ;
return ( static_cast<const ProbingData*>( pMdata)) ; }
inline ProbingData* GetProbingData( MachiningData* pMdata)
{ if ( pMdata == nullptr || pMdata->GetType() != MT_PROBING)
return nullptr ;
return ( static_cast<ProbingData*>( pMdata)) ; }
+3 -6
View File
@@ -29,11 +29,8 @@
using namespace std ;
//------------------------------ Errors --------------------------------------
// 1001 = "Error with setup : xxx"
// 1002 = "Error opening Cnc file"
//----------------------------------------------------------------------------
static const string ERR_EXT = ".err" ;
// 1002 = "Error with setup : xxx"
// 1003 = "Error opening Cnc file"
//----------------------------------------------------------------------------
Processor::Processor( void)
@@ -318,7 +315,7 @@ Processor::ProcessMachining( int nOpId, int nOpInd)
return false ;
// Verifico non sia vuota
if ( m_pMchMgr->IsMachiningEmpty())
if ( m_pMchMgr->IsMachiningEmpty( NEED_ONE_TP_OK))
return true ;
// Recupero l'utensile della lavorazione corrente
+74 -47
View File
@@ -4,7 +4,7 @@
// File : SawFinishing.cpp Data : 23.04.19 Versione : 2.1d3
// Contenuto : Implementazione gestione finitura superficie con lama.
//
// Note : Questa lavorazione è sempre espressa nel riferimento globale.
// Note : Questa lavorazione è sempre espressa nel riferimento globale.
//
// Modifiche : 05.04.16 DS Creazione modulo.
// 23.04.19 DS Aggiunte cornici curve.
@@ -51,6 +51,7 @@ using namespace std ;
// 2713 = "Error in SawFinishing : link movements not calculable"
// 2714 = "Error in SawFinishing : link outstroke xx"
// 2715 = "Error in SawFinishing : post apply not calculable"
// 2716 = "Error in SawFinishing : special apply not calculable"
// 2751 = "Warning in SawFinishing : Skipped entity (xx)"
// 2752 = "Warning in SawFinishing : No machinable path"
// 2753 = "Warning in SawFinishing : Tool name changed (xx)"
@@ -446,14 +447,15 @@ SawFinishing::SetParam( int nType, const string& sVal)
bool
SawFinishing::SetGeometry( const SELVECTOR& vIds)
{
// verifico validità gestore DB geometrico
// verifico validità gestore DB geometrico
if ( m_pGeomDB == nullptr)
return false ;
// reset della geometria corrente
// copia temporanea e reset della geometria corrente
SELVECTOR vOldId = m_vId ;
m_vId.clear() ;
// verifico che gli identificativi rappresentino delle entità ammissibili
// verifico che gli identificativi rappresentino delle entità ammissibili
for ( const auto& Id : vIds) {
// test sull'entità
// test sull'entità
int nSubs ;
if ( ! VerifyGeometry( Id, nSubs)) {
string sInfo = "Warning in SawFinishing : Skipped entity " + ToString( Id) ;
@@ -464,7 +466,8 @@ SawFinishing::SetGeometry( const SELVECTOR& vIds)
m_vId.emplace_back( Id) ;
}
// aggiorno lo stato
m_nStatus |= MCH_ST_GEO_MODIF ;
if ( m_vId != vOldId)
m_nStatus |= MCH_ST_GEO_MODIF ;
// restituisco presenza geometria da lavorare
return ( ! m_vId.empty()) ;
}
@@ -485,20 +488,22 @@ SawFinishing::Apply( bool bRecalc, bool bPostApply)
int nCurrCuts = m_nCuts ;
m_nCuts = 0 ;
// verifico validità gestore DB geometrico e Id del gruppo
// verifico validità gestore DB geometrico e Id del gruppo
if ( m_pGeomDB == nullptr || ! m_pGeomDB->ExistsObj( m_nOwnerId))
return false ;
// aggiorno dati geometrici dell'utensile
bool bToolChanged = true ;
if ( ! UpdateToolData( &bToolChanged)) {
if ( ! UpdateToolData()) {
m_pMchMgr->SetLastError( 2701, "Error in SawFinishing : UpdateToolData failed") ;
return false ;
}
// se modificata geometria, necessario ricalcolo
if ( ( m_nStatus & MCH_ST_GEO_MODIF) != 0)
bRecalc = true ;
// verifico se necessario continuare nell'aggiornamento
if ( ! bRecalc && ! bToolChanged &&
( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) {
if ( ! bRecalc && ( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) {
// confermo i percorsi di lavorazione
m_nCuts = nCurrCuts ;
string sLog = string( "SawFinishing apply skipped : status ") + ( m_nStatus == MCH_ST_OK ? "already ok" : "no postapply") ;
@@ -515,7 +520,7 @@ SawFinishing::Apply( bool bRecalc, bool bPostApply)
// recupero gruppo per geometria ausiliaria
int nAuxId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_AUX) ;
// se non c'è, lo aggiungo
// se non c'è, lo aggiungo
if ( nAuxId == GDB_ID_NULL) {
nAuxId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
if ( nAuxId == GDB_ID_NULL)
@@ -537,7 +542,7 @@ SawFinishing::Apply( bool bRecalc, bool bPostApply)
// recupero gruppo per geometria di lavorazione (Cutter Location)
int nClId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_CL) ;
// se non c'è, lo aggiungo
// se non c'è, lo aggiungo
if ( nClId == GDB_ID_NULL) {
nClId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
if ( nClId == GDB_ID_NULL)
@@ -584,7 +589,7 @@ SawFinishing::Apply( bool bRecalc, bool bPostApply)
// eseguo aggiornamento assi macchina e collegamento con operazione precedente
if ( ! Update( bPostApply))
return false ;
// aggiorno stato della lavorazione
m_nStatus = ( bPostApply ? MCH_ST_OK : MCH_ST_NO_POSTAPPL) ;
// dichiaro successiva da aggiornare
@@ -599,7 +604,7 @@ SawFinishing::Apply( bool bRecalc, bool bPostApply)
bool
SawFinishing::Update( bool bPostApply)
{
// verifico validità gestore DB geometrico e Id del gruppo
// verifico validità gestore DB geometrico e Id del gruppo
if ( m_pGeomDB == nullptr || ! m_pGeomDB->ExistsObj( m_nOwnerId))
return false ;
@@ -609,7 +614,7 @@ 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)
// 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
@@ -628,6 +633,19 @@ SawFinishing::Update( bool bPostApply)
return false ;
}
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
CalcAndSetAxesBBox() ;
// esecuzione eventuali personalizzazioni speciali
string sSpecErr ;
if ( bPostApply && ! SpecialApply( sSpecErr)) {
if ( ! IsEmptyOrSpaces( sSpecErr))
m_pMchMgr->SetLastError( 2716, sSpecErr) ;
else
m_pMchMgr->SetLastError( 2716, "Error in SawFinishing : special apply not calculable") ;
return false ;
}
// gestione movimenti all'inizio di ogni singolo percorso di lavorazione e alla fine della lavorazione
if ( ! AdjustStartEndMovements()) {
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
@@ -638,14 +656,11 @@ SawFinishing::Update( bool bPostApply)
return false ;
}
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
CalcAndSetAxesBBox() ;
// esecuzione eventuali personalizzazioni
string sErr ;
if ( bPostApply && ! PostApply( sErr)) {
if ( ! IsEmptyOrSpaces( sErr))
m_pMchMgr->SetLastError( 2715, sErr) ;
// esecuzione eventuali personalizzazioni finali
string sPostErr ;
if ( bPostApply && ! PostApply( sPostErr)) {
if ( ! IsEmptyOrSpaces( sPostErr))
m_pMchMgr->SetLastError( 2715, sPostErr) ;
else
m_pMchMgr->SetLastError( 2715, "Error in SawFinishing : post apply not calculable") ;
return false ;
@@ -790,7 +805,7 @@ SawFinishing::GetToolData( void) const
//----------------------------------------------------------------------------
bool
SawFinishing::UpdateToolData( bool* pbChanged)
SawFinishing::UpdateToolData( void)
{
// recupero il gestore DB utensili della macchina corrente
ToolsMgr* pTMgr = m_pMchMgr->GetCurrToolsMgr() ;
@@ -841,9 +856,9 @@ SawFinishing::UpdateToolData( bool* pbChanged)
m_Params.m_sToolName + ")" ;
m_pMchMgr->SetWarning( 2754, sInfo) ;
}
// se definito parametro di ritorno, lo assegno
if ( pbChanged != nullptr)
*pbChanged = bChanged ;
// se modificato, aggiusto lo stato
if ( bChanged)
m_nStatus = MCH_ST_TO_VERIFY ;
return true ;
}
@@ -851,7 +866,7 @@ SawFinishing::UpdateToolData( bool* pbChanged)
bool
SawFinishing::GetGeometry( SELVECTOR& vIds) const
{
// restituisco l'elenco delle entità
// restituisco l'elenco delle entità
vIds = m_vId ;
return true ;
}
@@ -946,7 +961,7 @@ SawFinishing::GetCurve( SelData Id)
bool
SawFinishing::AdjustGeometry( int nAuxId)
{
// sgrossatura di cornici diritte : due o più curve (sezioni e guida rettilinea)
// sgrossatura di cornici diritte : due o più curve (sezioni e guida rettilinea)
// sgrossatura di cornici curve : due curve (sezione e guida curva)
size_t nCrvCount = m_vId.size() ;
if ( nCrvCount >= 2) {
@@ -970,7 +985,7 @@ SawFinishing::AdjustGeometry( int nAuxId)
return false ;
}
}
// l'ultima curva è la guida
// l'ultima curva è la guida
PtrOwner<ICurve> pGuide( GetCurve( m_vId[nCrvCount-1])) ;
if ( IsNull( pGuide))
return false ;
@@ -1109,6 +1124,9 @@ SawFinishing::CalculateStraightAlongToolPath( int nAuxId, int nClId)
SetToolDir( vtTool) ;
SetCorrAuxDir( vtCorr) ;
// assegno il vettore estrazione al gruppo del percorso
m_pGeomDB->SetInfo( nPxId, KEY_EXTR, vtTool) ;
// Classifico i tratti a seconda della pendenza (salita, discesa, verticale, orizzontale)
INTVECTOR vnClass ;
ClassifySection( pCrv, vnClass) ;
@@ -1184,7 +1202,7 @@ SawFinishing::CalculateStraightAlongToolPath( int nAuxId, int nClId)
}
}
}
// se c'è qualcosa in sospeso
// se c'è qualcosa in sospeso
if ( nStatus != CCL_VERT) {
bSkipMax = false ;
bool bInvert = ( nStatus == CCL_RISE) ;
@@ -1305,6 +1323,9 @@ SawFinishing::CalculateStraightAcrossToolPath( int nAuxId, int nClId)
SetToolDir( vtTool) ;
SetCorrAuxDir( vtCorr) ;
// assegno il vettore estrazione al gruppo del percorso
m_pGeomDB->SetInfo( nPxId, KEY_EXTR, vtTool) ;
// Inizializzo contatore tagli
m_nCuts = 0 ;
@@ -1377,7 +1398,7 @@ SawFinishing::CalculateCurvedAlongToolPath( int nAuxId, int nClId)
// recupero il suo riferimento
Frame3d frGdL ;
m_pGeomDB->GetGlobFrame( nGuideId, frGdL) ;
// porto la curva in globale (dovrebbe già avere riferimento globale)
// porto la curva in globale (dovrebbe già avere riferimento globale)
pGuide->ToGlob( frGdL) ;
// recupero il box globale della linea guida
BBox3d b3Guide ;
@@ -1416,6 +1437,9 @@ SawFinishing::CalculateCurvedAlongToolPath( int nAuxId, int nClId)
SetPathId( nPxId) ;
SetToolDir( vtTool) ;
// assegno il vettore estrazione al gruppo del percorso
m_pGeomDB->SetInfo( nPxId, KEY_EXTR, vtTool) ;
// Classifico i tratti a seconda della pendenza (salita, discesa, verticale, orizzontale)
INTVECTOR vnClass ;
ClassifySection( pCrv, vnClass) ;
@@ -1492,7 +1516,7 @@ SawFinishing::CalculateCurvedAlongToolPath( int nAuxId, int nClId)
}
}
}
// se c'è qualcosa in sospeso
// se c'è qualcosa in sospeso
if ( nStatus != CCL_VERT) {
bSkipMax = false ;
bool bInvert = ( nStatus == CCL_RISE) ;
@@ -1536,7 +1560,7 @@ SawFinishing::CalculateCurvedAcrossToolPath( int nAuxId, int nClId)
// recupero il suo riferimento
Frame3d frGdL ;
m_pGeomDB->GetGlobFrame( nGuideId, frGdL) ;
// porto la curva in globale (dovrebbe già avere riferimento globale)
// porto la curva in globale (dovrebbe già avere riferimento globale)
pGuide->ToGlob( frGdL) ;
// recupero il box globale della linea guida
BBox3d b3Guide ;
@@ -1612,6 +1636,9 @@ SawFinishing::CalculateCurvedAcrossToolPath( int nAuxId, int nClId)
SetPathId( nPxId) ;
SetToolDir( vtTool) ;
// assegno il vettore estrazione al gruppo del percorso
m_pGeomDB->SetInfo( nPxId, KEY_EXTR, vtTool) ;
// Inizializzo contatore tagli
m_nCuts = 0 ;
@@ -1639,7 +1666,7 @@ SawFinishing::CalculateCurvedAcrossToolPath( int nAuxId, int nClId)
vtCorr.Rotate( Z_AX, dAngRotDeg - 90) ;
// flag di inizio
bool bFirst = ( dLen < EPS_SMALL) ;
// se non è inizio
// se non è inizio
bool bCorner = false ;
Vector3d vtPrev ;
if ( ! bFirst) {
@@ -1780,7 +1807,7 @@ SawFinishing::CalculateSection( int nSectGrpId, ICurve*& pSect)
bool
SawFinishing::TrimSection( ICurve* pCrv)
{
// se parametri di accorciamento iniziale e finale sono nulli, non faccio alcunché
// se parametri di accorciamento iniziale e finale sono nulli, non faccio alcunché
if ( m_Params.m_dStartAddLen > - EPS_SMALL && m_Params.m_dEndAddLen > -EPS_SMALL)
return true ;
@@ -1833,7 +1860,7 @@ SawFinishing::CalculateGuideLine( int nGuideId, const BBox3d& b3Sect,
// recupero il suo riferimento
Frame3d frGdL ;
m_pGeomDB->GetGlobFrame( nGuideId, frGdL) ;
// porto la curva in globale (dovrebbe già avere riferimento globale)
// porto la curva in globale (dovrebbe già avere riferimento globale)
pGuide->ToGlob( frGdL) ;
// recupero gli estremi della linea guida
pGuide->GetStartPoint( ptGdStart) ;
@@ -2216,14 +2243,14 @@ SawFinishing::CalcAlongZigZagCut( const Point3d& ptStart, const Point3d& ptEnd,
if ( AddLinearMove( ptNewStart) == GDB_ID_NULL)
return false ;
}
// se il precedente è più fuori
// se il precedente è più fuori
else if ( dDiff > 0) {
// allungo nuova passata
SetFeed( ( bVert ? GetVertFeed() : GetFeed())) ;
if ( AddLinearMove( ptNewStart - dDiff * vtNewDir) == GDB_ID_NULL)
return false ;
}
// se il corrente è più fuori
// se il corrente è più fuori
else {
// allungo passata precedente
if ( AddLinearMove( ptLast + dDiff * vtNewDir) == GDB_ID_NULL)
@@ -2592,7 +2619,7 @@ SawFinishing::CalcCurvedAlongZigZagCut( const ICurve* pCut, const Vector3d& vtTo
GetCurrPos( ptCurr) ;
// differenza tra corrente e nuovo lungo direzione ortogonale
double dOrtStartDiff = ( ptNewStart - ptCurr) * vtOrtStart ;
// se punto corrente più fuori, aggiungo punto fuori allo stesso modo sul nuovo
// se punto corrente più fuori, aggiungo punto fuori allo stesso modo sul nuovo
if ( dOrtStartDiff < - 10 * EPS_SMALL) {
Point3d ptOut = ptNewStart + ( - dOrtStartDiff * vtOrtStart) ;
SetFlag( 0) ;
@@ -2600,7 +2627,7 @@ SawFinishing::CalcCurvedAlongZigZagCut( const ICurve* pCut, const Vector3d& vtTo
if ( ! SameAsCurrPos( ptOut) && AddLinearMove( ptOut) == GDB_ID_NULL)
return false ;
}
// se altrimenti più dentro, aggiungo punto fuori allo stesso modo sul corrente
// se altrimenti più dentro, aggiungo punto fuori allo stesso modo sul corrente
else if ( dOrtStartDiff > 10 * EPS_SMALL) {
Point3d ptOut = ptCurr + ( dOrtStartDiff * vtOrtStart) ;
SetFlag( 0) ;
@@ -2635,14 +2662,14 @@ SawFinishing::CalcCurvedAlongZigZagCut( const ICurve* pCut, const Vector3d& vtTo
if ( AddLinearMove( ptNewStart) == GDB_ID_NULL)
return false ;
}
// se il precedente è più fuori
// se il precedente è più fuori
else if ( dDiff > 0) {
// allungo nuova passata
SetFeed( ( bVert ? GetVertFeed() : GetFeed())) ;
if ( AddLinearMove( ptNewStart - dDiff * vtDirStart) == GDB_ID_NULL)
return false ;
}
// se il corrente è più fuori
// se il corrente è più fuori
else {
// allungo passata precedente
if ( AddLinearMove( ptLast + dDiff * vtDirStart) == GDB_ID_NULL)
@@ -2654,7 +2681,7 @@ SawFinishing::CalcCurvedAlongZigZagCut( const ICurve* pCut, const Vector3d& vtTo
}
}
}
// se non ci sono già, vado all'inizio dell'arco
// se non ci sono già, vado all'inizio dell'arco
if ( ! SameAsCurrPos( ptStart) && AddLinearMove( ptStart) == GDB_ID_NULL)
return false ;
// 3 -> movimento di lato al punto finale
@@ -2816,7 +2843,7 @@ SawFinishing::AddCornerApproach( const Point3d& ptP, const Vector3d& vtCorr, con
{
// impongo minima distanza di approccio
dAppr = max( dAppr, 1.0) ;
// recupero posizione precedente (correzione precedente è passata perchè già impostata la nuova)
// recupero posizione precedente (correzione precedente è passata perchè già impostata la nuova)
Point3d ptPrev ;
if ( ! GetCurrPos( ptPrev))
return false ;
@@ -2927,7 +2954,7 @@ SawFinishing::GetHeightOnSection( const ICurve* pSect, double dX, double dYmin,
dY = aInfo.IciA[0].ptI.y ;
return true ;
}
// se non c'è intersezione assegno il minimo
// se non c'è intersezione assegno il minimo
dY = dYmin ;
return true ;
}
+9 -3
View File
@@ -38,8 +38,14 @@ class SawFinishing : public Machining
public : // Operation
int GetType( void) const override
{ return OPER_SAWFINISHING ; }
bool IsEmpty( void) const override
{ return ( m_nCuts == 0) ; }
bool IsEmpty( int nEmptyType = NEED_GEOM) const override
{ if ( m_nCuts == 0)
return true ;
if ( nEmptyType == NEED_ONE_TP_OK)
return ( ! IsAtLeastOnePathOk()) ;
if ( nEmptyType == NEED_ALL_TP_OK)
return ( ! AreAllPathsOk()) ;
return false ; }
bool UpdateStatus( int nModif) override
{ m_nStatus |= nModif ; return true ; }
@@ -62,7 +68,7 @@ class SawFinishing : public Machining
bool GetParam( int nType, int& nVal) const override ;
bool GetParam( int nType, double& dVal) const override ;
bool GetParam( int nType, std::string& sVal) const override ;
bool UpdateToolData( bool* pbChanged = nullptr) override ;
bool UpdateToolData( void) override ;
const ToolData& GetToolData( void) const override ;
bool GetGeometry( SELVECTOR& vIds) const override ;
+903 -218
View File
File diff suppressed because it is too large Load Diff
+21 -10
View File
@@ -38,8 +38,14 @@ class SawRoughing : public Machining
public : // Operation
int GetType( void) const override
{ return OPER_SAWROUGHING ; }
bool IsEmpty( void) const override
{ return ( m_nCuts == 0) ; }
bool IsEmpty( int nEmptyType = NEED_GEOM) const override
{ if ( m_nCuts == 0)
return true ;
if ( nEmptyType == NEED_ONE_TP_OK)
return ( ! IsAtLeastOnePathOk()) ;
if ( nEmptyType == NEED_ALL_TP_OK)
return ( ! AreAllPathsOk()) ;
return false ; }
bool UpdateStatus( int nModif) override
{ m_nStatus |= nModif ; return true ; }
@@ -62,7 +68,7 @@ class SawRoughing : public Machining
bool GetParam( int nType, int& nVal) const override ;
bool GetParam( int nType, double& dVal) const override ;
bool GetParam( int nType, std::string& sVal) const override ;
bool UpdateToolData( bool* pbChanged = nullptr) override ;
bool UpdateToolData( void) override ;
const ToolData& GetToolData( void) const override ;
bool GetGeometry( SELVECTOR& vIds) const override ;
@@ -73,19 +79,24 @@ class SawRoughing : public Machining
bool VerifyGeometry( SelData Id, int& nSubs) ;
ICurve* GetCurve( SelData Id) ;
bool AdjustGeometry( int nAuxId) ;
bool CalculateToolPath( int nAuxId, int nClId) ;
bool CalculateToolPath( int nAuxId, int nPvId, int nClId) ;
bool CalculateCurvedToolPath( int nAuxId, int nClId) ;
bool GeneratePreView( int nPathId, const ICurve* pSect, const Frame3d& frSect, double dGuideLen,
const Vector3d& vtGdDir, const BBox3d& b3Raw) ;
bool CalculateSection( int nSectGrpId, ICurve*& pSect) ;
bool TrimSection( ICurve* pCrv) ;
bool CalculateGuideLine( int nGuideId, const BBox3d& b3Sect,
Point3d& ptGdStart, Point3d& ptGdEnd, Vector3d& vtGdDir) ;
bool CalculateGuideLine( int nGuideId, const BBox3d& b3Sect, Point3d& ptGdStart, Point3d& ptGdEnd, Vector3d& vtGdDir) ;
bool AdaptGuideLineToRaw( Point3d& ptGdStart, Point3d& ptGdEnd, const Vector3d& vtGdDir, const BBox3d& b3Raw) const ;
bool CalculateOneWayCut( const Point3d& ptStart, const Point3d& ptEnd, const Vector3d& vtDir,
const Vector3d& vtTool, const Vector3d& vtCorr, double dElev, bool bFirst, bool bLast) ;
const Vector3d& vtTool, const Vector3d& vtCorr, double dElev, bool bFirst, bool bLast, const BBox3d& b3Raw) ;
bool CalculateZigZagCut( const Point3d& ptStart, const Point3d& ptEnd, const Vector3d& vtDir,
const Vector3d& vtTool, const Vector3d& vtCorr, double dElev, bool bFirst, bool bLast,
int& nCount) ;
int& nCount, const BBox3d& b3Raw) ;
bool CalculateZConstCut( const ICurve* pCrv, double dXmin, double dXmax, bool bIncludeMax, bool bIncludeMin,
const Point3d& ptGdStart, const Point3d& ptGdEnd, const Vector3d& vtGdDir, const Frame3d& frSect,
const BBox3d& b3Raw, double dDepth, bool bFirstInterval, bool bLastInterval, int& nCount) ;
bool CalculateCurvedZigZagCut( const ICurve* pCut, const Vector3d& vtTool, double dElev, bool bFirst, bool bLast,
int& nCount) ;
int& nCount) ;
bool AddApproach( const Point3d& ptP, const Vector3d& vtCorr, bool bFirst,
double dSafeZ, double dElev, double dAppr) ;
bool AddRetract( const Point3d& ptP, const Vector3d& vtCorr, double dSafeZ, double dElev, double dAppr) ;
@@ -112,7 +123,7 @@ class SawRoughing : public Machining
{ return ( IsUnknownValue( m_Params.m_dOffsR) ? m_TParams.m_dOffsR : m_Params.m_dOffsR) ; }
private :
SELVECTOR m_vId ; // identificativi entità geometriche da lavorare
SELVECTOR m_vId ; // identificativi entità geometriche da lavorare
bool m_bStraight ; // flag per cornici diritte/curve
SawRoughingData m_Params ; // parametri lavorazione
ToolData m_TParams ; // parametri utensile
+143 -41
View File
@@ -18,6 +18,7 @@
#include "Sawing.h"
#include "GeoConst.h"
#include "OperationConst.h"
#include "OperUserNotesConst.h"
#include "/EgtDev/Include/EXeCmdLogOff.h"
#include "/EgtDev/Include/EXeConst.h"
#include "/EgtDev/Include/EGkCurveLine.h"
@@ -56,6 +57,7 @@ using namespace std ;
// 2217 = "Error in Sawing : link movements not calculable"
// 2218 = "Error in Sawing : link outstroke xxx"
// 2219 = "Error in Sawing : post apply not calculable"
// 2220 = "Error in Sawing : special apply not calculable"
// 2251 = "Warning in Sawing : Skipped entity xxx"
// 2252 = "Warning in Sawing : No machinable path"
// 2253 = "Warning in Sawing : Tool name changed (xx)"
@@ -538,7 +540,8 @@ Sawing::SetGeometry( const SELVECTOR& vIds)
// verifico validità gestore DB geometrico
if ( m_pGeomDB == nullptr)
return false ;
// reset della geometria corrente
// copia temporanea e reset della geometria corrente
SELVECTOR vOldId = m_vId ;
m_vId.clear() ;
// verifico che gli identificativi rappresentino delle entità ammissibili
int nType = GEO_NONE ;
@@ -554,7 +557,8 @@ Sawing::SetGeometry( const SELVECTOR& vIds)
m_vId.emplace_back( Id) ;
}
// aggiorno lo stato
m_nStatus |= MCH_ST_GEO_MODIF ;
if ( m_vId != vOldId)
m_nStatus |= MCH_ST_GEO_MODIF ;
// restituisco presenza geometria da lavorare
return ( ! m_vId.empty() || vIds.empty()) ;
}
@@ -641,15 +645,17 @@ Sawing::Apply( bool bRecalc, bool bPostApply)
return false ;
// aggiorno dati geometrici dell'utensile
bool bToolChanged = true ;
if ( ! UpdateToolData( &bToolChanged)) {
if ( ! UpdateToolData()) {
m_pMchMgr->SetLastError( 2201, "Error in Sawing : UpdateToolData failed") ;
return false ;
}
// se modificata geometria, necessario ricalcolo
if ( ( m_nStatus & MCH_ST_GEO_MODIF) != 0)
bRecalc = true ;
// verifico se necessario continuare nell'aggiornamento
if ( ! bRecalc && ! bToolChanged &&
( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) {
if ( ! bRecalc && ( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) {
// confermo i percorsi di lavorazione
m_nCuts = nCurrCuts ;
string sLog = string( "Sawing apply skipped : status ") + ( m_nStatus == MCH_ST_OK ? "already ok" : "no postapply") ;
@@ -694,7 +700,7 @@ Sawing::Apply( bool bRecalc, bool bPostApply)
// verifiche per attacchi/uscite senza approcci e retrazioni
int nDownSE = 0 ;
GetValInNotes( m_Params.m_sUserNotes, "DownSE", nDownSE) ;
GetValInNotes( m_Params.m_sUserNotes, UN_DOWNSE, nDownSE) ;
m_bDownSE = ( nDownSE != 0 && m_Params.m_nStepType == SAW_ST_TOANDFROM) ;
// recupero gruppo per geometria di lavorazione (Cutter Location)
@@ -777,6 +783,16 @@ Sawing::Update( bool bPostApply)
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
CalcAndSetAxesBBox() ;
// esecuzione eventuali personalizzazioni speciali
string sSpecErr ;
if ( bPostApply && ! SpecialApply( sSpecErr)) {
if ( ! IsEmptyOrSpaces( sSpecErr))
m_pMchMgr->SetLastError( 2220, sSpecErr) ;
else
m_pMchMgr->SetLastError( 2220, "Error in Sawing : special apply not calculable") ;
return false ;
}
// gestione movimenti all'inizio di ogni singolo percorso di lavorazione e alla fine della lavorazione
if ( ! AdjustStartEndMovements()) {
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
@@ -787,11 +803,11 @@ Sawing::Update( bool bPostApply)
return false ;
}
// esecuzione eventuali personalizzazioni
string sErr ;
if ( bPostApply && ! PostApply( sErr)) {
if ( ! IsEmptyOrSpaces( sErr))
m_pMchMgr->SetLastError( 2219, sErr) ;
// esecuzione eventuali personalizzazioni finali
string sPostErr ;
if ( bPostApply && ! PostApply( sPostErr)) {
if ( ! IsEmptyOrSpaces( sPostErr))
m_pMchMgr->SetLastError( 2219, sPostErr) ;
else
m_pMchMgr->SetLastError( 2219, "Error in Sawing : post apply not calculable") ;
return false ;
@@ -1028,7 +1044,7 @@ Sawing::GetToolData( void) const
//----------------------------------------------------------------------------
bool
Sawing::UpdateToolData( bool* pbChanged)
Sawing::UpdateToolData( void)
{
// recupero il gestore DB utensili della macchina corrente
ToolsMgr* pTMgr = m_pMchMgr->GetCurrToolsMgr() ;
@@ -1075,9 +1091,9 @@ Sawing::UpdateToolData( bool* pbChanged)
m_Params.m_sToolName + ")" ;
m_pMchMgr->SetWarning( 2254, sInfo) ;
}
// se definito parametro di ritorno, lo assegno
if ( pbChanged != nullptr)
*pbChanged = bChanged ;
// se modificato, aggiusto lo stato
if ( bChanged)
m_nStatus = MCH_ST_TO_VERIFY ;
return true ;
}
@@ -1255,7 +1271,7 @@ Sawing::GetCurve( SelData Id)
pCrvCompo->ToGlob( frGlob) ;
vtN.ToGlob( frGlob) ;
// sistemazioni varie
AdjustCurveFromSurf( pCrvCompo, TOOL_ORTUP, FACE_DOWN, V_NULL, 0, 1) ;
AdjustCurveFromSurf( pCrvCompo, TOOL_ORTUP, FACE_DOWN, V_NULL, {}, 0, 1) ;
// aggiusto lato lavoro e inverti, angolo di fianco e lato mandrino
if ( m_Params.m_nWorkSide == SAW_WS_CENTER)
m_Params.m_nWorkSide = SAW_WS_RIGHT ;
@@ -1304,7 +1320,7 @@ Sawing::GetCurve( SelData Id)
pCrvCompo->ToGlob( frGlob) ;
vtN.ToGlob( frGlob) ;
// sistemazioni varie
AdjustCurveFromSurf( pCrvCompo, TOOL_ORTUP, FACE_DOWN, V_NULL, 0, 1) ;
AdjustCurveFromSurf( pCrvCompo, TOOL_ORTUP, FACE_DOWN, V_NULL, {}, 0, 1) ;
// aggiusto lato lavoro e inverti, angolo di fianco e lato mandrino
if ( m_Params.m_nWorkSide == SAW_WS_CENTER)
m_Params.m_nWorkSide = SAW_WS_RIGHT ;
@@ -1587,6 +1603,15 @@ Sawing::ProcessPath( int nPathId, int nPvId, int nClId)
double dThick ;
pCompo->GetThickness( dThick) ;
// aggiusto eventuali normali inverse di archi rispetto ad estrusione
const ICurve* pCrv = pCompo->GetFirstCurve() ;
while ( pCrv != nullptr) {
const ICurveArc* pArc = GetCurveArc( pCrv) ;
if ( pArc != nullptr && pArc->GetNormVersor() * vtExtr < 0)
const_cast<ICurveArc*>(pArc)->InvertN() ;
pCrv = pCompo->GetNextCurve() ;
}
// recupero distanza da fondo dei grezzi interessati dal percorso
double dRbDist, dAllRbDist ;
double dToler = 2 * m_TParams.m_dThick + tan( abs( m_Params.m_dSideAngle) * DEGTORAD) * m_TParams.m_dMaxMat ;
@@ -1864,8 +1889,8 @@ 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=") ;
if ( ! sFsta.empty()) {
string sFsta ;
if ( GetValInNotes( m_Params.m_sUserNotes, UN_FSTA, sFsta)) {
string sLen, sPu ;
SplitFirst( sFsta, ",", sLen, sPu) ;
if ( FromString( sLen, FvVar.dLenStart))
@@ -1875,8 +1900,8 @@ Sawing::ProcessLine( const ICurve* pCrvP, const ICurveLine* pLineC, const ICurve
}
}
if ( pCrvN == nullptr) {
string sFend = ExtractInfo( m_Params.m_sUserNotes, "Fend=") ;
if ( ! sFend.empty()) {
string sFend ;
if ( GetValInNotes( m_Params.m_sUserNotes, UN_FEND, sFend)) {
string sLen, sPu ;
SplitFirst( sFend, ",", sLen, sPu) ;
if ( FromString( sLen, FvVar.dLenEnd))
@@ -1889,10 +1914,10 @@ Sawing::ProcessLine( const ICurve* pCrvP, const ICurveLine* pLineC, const ICurve
// recupero eventuali estensioni dei baffi (whiskers)
double dStartWhiskExt = 0 ;
if ( m_Params.m_nLeadInType == SAW_LI_CENT)
GetValInNotes( m_Params.m_sUserNotes, "SWE", dStartWhiskExt) ;
GetValInNotes( m_Params.m_sUserNotes, UN_SWE, dStartWhiskExt) ;
double dEndWhiskExt = 0 ;
if ( m_Params.m_nLeadOutType == SAW_LO_CENT)
GetValInNotes( m_Params.m_sUserNotes, "EWE", dEndWhiskExt) ;
GetValInNotes( m_Params.m_sUserNotes, UN_EWE, dEndWhiskExt) ;
// Se richiesto Preview
if ( nPvId != GDB_ID_NULL) {
@@ -1928,6 +1953,14 @@ Sawing::GenerateLinePv( const ICurveLine* pLine, const Vector3d& vtTool, const V
return false ;
m_pGeomDB->SetName( nPxId, sName) ;
m_pGeomDB->SetMaterial( nPxId, BLUE) ;
// assegno il vettore estrazione al gruppo del percorso
m_pGeomDB->SetInfo( nPxId, KEY_EXTR, Z_AX) ;
// assegno i punti di inizio e fine al gruppo del percorso (tenendo conto degli allungamenti in vera lavorazione)
Vector3d vtMidDir ; pLine->GetMidDir( vtMidDir) ;
m_pGeomDB->SetInfo( nPxId, KEY_START, pLine->GetStart() - dStartWhiskExt * vtMidDir) ;
m_pGeomDB->SetInfo( nPxId, KEY_END, pLine->GetEnd() + dEndWhiskExt * vtMidDir) ;
// assegno l'elevazione massima
m_pGeomDB->SetInfo( nPxId, KEY_ELEV, dElev) ;
// punti notevoli
Point3d ptIni = pLine->GetStart() + dElev * vtCorr ;
@@ -2108,7 +2141,7 @@ Sawing::GenerateLineCl( const ICurveLine* pLine, const Vector3d& vtTool, const V
m_pGeomDB->SetName( nPxId, sName) ;
m_pGeomDB->SetMaterial( nPxId, BLUE) ;
// assegno il vettore estrazione al gruppo del percorso
m_pGeomDB->SetInfo( nPxId, KEY_EXTR, Vector3d( 0, 0, 1)) ;
m_pGeomDB->SetInfo( nPxId, KEY_EXTR, Z_AX) ;
// assegno i punti di inizio e fine al gruppo del percorso
m_pGeomDB->SetInfo( nPxId, KEY_START, pLine->GetStart()) ;
m_pGeomDB->SetInfo( nPxId, KEY_END, pLine->GetEnd()) ;
@@ -2141,6 +2174,15 @@ Sawing::GenerateLineCl( const ICurveLine* pLine, const Vector3d& vtTool, const V
double dActLstep = GetStepLast() ;
// direzione della linea
Vector3d vtDir ; pLine->GetStartDir( vtDir) ;
// parametri per partenza/arrivo a feed ridotta
double dCutLen ; pLine->GetLength( dCutLen) ;
double dStartFraz = FvVar.dLenStart / dCutLen ;
double dEndFraz = FvVar.dLenEnd / dCutLen ;
if ( dStartFraz + dEndFraz > 1) {
dStartFraz /= ( dStartFraz + dEndFraz) ;
dEndFraz = 1 - dStartFraz ;
}
double dMidFraz = 1 - dEndFraz ;
// Se una sola passata
if ( m_Params.m_nStepType != SAW_ST_TOANDFROM &&
@@ -2189,16 +2231,6 @@ Sawing::GenerateLineCl( const ICurveLine* pLine, const Vector3d& vtTool, const V
}
// 3 -> movimento di lato al punto finale
if ( FvVar.dLenStart > EPS_SMALL || FvVar.dLenEnd > EPS_SMALL) {
// lunghezza del taglio
double dCutLen ; pLine->GetLength( dCutLen) ;
double dStartFraz = FvVar.dLenStart / dCutLen ;
double dEndFraz = FvVar.dLenEnd / dCutLen ;
double dMidFraz = 1 - dEndFraz ;
if ( dStartFraz + dEndFraz > 1) {
dStartFraz /= ( dStartFraz + dEndFraz) ;
dEndFraz = 1 - dStartFraz ;
dMidFraz = dStartFraz ;
}
// punto finale
Point3d ptP3 = pLine->GetEnd() ;
// 3a -> eventuale movimento di lato a feed ridotta di inizio percorso
@@ -2274,9 +2306,38 @@ Sawing::GenerateLineCl( const ICurveLine* pLine, const Vector3d& vtTool, const V
if ( AddLinearMove( ptP2) == GDB_ID_NULL)
return false ;
// movimento di lato
SetFeed( ( ! bSideAng ? ( i == 0 ? GetBackFeed() : GetFeed()) : GetSideAngFeed())) ;
if ( AddLinearMove( ptP3) == GDB_ID_NULL)
return false ;
double dCurrFeed = ( ! bSideAng ? ( i == 0 ? GetBackFeed() : GetFeed()) : GetSideAngFeed()) ;
if ( FvVar.dLenStart > EPS_SMALL || FvVar.dLenEnd > EPS_SMALL) {
// scambio opportunamente le frazioni (dispari vanno, pari tornano)
double dCurrStartFraz = dStartFraz ;
double dCurrEndFraz = dEndFraz ;
if ( IsEven( i))
swap( dCurrStartFraz, dCurrEndFraz) ;
double dCurrMidFraz = 1 - dCurrEndFraz ;
// 3a -> eventuale movimento di lato a feed ridotta di inizio percorso
if ( dCurrStartFraz * dCutLen > EPS_SMALL) {
SetFeed( FvVar.dPuStart * dCurrFeed) ;
if ( AddLinearMove( Media( ptP2, ptP3, dCurrStartFraz)) == GDB_ID_NULL)
return false ;
}
// 3b -> eventuale movimento di lato a feed normale
if ( ( dCurrMidFraz - dCurrStartFraz) * dCutLen > EPS_SMALL) {
SetFeed( dCurrFeed) ;
if ( AddLinearMove( Media( ptP2, ptP3, dCurrMidFraz)) == GDB_ID_NULL)
return false ;
}
// 3c -> eventuale movimento di lato a feed ridotta di fine percorso
if ( dCurrEndFraz * dCutLen > EPS_SMALL) {
SetFeed( FvVar.dPuEnd * dCurrFeed) ;
if ( AddLinearMove( ptP3) == GDB_ID_NULL)
return false ;
}
}
else {
SetFeed( dCurrFeed) ;
if ( AddLinearMove( ptP3) == GDB_ID_NULL)
return false ;
}
}
// 4 -> retrazione
if ( ! AddRetract( pLine->GetStart(), vtCorr, dSafeZ, dElev, dAppr))
@@ -2310,10 +2371,33 @@ Sawing::GenerateLineCl( const ICurveLine* pLine, const Vector3d& vtTool, const V
if ( AddLinearMove( ptP2) == GDB_ID_NULL)
return false ;
// movimento di lato al punto finale
SetFeed( ( ! bSideAng ? GetFeed() : GetSideAngFeed())) ;
double dCurrFeed = ( ! bSideAng ? GetFeed() : GetSideAngFeed()) ;
Point3d ptP3 = pLine->GetEnd() + vtCorr * dDelta ;
if ( AddLinearMove( ptP3) == GDB_ID_NULL)
return false ;
if ( FvVar.dLenStart > EPS_SMALL || FvVar.dLenEnd > EPS_SMALL) {
// 3a -> eventuale movimento di lato a feed ridotta di inizio percorso
if ( dStartFraz * dCutLen > EPS_SMALL) {
SetFeed( FvVar.dPuStart * dCurrFeed) ;
if ( AddLinearMove( Media( ptP2, ptP3, dStartFraz)) == GDB_ID_NULL)
return false ;
}
// 3b -> eventuale movimento di lato a feed normale
if ( ( dMidFraz - dStartFraz) * dCutLen > EPS_SMALL) {
SetFeed( dCurrFeed) ;
if ( AddLinearMove( Media( ptP2, ptP3, dMidFraz)) == GDB_ID_NULL)
return false ;
}
// 3c -> eventuale movimento di lato a feed ridotta di fine percorso
if ( dEndFraz * dCutLen > EPS_SMALL) {
SetFeed( FvVar.dPuEnd * dCurrFeed) ;
if ( AddLinearMove( ptP3) == GDB_ID_NULL)
return false ;
}
}
else {
SetFeed( dCurrFeed) ;
if ( AddLinearMove( ptP3) == GDB_ID_NULL)
return false ;
}
// se non è ultimo passo
if ( i != 0) {
// movimento di risalita sopra il punto finale
@@ -2500,6 +2584,15 @@ Sawing::GenerateExtCurvePv( const ICurveComposite* pCrv, double dOffs,
return false ;
m_pGeomDB->SetName( nPxId, sName) ;
m_pGeomDB->SetMaterial( nPxId, BLUE) ;
// assegno il vettore estrusione al gruppo del percorso
m_pGeomDB->SetInfo( nPxId, KEY_EXTR, Z_AX) ;
// assegno i punti di inizio e fine al gruppo del percorso
Point3d ptStart ; pCrv->GetStartPoint( ptStart) ;
m_pGeomDB->SetInfo( nPxId, KEY_START, ptStart) ;
Point3d ptEnd ; pCrv->GetEndPoint( ptEnd) ;
m_pGeomDB->SetInfo( nPxId, KEY_END, ptEnd) ;
// assegno l'elevazione massima
m_pGeomDB->SetInfo( nPxId, KEY_ELEV, dElev) ;
// disabilito eventuale registrazione comandi EXE (riabilitazione automatica)
CmdLogOff cmdLogOff ;
@@ -3282,6 +3375,15 @@ Sawing::GenerateIntArcPv( const ICurveArc* pArc,
return false ;
m_pGeomDB->SetName( nPxId, sName) ;
m_pGeomDB->SetMaterial( nPxId, BLUE) ;
// assegno il vettore estrazione al gruppo del percorso
m_pGeomDB->SetInfo( nPxId, KEY_EXTR, Z_AX) ;
// assegno i punti di inizio e fine al gruppo del percorso
Point3d ptStart ; pArc->GetStartPoint( ptStart) ;
m_pGeomDB->SetInfo( nPxId, KEY_START, ptStart) ;
Point3d ptEnd ; pArc->GetEndPoint( ptEnd) ;
m_pGeomDB->SetInfo( nPxId, KEY_END, ptEnd) ;
// assegno l'elevazione massima
m_pGeomDB->SetInfo( nPxId, KEY_ELEV, dElev) ;
// disabilito eventuale registrazione comandi EXE (riabilitazione automatica)
CmdLogOff cmdLogOff ;
+9 -3
View File
@@ -39,8 +39,14 @@ class Sawing : public Machining
public : // Operation
int GetType( void) const override
{ return OPER_SAWING ; }
bool IsEmpty( void) const override
{ return ( m_nCuts == 0) ; }
bool IsEmpty( int nEmptyType = NEED_GEOM) const override
{ if ( m_nCuts == 0)
return true ;
if ( nEmptyType == NEED_ONE_TP_OK)
return ( ! IsAtLeastOnePathOk()) ;
if ( nEmptyType == NEED_ALL_TP_OK)
return ( ! AreAllPathsOk()) ;
return false ; }
bool UpdateStatus( int nModif) override
{ m_nStatus |= nModif ; return true ; }
@@ -63,7 +69,7 @@ class Sawing : public Machining
bool GetParam( int nType, int& nVal) const override ;
bool GetParam( int nType, double& dVal) const override ;
bool GetParam( int nType, std::string& sVal) const override ;
bool UpdateToolData( bool* pbChanged = nullptr) override ;
bool UpdateToolData( void) override ;
const ToolData& GetToolData( void) const override ;
bool GetGeometry( SELVECTOR& vIds) const override ;
+4
View File
@@ -53,11 +53,15 @@ class __declspec( novtable) ISimulator
virtual bool GetMoveInfo( int& nGmove, double& dFeed) const = 0 ;
virtual bool AddCollisionObj( int nInd, bool bToolOn, int nFrameId, int nType,
const Vector3d& vtMove, double dPar1, double dPar2, double dPar3) = 0 ;
virtual bool RemoveCollisionObj( int nFrameId) = 0 ;
virtual bool GetCollisionObj( int nPos, int& nInd, bool& bToolOn, int& nFrameId, int& nType,
Vector3d& vtMove, double& dPar1, double& dPar2, double& dPar3) = 0 ;
virtual bool ExecCollisionCheck( int& nCdInd, int& nObjInd, int nMoveType) = 0 ;
virtual bool OnCollision( int nCdInd, int nObjInd, int& nErr) = 0 ;
virtual bool SetToolForVmill( const std::string& sTool, const std::string& sHead, int nExit, int nFlag,
double dPar1, double dPar2, const INTVECTOR& vVmill, bool bFirst) = 0 ;
virtual bool EnableToolsForVmill( bool bEnable) = 0 ;
virtual bool EnableToolTipTrace( bool bEnable) = 0 ;
virtual int MoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt) = 0 ;
virtual bool SaveCmd( int nType, int nPar, const std::string& sPar, const std::string& sPar2) = 0 ;
} ;
+90 -20
View File
@@ -48,9 +48,10 @@ using namespace std ;
//----------------------------------------------------------------------------
static const double MIN_STEP = 1.0 ;
static const double MAX_STEP = 500.0 ;
static const double MID_STEP = 50.0 ;
static const double MAX_STEP = 500.0 ;
static const double COLL_STEP = 10. ;
static const double MAX_COLL_STEP = 100. ;
static const double SQ_COEFF_ROT_MOVE = 100. ;
static const double COEFF_LIM = 0.999 ;
static const double SAFEDIST_STD = 5.0 ;
@@ -792,12 +793,10 @@ SimulatorMP::FindAndManageOperationStart( bool bStart, bool bFirst, int& nChange
// recupero la nuova operazione
if ( nChangeTool == 0) {
if ( bStart) {
//m_nOpId = m_pMchMgr->GetFirstActiveOperation() ;
m_nOpInd = 0 ;
m_nOpId = ( m_nOpInd < int( m_vOperId.size()) ? m_vOperId[m_nOpInd] : GDB_ID_NULL) ;
}
else {
// m_nOpId = m_pMchMgr->GetNextActiveOperation( m_nOpId) ;
++ m_nOpInd ;
m_nOpId = ( m_nOpInd < int( m_vOperId.size()) ? m_vOperId[m_nOpInd] : GDB_ID_NULL) ;
}
@@ -961,6 +960,13 @@ SimulatorMP::FindAndManagePathStart( int& nStatus)
// se trovato nuovo CLpath con entità, gestisco inizio percorso di lavoro
if ( m_nEntId != GDB_ID_NULL) {
++ m_nCLPathInd ;
// verifico se Path in doppio
int nDBLPathId = GDB_ID_NULL ;
int nDBLId = m_pGeomDB->GetFirstNameInGroup( m_nOpId, MCH_DBL) ;
if ( nDBLId != GDB_ID_NULL) {
string sCLPathName ; m_pGeomDB->GetName( m_nCLPathId, sCLPathName) ;
nDBLPathId = m_pGeomDB->GetFirstNameInGroup( nDBLId, sCLPathName) ;
}
// recupero punti di inizio e fine percorso
Point3d ptStart ;
m_pGeomDB->GetInfo( m_nCLPathId, KEY_START, ptStart) ;
@@ -991,7 +997,7 @@ SimulatorMP::FindAndManagePathStart( int& nStatus)
m_nAuxEInd = 0 ;
m_nAuxETot = 0 ;
// richiamo gestione evento inizio percorso di lavoro
if ( ! OnPathStart( m_nCLPathId, m_nCLPathInd, m_nAuxSTot, ptStart, ptEnd, vtExtr,
if ( ! OnPathStart( m_nCLPathId, m_nCLPathInd, nDBLPathId, m_nAuxSTot, ptStart, ptEnd, vtExtr,
ptMin, ptMax, vAxMin, vAxMax, dElev, vActiveExit)) {
nStatus = CalcStatusOnError( ERR_NONE) ;
return false ;
@@ -1113,11 +1119,17 @@ SimulatorMP::ManageSingleMove( int& nStatus, double& dMove)
break ;
case CamData::AS_OUTSTROKE : {
DBLVECTOR OutAxes = pCamData->GetAxesVal() ;
for ( size_t i = OutAxes.size() ; i < 5 ; ++ i)
OutAxes.emplace_back( 0) ;
DBLVECTOR vAng( OutAxes.begin() + 3, OutAxes.end()) ;
int nStat ;
m_pMachine->VerifyOutstroke( OutAxes[0], OutAxes[1], OutAxes[2], vAng, true, nStat) ;
if ( ! m_pMchMgr->GetCurrIsRobot()) {
for ( size_t i = OutAxes.size() ; i < 5 ; ++ i)
OutAxes.emplace_back( 0) ;
DBLVECTOR vAng( OutAxes.begin() + 3, OutAxes.end()) ;
int nStat ;
m_pMachine->VerifyOutstroke( OutAxes[0], OutAxes[1], OutAxes[2], vAng, true, nStat) ;
}
else {
int nStat ;
m_pMachine->VerifyOutstroke( 0, 0, 0, OutAxes, true, nStat) ;
}
nStatus = MCH_SIM_OUTSTROKE ;
return false ; }
case CamData::AS_DIR_ERR :
@@ -1128,6 +1140,16 @@ SimulatorMP::ManageSingleMove( int& nStatus, double& dMove)
return false ;
}
DBLVECTOR AxesEnd = pCamData->GetAxesVal() ;
// Controllo che il numero di valori corrisponda con quello degli assi
int nEndsCnt = int( AxesEnd.size()) ;
int nAxesCnt = int( m_AxesName.size()) ;
if ( nEndsCnt != nAxesCnt) {
nStatus = MCH_SIM_ERR ;
m_pMchMgr->SetLastError( 1003, "Error : mismatch between the number of values and of axes") ;
string sOut = "Error : " + ToString( nEndsCnt) + " values vs " + ToString( nAxesCnt) + " axes" ;
LOG_ERROR( GetEMkLogger(), sOut.c_str())
return false ;
}
// Tipo di movimento
int nMoveType = pCamData->GetMoveType() ;
// Se inizio di nuova entità, mascheratura movimento
@@ -1576,6 +1598,8 @@ SimulatorMP::ExecCollisionCheck( int& nCdInd, int& nObjInd, int nMoveType)
continue ;
// recupero il riferimento
Frame3d frCd ; m_pGeomDB->GetGlobFrame( m_CdId[i], frCd) ;
// recupero il nome
string sCdName ; m_pGeomDB->GetName( m_CdId[i], sCdName) ;
// ciclo sugli oggetti con cui verificare
for ( int j = 0 ; j < int( m_CollObj.size()) ; ++ j) {
// se modo hidden è da saltare
@@ -1590,6 +1614,10 @@ SimulatorMP::ExecCollisionCheck( int& nCdInd, int& nObjInd, int nMoveType)
// se utensile attivo su grezzo in lavoro e non è rapido, salto
if ( bIsTool && bIsRaw && nMoveType != 0)
continue ;
// se contiene info con nome da saltare, verifico se è il caso
string sCollSkip ;
if ( m_pGeomDB->GetInfo( m_CollObj[j].nFrameId, "CollSkip", sCollSkip) && sCollSkip == sCdName)
continue ;
// esecuzione controlli di collisione
bool bOk = true ;
// oggetti che richiedono frame associato (Box, Cylinder, Sphere, Cone)
@@ -1663,8 +1691,8 @@ FindCollisionMarkId( const IGeomDB* pGeomDB, int nCollId)
int nCollParId = pGeomDB->GetParentId( nCollId) ;
string sCollParName = "COLLISION" ;
pGeomDB->GetName( nCollParId, sCollParName) ;
// COLLISION per parti generiche di macchina, BASE e MOBILE per fixtures
if ( sCollParName != "COLLISION" && sCollParName != "BASE" && sCollParName != "MOBILE")
// COLLISION* per parti generiche di macchina, BASE e MOBILE per fixtures
if ( sCollParName.rfind( "COLLISION", 0) != 0 && sCollParName != "BASE" && sCollParName != "MOBILE")
return nCollParId ;
else {
int nCollGprId = pGeomDB->GetParentId( nCollParId) ;
@@ -1940,6 +1968,8 @@ SimulatorMP::OnMachiningEnd( void)
{
// chiamo la funzione di fine lavorazione
bool bOk = CallFunction( ON_SIMUL_MACHINING_END, true) ;
// reset eventuale Path in double
bOk = bOk && m_pMachine->LuaResetGlobVar( GLOB_VAR + GVAR_DBLPATHID) ;
// forzo aggiornamento posizione assi (possono essere stati mossi nello script)
UpdateAxesPos() ;
return bOk ;
@@ -1947,13 +1977,18 @@ SimulatorMP::OnMachiningEnd( void)
//----------------------------------------------------------------------------
bool
SimulatorMP::OnPathStart( int nClPathId, int nClPathInd, int nAS, const Point3d& ptStart, const Point3d& ptEnd,
const Vector3d& vtExtr, const Point3d& ptMin, const Point3d& ptMax,
const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax, double dElev, const INTVECTOR& vActiveExit)
SimulatorMP::OnPathStart( int nClPathId, int nClPathInd, int nDBLPathId, int nAS, const Point3d& ptStart, const Point3d& ptEnd,
const Vector3d& vtExtr, const Point3d& ptMin, const Point3d& ptMax,
const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax, double dElev, const INTVECTOR& vActiveExit)
{
// assegno identificativo e indice percorso di lavorazione
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_PATHID, nClPathId) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_PATHIND, nClPathInd) ;
// assegno identificativo percorso di lavorazione in doppio
if ( nDBLPathId == GDB_ID_NULL)
bOk = bOk && m_pMachine->LuaResetGlobVar( GLOB_VAR + GVAR_DBLPATHID) ;
else
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_DBLPATHID, nDBLPathId) ;
// assegno numero di dati ausiliari iniziali
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_AUXTOT, nAS) ;
// assegno punti iniziale e finale e versore estrusione
@@ -2129,9 +2164,9 @@ SimulatorMP::OnMoveStart( const CamData* pCamData, const CamData* pNextCamData,
bool bNeg = ( sLink.find( '-') != string::npos) ;
string sMainAxis = sLink ; ReplaceString( sMainAxis, "-", "") ;
int nInd = 0 ;
for ( int i = 0 ; nInd == 0 && i < int( m_AxesName.size()) ; ++ i) {
if ( m_AxesName[i] == sMainAxis)
nInd = i + 1 ;
for ( int j = 0 ; nInd == 0 && j < ssize( m_AxesName) ; ++ j) {
if ( m_AxesName[j] == sMainAxis)
nInd = j + 1 ;
}
// se trovato asse principale di riferimento
if ( nInd > 0) {
@@ -2164,11 +2199,17 @@ SimulatorMP::OnMoveStart( const CamData* pCamData, const CamData* pNextCamData,
}
}
// altrimenti errore
else
else {
bOk = false ;
string sErr = " Error in OnMoveStart : Wrong Move AuxAxis " + ToString( i) ;
LOG_ERROR( GetEMkLogger(), sErr.c_str())
}
}
else
else {
bOk = false ;
string sErr = " Error in OnMoveStart : Wrong Name AuxAxis " + ToString( i) ;
LOG_ERROR( GetEMkLogger(), sErr.c_str())
}
}
return bOk ;
@@ -2316,6 +2357,34 @@ SimulatorMP::AddCollisionObj( int nInd, bool bToolOn, int nFrameId, int nType, c
return true ;
}
//----------------------------------------------------------------------------
bool
SimulatorMP::RemoveCollisionObj( int nFrameId)
{
erase_if( m_CollObj, [nFrameId]( CollObj Item) { return ( Item.nFrameId == nFrameId) ; }) ;
return true ;
}
//----------------------------------------------------------------------------
bool
SimulatorMP::GetCollisionObj( int nPos, int& nInd, bool& bToolOn, int& nFrameId, int& nType,
Vector3d& vtMove, double& dPar1, double& dPar2, double& dPar3)
{
// posizione nel vettore non valida
if ( nPos < 0 || nPos >= ssize( m_CollObj))
return false ;
// assegno i dati
nInd = m_CollObj[nPos].nInd ;
bToolOn = m_CollObj[nPos].bToolOn ;
nFrameId = m_CollObj[nPos].nFrameId ;
nType = m_CollObj[nPos].nType ;
vtMove = m_CollObj[nPos].vtMove ;
dPar1 = m_CollObj[nPos].dPar1 ;
dPar2 = m_CollObj[nPos].dPar2 ;
dPar3 = m_CollObj[nPos].dPar3 ;
return true ;
}
//----------------------------------------------------------------------------
bool
SimulatorMP::SetToolForVmill( const string& sTool, const string& sHead, int nExit, int nFlag, double dPar1, double dPar2,
@@ -2526,6 +2595,7 @@ SimulatorMP::ExecCmdData( int& nStatus)
static const int STEP_RAPID = -2 ;
static const int STEP_RAPROT = -3 ;
static const int STEP_COLLROT = -4 ;
double dMaxStep = ( NeedCollisionCheck() ? MAX_COLL_STEP : MAX_STEP) ;
int nStep = 1 ;
for ( int i = 0 ; i < nAxCount ; ++ i) {
double dMove = abs( CmdCurr.vAxNaEpSt[i].dEndPos - vPrev[i]) ;
@@ -2540,7 +2610,7 @@ SimulatorMP::ExecCmdData( int& nStatus)
else // STEP_COLLROT
dStep = min( 0.4 * m_dStep, 10.) ;
}
dStep = max( dStep, 1.) ;
dStep = Clamp( dStep, MIN_STEP, dMaxStep) ;
int nAxStep = int( dMove / dStep) + 1 ;
nStep = max( nStep, nAxStep) ;
}
+6 -1
View File
@@ -40,11 +40,16 @@ class SimulatorMP : public ISimulator
bool GetMoveInfo( int& nGmove, double& dFeed) const override ;
bool AddCollisionObj( int nInd, bool bToolOn, int nFrameId, int nType,
const Vector3d& vtMove, double dPar1, double dPar2, double dPar3) override ;
bool RemoveCollisionObj( int nFrameId) override ;
bool GetCollisionObj( int nPos, int& nInd, bool& bToolOn, int& nFrameId, int& nType,
Vector3d& vtMove, double& dPar1, double& dPar2, double& dPar3) override ;
bool ExecCollisionCheck( int& nCdInd, int& nObjInd, int nMoveType) override ;
bool OnCollision( int nCdInd, int nObjInd, int& nErr) override ;
bool SetToolForVmill( const std::string& sTool, const std::string& sHead, int nExit, int nFlag,
double dPar1, double dPar2, const INTVECTOR& vVmill, bool bFirst) override ;
bool EnableToolsForVmill( bool bEnable) override ;
bool EnableToolTipTrace( bool bEnable) override
{ return false ; }
int MoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt) override ;
bool SaveCmd( int nType, int nPar, const std::string& sPar, const std::string& sPar2) override ;
@@ -99,7 +104,7 @@ class SimulatorMP : public ISimulator
bool OnMachiningEnd( void) ;
bool OnPathStartAux( int nInd, const std::string& sAS, int& nErr) ;
bool OnPathEndAux( int nInd, const std::string& sAE, int& nErr) ;
bool OnPathStart( int nClPathId, int nClPathInd, int nAS, const Point3d& ptStart, const Point3d& ptEnd,
bool OnPathStart( int nClPathId, int nClPathInd, int nDBLPathId, int nAS, const Point3d& ptStart, const Point3d& ptEnd,
const Vector3d& vtExtr, const Point3d& ptMin, const Point3d& ptMax,
const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax, double dElev, const INTVECTOR& vActiveExit) ;
bool OnPathEnd( int nAE) ;
+198 -25
View File
@@ -29,15 +29,18 @@
#include "/EgtDev/Include/EGkCDeClosedSurfTmClosedSurfTm.h"
#include "/EgtDev/Include/EGkVolZmap.h"
#include "/EgtDev/Include/EGkGeoVector3d.h"
#include "/EgtDev/Include/EGkGeoPoint3d.h"
#include "/EgtDev/Include/EGkStringUtils3d.h"
#include "/EgtDev/Include/EGkSurfLocal.h"
#include "/EgtDev/Include/EXeCmdLogOff.h"
#include "/EgtDev/Include/EXeSetModifiedOff.h"
#include "/EgtDev/Include/EXeConst.h"
#include "/EgtDev/Include/EMkToolConst.h"
#include "/EgtDev/Include/EMkOperationConst.h"
#include "/EgtDev/Include/EGnGetKeyData.h"
#include "/EgtDev/Include/EgtPerfCounter.h"
#include "/EgtDev/Include/EgtNumUtils.h"
#include "/EgtDev/Include/EgtIniFile.h"
#include "/EgtDev/Include/EgtKeyCodes.h"
#include "/EgtDev/Include/SELkKeyProc.h"
@@ -48,9 +51,10 @@ using namespace std ;
//----------------------------------------------------------------------------
static const double MIN_STEP = 1.0 ;
static const double MAX_STEP = 500.0 ;
static const double MID_STEP = 50.0 ;
static const double MAX_STEP = 500.0 ;
static const double COLL_STEP = 10. ;
static const double MAX_COLL_STEP = 100. ;
static const double SQ_COEFF_ROT_MOVE = 100. ;
static const double COEFF_LIM = 0.999 ;
static const double SAFEDIST_STD = 5.0 ;
@@ -88,9 +92,13 @@ SimulatorSP::SimulatorSP( void)
m_nAuxEInd = 0 ;
m_nExit = 0 ;
m_dTDiam = 0 ;
m_dTLen = 0 ;
m_bCutOnTip = false ;
m_bEnableVm = false ;
m_dSafeDist = SAFEDIST_STD ;
m_bEnableTrace = false ;
m_nTraceGroup = GDB_ID_NULL ;
m_nCurrTrace = GDB_ID_NULL ;
m_nAxesMask = 0 ;
m_bEnabAxes = true ;
m_bShowAxes = true ;
@@ -200,6 +208,9 @@ SimulatorSP::Start( bool bFirst)
// Verifico attrezzaggio
if ( ! VerifySetup())
bOk = false ;
// Recupero il materiale associato alla macchina
string sMachIni = m_pMachine->GetMachineDir() + "\\" + m_pMachine->GetMachineName() + ".ini" ;
m_sMachineMaterial = GetPrivateProfileStringUtf8( GENERAL_SEC.c_str(), MATERIAL_KEY.c_str(), "", sMachIni.c_str()) ;
}
// Reset utensile, interpolazione e assi correnti
@@ -207,7 +218,9 @@ SimulatorSP::Start( bool bFirst)
m_sHead.clear() ;
m_nExit = 0 ;
m_dTDiam = 0 ;
m_dTLen = 0 ;
m_bCutOnTip = false ;
m_nCurrTrace = GDB_ID_NULL ;
ResetInterpolation() ;
ResetAxes() ;
ResetAuxAxes() ;
@@ -573,6 +586,7 @@ SimulatorSP::UpdateTool( bool bFirst, int& nErr)
m_sHead = sHead ;
m_nExit = nExit ;
m_pMchMgr->TdbGetCurrToolParam( TPA_DIAM, m_dTDiam) ;
m_pMchMgr->TdbGetCurrToolParam( TPA_LEN, m_dTLen) ;
double dTipFeed = 0 ;
m_pMchMgr->TdbGetCurrToolParam( TPA_TIPFEED, dTipFeed) ;
m_bCutOnTip = ( dTipFeed > EPS_MACH_LEN_PAR) ;
@@ -616,6 +630,7 @@ SimulatorSP::UpdateTool( bool bFirst, int& nErr)
m_sHead = sHead ;
m_nExit = nExit ;
m_pMchMgr->TdbGetCurrToolParam( TPA_DIAM, m_dTDiam) ;
m_pMchMgr->TdbGetCurrToolParam( TPA_LEN, m_dTLen) ;
double dTipFeed = 0 ;
m_pMchMgr->TdbGetCurrToolParam( TPA_TIPFEED, dTipFeed) ;
m_bCutOnTip = ( dTipFeed > EPS_MACH_LEN_PAR) ;
@@ -725,11 +740,11 @@ SimulatorSP::FindAndManageOperationStart( bool bStart, bool bFirst, int& nStatus
bFirst = false ;
// recupero la nuova operazione
if ( bStart) {
m_nOpId = m_pMchMgr->GetFirstActiveOperation() ;
m_nOpId = m_pMchMgr->GetFirstActiveOperation( true) ;
m_nOpInd = 0 ;
}
else
m_nOpId = m_pMchMgr->GetNextActiveOperation( m_nOpId) ;
m_nOpId = m_pMchMgr->GetNextActiveOperation( m_nOpId, true) ;
// ciclo sulle successive operazioni
while ( m_nOpId != GDB_ID_NULL) {
// se lavorazione valida
@@ -888,9 +903,18 @@ SimulatorSP::FindAndManagePathStart( int& nStatus)
m_dCoeff = 0 ;
}
}
// reset eventuale curva di TipTrace
m_nCurrTrace = GDB_ID_NULL ;
// se trovato nuovo CLpath con entità, gestisco inizio percorso di lavoro
if ( m_nEntId != GDB_ID_NULL) {
++ m_nCLPathInd ;
// verifico se Path in doppio
int nDBLPathId = GDB_ID_NULL ;
int nDBLId = m_pGeomDB->GetFirstNameInGroup( m_nOpId, MCH_DBL) ;
if ( nDBLId != GDB_ID_NULL) {
string sCLPathName ; m_pGeomDB->GetName( m_nCLPathId, sCLPathName) ;
nDBLPathId = m_pGeomDB->GetFirstNameInGroup( nDBLId, sCLPathName) ;
}
// recupero punti di inizio e fine percorso
Point3d ptStart ;
m_pGeomDB->GetInfo( m_nCLPathId, KEY_START, ptStart) ;
@@ -921,7 +945,7 @@ SimulatorSP::FindAndManagePathStart( int& nStatus)
m_nAuxEInd = 0 ;
m_nAuxETot = 0 ;
// richiamo gestione evento inizio percorso di lavoro
if ( ! OnPathStart( m_nCLPathId, m_nCLPathInd, m_nAuxSTot, ptStart, ptEnd, vtExtr,
if ( ! OnPathStart( m_nCLPathId, m_nCLPathInd, nDBLPathId, m_nAuxSTot, ptStart, ptEnd, vtExtr,
ptMin, ptMax, vAxMin, vAxMax, dElev, vActiveExit)) {
nStatus = CalcStatusOnError( 0) ;
return false ;
@@ -955,6 +979,8 @@ SimulatorSP::ManagePathEnd( int& nStatus)
// gestione stato
if ( ! bOk)
nStatus = CalcStatusOnError( 0) ;
// reset eventuale curva di TipTrace
m_nCurrTrace = GDB_ID_NULL ;
return bOk ;
}
@@ -1041,11 +1067,17 @@ SimulatorSP::ManageSingleMove( int& nStatus, double& dMove)
break ;
case CamData::AS_OUTSTROKE : {
DBLVECTOR OutAxes = pCamData->GetAxesVal() ;
for ( size_t i = OutAxes.size() ; i < 5 ; ++ i)
OutAxes.emplace_back( 0) ;
DBLVECTOR vAng( OutAxes.begin() + 3, OutAxes.end()) ;
int nStat ;
m_pMachine->VerifyOutstroke( OutAxes[0], OutAxes[1], OutAxes[2], vAng, true, nStat) ;
if ( ! m_pMchMgr->GetCurrIsRobot()) {
for ( int i = int( OutAxes.size()) ; i <= 5 ; ++ i)
OutAxes.emplace_back( 0) ;
DBLVECTOR vAng( OutAxes.begin() + 3, OutAxes.end()) ;
int nStat ;
m_pMachine->VerifyOutstroke( OutAxes[0], OutAxes[1], OutAxes[2], vAng, true, nStat) ;
}
else {
int nStat ;
m_pMachine->VerifyOutstroke( 0, 0, 0, OutAxes, true, nStat) ;
}
nStatus = MCH_SIM_OUTSTROKE ;
return false ; }
case CamData::AS_DIR_ERR :
@@ -1056,6 +1088,16 @@ SimulatorSP::ManageSingleMove( int& nStatus, double& dMove)
return false ;
}
DBLVECTOR AxesEnd = pCamData->GetAxesVal() ;
// Controllo che il numero di valori corrisponda con quello degli assi
int nEndsCnt = int( AxesEnd.size()) ;
int nAxesCnt = int( m_AxesName.size()) ;
if ( nEndsCnt != nAxesCnt) {
nStatus = MCH_SIM_ERR ;
m_pMchMgr->SetLastError( 1003, "Error : mismatch between the number of values and of axes") ;
string sOut = "Error : " + ToString( nEndsCnt) + " values vs " + ToString( nAxesCnt) + " axes" ;
LOG_ERROR( GetEMkLogger(), sOut.c_str())
return false ;
}
// Tipo di movimento
int nMoveType = pCamData->GetMoveType() ;
// Se inizio di nuova entità, mascheratura movimento
@@ -1098,6 +1140,10 @@ SimulatorSP::ManageSingleMove( int& nStatus, double& dMove)
for ( int i = 0 ; i < int( m_VmId.size()) ; ++ i)
bOkI = m_pGeomDB->GetGlobFrame( m_VmId[i], vFrVzmI[i]) && bOkI ;
// Eventuale primo tracciamento punto tip utensile
if ( m_nCurrTrace == GDB_ID_NULL)
TraceToolTipMove( nMoveType) ;
// Dati per eventuale verifica di collisione
int nCdInd, nObjInd ;
bool bCollCheck = true ;
@@ -1194,6 +1240,8 @@ SimulatorSP::ManageSingleMove( int& nStatus, double& dMove)
}
// eseguo eventuale collision check
bCollCheck = bCollCheck && ExecCollisionCheck( nCdInd, nObjInd, nMoveType) ;
// eventuale tracciamento punto tip utensile
TraceToolTipMove( nMoveType) ;
}
}
// Eseguo movimento su arco
@@ -1278,6 +1326,8 @@ SimulatorSP::ManageSingleMove( int& nStatus, double& dMove)
}
// eseguo eventuale collision check
bCollCheck = bCollCheck && ExecCollisionCheck( nCdInd, nObjInd, nMoveType) ;
// eventuale tracciamento punto tip utensile
TraceToolTipMove( nMoveType) ;
}
}
}
@@ -1338,6 +1388,8 @@ SimulatorSP::ManageSingleMove( int& nStatus, double& dMove)
}
// eseguo eventuale collision check
bCollCheck = bCollCheck && ExecCollisionCheck( nCdInd, nObjInd, nMoveType) ;
// eventuale tracciamento punto tip utensile
TraceToolTipMove( nMoveType) ;
}
}
@@ -1498,6 +1550,8 @@ SimulatorSP::ExecCollisionCheck( int& nCdInd, int& nObjInd, int nMoveType)
continue ;
// recupero il riferimento
Frame3d frCd ; m_pGeomDB->GetGlobFrame( m_CdId[i], frCd) ;
// recupero il nome
string sCdName ; m_pGeomDB->GetName( m_CdId[i], sCdName) ;
// ciclo sugli oggetti con cui verificare
for ( int j = 0 ; j < int( m_CollObj.size()) ; ++ j) {
// se modo hidden è da saltare
@@ -1512,6 +1566,10 @@ SimulatorSP::ExecCollisionCheck( int& nCdInd, int& nObjInd, int nMoveType)
// se utensile attivo su grezzo in lavoro e non è rapido, salto
if ( bIsTool && bIsRaw && nMoveType != 0)
continue ;
// se contiene info con nome da saltare, verifico se è il caso
string sCollSkip ;
if ( m_pGeomDB->GetInfo( m_CollObj[j].nFrameId, "CollSkip", sCollSkip) && sCollSkip == sCdName)
continue ;
// esecuzione controlli di collisione
bool bOk = true ;
// oggetti che richiedono frame associato (Box, Cylinder, Sphere, Cone)
@@ -1585,8 +1643,8 @@ FindCollisionMarkId( const IGeomDB* pGeomDB, int nCollId)
int nCollParId = pGeomDB->GetParentId( nCollId) ;
string sCollParName = "COLLISION" ;
pGeomDB->GetName( nCollParId, sCollParName) ;
// COLLISION per parti generiche di macchina, BASE e MOBILE per fixtures
if ( sCollParName != "COLLISION" && sCollParName != "BASE" && sCollParName != "MOBILE")
// COLLISION* per parti generiche di macchina, BASE e MOBILE per fixtures
if ( sCollParName.rfind( "COLLISION", 0) != 0 && sCollParName != "BASE" && sCollParName != "MOBILE")
return nCollParId ;
else {
int nCollGprId = pGeomDB->GetParentId( nCollParId) ;
@@ -1626,6 +1684,74 @@ SimulatorSP::ResetCollisionMark( void)
return true ;
}
//----------------------------------------------------------------------------
bool
SimulatorSP::EnableToolTipTrace( bool bEnable)
{
if ( bEnable != m_bEnableTrace) {
if ( bEnable) {
;
}
else {
int nTraceCrvId = m_pGeomDB->GetFirstInGroup( m_nTraceGroup) ;
while ( nTraceCrvId != GDB_ID_NULL) {
m_pGeomDB->SetStatus( nTraceCrvId, GDB_ST_OFF) ;
nTraceCrvId = m_pGeomDB->GetNext( nTraceCrvId) ;
}
m_nCurrTrace = GDB_ID_NULL ;
}
}
m_bEnableTrace = bEnable ;
return true ;
}
//----------------------------------------------------------------------------
bool
SimulatorSP::TraceToolTipMove( int nMoveType)
{
// verifico che la tracciatura sia abilitata
if ( ! m_bEnableTrace)
return true ;
// recupero il gruppo per le curve di traccia
int nTraceGrpId ;
if ( ! m_pMachine->LuaGetGlobVar( GLOB_VAR + GVAR_TOOLTRACE, nTraceGrpId))
return false ;
m_nTraceGroup = nTraceGrpId ;
// recupero posizione utensile corrente
int nExitId = m_pMachine->GetExitId( m_sHead, m_nExit) ;
Frame3d frExit ;
if ( ! m_pGeomDB->GetGroupGlobFrame( nExitId, frExit))
return false ;
Point3d ptTip = frExit.Orig() - ( m_sMachineMaterial != "Additive" ? m_dTLen : 0) * frExit.VersZ() ;
// disabilito gestione segnalazione modifiche progetto
SetModifiedOff modOff ;
// eseguo tracciatura
static string TRACE_MOVE = "Move" ;
static int TRACE_MAX_LINE = 1000 ;
if ( m_nCurrTrace == GDB_ID_NULL) {
m_nCurrTrace = ExeCreateGeoPoint( nTraceGrpId, ptTip, GDB_ID_ROOT) ;
m_pGeomDB->SetInfo( m_nCurrTrace, TRACE_MOVE, nMoveType) ;
m_pGeomDB->SetStipple( m_nCurrTrace, ( nMoveType == 0 ? 3 : 0), 0x8C8C) ;
}
else {
const ICurveComposite* pCC = GetCurveComposite( m_pGeomDB->GetGeoObj( m_nCurrTrace)) ;
int nCount = ( pCC != nullptr ? pCC->GetCurveCount() : 0) ;
int nTraMove ;
m_pGeomDB->GetInfo( m_nCurrTrace, TRACE_MOVE, nTraMove) ;
if ( ( nMoveType == 0) == ( nTraMove == 0) && nCount < TRACE_MAX_LINE)
ExeAddCurveCompoLine( m_nCurrTrace, ptTip, true, GDB_ID_ROOT) ;
else {
Point3d ptPrev ; ExeEndPoint( m_nCurrTrace, GDB_ID_ROOT, ptPrev) ;
m_nCurrTrace = ExeCreateGeoPoint( nTraceGrpId, ptPrev, GDB_ID_ROOT) ;
ExeAddCurveCompoLine( m_nCurrTrace, ptTip, true, GDB_ID_ROOT) ;
m_pGeomDB->SetInfo( m_nCurrTrace, TRACE_MOVE, nMoveType) ;
m_pGeomDB->SetStipple( m_nCurrTrace, ( nMoveType == 0 ? 3 : 0), 0x8C8C) ;
}
}
return true ;
}
//----------------------------------------------------------------------------
bool
SimulatorSP::OnInit( void)
@@ -1901,6 +2027,8 @@ SimulatorSP::OnMachiningEnd( void)
return true ;
// chiamo la funzione di fine lavorazione
bool bOk = m_pMachine->LuaCallFunction( ON_SIMUL_MACHINING_END) ;
// reset eventuale Path in double
bOk = bOk && m_pMachine->LuaResetGlobVar( GLOB_VAR + GVAR_DBLPATHID) ;
// forzo aggiornamento posizione assi (possono essere stati mossi nello script)
UpdateAxesPos() ;
return bOk ;
@@ -1908,13 +2036,18 @@ SimulatorSP::OnMachiningEnd( void)
//----------------------------------------------------------------------------
bool
SimulatorSP::OnPathStart( int nClPathId, int nClPathInd, int nAS, const Point3d& ptStart, const Point3d& ptEnd,
const Vector3d& vtExtr, const Point3d& ptMin, const Point3d& ptMax,
const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax, double dElev, const INTVECTOR& vActiveExit)
SimulatorSP::OnPathStart( int nClPathId, int nClPathInd, int nDBLPathId, int nAS, const Point3d& ptStart, const Point3d& ptEnd,
const Vector3d& vtExtr, const Point3d& ptMin, const Point3d& ptMax,
const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax, double dElev, const INTVECTOR& vActiveExit)
{
// assegno identificativo e indice percorso di lavorazione
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_PATHID, nClPathId) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_PATHIND, nClPathInd) ;
// assegno identificativo percorso di lavorazione in doppio
if ( nDBLPathId == GDB_ID_NULL)
bOk = bOk && m_pMachine->LuaResetGlobVar( GLOB_VAR + GVAR_DBLPATHID) ;
else
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_DBLPATHID, nDBLPathId) ;
// assegno numero di dati ausiliari iniziali
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_AUXTOT, nAS) ;
// assegno punti iniziale e finale e versore estrusione
@@ -2112,9 +2245,9 @@ SimulatorSP::OnMoveStart( const CamData* pCamData, const CamData* pNextCamData,
bool bNeg = ( sLink.find( '-') != string::npos) ;
string sMainAxis = sLink ; ReplaceString( sMainAxis, "-", "") ;
int nInd = 0 ;
for ( int i = 0 ; nInd == 0 && i < int( m_AxesName.size()) ; ++ i) {
if ( m_AxesName[i] == sMainAxis)
nInd = i + 1 ;
for ( int j = 0 ; nInd == 0 && j < ssize( m_AxesName) ; ++ j) {
if ( m_AxesName[j] == sMainAxis)
nInd = j + 1 ;
}
// se trovato asse principale di riferimento
if ( nInd > 0) {
@@ -2141,17 +2274,23 @@ SimulatorSP::OnMoveStart( const CamData* pCamData, const CamData* pNextCamData,
m_AuxAxesEnd.emplace_back( dEnd) ;
m_AuxAxesLink.emplace_back( 0) ;
if ( ! m_pMachine->VerifyOutstroke( sName, dEnd)) {
nErr = 1 ;
nErr = ERR_OUTSTROKE ;
bOk = false ;
}
}
}
// altrimenti errore
else
else {
bOk = false ;
string sErr = " Error in OnMoveStart : Wrong Move AuxAxis " + ToString( i) ;
LOG_ERROR( GetEMkLogger(), sErr.c_str())
}
}
else
else {
bOk = false ;
string sErr = " Error in OnMoveStart : Wrong Name AuxAxis " + ToString( i) ;
LOG_ERROR( GetEMkLogger(), sErr.c_str())
}
}
return bOk ;
@@ -2227,7 +2366,8 @@ SimulatorSP::OnResetMachine( void)
//----------------------------------------------------------------------------
bool
SimulatorSP::AddCollisionObj( int nInd, bool bToolOn, int nFrameId, int nType, const Vector3d& vtMove, double dPar1, double dPar2, double dPar3)
SimulatorSP::AddCollisionObj( int nInd, bool bToolOn, int nFrameId, int nType,
const Vector3d& vtMove, double dPar1, double dPar2, double dPar3)
{
// verifiche sui parametri
if ( nInd <= 0 || nFrameId <= GDB_ID_NULL)
@@ -2258,6 +2398,35 @@ SimulatorSP::AddCollisionObj( int nInd, bool bToolOn, int nFrameId, int nType, c
}
// aggiungo al vettore
m_CollObj.emplace_back( nInd, bToolOn, nFrameId, nType, vtMove, dPar1, dPar2, dPar3) ;
return true ;
}
//----------------------------------------------------------------------------
bool
SimulatorSP::RemoveCollisionObj( int nFrameId)
{
erase_if( m_CollObj, [nFrameId]( CollObj Item) { return ( Item.nFrameId == nFrameId) ; }) ;
return true ;
}
//----------------------------------------------------------------------------
bool
SimulatorSP::GetCollisionObj( int nPos, int& nInd, bool& bToolOn, int& nFrameId, int& nType,
Vector3d& vtMove, double& dPar1, double& dPar2, double& dPar3)
{
// posizione nel vettore non valida
if ( nPos < 0 || nPos >= ssize( m_CollObj))
return false ;
// assegno i dati
nInd = m_CollObj[nPos].nInd ;
bToolOn = m_CollObj[nPos].bToolOn ;
nFrameId = m_CollObj[nPos].nFrameId ;
nType = m_CollObj[nPos].nType ;
vtMove = m_CollObj[nPos].vtMove ;
dPar1 = m_CollObj[nPos].dPar1 ;
dPar2 = m_CollObj[nPos].dPar2 ;
dPar3 = m_CollObj[nPos].dPar3 ;
return true ;
}
@@ -2415,6 +2584,7 @@ SimulatorSP::MoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt)
static const int STEP_RAPID = -2 ;
static const int STEP_RAPROT = -3 ;
static const int STEP_COLLROT = -4 ;
double dMaxStep = ( NeedCollisionCheck() ? MAX_COLL_STEP : MAX_STEP) ;
bool bViewAllFrames = true ;
int nStep = 1 ;
for ( int i = 0 ; i < nAxCount ; ++ i) {
@@ -2430,11 +2600,11 @@ SimulatorSP::MoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt)
bViewAllFrames = ( bIsRobot ? true : false) ;
}
else { // STEP_COLLROT
dStep = min( 0.4 * m_dStep, 10.) ;
dStep = min( 0.4 * m_dStep, COLL_STEP) ;
bViewAllFrames = ( bIsRobot ? true : false) ;
}
}
dStep = max( dStep, 1.) ;
dStep = Clamp( dStep, MIN_STEP, dMaxStep) ;
int nAxStep = int( dMove / dStep) + 1 ;
nStep = max( nStep, nAxStep) ;
}
@@ -2467,11 +2637,14 @@ SimulatorSP::MoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt)
}
}
// Aggiorno visualizzazione
if ( bViewAllFrames || ( i % 4) == 0 || i == nStep)
if ( bViewAllFrames || ( i % 8) == 0 || i == nStep)
ExeDraw() ;
// Verifico collisioni
int nCdInd, nObjInd ;
bool bCollCheck = ExecCollisionCheck( nCdInd, nObjInd, nMoveType) ;
// eventuale tracciamento punto tip utensile
TraceToolTipMove( nMoveType) ;
// Se riscontrata collisione
if ( ! bCollCheck) {
// Richiamo funzione di convalida collisione
int nPrevErr ;
@@ -2500,7 +2673,7 @@ SimulatorSP::MoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt)
// Gestione aggiornamenti...
if ( ExeGetEnableUI()) {
// Aggiornamento interfaccia
ExeProcessEvents( 0, 4) ;
ExeProcessEvents( 0, 0) ;
while ( m_nUiStatus == MCH_UISIM_PAUSE) {
ExeProcessEvents( 0, 4) ;
}
+11 -1
View File
@@ -40,11 +40,15 @@ class SimulatorSP : public ISimulator
bool GetMoveInfo( int& nGmove, double& dFeed) const override ;
bool AddCollisionObj( int nInd, bool bToolOn, int nFrameId, int nType,
const Vector3d& vtMove, double dPar1, double dPar2, double dPar3) override ;
bool RemoveCollisionObj( int nFrameId) override ;
bool GetCollisionObj( int nPos, int& nInd, bool& bToolOn, int& nFrameId, int& nType,
Vector3d& vtMove, double& dPar1, double& dPar2, double& dPar3) override ;
bool ExecCollisionCheck( int& nCdInd, int& nObjInd, int nMoveType) override ;
bool OnCollision( int nCdInd, int nObjInd, int& nErr) override ;
bool SetToolForVmill( const std::string& sTool, const std::string& sHead, int nExit, int nFlag,
double dPar1, double dPar2, const INTVECTOR& vVmill, bool bFirst) override ;
bool EnableToolsForVmill( bool bEnable) override ;
bool EnableToolTipTrace( bool bEnable) override ;
int MoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt) override ;
bool SaveCmd( int nType, int nPar, const std::string& sPar, const std::string& sPar2) override
{ return false ; }
@@ -81,6 +85,7 @@ class SimulatorSP : public ISimulator
{ return ( m_nUiStatus == MCH_UISIM_STOP) ; }
bool SetCollisionMark( int nCdInd, int nObjInd) ;
bool ResetCollisionMark( void) ;
bool TraceToolTipMove( int nMoveType) ;
bool OnInit( void) ;
bool OnExit( void) ;
bool OnProgramStart( bool bFirst) ;
@@ -98,7 +103,7 @@ class SimulatorSP : public ISimulator
bool OnMachiningEnd( void) ;
bool OnPathStartAux( int nInd, const std::string& sAS, int& nErr) ;
bool OnPathEndAux( int nInd, const std::string& sAE, int& nErr) ;
bool OnPathStart( int nClPathId, int nClPathInd, int nAS, const Point3d& ptStart, const Point3d& ptEnd,
bool OnPathStart( int nClPathId, int nClPathInd, int nDBLPathId, int nAS, const Point3d& ptStart, const Point3d& ptEnd,
const Vector3d& vtExtr, const Point3d& ptMin, const Point3d& ptMax,
const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax, double dElev, const INTVECTOR& vActiveExit) ;
bool OnPathEnd( int nAE) ;
@@ -142,6 +147,7 @@ class SimulatorSP : public ISimulator
MachMgr* m_pMchMgr ; // puntatore al gestore di tutte le lavorazioni
IGeomDB* m_pGeomDB ; // puntatore al DB geometrico
Machine* m_pMachine ; // puntatore alla macchina
std::string m_sMachineMaterial ; // nome del materiale associato 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
@@ -161,6 +167,7 @@ class SimulatorSP : public ISimulator
std::string m_sHead ; // nome della testa corrente
int m_nExit ; // indice dell'uscita corrente
double m_dTDiam ; // diametro dell'utensile corrente
double m_dTLen ; // lunghezza dell'utensile corrente
bool m_bCutOnTip ; // flag capacità di lavorare di testa dell'utensile corrente
bool m_bEnableVm ; // flag abilitazione Virtual Milling
INTVECTOR m_VmId ; // vettore identificativi Zmap per Virtual Milling
@@ -169,6 +176,9 @@ class SimulatorSP : public ISimulator
COBVECTOR m_CollObj ; // vettore oggetti da testare per collisione con grezzo
double m_dSafeDist ; // distanza di sicurezza per verifica collisioni
INTVECTOR m_nCollMarkId ; // elenco oggetti marcati per visualizzare meglio la collisione rilevata
bool m_bEnableTrace ; // flag abilitazione tool tip trace
int m_nTraceGroup ; // Id del gruppo in cui si inceriscono le curve di tracciatura
int m_nCurrTrace ; // Id della curva composita corrente di trace
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
+3547 -2007
View File
File diff suppressed because it is too large Load Diff
+80 -26
View File
@@ -18,6 +18,7 @@
#include "SurfFinishingData.h"
#include "ToolData.h"
#include "MachiningConst.h"
#include "GeoConst.h"
#include "/EgtDev/Include/EGkCurveComposite.h"
#include "/EgtDev/Include/EGkSurfTriMesh.h"
#include "/EgtDev/Include/EgtNumUtils.h"
@@ -33,7 +34,6 @@ class StmFromTriangleSoup ;
struct PATH {
PtrOwner<ICurveComposite> pCrvPath ;
int nType ;
double dSideAng ;
} ;
// vettore associato
typedef std::vector<PATH> VECTORPATHS ;
@@ -43,6 +43,7 @@ struct CollisionSfr {
PNTUVVECT CollisionInfo ;
bool bInSpiral ;
bool bInZConst ;
bool bOnBorder ;
} ;
// vettore associato
typedef std::vector<CollisionSfr> VECTORCOLLISIONSFR ;
@@ -62,8 +63,14 @@ class SurfFinishing : public Machining
public : // Operation
int GetType( void) const override
{ return OPER_SAWFINISHING ; }
bool IsEmpty( void) const override
{ return ( m_nPaths == 0) ; }
bool IsEmpty( int nEmptyType = NEED_GEOM) const override
{ if ( m_nPaths == 0)
return true ;
if ( nEmptyType == NEED_ONE_TP_OK)
return ( ! IsAtLeastOnePathOk()) ;
if ( nEmptyType == NEED_ALL_TP_OK)
return ( ! AreAllPathsOk()) ;
return false ; }
bool UpdateStatus( int nModif) override
{ m_nStatus |= nModif ; return true ; }
@@ -86,7 +93,7 @@ class SurfFinishing : public Machining
bool GetParam( int nType, int& nVal) const override ;
bool GetParam( int nType, double& dVal) const override ;
bool GetParam( int nType, std::string& sVal) const override ;
bool UpdateToolData( bool* pbChanged = nullptr) override ;
bool UpdateToolData( void) override ;
const ToolData& GetToolData( void) const override ;
bool GetGeometry( SELVECTOR& vIds) const override ;
@@ -98,29 +105,63 @@ class SurfFinishing : public Machining
bool VerifyGeometry( SelData Id, int& nSubs) ;
bool GetCurves( SelData Id, ICURVEPLIST& lstPC) ;
bool Chain( int nGrpDestId) ;
bool ProcessSfr( int nPathId, int nPvId, int nClId) ;
bool GetSurfacesByIds( SURFLOCALVECTOR& vSrfLoc, SURFLOCALVECTOR& vSrfSuppLoc, Frame3d& frSurf) ;
bool CalcRegionElevation( const ISurfFlatRegion* pSfr, const Vector3d& vtTool, double dRad, double dLen, double& dElev) const ; ;
bool SetCAvTlStmForSurfaces( ICAvToolSurfTm* pCAvTlStm, const ISurfFlatRegion* pSfrCnt, double dDepth,
double dToolLen, double dToolDiam, double dToolCornRad,
double dToolSideAng, double dToolMaxMat, double dMachOffsR,
const SURFLOCALVECTOR& vSurfLoc, const SURFLOCALVECTOR& vSurfSuppLoc) ;
bool EraseMaxDownSurf( const SURFLOCALVECTOR& vSurfLoc, const Frame3d& frSurf, const Vector3d& vtTool,
double dDepth, ISurfFlatRegion* pSfrCnt) ;
bool ProcessCrvCompo( int nPathId, int nPvId, int nClId) ;
bool SimplifyCurve( ICurveComposite* pCompo) const ;
bool ProcessSfr( int nPathId, int nPvId, int nClId) ;
bool SimplifyCurve( ICurveComposite* pCompo, const Frame3d& frLocXY,
double dMergeLinTol = 200. * EPS_SMALL, double dMergeAndTolDeg = 200. * EPS_ANG_SMALL,
double dSmallDefLinTol = 150. * EPS_SMALL, double dSmallDefAngTolDeg = 2. * ANG_TOL_STD_DEG,
double dArcApproxLinTol = 50. * EPS_SMALL, double dArcApproxAngTolDeg = ANG_TOL_STD_DEG) const ;
bool CalcZConstProjectedLink( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frPocket,
const Frame3d& frSurf, const Vector3d& vtTool, double dDepth,
const Point3d ptStart_forced, const Point3d ptEnd_forced,
ICurveComposite* pCrv) ;
ICurveComposite* pCrv) const ;
// lavorazioni per superfici
bool AddZigZag( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf, const ISurfFlatRegion* pSfrPock,
bool AddZigZag( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf, const ISurfFlatRegion* pSfrCnt,
const Vector3d& vtTool, double dDepth, double dElev, bool bSplitArcs) ;
bool AddOneWay( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf, const ISurfFlatRegion* pSfrPock,
bool AddOneWay( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf, const ISurfFlatRegion* pSfrCnt,
const Vector3d& vtTool, double dDepth, double dElev, bool bSplitArcs) ;
bool AddSpiral( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf, const ISurfFlatRegion* pSfrPock,
bool AddSpiral( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf, const ISurfFlatRegion* pSfrCnt,
const Vector3d& vtTool, double dDepth, double dElev, bool bSplitArcs, bool bInVsOut) ;
bool AddZConst( ICAvToolSurfTm* pCAvTlStm, const SURFLOCALVECTOR& vSrfLoc, const Frame3d& frSurf, const ISurfFlatRegion* pSfr,
const Vector3d& vtTool, double dDepth, double dElev, bool bSplitArcs) ;
bool AddOptimal( ICAvToolSurfTm* pCAvTlStm, const SURFLOCALVECTOR& vSrfLoc, const Frame3d& frSurf, const ISurfFlatRegion* pSfr,
const Vector3d& vtTool, double dDepth, double dElev, bool bSplitArcs) ;
bool AddZConst( ICAvToolSurfTm* pCAvTlStm, const SURFLOCALVECTOR& vSrfLoc, const Frame3d& frSurf,
const ISurfFlatRegion* pSfrCnt, const Vector3d& vtTool, double dDepth, double dElev, bool bSplitArcs) ;
bool AddOptimal( ICAvToolSurfTm* pCAvTlStm, const SURFLOCALVECTOR& vSrfLoc, const Frame3d& frSurf,
const ISurfFlatRegion* pSfrCntZigZag, const ISurfFlatRegion* pSfrCntZConst, const Vector3d& vtTool,
double dDepth, double dElev, bool bSplitArcs) ;
bool AddPencil( ICAvToolSurfTm* pCAvTlStm, const SURFLOCALVECTOR& vSrfLoc, const Frame3d& frSurf,
const ISurfFlatRegion* pSfrCnt, const Vector3d& vtTool, double dDepth, double dElev, bool bSplitArcs) ;
// lavorazioni per curve
bool AddProjection( ICAvToolSurfTm* pCAvTlStm, const SURFLOCALVECTOR& vSrfLoc, const Frame3d& frSurf, const ICurveComposite* pCompo,
const Vector3d& vtTool, double dDepth, double dElev, bool bSplitArcs) ;
// creazione del percorso finale di lavorazione
bool AddFinishing( const ISurfFlatRegion* pSfrCnt, ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf, const ICRVCOMPOPOVECTOR& vCrvCompo,
const Vector3d& vtTool, double dElev, double dDepth, bool bSplitArcs) ;
// collisione con i percorsi di lavorazione
bool CorrectPathByCollision( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf, const Vector3d& vtTool,
double dDepth, ICRVCOMPOPOVECTOR& vpCrvs) ;
bool WorkPencilCurves( const ICRVCOMPOPOVECTOR& vCrvCompo, const ISurfFlatRegion* pSfrCnt, int nPencilType, double dOffs, int nOffs,
double dDepth, double dElev, double dLinTol, const Vector3d& vtTool, const SURFLOCALVECTOR& vSrfLoc,
const Frame3d& frSurf, ICAvToolSurfTm* pCAvTlStm, bool bSplitArcs) ;
bool OrderAndConnectPencilCurves( ICRVCOMPOPOVECTOR& vCrvCompo, double dLinkTol) const ;
bool GetOffsetCurvesFromPencilProjection( const ICRVCOMPOPOVECTOR& vCrvCompo, const ISurfFlatRegion* pSfrClass,
double dOffs, int nPencilType, ICRVCOMPOPOVECTOR& vCrvCompoRes) const ;
bool ProjectExposedPencilCurvesOnPlane( ICAvToolSurfTm* pCAvTlStm, const ICRVCOMPOPOVECTOR& vCrvCompo,
const Plane3d& plProj, const Vector3d& vtAxL, const Vector3d& vtMoveL,
double dOffs, double dDepth, ICRVCOMPOPOVECTOR& vCrvCompoProj) const ;
bool ChainPencilCurves( ICRVCOMPOPOVECTOR& vCrvCompo, double dLinTol, bool bAllowInvert = true) const ;
bool GetSurfTriMeshFromOffset( const SURFLOCALVECTOR& vSrfLoc, double dOffs, double dLinTol, ISurfTriMesh* pStmOffs) const ;
bool GetCurvesFromSurfTriMeshesOffset( const ISurfTriMesh * pStmOffs, double dBiTanAng, double dLinTol,
int nOffs, const ISurfFlatRegion* pSfrCnt, ICRVCOMPOPOVECTOR& vCrvCompo ) ;
bool ChooseFinishingForOptimal( const ISurfFlatRegion* pSfr, int nChunk, bool& bSpiral, double& dSideAng) ;
bool OrderOptimalPathsByZLoc( const ISurfFlatRegion* pSfr, VECTORPATHS& vCrvPaths) ;
bool OrderOptimalPathsByZLoc( const ISurfFlatRegion* pSfrCntZConst, const ISurfFlatRegion* pSfrCntZigZag, VECTORPATHS& vCrvPaths) const ;
bool GetSfrBySilhouette( ICAvParSilhouettesSurfTm* pCavParSilh, double dDepth, double dSilTolSamp,
double dSilTolLin, double dSilTolAng, ISurfFlatRegion* pSfrSil) ;
bool ApproxSilhouetteClosedPLForOptimal( PolyLine& PL, double dSampleTol, double dMaxLinTol, double dAngTol, double dLinFeaTol, ICurveComposite* pCompoPL) ;
@@ -128,19 +169,23 @@ class SurfFinishing : public Machining
const Vector3d& vtTool, double dDepth, double dClippingAngle, double dTolerAngle,
ISURFTMPOVECTOR& vpStm1, ISURFTMPOVECTOR& vpStm2, double& dMaxFrontTriaRad) const ;
bool GetZConstQuotesInsideSfrParallelToTool( const SURFLOCALVECTOR&, const Frame3d& frSurf, const ISurfFlatRegion* pSfr,
const Vector3d& vtTool, std::set<double>& setZAmbiguos) ;
ICAvParSilhouettesSurfTm* GetParSilhouettesForZConst( const ISURFTMPOVECTOR& vStm, const ISurfFlatRegion* pSfr) const ;
const Vector3d& vtTool, std::set<double>& setZAmbiguos) const ;
ISurfFlatRegion* GetSfrSilhouette( const SURFLOCALVECTOR& vSrfLoc, const Frame3d& frLvl0, double dDepth) const ;
ISurfFlatRegion* GetSfrProjectedStmLoops( const ISURFTMPOVECTOR& vStm, const ISurfFlatRegion* pSfrContour,
const DBLVECTOR& vdLinFeaTol, const DBLVECTOR& vdAngTol, const DBLVECTOR& vdMaxLinTol) const ;
ISurfTriMesh* SplitStmTriaUnderClippingAngle( const SurfLocal SrfLoc, const Vector3d& vtTest, double dClippingAngle,
double dFrontTriaTolerAng, double& dMaxFrontTriaRad) const ;
bool CalcOptimalZConstCurves( const ISurfFlatRegion* pSfrLoc, const SURFLOCALVECTOR& vSrfLoc,
const Frame3d& frSurf, const Vector3d& vtTool, double dAngDegSplit,
double dAngDegTol, double dDepth, ICAvToolSurfTm* pCAvTlStm, VECTORPATHS& vPaths, ISurfFlatRegion* pSfrProj) const ;
bool CalcOptimalZigZagCurves( const ISurfFlatRegion* pSfrLoc, const Frame3d& frSurf,
const Vector3d& vtTool, double dDepth, ICAvToolSurfTm* pCAvTlStm, VECTORPATHS& vPaths) const ;
bool GetOptimalSfr( ICAvToolSurfTm* pCAvTlStm, const SURFLOCALVECTOR& vSrfLoc, const Frame3d& frSurf, const ISurfFlatRegion* pSfrLoc, const Vector3d& vtTool,
double dDepth, double dElev, ISurfFlatRegion* pSfrSpiral, ISurfFlatRegion* pSfrZConst) const ;
bool CalcZConstSilCrv( ICAvParSilhouettesSurfTm* pCavParSilh, const SURFLOCALVECTOR& vSrfLoc, const Frame3d& frSurf,
const ISurfFlatRegion* pSfrClass, const Vector3d& vtTool, double dDepth, std::vector<ICRVCOMPOPOVECTOR>& vCrvCompo) ;
const ISurfFlatRegion* pSfrClass, const Vector3d& vtTool, double dDepth, std::vector<ICRVCOMPOPOVECTOR>& vCrvCompo) const ;
bool CreateZConstPaths( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf, std::vector<ICRVCOMPOPOVECTOR>& vCrvCompo, const Vector3d& vtTool,
const ISurfFlatRegion* pSfr, double dDepth, ICRVCOMPOPOVECTOR& vCrvPath) ;
const ISurfFlatRegion* pSfr, double dDepth, ICRVCOMPOPOVECTOR& vCrvPath) const ;
bool AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dElev, double dAppr) ;
bool AddLinkApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dElev, double dAppr) ;
bool AddLinkRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dElev, double dAppr) ;
@@ -149,16 +194,25 @@ class SurfFinishing : public Machining
bool AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtTool, bool bSplitArcs) ;
bool CalcLeadOutEnd( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d& vtTool, const Vector3d& vtNorm, Point3d& ptP1) const ;
bool AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Point3d& ptP1, const Vector3d& vtTool, bool bSplitArcs) ;
bool GetLastGoodPoint( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf,
const Point3d& ptStart, const Point3d& ptEnd, const Vector3d& vtTool, Point3d& ptP1) const ;
bool GetLastGoodPoint( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf, const Point3d& ptStart,
const Point3d& ptEnd, const Vector3d& vtInit, const Vector3d& vtTool,
bool bLeadInVsOut, Point3d& ptP1) const ;
bool GetLinkFromPaths( const Point3d& ptStart, const Point3d& ptEnd, const Vector3d& vtTool, const ISurfFlatRegion* pSfrCnt,
double dDepth, double dSafeZ, ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf, ICurveComposite* pCrvLink) const ;
bool GetSurfaceNormalAtPoint( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf,
const Point3d& ptTool, const Vector3d& vtTool, Vector3d& vtNorm) const ;
bool GetActiveSurfaces( INTVECTOR& vSurfId) const ;
bool MarchingSquares( const VECTORCOLLISIONSFR& vPntM, bool bSpiral, int nStepX, int nStepY, double dClippingAngle,
const Vector3d& vtAxL, const Vector3d& vtMoveL, ICAvToolSurfTm* pCAvTlStm,
bool GetActiveSurfaces( INTVECTOR& vSurfId, INTVECTOR& vSurfSuppId) const ;
int ProcessSquare( int nFlag, double dLevel, double dQPt0, double dQpt1, double dQpt2, double dQpt3,
int& nI1s, int& nI1e, int& nI2s, int& nI2e) const ;
Point3d CalcShapedPoint( const PNTUVVECT& myInfoStart, const PNTUVVECT& myInfoEnd, int nType, const Vector3d& vtAxL,
const Vector3d& vtMoveL, double dCosSplitAngle, double dLimInfCosSplitAng,
double dLimSupCosSplitAng, ICAvToolSurfTm* pCAvTlStm, int _nInd_debug) const ;
bool TestSubEdges( std::unordered_map<int, Point3d>& umEdgePnt, const INTVECTOR& vEdgeInd, int nType, int nFirst, int nLast,
const VECTORCOLLISIONSFR& vPntM, int nStepX, const Vector3d vtAxL, const Vector3d& vtMoveL,
double dCosSplitAng, double dLimInfCosSplitAng, double dLimSupCosSplitAng, ICAvToolSurfTm* pCAvTlStm, int _nInd_debug) const ;
bool MarchingSquares( const VECTORCOLLISIONSFR& vPntM, int nType, double dOffsTol, int nStepX, int nStepY, double dClippingAngle,
double dLimInfClippingAng, double dLimSupClippingAng, const Vector3d& vtAxL, const Vector3d& vtMoveL, ICAvToolSurfTm* pCAvTlStm,
ICRVCOMPOPOVECTOR& vCrvCompo) const ;
bool CalcShapedPoint( const PNTUVVECT& myInfoStart, const PNTUVVECT& myInfoEnd, bool bSpiral, const Vector3d& vtAxL,
const Vector3d& vtMoveL, double dClippingAngle, ICAvToolSurfTm* pCAvTlStm, Point3d& ptShaped, int _debug_ind = -1) const ;
double GetRightFeed( const Vector3d& vtMove, const Vector3d& vtTool) const ;
double GetRadiusForStartEndElevation( void) const ;
+1 -1
View File
@@ -392,7 +392,7 @@ SurfFinishingData::VerifySubType( int nVal) const
return ( nVal == SURFFIN_SUB_ZIGZAG || nVal == SURFFIN_SUB_ONEWAY ||
nVal == SURFFIN_SUB_SPIRALIN || nVal == SURFFIN_SUB_SPIRALOUT ||
nVal == SURFFIN_SUB_Z_CONST || nVal == SURFFIN_SUB_OPTIMAL ||
nVal == SURFFIN_SUB_PROJECT) ;
nVal == SURFFIN_SUB_PROJECT || nVal == SURFFIN_SUB_PENCIL) ;
}
//----------------------------------------------------------------------------
+1648 -343
View File
File diff suppressed because it is too large Load Diff
+104 -17
View File
@@ -23,7 +23,6 @@
#include "/EgtDev/Include/EGkSurfTriMesh.h"
#include "/EgtDev/Include/EGkIntersPlaneSurfTm.h"
class ICAvToolSurfTm ;
class ICAvParSilhouettesSurfTm ;
// struttura informazioni sui singoli percorsi
@@ -38,23 +37,93 @@ struct PathInfoSR {
// tipo percorso
typedef std::vector<PathInfoSR> PATHINFOSRVECTOR ;
// struttura informazioni per Step/SubSteps durante la loro creazione [quindi temporanei]
struct StepInfoSRTmp {
StepInfoSRTmp( void)
: nIndRef( -1), dDepth( 0), bSubStep( false), bPlaneZStep( false), dPercFeed( 0.),
pSfrRemoved( nullptr), pSfrPlaneZ( nullptr) {}
StepInfoSRTmp( int nIR, double dD, bool bSS, bool bPZ, double dPF, ISurfFlatRegion* pSR, ISurfFlatRegion* pSPZ)
: nIndRef( nIR), dDepth( dD), bSubStep( bSS), bPlaneZStep( bPZ), dPercFeed( dPF),
pSfrRemoved( pSR), pSfrPlaneZ( pSPZ) {}
~StepInfoSRTmp() {
delete( pSfrRemoved) ;
delete( pSfrPlaneZ) ;
}
int nIndRef ; // ( usato solo per step intermedi ) posizione step precedente
double dDepth ; // profondità posizione piano di svuotatura ( in negativo)
bool bSubStep ; // flag per indicare se lo Step è un SubStep
bool bPlaneZStep ; // flag per indicare se lo Step è un planeZ
double dPercFeed ; // percentuale degli extra steps relativa agli step base ( per Feed ZLoc)
ISurfFlatRegion* pSfrRemoved ; // regione PROGRESSIVA rimossa attuale
ISurfFlatRegion* pSfrPlaneZ ; // regione individuata da PlaneZDetection
} ;
// vettore associato
typedef std::vector<StepInfoSRTmp> STEPINFOTMPSRVECTOR ;
// struttura per salvataggio Sfr con parametri nel GeomDB
struct SfrGeoDBInfo {
SfrGeoDBInfo( ISurfFlatRegion* pMySfr, ISurfFlatRegion* pMySfrLimit, ISurfFlatRegion* pMySfrRemoved,
bool bMySubSubStep, double dMyDepth, double dMyRelativeDepth, double dMyZLocCoefFeed)
: bSubStep( bMySubSubStep), dDepth( dMyDepth), dRelativeDepth( dMyRelativeDepth), dZLocCoefFeed( dMyZLocCoefFeed) {
pSfr.Set( pMySfr) ;
pSfrLimit.Set( pMySfrLimit) ;
pSfrRemoved.Set( pMySfrRemoved) ;
}
SfrGeoDBInfo()
: bSubStep( true), dDepth( 0.), dRelativeDepth( 0.), dZLocCoefFeed( 1.) {
pSfr.Set( nullptr) ;
pSfrLimit.Set( nullptr) ;
pSfrRemoved.Set( nullptr) ;
}
PtrOwner<ISurfFlatRegion> pSfr ; // superficie di Sgrossatura ( allo step corrente)
PtrOwner<ISurfFlatRegion> pSfrLimit ; // superficie Limite ( allo step corrente)
PtrOwner<ISurfFlatRegion> pSfrRemoved ; // supericie Rimossa ( allo step corrente)
bool bSubStep ; // flag per indicare se Step semplice o meno ( Extra/PlaneZ)
double dDepth ; // profondità
double dRelativeDepth ; // profondità relativa
double dZLocCoefFeed ; // coefficiente di riduzione della Feed complessivo
} ;
// vettore associato
typedef std::vector<SfrGeoDBInfo> SFRGEODBINFOVECTOR ;
// struttura informazioni per Step/SubSteps complessivi
struct StepInfoSR {
double dDepth ; // profondità dello step attuale
double dRelativeDepth ; // profondità relativa allo step al di sopra
double dZlocCoeffFeed ; // coeffiziente riduzione Feed lungo Zloc
double dZlocCoeffFeed ; // coefficiente riduzione Feed lungo Zloc
int nSubType ; // tipo di lavorazione dello Step corrente
bool bIsExtraStep ; // flag per SubStep o PlaneZStep
bool bInverted ; // se percorsi invertiti
PtrOwner<ISurfFlatRegion> pSfrPock ; // regione piana di svuotatura
PtrOwner<ISurfFlatRegion> pSfrLimit ; // regione piana da non svuotare
PtrOwner<ISurfFlatRegion> pSfrPock ; // regione piana di sgrossatura
PtrOwner<ISurfFlatRegion> pSfrLimit ; // regione piana da non rovinare
PATHINFOSRVECTOR vPaths ; // percorsi di Pocketing
} ;
// tipo step
// vettore associato
typedef std::vector<StepInfoSR> STEPINFOSRVECTOR ;
// planeZ detection <SfrFace, dDepth>
typedef std::pair<PtrOwner<ISurfFlatRegion>, double> PLANEZFACE ;
typedef std::vector<PLANEZFACE> PLANEZFACEVECTOR ;
// posizione reciproca tra Step/SubStep/PlaneZ
enum { DOWN = 0, PLANAR = 1, ABOVE = 2} ;
// struttura per ordinamento mediante ZChunk
struct StepData {
PtrOwner<ISurfFlatRegion> pSfrChunk ; // regione piana di sgrossatura
PtrOwner<ISurfFlatRegion> pSfrLimit ; // regione piana da non rovinare
PtrOwner<ISurfFlatRegion> pSfrRemoved ; // regione piana rimossa alla Depth corrente
bool bIsSubStep ; // Flag per Step base o Extra ( SubStep/PlaneZ)
double dDepth ; // profondità
double dRelativeDepth ; // profondità relativa
double dZLocCoeffFeed ; // coefficiente di riduzione della Feed
} ;
// vettore di StepData
typedef std::vector<StepData> STEPDATAVECTOR ;
// Matrice di StepData
typedef std::vector<STEPDATAVECTOR> STEPDATAMATRIX ;
// ordine <Ind, ZMin, ZMax>
typedef std::pair<int, std::pair<double, double>> INTDBLDBL ;
// vettore associato
typedef std::vector<INTDBLDBL> INTDBLDBLVECTOR ;
//----------------------------------------------------------------------------
class SurfRoughing : public Machining
@@ -71,8 +140,14 @@ class SurfRoughing : public Machining
public : // Operation
int GetType( void) const override
{ return OPER_SURFROUGHING ; }
bool IsEmpty( void) const override
{ return ( m_nPaths == 0) ; }
bool IsEmpty( int nEmptyType = NEED_GEOM) const override
{ if ( m_nPaths == 0)
return true ;
if ( nEmptyType == NEED_ONE_TP_OK)
return ( ! IsAtLeastOnePathOk()) ;
if ( nEmptyType == NEED_ALL_TP_OK)
return ( ! AreAllPathsOk()) ;
return false ; }
bool UpdateStatus( int nModif) override
{ m_nStatus |= nModif ; return true ; }
@@ -95,7 +170,7 @@ class SurfRoughing : public Machining
bool GetParam( int nType, int& nVal) const override ;
bool GetParam( int nType, double& dVal) const override ;
bool GetParam( int nType, std::string& sVal) const override ;
bool UpdateToolData( bool* pbChanged = nullptr) override ;
bool UpdateToolData( void) override ;
const ToolData& GetToolData( void) const override ;
bool GetGeometry( SELVECTOR& vIds) const override ;
@@ -111,8 +186,15 @@ class SurfRoughing : public Machining
bool DetectPlaneZ( const CISURFTMPVECTOR& vpStm, const Frame3d& frCompo, const Vector3d& vtTool, PLANEZFACEVECTOR& vPlaneZ,
double dMinDepth, double dMaxDepth) const ;
bool CalcPaths( const INTINTVECTOR& vPocket, STEPINFOSRVECTOR& vStepInfo) const ;
bool OrderByZChunk( SFRGEODBINFOVECTOR& vInfoSfrGeomDB, int nTempInd, const ISurfFlatRegion* pSfrSgro) const ;
bool OrderZChunkSteps( STEPDATAMATRIX& vvDataSteps, STEPDATAMATRIX& vIndepChunkGroup,
INTDBLDBLVECTOR& vMapGrpZLoc) const ;
bool GetLinkFromPaths( STEPINFOSRVECTOR& vStepInfo, int i, int j, const Point3d& ptStart,
const Vector3d& vtTool, double dSafeZ, double dExtraElev, double& dEndElev,
ICurveComposite* pCrvLink) const ;
bool CalcRegionElevation( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dRad, double dLen, double& dElev) const ;
bool AddPocket( const INTINTVECTOR& vPocket, const Vector3d& vtTool, double dElev, double dStep, double dSubStep, bool bSplitArcs) ;
bool AddRoughing( const INTINTVECTOR& vPocket, const Vector3d& vtTool, double dElev, double dStep,
double dSubStep, bool bSplitArcs) ;
bool AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dElev, double dAppr, bool bOutStart, bool bAbsFirst) ;
bool AddLinkApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dElev, double dAppr, bool bOutMove) ;
bool AddLinkRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dElev, double dAppr) ;
@@ -124,10 +206,14 @@ class SurfRoughing : public Machining
bool AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d& vtN,
const ICurveComposite* pRCrv, bool bSplitArcs, bool bNoneForced, Point3d& ptP1) ;
ISurfTriMesh* GetRaw( void) const ;
ISurfTriMesh* GetStmOutSideSfr( const ISurfFlatRegion* pSfr, const ISurfTriMesh* pStmRaw, const Vector3d& vtExtr) const ;
ISurfTriMesh* GetStmOutSideSfr( const ISurfFlatRegion* pSfr, double dDepth, const ISurfTriMesh* pStmRaw, const Vector3d& vtExtr) const ;
ISurfFlatRegion* GetSfrByStmIntersection( const IntersParPlanesSurfTm& IPPStm, double dDist, double dSmallOffs = 0) const ;
ISurfFlatRegion* GetSfrSilhouette( ICAvParSilhouettesSurfTm* pCavParSilh, double dDepth, double Sil_tol, bool& bOk) const ;
bool GetActiveSurfaces( INTVECTOR& vSurfId) const ;
ISurfFlatRegion* GetSfrCornerColl( ISurfFlatRegion* pSfr, const ISurfFlatRegion* pSfrLimit,
const ISurfFlatRegion* pSfrColl, const ISurfFlatRegion* pSfrSearchCorners) const ;
bool GetToolCollisionRegion( const ISurfFlatRegion* pSfrSgro, double& dDepth, ISurfFlatRegion* pSfrColl,
ISurfFlatRegion* pSfrSearchCorners) const ;
bool GetActiveSurfaces( INTVECTOR& vSurfId, INTVECTOR& vSurfSuppId) const ;
double GetRightFeed( const Vector3d& vtMove, const Vector3d& vtTool) const ;
double GetRadiusForStartEndElevation( void) const ;
bool ResetCurveAllTempProp( ICurve* pCurve) const ;
@@ -136,10 +222,10 @@ class SurfRoughing : public Machining
bool CloseOpenEdgesUnderTolerance( ISurfFlatRegion* pSfr, double dToler) ;
bool ModifySurfForOpenCloseEdges( ISurfFlatRegion* pSfr, const Vector3d& vtTool, const ICurveComposite* pCrvCompo) const ;
bool ChooseCloseOrOpenEdge( ISurfFlatRegion* pSfr, const ISurfFlatRegion* pSfrRef) const ;
bool SimplifyCurve( ICurveComposite* pCompo, const ICRVCOMPOPOVECTOR& vCrvCheck) const ;
bool SimplifyCurve( ICurveComposite* pCompo, const ICRVCOMPOPOVECTOR& vCrvCheck, const Frame3d& frLocXY) const ;
bool SimplyfySfr( ISurfFlatRegion* pSfr) const ;
bool CheckSafetyLinearLink( const Point3d& ptCurr, const ISurfFlatRegion* pSfrLimit, const Vector3d& vtTool,
const Point3d& ptDest, bool& bSafe) const ;
bool CheckSafetyLinearLink( const Point3d& ptCurr, const Point3d& ptDest, const ISurfFlatRegion* pSfrCheck, const Vector3d& vtTool,
bool& bSafe) const ;
bool GetHomogeneousParts( const ICurveComposite* pCrvCompo, ICRVCOMPOPOVECTOR& vpCrvs) const ;
bool VerifyLeadInHelix( const ISurfFlatRegion* pSfr, const Point3d& ptStart, const Point3d& ptCen, double dHelixRad) const ;
bool VerifyLeadInZigZag( const ISurfFlatRegion* pSfr, const Point3d& ptStart, const Point3d& ptPa, const Point3d& ptPb) const ;
@@ -183,9 +269,9 @@ class SurfRoughing : public Machining
return m_Params.m_nLeadOutType ; }
/* debug functions */
void DrawLoopsSurf( const ISurfFlatRegion* pSfr, bool bWithSurf, Color Col, bool bAlphaCoverage, std::string sName) ;
void DrawFeed( const ICurve* pCrv, double dFeed) ;
void DrawNormalShaderSurfTm( const ISurfTriMesh* pStm, std::string sName) ;
void DrawLoopsSurf( const ISurfFlatRegion* pSfr, bool bWithSurf, Color Col, bool bAlphaCoverage, std::string sName) const ;
void DrawFeed( const ICurve* pCrv, double dFeed) const ;
void DrawNormalShaderSurfTm( const ISurfTriMesh* pStm, std::string sName) const ;
/* end debug functions */
private :
@@ -201,5 +287,6 @@ class SurfRoughing : public Machining
double m_dStepToler ; // tolleranza di rimozione chunk per Steps
double m_dSubStepToler ; // tolleranza di rimozione chunk per SubSteps
bool m_bDetectPlaneZ ; // flag per calcolo piani in Zloc di Pocketing
bool m_bOrderZ ; // flag per ordinamento Chunks secondo vtTool
bool m_bRunning ; // flag di calcoli in corso
} ;
+17 -3
View File
@@ -45,6 +45,7 @@ enum nSurfRoughingKey {
KEY_NNU,
KEY_OL,
KEY_OR,
KEY_OVL,
KEY_PS,
KEY_S,
KEY_SA,
@@ -78,6 +79,7 @@ static const array<string,KEY_ZZZ> sSurfRoughingKey = {
"NNU",
"OL",
"OR",
"OVL",
"PS",
"S",
"SA",
@@ -113,7 +115,7 @@ SurfRoughingData::Clone( void) const
bool
SurfRoughingData::CopyFrom( const MachiningData* pMdata)
{
// è inutile copiare se sorgente coincide con destinazione
// è inutile copiare se sorgente coincide con destinazione
if ( pMdata == this)
return true ;
// la sorgente deve essere dello stesso tipo
@@ -138,6 +140,7 @@ SurfRoughingData::CopyFrom( const MachiningData* pMdata)
m_bInvert = pSdata->m_bInvert ;
m_sDepth = pSdata->m_sDepth ;
m_dStartPos = pSdata->m_dStartPos ;
m_dOverlap = pSdata->m_dOverlap ;
m_dStep = pSdata->m_dStep ;
m_dSubStep = pSdata->m_dSubStep ;
m_dSideStep = pSdata->m_dSideStep ;
@@ -183,6 +186,7 @@ SurfRoughingData::SameAs(const MachiningData* pMdata) const
m_bInvert == pSdata->m_bInvert &&
m_sDepth == pSdata->m_sDepth &&
abs( m_dStartPos - pSdata->m_dStartPos) < EPS_MACH_LEN_PAR &&
abs( m_dOverlap - pSdata->m_dOverlap) < EPS_MACH_LEN_PAR &&
abs( m_dStep - pSdata->m_dStep) < EPS_MACH_LEN_PAR &&
abs( m_dSubStep - pSdata->m_dSubStep) < EPS_MACH_LEN_PAR &&
abs( m_dSideStep - pSdata->m_dSideStep) < EPS_MACH_LEN_PAR &&
@@ -202,7 +206,7 @@ SurfRoughingData::SameAs(const MachiningData* pMdata) const
int
SurfRoughingData::GetSize( void) const
{
// in debug verifico validità ultimo campo
// in debug verifico validità ultimo campo
assert( sSurfRoughingKey[KEY_UUID] == "UUID") ;
return KEY_ZZZ ;
}
@@ -294,6 +298,9 @@ SurfRoughingData::FromString( const string& sString, int& nKey)
case KEY_OL :
bOk = ::FromString( sVal, m_dOffsL) ;
break ;
case KEY_OVL :
bOk = ::FromString( sVal, m_dOverlap) ;
break ;
case KEY_PS :
bOk = ::FromString( sVal, m_dStartPos) ;
break ;
@@ -358,6 +365,7 @@ SurfRoughingData::ToString( int nInd) const
case KEY_NNU : return ( sSurfRoughingKey[KEY_NNU] + "=" + m_sUserNotes) ;
case KEY_OL : return ( sSurfRoughingKey[KEY_OL] + "=" + ::ToString( m_dOffsL)) ;
case KEY_OR : return ( sSurfRoughingKey[KEY_OR] + "=" + ::ToString( m_dOffsR)) ;
case KEY_OVL : return ( sSurfRoughingKey[KEY_OVL] + "=" + ::ToString( m_dOverlap)) ;
case KEY_PS : return ( sSurfRoughingKey[KEY_PS] + "=" + ::ToString( m_dStartPos)) ;
case KEY_S : return ( sSurfRoughingKey[KEY_S] + "=" + ::ToString( m_dSpeed)) ;
case KEY_SA : return ( sSurfRoughingKey[KEY_SA] + "=" + ::ToString( m_dSideAngle)) ;
@@ -377,7 +385,7 @@ SurfRoughingData::ToString( int nInd) const
bool
SurfRoughingData::IsOptional( int nKey) const
{
return ( nKey == KEY_LIEL || nKey == KEY_SST) ;
return ( nKey == KEY_LIEL || nKey == KEY_SST || nKey == KEY_OVL) ;
}
//----------------------------------------------------------------------------
@@ -502,6 +510,9 @@ SurfRoughingData::SetParam( int nType, double dVal)
case MPA_OFFSL :
m_dOffsL = dVal ;
return true ;
case MPA_OVERL :
m_dOverlap = dVal ;
return true ;
case MPA_DEPTH :
m_sDepth = ::ToString( dVal) ;
return true ;
@@ -643,6 +654,9 @@ SurfRoughingData::GetParam( int nType, double& dVal) const
case MPA_OFFSL :
dVal = m_dOffsL ;
return true ;
case MPA_OVERL :
dVal = m_dOverlap ;
return true ;
case MPA_STARTPOS :
dVal = m_dStartPos ;
return true ;
+7 -6
View File
@@ -23,16 +23,17 @@ struct SurfRoughingData : public MachiningData
std::string m_sInitAngs ; // angoli iniziali suggeriti (Nome1=val1,Nome2=val2)
std::string m_sBlockedAxis ; // eventuale asse rotante bloccato (Nome=val)
int m_nSolCh ; // criterio scelta soluzione (quando possibili molteplici)
double m_dSpeed ; // velocità di rotazione (+ se CCW, - se CW) ( se 0 da utensile)
double m_dFeed ; // velocità di lavorazione normale ( se 0 da utensile)
double m_dStartFeed ; // velocità di lavorazione iniziale ( se 0 da utensile)
double m_dEndFeed ; // velocità di lavorazione finale ( se 0 da utensile)
double m_dTipFeed ; // velocità di lavorazione di testa ( se 0 da utensile)
double m_dSpeed ; // velocità di rotazione (+ se CCW, - se CW) ( se 0 da utensile)
double m_dFeed ; // velocità di lavorazione normale ( se 0 da utensile)
double m_dStartFeed ; // velocità di lavorazione iniziale ( se 0 da utensile)
double m_dEndFeed ; // velocità di lavorazione finale ( se 0 da utensile)
double m_dTipFeed ; // velocità di lavorazione di testa ( se 0 da utensile)
double m_dOffsR ; // offset radiale ( se UNKNOWN_PAR da utensile)
double m_dOffsL ; // offset longitudinale ( se UNKNOWN_PAR da utensile)
bool m_bInvert ; // flag di inversione direzione lavorazione
std::string m_sDepth ; // affondamento massimo (espressione numerica)
double m_dStartPos ; // quota di inizio lavorazione (sempre >= 0)
double m_dOverlap ; // distanza di sovrapposizione con il contorno
double m_dStep ; // passo di affondamento (0=nessun passo)
double m_dSideStep ; // distanza tra le passate
double m_dSubStep ; // distanza tra le passate intermedie
@@ -50,7 +51,7 @@ struct SurfRoughingData : public MachiningData
SurfRoughingData( void)
: m_ToolUuid(), m_nSolCh( 0), m_dSpeed( 0), m_dFeed( 0), m_dStartFeed( 0), m_dEndFeed( 0), m_dTipFeed( 0),
m_dOffsR( UNKNOWN_PAR), m_dOffsL( UNKNOWN_PAR), m_bInvert( false),
m_dStartPos( 0), m_dStep( 0), m_dSideStep( 0), m_dSubStep( 0), m_nSubType( 0), m_dSideAngle( 0),
m_dStartPos( 0), m_dOverlap( 0), m_dStep( 0), m_dSideStep( 0), m_dSubStep( 0), m_nSubType( 0), m_dSideAngle( 0),
m_nLeadInType( 0), m_dLiTang( 0), m_dLiElev( 0),
m_nLeadOutType( 0), m_dLoTang( 0), m_dApprox( 0) {}
SurfRoughingData* Clone( void) const override ;
+6 -1
View File
@@ -85,7 +85,12 @@ ToolsMgr::Reload( void)
Scanner TheScanner ;
if ( ! TheScanner.Init( m_sToolsPath, ";")) {
LOG_ERROR( GetEMkLogger(), "ReloadTools : Error on Init")
return false ;
if ( ExistsDirectory( m_sToolsDir) && ! ExistsFile( m_sToolsPath)) {
m_bModified = true ;
return true ;
}
else
return false ;
}
// variabili di stato della lettura
+315 -204
View File
@@ -18,6 +18,7 @@
#include "WaterJetting.h"
#include "GeoConst.h"
#include "OperationConst.h"
#include "OperUserNotesConst.h"
#include "/EgtDev/Include/EGkCurveLine.h"
#include "/EgtDev/Include/EGkCurveArc.h"
#include "/EgtDev/Include/EGkCurveComposite.h"
@@ -57,6 +58,7 @@ using namespace std ;
// 3219 = "Error in WaterJetting : Tool loading failed"
// 3220 = "Error in WaterJetting : Center work not allowed with side angle"
// 3221 = "Error in WaterJetting : Path plane different from XY"
// 3222 = "Error in WaterJetting : special apply not calculable"
// 3251 = "Warning in WaterJetting : Skipped entity (xx)"
// 3252 = "Warning in WaterJetting : No machinable path"
// 3253 = "Warning in WaterJetting : Tool name changed (xx)"
@@ -66,6 +68,7 @@ using namespace std ;
//----------------------------------------------------------------------------
const double EXTRA_ACC_LEN = 0.5 ;
const double INTANG_ROT_LEN = 5.0 ;
const double LEN_TOL = 100 * EPS_SMALL ; // valore limite per gestione degli angoli
//----------------------------------------------------------------------------
USEROBJ_REGISTER( GetOperationClass( OPER_WATERJETTING), WaterJetting) ;
@@ -501,7 +504,8 @@ WaterJetting::SetGeometry( const SELVECTOR& vIds)
// verifico validità gestore DB geometrico
if ( m_pGeomDB == nullptr)
return false ;
// reset della geometria corrente
// copia temporanea e reset della geometria corrente
SELVECTOR vOldId = m_vId ;
m_vId.clear() ;
// verifico che gli identificativi rappresentino delle entità ammissibili (tutte curve, tutti testi o tutte facce)
int nType = GEO_NONE ;
@@ -517,7 +521,8 @@ WaterJetting::SetGeometry( const SELVECTOR& vIds)
m_vId.emplace_back( Id) ;
}
// aggiorno lo stato
m_nStatus |= MCH_ST_GEO_MODIF ;
if ( m_vId != vOldId)
m_nStatus |= MCH_ST_GEO_MODIF ;
// restituisco presenza geometria da lavorare
return ( ! m_vId.empty() || vIds.empty()) ;
}
@@ -621,16 +626,18 @@ WaterJetting::Apply( bool bRecalc, bool bPostApply)
return false ;
// aggiorno dati geometrici dell'utensile
bool bToolChanged = true ;
if ( ! UpdateToolData( &bToolChanged)) {
if ( ! UpdateToolData()) {
m_pMchMgr->SetLastError( 3201, "Error in WaterJetting : UpdateToolData failed") ;
return false ;
}
m_nHeadSolCh = m_pMchMgr->GetCurrMachine()->GetHeadSolCh( m_TParams.m_sHead) ;
// se modificata geometria, necessario ricalcolo
if ( ( m_nStatus & MCH_ST_GEO_MODIF) != 0)
bRecalc = true ;
// verifico se necessario continuare nell'aggiornamento
if ( ! bRecalc && ! bToolChanged &&
( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) {
if ( ! bRecalc && ( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) {
// confermo i percorsi di lavorazione
m_nMills = nCurrMills ;
string sLog = string( "WaterJetting apply skipped : status ") + ( m_nStatus == MCH_ST_OK ? "already ok" : "no postapply") ;
@@ -761,6 +768,19 @@ WaterJetting::Update( bool bPostApply)
return false ;
}
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
CalcAndSetAxesBBox() ;
// esecuzione eventuali personalizzazioni speciali
string sSpecErr ;
if ( bPostApply && ! SpecialApply( sSpecErr)) {
if ( ! IsEmptyOrSpaces( sSpecErr))
m_pMchMgr->SetLastError( 3222, sSpecErr) ;
else
m_pMchMgr->SetLastError( 3222, "Error in WaterJetting : special apply not calculable") ;
return false ;
}
// gestione movimenti all'inizio di ogni singolo percorso di lavorazione e alla fine della lavorazione
if ( ! AdjustStartEndMovements()) {
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
@@ -771,10 +791,7 @@ WaterJetting::Update( bool bPostApply)
return false ;
}
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
CalcAndSetAxesBBox() ;
// esecuzione eventuali personalizzazioni
// esecuzione eventuali personalizzazioni finali
string sErr ;
if ( bPostApply && ! PostApply( sErr)) {
if ( ! IsEmptyOrSpaces( sErr))
@@ -959,7 +976,7 @@ WaterJetting::GetToolData( void) const
//----------------------------------------------------------------------------
bool
WaterJetting::UpdateToolData( bool* pbChanged)
WaterJetting::UpdateToolData( void)
{
// recupero il gestore DB utensili della macchina corrente
ToolsMgr* pTMgr = m_pMchMgr->GetCurrToolsMgr() ;
@@ -1010,9 +1027,9 @@ WaterJetting::UpdateToolData( bool* pbChanged)
m_Params.m_sToolName + ")" ;
m_pMchMgr->SetWarning( 3254, sInfo) ;
}
// se definito parametro di ritorno, lo assegno
if ( pbChanged != nullptr)
*pbChanged = bChanged ;
// se modificato, aggiusto lo stato
if ( bChanged)
m_nStatus = MCH_ST_TO_VERIFY ;
return true ;
}
@@ -1198,9 +1215,6 @@ WaterJetting::Chain( int nGrpDestId)
// vettore puntatori alle curve
ICURVEPOVECTOR vpCrvs ;
vpCrvs.reserve( m_vId.size()) ;
// vettore selettori delle curve originali
SELVECTOR vInds ;
vInds.reserve( m_vId.size()) ;
// recupero tutte le curve e le porto in globale
for ( const auto& Id : m_vId) {
// prendo le curve
@@ -1210,14 +1224,16 @@ WaterJetting::Chain( int nGrpDestId)
m_pMchMgr->SetWarning( 3251, sInfo) ;
}
for ( auto pCrv : lstPC) {
// salvo l'id geometrico della curva nelle sue temp prop per i conti successivi
pCrv->SetTempProp( Id.nId, 0) ;
pCrv->SetTempProp( Id.nSub, 1) ;
vpCrvs.emplace_back( pCrv) ;
vInds.emplace_back( Id) ;
}
}
// verifico se sono necessarie sistemazioni per collegamenti (bridges)
// 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) ;
AdjustCurvesForBridges( vpCrvs) ;
}
// preparo i dati per il concatenamento
bool bFirst = true ;
@@ -1246,8 +1262,8 @@ WaterJetting::Chain( int nGrpDestId)
}
// recupero i percorsi concatenati
int nCount = 0 ;
INTVECTOR vnId2 ;
while ( chainC.GetChainFromNear( ptNear, false, vnId2)) {
INTVECTOR vnId ;
while ( chainC.GetChainFromNear( ptNear, false, vnId)) {
// creo una curva composita
PtrOwner<ICurveComposite> pCrvCompo( CreateCurveComposite()) ;
if ( IsNull( pCrvCompo))
@@ -1256,18 +1272,18 @@ WaterJetting::Chain( int nGrpDestId)
Vector3d vtExtr = Z_AX ;
double dThick = 0 ;
// vettore Id originali
SELVECTOR vId2 ;
vId2.reserve( vnId2.size()) ;
SELVECTOR vOrigId ;
vOrigId.reserve( vnId.size()) ;
// recupero le curve semplici e le inserisco nella curva composita
for ( size_t i = 0 ; i < vnId2.size() ; ++ i) {
int nId = abs( vnId2[i]) - 1 ;
bool bInvert = ( vnId2[i] < 0) ;
vId2.emplace_back( vInds[nId]) ;
for ( int i = 0 ; i < int( vnId.size()) ; ++ i) {
int nId = abs( vnId[i]) - 1 ;
bool bInvert = ( vnId[i] < 0) ;
// recupero la curva
ICurve* pCrv = vpCrvs[nId] ;
vOrigId.emplace_back( pCrv->GetTempProp( 0), pCrv->GetTempProp( 1)) ;
// se necessario, la inverto
if ( bInvert)
pCrv->Invert() ;
pCrv->Invert() ;
// recupero eventuali estrusione e spessore
Vector3d vtTemp ;
if ( pCrv->GetExtrusion( vtTemp)) {
@@ -1296,7 +1312,7 @@ WaterJetting::Chain( int nGrpDestId)
if ( nPathId == GDB_ID_NULL)
return false ;
m_pGeomDB->SetName( nPathId, MCH_PATH + ToString( ++ nCount)) ;
m_pGeomDB->SetInfo( nPathId, KEY_IDS, ToString( vId2)) ;
m_pGeomDB->SetInfo( nPathId, KEY_IDS, ToString( vOrigId)) ;
// inserisco la curva composita nel gruppo destinazione
int nNewId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nPathId, ::Release( pCrvCompo)) ;
if ( nNewId == GDB_ID_NULL)
@@ -1307,7 +1323,7 @@ WaterJetting::Chain( int nGrpDestId)
//----------------------------------------------------------------------------
bool
WaterJetting::AdjustCurvesForBridges( ICURVEPOVECTOR& vpCrvs, SELVECTOR& vInds)
WaterJetting::AdjustCurvesForBridges( ICURVEPOVECTOR& vpCrvs)
{
// Gruppo dei collegamenti
struct Bridge {
@@ -1338,44 +1354,49 @@ WaterJetting::AdjustCurvesForBridges( ICURVEPOVECTOR& vpCrvs, SELVECTOR& vInds)
}
// Verifico i collegamenti che interessano le geometrie della lavorazione
double const DIST_MAX = 5 ;
for ( int i = 0 ; i < int( vBridges.size()) ; ++ i) {
// cerco le due curve interessate dal collegamento
// cerco le due curve interessate dal collegamento calcolando e verificando anche la posizione dei punti di collegamento sulle
// due curve
double dMinLen = vBridges[i].dWidth + m_TParams.m_dDiam ;
int nI1 = -1 ;
for ( int j = 0 ; j < int( vInds.size()) ; ++ j) {
if ( vInds[j].nId == vBridges[i].nEnt1) {
nI1 = j ;
break ;
double dDist1, dU1, dLenP1, dLen1 ; int nF1 ;
for ( int j = 0 ; j < int( vpCrvs.size()) ; ++ j) {
// recupero l'id geometrico della curva dalla sua temp prop
int nCrvId = vpCrvs[j]->GetTempProp() ;
if ( nCrvId == vBridges[i].nEnt1) {
DistPointCurve distPC1( vBridges[i].ptP1, *vpCrvs[j]) ;
if ( distPC1.GetDist( dDist1) && dDist1 < DIST_MAX &&
distPC1.GetParamAtMinDistPoint( 0, dU1, nF1) &&
vpCrvs[j]->GetLengthAtParam( dU1, dLenP1) &&
vpCrvs[j]->GetLength( dLen1) &&
dLenP1 > dMinLen - EPS_SMALL &&
( dLen1 - dLenP1) > dMinLen - EPS_SMALL) {
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 ;
double dDist2, dU2, dLenP2, dLen2 ; int nF2 ;
for ( int j = 0 ; j < int( vpCrvs.size()) ; ++ j) {
int nCrvId = vpCrvs[j]->GetTempProp() ;
if ( nCrvId == vBridges[i].nEnt2) {
DistPointCurve distPC2( vBridges[i].ptP2, *vpCrvs[j]) ;
if ( distPC2.GetDist( dDist2) && dDist2 < DIST_MAX &&
distPC2.GetParamAtMinDistPoint( 0, dU2, nF2) &&
vpCrvs[j]->GetLengthAtParam( dU2, dLenP2) &&
vpCrvs[j]->GetLength( dLen2) &&
dLenP2 > dMinLen - EPS_SMALL &&
( dLen2 - dLenP2) > dMinLen - EPS_SMALL) {
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()) ;
@@ -1393,15 +1414,11 @@ WaterJetting::AdjustCurvesForBridges( ICURVEPOVECTOR& vpCrvs, SELVECTOR& vInds)
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
// inserisco le nuove curve nel vettore delle curve
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 ;
@@ -1492,7 +1509,9 @@ WaterJetting::ProcessPath( int nPathId, int nPvId, int nClId)
// recupero direzione utensile da estrusione
Vector3d vtTool ;
pCompo->GetExtrusion( vtTool) ;
if ( ! ( vtTool - Z_AX).IsSmall()) {
if ( vtTool.IsSmall())
vtTool = Z_AX ;
if ( ! AreSameVectorApprox( vtTool, Z_AX)) {
m_pMchMgr->SetLastError( 3221, "Error in WaterJetting : Path plane different from XY") ;
return false ;
}
@@ -1501,18 +1520,19 @@ WaterJetting::ProcessPath( int nPathId, int nPvId, int nClId)
if ( pCompo->IsClosed()) {
// recupero indicazione lato di inizio
int nStart = 0 ;
string sMyNotes = m_Params.m_sUserNotes ;
ToUpper( sMyNotes) ;
if ( sMyNotes.find( "START=XP") != string::npos)
nStart = 1 ;
else if ( sMyNotes.find( "START=XM") != string::npos)
nStart = -1 ;
else if ( sMyNotes.find( "START=YP") != string::npos)
nStart = 2 ;
else if ( sMyNotes.find( "START=YM") != string::npos)
nStart = -2 ;
else if ( sMyNotes.find( "START=") != string::npos)
nStart = 11 ;
string sStart ;
if ( GetValInNotes( m_Params.m_sUserNotes, UN_START, sStart)) {
if ( sStart == "XP")
nStart = 1 ;
else if ( sStart == "XM")
nStart = -1 ;
else if ( sStart == "YP")
nStart = 2 ;
else if ( sStart == "YM")
nStart = -2 ;
else
nStart = 11 ;
}
// se richiesta sistemazione punto di inizio
if ( nStart != 0 && nStart != 11) {
const double COS_ANG_PERD_TG = cos( 5 * DEGTORAD) ;
@@ -1575,12 +1595,12 @@ WaterJetting::ProcessPath( int nPathId, int nPvId, int nClId)
}
// se altrimenti suggerito punto di inizio
else if ( nStart == 11) {
ReplaceString( sMyNotes, "(", "") ;
ReplaceString( sMyNotes, ")", "") ;
TrimLeft( sStart, "(") ;
TrimRight( sStart, ")") ;
Point3d ptStart ;
double dPar ;
int nFlag ;
if ( GetValInNotes( sMyNotes, "START", ptStart) &&
if ( FromString( sStart, ptStart) &&
DistPointCurve( ptStart, *pCompo).GetParamAtMinDistPoint( 0, dPar, nFlag)) {
pCompo->ChangeStartPoint( dPar) ;
}
@@ -1720,8 +1740,20 @@ WaterJetting::ProcessPath( int nPathId, int nPvId, int nClId)
return false ;
m_pGeomDB->SetName( nPxId, sPathName) ;
m_pGeomDB->SetMaterial( nPxId, GREEN) ;
// assegno il vettore estrazione al gruppo del percorso
m_pGeomDB->SetInfo( nPxId, KEY_EXTR, vtTool) ;
// assegno i punti di inizio e fine al gruppo del percorso
m_pGeomDB->SetInfo( nPxId, KEY_START, ptStart) ;
m_pGeomDB->SetInfo( nPxId, KEY_END, ptEnd) ;
// assegno l'elevazione massima
m_pGeomDB->SetInfo( nPxId, KEY_ELEV, m_dElev) ;
// Sistemazioni per angoli interni
AdjustPathForInternalAngles( pCompo) ;
// creo l'anteprima del percorso
if ( ! GeneratePreView( nPxId, pCompo, dAddedOverlap))
if ( ! GeneratePreView( nPxId, pCompo, vtTool, dAddedOverlap))
return false ;
}
@@ -1761,10 +1793,10 @@ WaterJetting::ProcessPath( int nPathId, int nPvId, int nClId)
//----------------------------------------------------------------------------
bool
WaterJetting::GeneratePreView( int nPathId, const ICurveComposite* pCompo, double dAddedOverlap)
WaterJetting::GeneratePreView( int nPathId, const ICurveComposite* pCompo, const Vector3d& vtTool, double dAddedOverlap)
{
// colore taglio, dipendente da angolo di inclinazione
Color colCut = LIME ;
Color colCut = TEAL ;
if ( abs( m_Params.m_dSideAngle) > EPS_ANG_SMALL)
colCut = FUCHSIA ;
// creo copia della curva composita
@@ -1777,11 +1809,12 @@ WaterJetting::GeneratePreView( int nPathId, const ICurveComposite* pCompo, doubl
pCrv->TrimStartAtLen( dAddedOverlap) ;
pCrv->Invert() ;
}
bool bClosed = pCrv->IsClosed() ;
// calcolo la regione ridotta
PtrOwner<ISurfFlatRegion> pSfr ;
double dSideCoeff = ( abs( m_Params.m_dSideAngle) > EPS_ANG_SMALL ? 1. / cos( m_Params.m_dSideAngle * DEGTORAD) : 1) ;
double dRad = 0.5 * m_TParams.m_dDiam * dSideCoeff ;
pSfr.Set( GetSurfFlatRegionFromFatCurve( Release( pCrv), dRad, false, false)) ;
pSfr.Set( GetSurfFlatRegionFromFatCurve( Release( pCrv), dRad, false, true)) ;
if ( IsNull( pSfr))
return false ;
// aggiungo eventuali anelli su angoli esterni
@@ -1799,23 +1832,38 @@ WaterJetting::GeneratePreView( int nPathId, const ICurveComposite* pCompo, doubl
m_pGeomDB->SetMaterial( nRRId, INVISIBLE) ;
// regione per attacco
PtrOwner<ISurfFlatRegion> pSfrLI( GenerateLeadInPreview( pCompo)) ;
PtrOwner<ISurfFlatRegion> pSfrLI( GenerateLeadInPreview( pCompo, vtTool, bClosed)) ;
if ( IsNull( pSfrLI))
return false ;
if ( pSfrLI->IsValid()) {
// se regione definita la aggiungo alla regione completa
if ( ! pSfrTot->Add( *pSfrLI))
return false ;
// aggiungo nel DB
int nRLiId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nPathId, Release( pSfrLI)) ;
if ( nRLiId == GDB_ID_NULL)
return false ;
m_pGeomDB->SetName( nRLiId, MCH_PV_RLICUT) ;
m_pGeomDB->SetMaterial( nRLiId, INVISIBLE) ;
if ( pSfrLI->IsValid()) {
// se nessun attacco pSrfLI è solo un cerchio segnaposto, aggiungo la sua curva di bordo al DB
if ( GetLeadInType() == WJET_LI_NONE) {
PtrOwner<ICurve> pCrvLI( pSfrLI->GetLoop( 0, 0)) ;
if ( IsNull( pCrvLI))
return false ;
int nCLIId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nPathId, Release( pCrvLI)) ;
if ( nCLIId == GDB_ID_NULL)
return false ;
// assegno nome e colore
m_pGeomDB->SetName( nCLIId, MCH_PV_CUT) ;
m_pGeomDB->SetMaterial( nCLIId, colCut) ;
}
// altrimenti aggiungo la regione
else {
// aggiungo alla regione completa
if ( ! pSfrTot->Add( *pSfrLI))
return false ;
// aggiungo nel DB
int nRLiId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nPathId, Release( pSfrLI)) ;
if ( nRLiId == GDB_ID_NULL)
return false ;
m_pGeomDB->SetName( nRLiId, MCH_PV_RLICUT) ;
m_pGeomDB->SetMaterial( nRLiId, INVISIBLE) ;
}
}
// regione per uscita
PtrOwner<ISurfFlatRegion> pSfrLO( GenerateLeadOutPreview( pCompo)) ;
PtrOwner<ISurfFlatRegion> pSfrLO( GenerateLeadOutPreview( pCompo, vtTool)) ;
if ( IsNull( pSfrLO))
return false ;
if ( pSfrLO->IsValid()) {
@@ -1976,22 +2024,31 @@ WaterJetting::GeneratePreView( int nPathId, const ICurveComposite* pCompo, doubl
//----------------------------------------------------------------------------
ISurfFlatRegion*
WaterJetting::GenerateLeadInPreview( const ICurveComposite* pCompo)
WaterJetting::GenerateLeadInPreview( const ICurveComposite* pCompo, const Vector3d& vtN, bool bClosed)
{
// Creo la superficie
PtrOwner<ISurfFlatRegion> pSfr( CreateSurfFlatRegion()) ;
if ( IsNull( pSfr))
return nullptr ;
// Assegno il tipo
int nType = GetLeadInType() ;
if ( nType == WJET_LI_NONE)
return Release( pSfr) ;
double dSideCoeff = ( abs( m_Params.m_dSideAngle) > EPS_ANG_SMALL ? 1. / cos( m_Params.m_dSideAngle * DEGTORAD) : 1) ;
double dRad = 0.49 * m_TParams.m_dDiam * dSideCoeff ; // non 0.5 per evitare problemi di coincidenza
// Recupero punto e direzione iniziali del percorso
Point3d ptStart ; pCompo->GetStartPoint( ptStart) ;
Vector3d vtStart ; pCompo->GetStartDir( vtStart) ;
// Recupero versore estrusione
Vector3d vtN ; pCompo->GetExtrusion( vtN) ;
// Verifico il tipo
int nType = GetLeadInType() ;
if ( nType == WJET_LI_NONE) {
// se nessun attacco e curva chiusa creo segnaposto per indicare punto di inizio
if ( bClosed) {
pSfr.Set( GetSurfFlatRegionDisk( dRad)) ;
if ( ! IsNull( pSfr))
pSfr->Translate( ptStart - ORIG) ;
}
return Release( pSfr) ;
}
// Calcolo punto iniziale dell'attacco
Point3d ptP1 ;
if ( ! CalcLeadInStart( ptStart, vtStart, vtN, pCompo, ptP1))
@@ -2014,9 +2071,7 @@ WaterJetting::GenerateLeadInPreview( const ICurveComposite* pCompo)
default :
return nullptr ;
}
// calcolo la regione
double dSideCoeff = ( abs( m_Params.m_dSideAngle) > EPS_ANG_SMALL ? 1. / cos( m_Params.m_dSideAngle * DEGTORAD) : 1) ;
double dRad = 0.49 * m_TParams.m_dDiam * dSideCoeff ; // non 0.5 per evitare problemi di coincidenza
// calcolo la regione
pSfr.Set( GetSurfFlatRegionFromFatCurve( Release( pCrv), dRad, false, false)) ;
if ( IsNull( pSfr))
return nullptr ;
@@ -2034,7 +2089,7 @@ WaterJetting::GenerateLeadInPreview( const ICurveComposite* pCompo)
//----------------------------------------------------------------------------
ISurfFlatRegion*
WaterJetting::GenerateLeadOutPreview( const ICurveComposite* pCompo)
WaterJetting::GenerateLeadOutPreview( const ICurveComposite* pCompo, const Vector3d& vtN)
{
// Creo la regione
PtrOwner<ISurfFlatRegion> pSfr( CreateSurfFlatRegion()) ;
@@ -2064,8 +2119,6 @@ WaterJetting::GenerateLeadOutPreview( const ICurveComposite* pCompo)
// Recupero punto e direzione iniziali del percorso
Point3d ptEnd ; pCompo->GetEndPoint( ptEnd) ;
Vector3d vtEnd ; pCompo->GetEndDir( vtEnd) ;
// Recupero versore estrusione
Vector3d vtN ; pCompo->GetExtrusion( vtN) ;
// Calcolo la curva di uscita
PtrOwner<ICurve> pCrv ;
switch ( nType) {
@@ -2107,55 +2160,61 @@ WaterJetting::AddLoopsPreview( const ICurveComposite* pCompo, ISurfFlatRegion* p
for ( int i = 1 ; i <= nMaxInd ; ++ i) {
// curva corrente
const ICurve* pCrvC = pCompo->GetCurve( i) ;
// Recupero versore estrusione
Vector3d vtN ; pCompo->GetExtrusion( vtN) ;
// direzione finale precedente
// curva precedente
const ICurve* pCrvP = pCompo->GetCurve( i - 1) ;
// verifico che tratti abbiano lunghezza sufficiente per gestione angolo
double dLenC ; pCrvC->GetLength( dLenC) ;
double dLenP ; pCrvP->GetLength( dLenP) ;
if ( dLenC < LEN_TOL || dLenP < LEN_TOL)
continue ;
// angolo tra direzione finale precedente e direzione iniziale corrente
Vector3d vtEnd ; pCrvP->GetEndDir( vtEnd) ;
// direzione iniziale corrente
Vector3d vtStart ; pCrvC->GetStartDir( vtStart) ;
// angolo tra le direzioni
double dAng ; vtEnd.GetAngleXY( vtStart, dAng) ;
// se previsto e angolo esterno, si aggiunge l'anello
if ( m_Params.m_nExtCornerType == WJET_EC_LOOP && IsExternalAngle( dAng)) {
// curva dell'anello
PtrOwner<ICurveComposite> pCompo( CreateCurveComposite()) ;
if ( IsNull( pCompo))
PtrOwner<ICurveComposite> pLoop( CreateCurveComposite()) ;
if ( IsNull( pLoop))
return false ;
// lunghezza tratti lineari e loro punti estremi
double dTgLen = 0.5 * m_TParams.m_dDiam * tan( 0.5 * dAng * DEGTORAD) ;
double dTgLen = 0.5 * m_TParams.m_dDiam * tan( 0.5 * abs( dAng) * DEGTORAD) ;
if ( m_Params.m_dSideAngle > EPS_ANG_SMALL) {
double dW = m_dElev * sin( m_Params.m_dSideAngle * DEGTORAD) ;
double dExtraLen = dW / tan( ( 180 - abs( dAng)) / 2 * DEGTORAD) ;
double dExtraLen = dW / tan( 0.5 * ( 180 - abs( dAng)) * DEGTORAD) ;
dTgLen += dExtraLen ;
}
Point3d ptP ; pCrvC->GetStartPoint( ptP) ;
Point3d ptPe = ptP + vtEnd * dTgLen ;
Point3d ptPs = ptP - vtStart * dTgLen ;
// tratto prima dell'anello
if ( ! pCompo->AddPoint( ptP) || ! pCompo->AddLine( ptPe))
if ( ! pLoop->AddPoint( ptP) || ! pLoop->AddLine( ptPe))
return false ;
// anello
if ( ! pCompo->AddArcTg( ptPs))
if ( ! pLoop->AddArcTg( ptPs))
return false ;
// verifico che l'anello non interferisca con la curva di lavoro
IntersCurveCurve intAC( *pLoop->GetLastCurve(), *pCompo) ;
if ( intAC.GetIntersCount() > 0)
continue ;
// tratto dopo l'anello
if ( ! pCompo->AddLine( ptP))
if ( ! pLoop->AddLine( ptP))
return false ;
// lo porto in antiorario
double dArea ;
if ( ! pCompo->GetAreaXY( dArea))
if ( ! pLoop->GetAreaXY( dArea))
return false ;
if ( dArea < 0)
pCompo->Invert() ;
pLoop->Invert() ;
// ne eseguo l'offset
double dSideCoeff = ( abs( m_Params.m_dSideAngle) > EPS_ANG_SMALL ? 1. / cos( m_Params.m_dSideAngle * DEGTORAD) : 1) ;
double Rad = 0.49 * m_TParams.m_dDiam * dSideCoeff ; // non 0.5 per evitare problemi di coincidenza
if ( ! pCompo->SimpleOffset( Rad, ICurve::OFF_FILLET))
if ( ! pLoop->SimpleOffset( Rad, ICurve::OFF_FILLET))
return false ;
// calcolo la regione
PtrOwner<ISurfFlatRegion> pSfr ;
SurfFlatRegionByContours SfrCntr ;
SfrCntr.AddCurve( Release( pCompo)) ;
SfrCntr.AddCurve( Release( pLoop)) ;
pSfr.Set( SfrCntr.GetSurf()) ;
// Unisco le due regioni
if ( IsNull( pSfr) || ! pSPV->Add( *pSfr))
@@ -2224,7 +2283,7 @@ WaterJetting::AdjustPathForInternalAngles( ICurveComposite* pCompo)
double dExtraLen = dSlowLen + INTANG_ROT_LEN - dLen ;
if ( dExtraLen > 0) {
// se entità successiva è in tangenza e abbastanza lunga, allungo la corrente a scapito della successiva
if ( ! bNextIntAng && dNextLen > dExtraLen) {
if ( abs( dNextAng) < EPS_ANG_SMALL && dNextLen > dExtraLen) {
double dU ; Point3d ptP ;
if ( pCrvN->GetParamAtLength( dExtraLen, dU) &&
pCrvN->GetPointD1D2( dU, ICurve::FROM_MINUS, ptP))
@@ -2241,7 +2300,7 @@ WaterJetting::AdjustPathForInternalAngles( ICurveComposite* pCompo)
double dExtraLen = dSlowLen + INTANG_ROT_LEN - dLen ;
if ( dExtraLen > 0) {
// se entità precedente è in tangenza e abbastanza lunga, allungo la corrente a scapito della precedente
if ( ! bPrevIntAng && dPrevLen > dExtraLen) {
if ( abs( dPrevAng) < EPS_ANG_SMALL && dPrevLen > dExtraLen) {
double dU ; Point3d ptP ;
if ( pCrvP->GetParamAtLength( dPrevLen - dExtraLen, dU) &&
pCrvP->GetPointD1D2( dU, ICurve::FROM_MINUS, ptP))
@@ -2260,13 +2319,12 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
{
// numero punti di accelerazione/decelerazione
const int ACC_PNT_NUM = 7 ;
// lunghezza minima per poter suddividere con punti di accelerazione/decelerazione
const double MIN_ACC_LEN = 1.0 ;
// recupero distanze di sicurezza
double dSafeZ = GetSafeZ() ;
// Recupero versore estrusione
Vector3d vtN ; pCompo->GetExtrusion( vtN) ;
// verifico se la curva è chiusa a meno di eventuale dAddedOverlap
bool bClosed = ( pCompo->IsClosed() || dAddedOverlap > EPS_SMALL) ;
@@ -2281,6 +2339,7 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
PtrOwner<ICurve> pCurve( pCrvC->Clone()) ;
if ( IsNull( pCurve))
return false ;
double dLen ; pCurve->GetLength( dLen) ;
double dUprev = 0 ;
bool bSlowFull = false ; // modalità speciale per angoli interni con rallentamento uniforme su tutta l'entità
// se prima entità, approccio e affondo
@@ -2316,19 +2375,23 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
// direzione finale precedente
const ICurve* pCrvP = pCompo->GetCurve( i - 1) ;
Vector3d vtEnd ; pCrvP->GetEndDir( vtEnd) ;
double dLenP ; pCrvP->GetLength( dLenP) ;
// direzione iniziale corrente
Vector3d vtStart ; pCrvC->GetStartDir( vtStart) ;
// angolo tra le direzioni
double dAng ;
double dAng = 0 ;
vtEnd.GetAngleXY( vtStart, dAng) ;
// se tratto sotto la tolleranza, ignoro la gestione dell'angolo
if ( dLen < LEN_TOL || dLenP < LEN_TOL)
dAng = 0 ;
// Se angolo esterno e richiesto anello esterno
if ( IsExternalAngle( dAng) && m_Params.m_nExtCornerType == WJET_EC_LOOP) {
// lunghezza tratti lineari
double dTgLen = 0.5 * m_TParams.m_dDiam * tan( 0.5 * dAng * DEGTORAD) ;
double dTgLen = 0.5 * m_TParams.m_dDiam * tan( 0.5 * abs( dAng) * DEGTORAD) ;
if ( m_Params.m_dSideAngle > EPS_ANG_SMALL) {
// se inclinazione positiva calcolo di quanto deve uscire per non rovinare lo spigolo
double dW = m_dElev * sin( m_Params.m_dSideAngle * DEGTORAD) ;
double dExtraLen = dW / tan( ( 180 - abs( dAng)) / 2 * DEGTORAD) ;
double dExtraLen = dW / tan( 0.5 * ( 180 - abs( dAng)) * DEGTORAD) ;
dTgLen += dExtraLen ;
}
// calcolo punti estremi
@@ -2342,31 +2405,42 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
return false ;
// anello
PtrOwner<ICurve> pCrvA( GetArc2PVN( ptPe, ptPs, vtEnd, vtN)) ;
bool bLoopOk = true ;
PtrOwner<ICurve> pCrvA( GetArc2PVN( ptPe, ptPs, vtEnd, vtTool)) ;
if ( ! IsNull( pCrvA) && pCrvA->GetType() == CRV_ARC) {
// suddivido l'anello in due parti per forzare il passaggio dalla posizione vtTool = Z_AX
PtrOwner<ICurveComposite> pCompoArc( ConvertCurveToComposite( Release( ( pCrvA)))) ;
if ( IsNull( pCompoArc))
return false ;
if ( pCompoArc->AddJoint( 0.5)) {
// aggiungo il primo tratto
Vector3d vtCorr = CalcCorrDir( pCompoArc, 1) ;
SetToolCorrAuxDir( Z_AX, vtCorr) ;
if ( AddCurveMove( pCompoArc->GetCurve(0), bSplitArcs) == GDB_ID_NULL)
// verifico che l'anello non interferisca con la curva di lavoro
IntersCurveCurve intAC( *pCrvA, *pCompo) ;
if ( intAC.GetIntersCount() == 0) {
// suddivido l'anello in due parti per forzare il passaggio dalla posizione vtTool = Z_AX
PtrOwner<ICurveComposite> pCompoArc( ConvertCurveToComposite( Release( ( pCrvA)))) ;
if ( IsNull( pCompoArc))
return false ;
// aggiungo secondo tratto
CalcAndSetToolCorrAuxDir( pCompo, i + 0.5) ;
if ( AddCurveMove( pCompoArc->GetCurve(1), bSplitArcs) == GDB_ID_NULL)
return false ;
if ( pCompoArc->AddJoint( 0.5)) {
// aggiungo il primo tratto
Vector3d vtCorr = CalcCorrDir( pCompoArc, 1) ;
SetToolCorrAuxDir( Z_AX, vtCorr) ;
if ( AddCurveMove( pCompoArc->GetCurve( 0), bSplitArcs) == GDB_ID_NULL)
return false ;
// aggiungo secondo tratto
CalcAndSetToolCorrAuxDir( pCompo, i + 0.5) ;
if ( AddCurveMove( pCompoArc->GetCurve( 1), bSplitArcs) == GDB_ID_NULL)
return false ;
}
else {
// se non è possibile suddividere anello
CalcAndSetToolCorrAuxDir( pCompo, i + 0.5) ;
if ( AddCurveMove( pCompoArc, bSplitArcs) == GDB_ID_NULL)
return false ;
}
}
else {
// se non è possibile suddividere anello
CalcAndSetToolCorrAuxDir( pCompo, i + 0.5) ;
if ( AddCurveMove( pCompoArc, bSplitArcs) == GDB_ID_NULL)
return false ;
}
else
bLoopOk = false ;
}
else {
else
bLoopOk = false ;
// se anello non possibile
if ( ! bLoopOk) {
CalcAndSetToolCorrAuxDir( pCompo, i + 0.5) ;
if ( AddLinearMove( ptPs, bSplitArcs) == GDB_ID_NULL)
return false ;
@@ -2385,9 +2459,12 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
// Feed ridotta
double dMinFeed = GetActualReducedFeed() ;
// ciclo sui punti di accelerazione
for ( int j = 1 ; j <= ACC_PNT_NUM ; ++ j) {
double dCoeff = j / double( ACC_PNT_NUM) ;
double dU ; pCrvC->GetParamAtLength( dCoeff * dAccLen, dU) ;
int nAccPntNum = dAccLen > MIN_ACC_LEN - EPS_SMALL ? ACC_PNT_NUM : 1 ;
for ( int j = 1 ; j <= nAccPntNum ; ++ j) {
double dCoeff = j / double( nAccPntNum) ;
double dU = dUprev ; pCrvC->GetParamAtLength( dCoeff * dAccLen, dU) ;
if ( abs( dU - dUprev) < EPS_SMALL)
continue ;
PtrOwner<ICurve> pCrvT( pCrvC->Clone()) ;
if ( IsNull( pCrvT) || ! pCrvT->TrimStartEndAtParam( dUprev, dU))
return false ;
@@ -2428,15 +2505,19 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
}
}
if ( ! bSlowFull) {
dAccLen = min( dFreeLen - EXTRA_ACC_LEN, ( bReduceFeed ? m_Params.m_dCornerSlowLen : INTANG_ROT_LEN)) ;
double dMinLen = dFreeLen / 2 - EXTRA_ACC_LEN ;
if ( dMinLen < EPS_SMALL && abs( m_Params.m_dSideAngle) > EPS_ANG_SMALL)
dMinLen = dFreeLen / 2 ;
dAccLen = min( dMinLen, ( bReduceFeed ? m_Params.m_dCornerSlowLen : INTANG_ROT_LEN)) ;
if ( m_Params.m_dSideAngle > 0) {
// verifico sia rispettata la lunghezza minima per non rovinare l'angolo
double dW = m_dElev * sin( m_Params.m_dSideAngle * DEGTORAD) ;
double dSlowLen = dW / tan( ( 180 - abs( dAng)) / 2 * DEGTORAD) ;
if ( dSlowLen > dFreeLen - EXTRA_ACC_LEN) {
if ( dSlowLen > dFreeLen + EPS_SMALL) {
m_pMchMgr->SetLastError( 3204, "Error in WaterJetting : entity too small near inside corner") ;
return false ;
}
dAccLen = min( dSlowLen + m_Params.m_dCornerSlowLen, dFreeLen - EXTRA_ACC_LEN) ;
dAccLen = max( dAccLen, dSlowLen) ;
}
}
@@ -2447,10 +2528,13 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
double dUend ; pCrvC->GetParamAtLength( dAccLen, dUend) ;
Vector3d vtTp = CalcToolDir( pCompo, i + dUsta) ;
Vector3d vtTn = CalcToolDir( pCompo, i + dUend) ;
int nAccPntNum = dAccLen > MIN_ACC_LEN - EPS_SMALL ? ACC_PNT_NUM : 1 ;
// ciclo sui punti di accelerazione
for ( int j = 1 ; j <= ACC_PNT_NUM ; ++ j) {
double dCoeff = j / double( ACC_PNT_NUM) ;
double dU ; pCrvC->GetParamAtLength( dCoeff * dAccLen, dU) ;
for ( int j = 1 ; j <= nAccPntNum ; ++ j) {
double dCoeff = j / double( nAccPntNum) ;
double dU = dUprev ; pCrvC->GetParamAtLength( dCoeff * dAccLen, dU) ;
if ( abs( dUprev - dU) < EPS_SMALL)
continue ;
PtrOwner<ICurve> pCrvT( pCrvC->Clone()) ;
if ( IsNull( pCrvT) || ! pCrvT->TrimStartEndAtParam( dUprev, dU))
return false ;
@@ -2477,8 +2561,13 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
// direzione iniziale successiva
const ICurve* pCrvN = pCompo->GetCurve( i + 1) ;
Vector3d vtStart ; pCrvN->GetStartDir( vtStart) ;
double dLenN ; pCrvN->GetLength( dLenN) ;
// angolo tra le direzioni
double dAng ; vtEnd.GetAngleXY( vtStart, dAng) ;
double dAng = 0 ;
vtEnd.GetAngleXY( vtStart, dAng) ;
// se tratto sotto la tolleranza, ignoro la gestione dell'angolo
if ( dLen < LEN_TOL || dLenN < LEN_TOL)
dAng = 0 ;
// se angolo esterno e richiesto rallentamento esterno, aggiungo decelerazione
if ( IsExternalAngle( dAng) && m_Params.m_nExtCornerType == WJET_EC_SLOW) {
// lunghezza entità
@@ -2488,9 +2577,10 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
// Feed ridotta
double dMinFeed = GetActualReducedFeed() ;
// ciclo sui punti di decelerazione
for ( int j = 0 ; j < ACC_PNT_NUM ; ++ j) {
double dCoeff = j / double( ACC_PNT_NUM) ;
double dU ; pCrvC->GetParamAtLength( dLen - ( 1 - dCoeff) * dAccLen, dU) ;
int nAccPntNum = dAccLen > MIN_ACC_LEN - EPS_SMALL ? ACC_PNT_NUM : 1 ;
for ( int j = 0 ; j < nAccPntNum ; ++ j) {
double dCoeff = j / double( nAccPntNum) ;
double dU = dUprev ; pCrvC->GetParamAtLength( dLen - ( 1 - dCoeff) * dAccLen, dU) ;
if ( abs( dUprev - dU) < EPS_SMALL)
continue ;
PtrOwner<ICurve> pCrvT( pCrvC->Clone()) ;
@@ -2516,46 +2606,49 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
// se prima entità e modalità WJET_IC_SLOW_FULL verifico se davvero applicabile controllando angolo con ultima entità
if ( i == 0 && m_Params.m_nIntCornerType == WJET_IC_SLOW_FULL) {
bSlowFull = true ;
if ( bClosed) {
// creo una copia della curva senza l'overlap aggiunto
PtrOwner<ICurveComposite> pCrvTmp( pCompo->Clone()) ;
double dLen ; pCrvTmp->GetLength( dLen) ;
if ( IsNull( pCrvTmp) || ! pCrvTmp->TrimEndAtLen( dLen - dAddedOverlap))
return false ;
// verifico che anche angolo sullo start della curva sia di tipo prev
const ICurve* pCrvLast = pCrvTmp->GetLastCurve() ;
Vector3d vtStart ; pCurve->GetStartDir( vtStart) ;
Vector3d vtEnd ; pCrvLast->GetEndDir( vtEnd) ;
if ( AreSameVectorApprox( vtStart, vtEnd)) {
// se curve in tangenza controllo angolo tra l'ultima e la penultima curva
int nCrvNbr = pCrvTmp->GetCurveCount() ;
const ICurve* pCrvP = pCrvTmp->GetCurve( nCrvNbr - 2) ;
pCrvLast->GetStartDir( vtStart) ;
pCrvP->GetEndDir( vtEnd) ;
}
// se angolo precedente non è interno il tratto non va realizzato in modalità full
double dAngPrev ; vtEnd.GetAngleXY( vtStart, dAngPrev) ;
if ( ! IsInternalAngle( dAngPrev))
bSlowFull = false ;
}
// salvo il valore per l'ultima entità
bStartSlowFull = bSlowFull ;
bSlowFull = true ;
if ( bClosed) {
// creo una copia della curva senza l'overlap aggiunto
PtrOwner<ICurveComposite> pCrvTmp( pCompo->Clone()) ;
double dLen ; pCrvTmp->GetLength( dLen) ;
if ( IsNull( pCrvTmp) || ! pCrvTmp->TrimEndAtLen( dLen - dAddedOverlap))
return false ;
// verifico che anche angolo sullo start della curva sia di tipo prev
const ICurve* pCrvLast = pCrvTmp->GetLastCurve() ;
Vector3d vtStart ; pCurve->GetStartDir( vtStart) ;
Vector3d vtEnd ; pCrvLast->GetEndDir( vtEnd) ;
if ( AreSameVectorApprox( vtStart, vtEnd)) {
// se curve in tangenza controllo angolo tra l'ultima e la penultima curva
int nCrvNbr = pCrvTmp->GetCurveCount() ;
const ICurve* pCrvP = pCrvTmp->GetCurve( nCrvNbr - 2) ;
pCrvLast->GetStartDir( vtStart) ;
pCrvP->GetEndDir( vtEnd) ;
}
// se angolo precedente non è interno il tratto non va realizzato in modalità full
double dAngPrev ; vtEnd.GetAngleXY( vtStart, dAngPrev) ;
if ( ! IsInternalAngle( dAngPrev))
bSlowFull = false ;
}
// salvo il valore per l'ultima entità
bStartSlowFull = bSlowFull ;
}
if ( bSlowFull)
// sfrutto tutta la lunghezza a disposizone
dAccLen = dFreeLen ;
else {
dAccLen = min( dFreeLen - EXTRA_ACC_LEN, ( bReduceFeed ? m_Params.m_dCornerSlowLen : INTANG_ROT_LEN)) ;
double dMinLen = dFreeLen - EXTRA_ACC_LEN ;
if ( dMinLen < EPS_SMALL && abs( m_Params.m_dSideAngle) > EPS_ANG_SMALL)
dMinLen = dFreeLen ;
dAccLen = min( dMinLen, ( bReduceFeed ? m_Params.m_dCornerSlowLen : INTANG_ROT_LEN)) ;
if ( m_Params.m_dSideAngle > 0) {
double dW = m_dElev * sin( m_Params.m_dSideAngle * DEGTORAD) ;
double dSlowLen = dW / tan( ( 180 - abs( dAng)) / 2 * DEGTORAD) ;
if ( dSlowLen > dFreeLen - EXTRA_ACC_LEN) {
if ( dSlowLen > dFreeLen + EPS_SMALL) {
m_pMchMgr->SetLastError( 3204, "Error in WaterJetting : entity too small near inside corner") ;
return false ;
}
dAccLen = min( dSlowLen + m_Params.m_dCornerSlowLen, dFreeLen - EXTRA_ACC_LEN) ;
dAccLen = max( dAccLen, dSlowLen) ;
}
}
@@ -2566,10 +2659,11 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
double dUend = 1 ;
Vector3d vtTp = CalcToolDir( pCompo, i + dUsta) ;
Vector3d vtTn = CalcToolDir( pCompo, i + dUend) ;
int nAccPntNum = dAccLen > MIN_ACC_LEN - EPS_SMALL ? ACC_PNT_NUM : 1 ;
// ciclo sui punti di decelerazione
for ( int j = 0 ; j < ACC_PNT_NUM ; ++ j) {
double dCoeff = j / double( ACC_PNT_NUM) ;
double dU ; pCrvC->GetParamAtLength( dLen - ( 1 - dCoeff) * dAccLen, dU) ;
for ( int j = 0 ; j < nAccPntNum ; ++ j) {
double dCoeff = j / double( nAccPntNum) ;
double dU = dUprev ; pCrvC->GetParamAtLength( dLen - ( 1 - dCoeff) * dAccLen, dU) ;
if ( abs( dUprev - dU) < EPS_SMALL)
continue ;
PtrOwner<ICurve> pCrvT( pCrvC->Clone()) ;
@@ -2862,9 +2956,11 @@ WaterJetting::CalcAndSetToolCorrAuxDir( const ICurveComposite* pCompo, double dU
// verifico curva
if ( pCompo == nullptr)
return false ;
// se utensile centrato, direzione di correzione nulla
if ( m_Params.m_nWorkSide == WJET_WS_CENTER)
// se utensile centrato, direzione di correzione nulla e direzione utensile sempre Z+
if ( m_Params.m_nWorkSide == WJET_WS_CENTER) {
SetToolDir( Z_AX) ;
return true ;
}
// calcolo del versore fresa
Vector3d vtTool = CalcToolDir( pCompo, dU) ;
// calcolo del versore correzione
@@ -3013,11 +3109,17 @@ WaterJetting::CalcOffset( ICurveComposite* pCompo, double dSignOffs)
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 ;
if ( ! AreSameVectorEpsilon( vtStart, vtEnd, sin( 5 * DEGTORAD))) {
// se spigolo forzo apertura solo se è loop esterno
double dArea = 0 ; pCompo->GetAreaXY( dArea) ;
if ( ( dArea > 0 && m_Params.m_nWorkSide == WJET_WS_RIGHT) ||
( dArea < 0 && m_Params.m_nWorkSide == WJET_WS_LEFT))
nFlag |= ICurve::OFF_FORCE_OPEN ;
}
}
// eseguo offset semplice
if ( pCompo->SimpleOffset( dSignOffs, nFlag))
constexpr double MAX_ANG_EXT = 135 ;
if ( pCompo->SimpleOffset( dSignOffs, nFlag, MAX_ANG_EXT))
return true ;
// se curva piatta, provo con offset avanzato
bool bOk = false ;
@@ -3027,8 +3129,17 @@ WaterJetting::CalcOffset( ICurveComposite* pCompo, double dSignOffs)
if ( OffsCrv.Make( pCompo, dSignOffs, nFlag)) {
ICurve* pOffs = OffsCrv.GetLongerCurve() ;
if ( pOffs != nullptr) {
Point3d ptStart ; pCompo->GetStartPoint( ptStart) ;
Vector3d vtExtr ; pCompo->GetExtrusion( vtExtr) ;
pCompo->Clear() ;
pCompo->AddCurve( pOffs) ;
// ripristino estrusione della curva compo ( rimossa dal Clear)
pCompo->SetExtrusion( vtExtr) ;
// ripristino punto iniziale
double dPar ;
int nFlagDist ;
if ( DistPointCurve( ptStart, *pCompo).GetParamAtMinDistPoint( 0, dPar, nFlagDist))
pCompo->ChangeStartPoint( dPar) ;
bOk = true ;
}
}
+13 -7
View File
@@ -36,8 +36,14 @@ class WaterJetting : public Machining
public : // Operation
int GetType( void) const override
{ return OPER_WATERJETTING ; }
bool IsEmpty( void) const override
{ return ( m_nMills == 0) ; }
bool IsEmpty( int nEmptyType = NEED_GEOM) const override
{ if ( m_nMills == 0)
return true ;
if ( nEmptyType == NEED_ONE_TP_OK)
return ( ! IsAtLeastOnePathOk()) ;
if ( nEmptyType == NEED_ALL_TP_OK)
return ( ! AreAllPathsOk()) ;
return false ; }
bool UpdateStatus( int nModif) override
{ m_nStatus |= nModif ; return true ; }
@@ -61,7 +67,7 @@ class WaterJetting : public Machining
bool GetParam( int nType, int& nVal) const override ;
bool GetParam( int nType, double& dVal) const override ;
bool GetParam( int nType, std::string& sVal) const override ;
bool UpdateToolData( bool* pbChanged = nullptr) override ;
bool UpdateToolData( void) override ;
const ToolData& GetToolData( void) const override ;
bool GetGeometry( SELVECTOR& vIds) const override ;
@@ -72,13 +78,13 @@ 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 AdjustCurvesForBridges( ICURVEPOVECTOR& vpCrvs) ;
bool VerifySideAngle( void) ;
bool ProcessPath( int nPathId, int nPvId, int nClId) ;
bool AdjustPathForInternalAngles( ICurveComposite* pCompo) ;
bool GeneratePreView( int nPathId, const ICurveComposite* pCompo, double dAddedOverlap) ;
ISurfFlatRegion* GenerateLeadInPreview( const ICurveComposite* pCompo) ;
ISurfFlatRegion* GenerateLeadOutPreview( const ICurveComposite* pCompo) ;
bool GeneratePreView( int nPathId, const ICurveComposite* pCompo, const Vector3d& vtTool, double dAddedOverlap) ;
ISurfFlatRegion* GenerateLeadInPreview( const ICurveComposite* pCompo, const Vector3d& vtN, bool bClosed) ;
ISurfFlatRegion* GenerateLeadOutPreview( const ICurveComposite* pCompo, const Vector3d& vtN) ;
bool AddLoopsPreview( const ICurveComposite* pCompo, ISurfFlatRegion* pSPV) ;
bool AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTool, bool bSplitArcs, double dAddedOverlap) ;
bool AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, bool bSplit) ;