243 Commits

Author SHA1 Message Date
Riccardo Elitropi ca72ddf1a4 EgtMachKernel :
- aggiunto utensile Vmill Additivo.
2024-04-22 13:22:50 +02:00
Dario Sassi d1406baa2e EgtMachKernel :
- corretto passaggio parametri spezzatura in pocketing e milling (correzione #1765).
2024-04-17 11:39:10 +02:00
Dario Sassi 89d46baf43 EgtMachKernel 2.6d4 :
- aggiunta gestione riferimento canonico per calcolo cinematica robot comunque disposto nello spazio
- adattamento funzioni di calcolo posizione, direzione utensile e ausiliaria da questi angoli
- in svuotatura corretta mancata esplosione di archi in rette sui percorsi di ritorno quando richiesta.
2024-04-17 06:58:27 +02:00
Dario Sassi 1f57693da8 EgtMachKernel :
- in foratura corretta segnalazione di errore fuorviante
- in fresatura sistemata gestione direzioni inizio e fine con percorrenze in direzione inversa
- in link tra percorsi di lavorazione per robot aggiunta posizione iniziale a Zmax dopo inserimento di risalita a Zmax in percorso immediatamente precedente.
2024-04-13 17:44:30 +02:00
Dario Sassi 010f676234 EgtMachKernel :
- modifiche a fresature per direzioni di riferimento di attacchi e uscite come inizio e fine dei percorsi originali
- migliorata in fresatura visualizzazione movimento lame quando interessano 2 o 3 curve di lavoro.
2024-04-11 00:24:09 +02:00
SaraP 1839b45e96 EgtMachKernel 2.6d3 :
- in WaterJet modificati anelli per angoli esterni
- spezzatura movimenti per robot.
2024-04-10 12:04:10 +02:00
Dario Sassi 9bc699be18 EgtMachKernel 2.6d2 :
- ricompilazione per modifiche a EgtLock.
2024-04-09 14:49:50 +02:00
Dario Sassi f701828a25 EgtMachKernel :
- aggiunta a MachMgr funzione GetClEntAxesMask
- gestione emissione in generazione/simulazione/stima di tutti gli assi rotanti del robot.
2024-04-03 08:14:20 +02:00
Dario Sassi f8d2f26692 EgtMachKernel 2.6d1 :
- se robot sempre spezzatura
- spezzatura movimenti per robot
- in tagli con lama, tolto da Apply preview.
2024-04-02 15:37:22 +02:00
Dario Sassi 4e3079e504 EgtMachKernel :
- in fresature aggiunte inserzioni ed estrazioni su link di percorsi OneWay con lame o utensili che non tagliano di testa.
2024-03-26 17:32:56 +01:00
Dario Sassi 0d0f195d8b EgtMachKernel :
- modifiche a fresature per approcci/retrazioni con frese che non lavorano di testa.
2024-03-26 13:32:13 +01:00
Dario Sassi 7fbce2b593 EgtMachKernel :
- aggiunta gestione oggetti per verifica collisioni nei link tra lavorazioni anche nelle tavole
- in fresatura standard migliorati approcci e retrazioni per frese che non lavorano di testa
- in simulazione migliorata gestione comandi ausiliari di start in Disposizioni senza movimenti.
2024-03-19 18:11:50 +01:00
Dario Sassi 74b2874f56 EgtMachKernel :
- correzione a gestione visualizzazione tavola corrente.
2024-03-16 10:32:57 +01:00
SaraP 9540563a87 EgtMachKernel 2.6c3 :
- modifiche allo split nei grezzi con lavorazioni per gestire tagli inclinati
- introdotte regioni up e down per i grezzi
- nelle preview di sawing e milling aggiunte superfici di lavorazione in corrispondenza delle facce del grezzo.
2024-03-14 10:30:37 +01:00
Dario Sassi 8eeca04757 EgtMachKernel 2.6c2 :
- ricompilazione con cambio versione.
2024-03-10 10:26:06 +01:00
Dario Sassi db6ae7538f EgtMachKernel 2.6c1 :
- migliorato calcolo collegamento tra passate di fresature a step OneWay.
2024-03-05 08:57:15 +01:00
Dario Sassi 839639fcc8 EgtMachKernel :
- eliminate alcune variabili non usate.
2024-02-27 18:36:32 +01:00
Dario Sassi c3729befbb EgtMachKernel :
- modifiche e correzioni per flag di fine passata (301) in fresatura con lama a ZigZag e OneWay.
2024-02-27 10:36:52 +01:00
Dario Sassi a79d9c9fe8 EgtMachKernel :
- piccola correzione a fresature con attacco/uscita a scivolo.
2024-02-26 18:06:22 +01:00
Dario Sassi d3b281a858 EgtMachKernel :
- migliorata fresatura di lato con lama con più passaggi (ZigZag e OneWay) con note utente
      SideElev anche negativa per avere controllo MaxMat con Step
      TrimExt=nClosedStmId per definire superficie chiusa con cui estendere/trimmare il percorso di lavoro.
2024-02-26 15:15:07 +01:00
Dario Sassi 37d0b8f552 EgtMachKernel :
- in Milling corretto calcolo punto inizio attacco nel caso percorso invertito per ZigZag o similare.
2024-02-22 16:59:14 +01:00
Dario Sassi 737124b0bd EgtMachKernel :
- modifiche per configurazione canonica robot da ZYY-ZYZ a ZYY-XYX.
2024-02-20 10:52:23 +01:00
Dario Sassi 09bdd4852d EgtMachKernel :
- corretto controllo catena cinematica in assenza di assi lineari (eliminato anche possibile crash).
2024-02-19 17:16:14 +01:00
Dario Sassi 1d3c722fd3 EgtMachKernel 2.6b4 :
- in simulazione aggiunti eventi Init e Exit a cui possono rispondere le funzioni lua OnSimulInit e OnSimulExit.
2024-02-19 14:54:50 +01:00
Dario Sassi 3ca2db72e9 EgtMachKernel 2.6b3 :
- adattamenti per modifiche a funzioni di Collision Detection.
2024-02-16 08:47:33 +01:00
Dario Sassi 028a5b7bba EgtMachKernel :
- aggiunta gestione macchine di tipo Robot, le altre sono ora definite di tipo Center.
2024-02-13 11:45:05 +01:00
Dario Sassi 1179ad7e84 EgtMachKernel 2.6b1 :
- migliorato controlli su testa e suo attrezzaggio per MultipleDrill.
2024-02-02 16:20:05 +01:00
Dario Sassi d8c5fe0ea7 EgtMachkernel :
- ora vengono restituiti ThDiam e ThLength anche per le mortasatrici/seghe a catena (ovviamente vanno considerati nella direzione dell'utensile).
2024-01-29 19:54:17 +01:00
Dario Sassi a21be79df8 EgtMachKernel 2.6a2 :
- modificato controllo parametri in LuaEmtMoveAxes per evitare crash in R64
- piccole migliorie.
2024-01-25 08:35:26 +01:00
Dario Sassi d66cc47936 EgtMachKernel :
- aggiunta funzione ChangeMachGroupName di MachMgr.
2024-01-16 19:44:30 +01:00
Dario Sassi cd2315af46 EgtMachKernel 2.6a1 :
- ricompilazione con cambio versione.
2024-01-16 15:50:38 +01:00
Dario Sassi 204d63b7c9 EgtMachKernel :
- modifiche per gestione teste multiple in foratura con modalità fissa, singola o multipla.
2024-01-16 09:35:21 +01:00
Dario Sassi 5a5b48326f EgtMachKernel :
- in foratura con testa multiuscite senza assi rotanti tolta necessità di presenza Asse Ausiliario.
2024-01-15 17:21:54 +01:00
Dario Sassi bd448babd9 EgtMachKernel 2.5l6 :
- aggiunta gestione script opzionale OnSpecialTestCollisionAvoid per avere un test custom di verifica collisione nei movimenti link tra le lavorazioni.
2024-01-15 15:06:50 +01:00
Dario Sassi 73ba4eb93a EgtMachKernel :
- allo script di aggiornamento utensili custom ora viene passata anche la SPEED (per permettere di sistemare il senso di rotazione indicato)
- nelle fresature in approccio e retrazione aggiunta gestione extra tra lunghezza di lavoro e lunghezza totale.
2024-01-06 15:47:57 +01:00
Dario Sassi 268fa05cc0 EgtMachKernel 2.5l5 :
- correzioni per forature semplici con rinvii
- correzioni per forature con aggregato da sotto.
2024-01-05 19:09:39 +01:00
Dario Sassi b5ef9ae6dc EgtMachKernel :
- aggiunto nuovo calcolo elevazione per un segmento dati gli estremi
- in fresatura migliorato approccio e retrazione per lame e frese che non lavorano di testa e non considerate fuori completamente dal pezzo.
2024-01-02 16:00:59 +01:00
Dario Sassi fcaf15cbe1 EgtMachKernel :
- in generazione CN e stima si imposta fase a 1 prima dell'inizio e al termine
- in simulazione aggiunta gestione errore in evento OnToolSelect.
2023-12-29 13:08:21 +01:00
Dario Sassi ab84757a80 EgtMachKernel 2.5l4 :
- piccole migliorie e correzioni a forature multiple con aggregato.
2023-12-20 17:37:34 +01:00
Dario Sassi 0fab073568 Merge remote-tracking branch 'origin/Drilling' 2023-12-20 08:22:21 +01:00
Dario Sassi 4d29452c2d EgtMachKernel :
- in fresatura aggiunta gestione movimento compensazione raggio utensile in ingressi e uscite lineari e tangenti anche senza correzione raggio fresa in macchina.
2023-12-19 16:47:43 +01:00
Dario Sassi 1bcff0eb79 EgtMachKernel :
- in svuotatura cambiato calcolo elevazione.
2023-12-18 09:31:31 +01:00
Dario Sassi 52bcc69023 EgtMachKernel 2.5l3 :
- in fresature migliorato calcolo di retrazione orizzontale quando quasi sotto il pezzo con utensile lama o fresa notip.
2023-12-15 19:57:55 +01:00
Dario Sassi 18ccead437 EgtMachKernel 2.5l2 :
- rimossa costante non più utilizzata.
2023-12-11 10:28:31 +01:00
Dario Sassi d49f198720 EgtMachKernel :
- ulteriori migliorie nel calcolo dell'elevazione.
2023-12-07 11:00:26 +01:00
Dario Sassi 368721dcaa EgtMachKernel 2.5l1 :
- elevation ora viene calcolato più precisamente tramite Collision Avoid.
2023-12-01 16:51:48 +01:00
Dario Sassi c8c8d9e2a5 EgtMachKernel :
- preparazione nuova gestione calcolo elevazioni.
2023-11-28 09:39:06 +01:00
Dario Sassi d5c39485ea EgtMachKernel 2.5k3 :
- aggiunta la possibilità di forzare sempre la visualizzazione del versore fresa negli oggetti CamData
- le funzioni lua EmtAddRapidStart, EmtAddRapidMove, EmtAddLinearMove e EmtAddArcMove ora hanno un parametro opzionale in più per forzare la visualizzazione della direzione utensile
- agli script per Lavorazioni Generiche ora sono passati parecchi dati geometrici e non dell'utensile utilizzato
- in visualizzazione dei percorsi in Doppio ora si tiene conto anche del parametro opzionale DeltaZ.
2023-11-22 20:31:38 +01:00
Dario Sassi e14c8eb8b3 EgtMachKernel 2.5k2 :
- correzioni a CalculateClPathAxesValues per lavorazioni 5 assi in continuo.
2023-11-16 18:59:46 +01:00
Dario Sassi d5638e192c EgtMachKernel :
- corretta GetDistanceFromRawSide per sapere quanto una posizione è all'interno del grezzo (sbagliava se posizione sul bordo e direzione di fuga tangente al bordo).
2023-11-06 11:10:41 +01:00
Dario Sassi 85cdb84a5a EgtMachKernel :
- corretto crash in simulazione con posizione Tc vuota dovuto a modifiche commit precedente.
2023-11-06 09:33:17 +01:00
Dario Sassi 63a71db7ff EgtMachKernel :
- modifiche per gestire aggregati di utensili su tool changer.
2023-11-06 08:49:27 +01:00
Dario Sassi aa369739c9 EgtMachKernel 2.5k1 :
- ricompilazione con cambio versione.
2023-11-03 17:24:28 +01:00
Dario Sassi d19dfc5f8f EgtMachKernel 2.5j5 :
- migliorato calcolo approcci di fresature e svuotature
- in fresatura e svuotatura ora attacchi elica, zigzag e inseguimento partono 2mm sopra il materiale
- in fresatura migliorato passaggio ad inseguimento tra uno step e il successivo.
2023-11-01 19:21:28 +01:00
Dario Sassi d874e30288 EgtMachKernel 2.5j4 :
- aggiunte a interfaccia di MachMgr le funzioni GetClEntAxesVal, GetToolSetupPosInCurrSetup e GetAllCurrAxesName.
2023-10-28 18:13:56 +02:00
Dario Sassi 4047b8385e EgtMachKernel :
- aggiunto messaggio di log nel caso di utensile non caricato perchè l'insieme tavola-testa non ha tre assi lineari.
2023-10-24 11:52:23 +02:00
Dario Sassi 63e95ab2fe EgtMachKernel 2.5j3 :
- migliorata simulazione con assi principali che non fanno movimento mentre lo fanno gli ausiliari (per controllo collisioni)
- la funzione EmtMoveAxes base per SimulMoveAxes ora gestisce fino a 10 assi in contemporanea.
2023-10-22 15:58:36 +02:00
Dario Sassi 93a5bd72c7 EgtMachKernel 2.5j2 :
- in creazione disegno utensile si nascondono eventuali Carter se è per visualizzazione in gestione DB utensili
- in OnToolData per generazione aggiunto parametro tipo utensile EMT.TTYPE
- in simulazione si lancia UpdateCurrSetup solo al primo avvio.
2023-10-16 16:10:24 +02:00
Dario Sassi b3a1ee8e6c EgtMachKernel 2.5j1 :
- ricompilazione con cambio versione.
2023-10-09 13:02:22 +02:00
Dario Sassi 562e8342c3 EgtMachKernel 2.5i6 :
- in fresatura e svuotatura modificati approcci e retrazioni per macchine con TiltingTable (TURN) per stare più lontani dal materiale.
2023-09-27 21:11:18 +02:00
Dario Sassi 8c821750ba EgtMachKernel 2.5i5 :
- ricompilazione a 64bit con Enable Enhanced Instruction Set = Not Set.
2023-09-21 15:26:02 +02:00
Dario Sassi 6669fdc7a9 EgtMachKernel :
- migliorato log di virtual  milling in simulazione.
2023-09-18 08:15:19 +02:00
Dario Sassi e2043a7e3a EgtMachKerenl :
- piccole migliorie a simulazione (aumento velocità in rapidi e log).
2023-09-14 17:25:44 +02:00
Dario Sassi f92cec9d3d EgtMachKernel 2.5i1 :
- aggiunta visualizzazione geometria di lavorazione in doppio per Drill, Pocketing e Milling
- a OnSetHead passata anche variabile globale EMC.USERNOTES con note utente dell'utensile
- in Simulazione corretto richiamo impostazione virtual milling su utensili con raggio maggiore del massimo gambo ammesso dal portautensile.
2023-09-11 10:47:42 +02:00
Dario Sassi f30f028b17 EgtMachKernel 2.5h3 :
- aggiunta possibilità di copiare un gruppo di lavoro.
2023-08-27 18:30:01 +02:00
Dario Sassi 1adcb2991c EgtMachKernel :
- in SurfFinishing possibilità di invertire anche percorso di lavorazione a ZigZag.
2023-08-25 10:42:53 +02:00
Dario Sassi 285e0ce910 EgtMachKernel 2.5h2 :
- aggiunta definizione EMC.VER con versione della dll a OnSetTable, OnSetHead e OnVerifyProtectedAreas
- alla modifica di posizione o direzione di un asse si sistema anche la geometria per la simulazione
- alla modifica della posizione di una uscita si sistema anche la geometria per la simulazione
- corretto carico uscite di una testa per direzioni poco discoste da quelle canoniche non correttamente assegnate.
2023-08-19 11:53:38 +02:00
Dario Sassi 652aa35aaa EgtMachKernel 2.5h1 :
- alla info di testa ZMAXONROT aggiunto parametro opzionale (3°) che indica lo spessore dei pezzi oltre il quale applicare la prescrizione.
2023-08-02 20:02:50 +02:00
DarioS 2b5aacc160 EgtMachKernel 2.5g3 :
- corretta fresatura zigzag con attacco con componente in direzione utensile (poteva risultare movimento nullo con conseguente erore)
- modificato controllo indeterminazione angoli su primo asse rotante per gestire correttamente macchina Multiax C1522 con rinvio da sotto.
2023-07-27 09:31:59 +02:00
DarioS 1097f2a19f EgtMachKernel :
- semplificazioni con utilizzo di ConvertCurveToComposite.
2023-07-21 15:12:35 +02:00
DarioS 8c1b61b6b8 EgtMachKernel 2.5g2 :
- prima di fare il calcolo degli assi nell'update delle lavorazioni si cancellano le entità di tipo CLIMB, RISE e HOME che potrebbero dare errori come extra-corse e che in ogni caso verrebbero cancellate e ricalcolate subito dopo con la funzione AdjustStartEndMovements.
2023-07-20 20:43:33 +02:00
DarioS 80363af1f6 EgtMachKernel :
- piccola miglioria stilistica.
2023-07-19 09:54:12 +02:00
DarioS 9b5adeaeb3 EgtMachKernel :
- i movimenti in rapido sono disegnati tratteggiati.
2023-07-10 11:17:59 +02:00
DarioS 01854f30ed EgtMachKernel 2.5g1 :
- in svuotatura corretta gestione forzatura contorni chiusi (Open=0 in UserNotes della lavorazione) con i casi ottimizzati.
2023-07-07 17:08:56 +02:00
DarioS cdb35b4c38 EgtMachKernel 2.5f3 :
- dove possibile e sicuro sostituiti dynamic_cast con static_cast.
2023-06-30 11:51:03 +02:00
DarioS 994658da16 EgtMachKernel :
- in simulazione aggiunta gestione collisione anche con poliedri.
2023-06-19 08:12:03 +02:00
DarioS 135c0bda51 EgtMachKernel 2.5f2 :
- correzione in fresatura per approccio con lame/frese notip.
2023-06-14 15:05:46 +02:00
DarioS d927848815 EgtMachKernel :
- in milling corretto approccio/retrazione di frese che non lavorano di testa.
2023-06-09 16:05:28 +02:00
DarioS 7b91c17cb3 EgtMachKernel :
- nell'interpretazione degli assi rotanti bloccati e degli angoli suggeriti dal token asse si toglie eventuale '=' finale che non può essere gestito nelle note utente della lavorazione.
2023-06-08 10:16:57 +02:00
DarioS 3851bdcecb EgtMachKernel 2.5f1 :
- in svuotature modificata gestione lati aperti, ora vengono lavorati con affondo laterali pari al passo di lato.
2023-06-08 08:17:54 +02:00
Riccardo Elitropi d2965af836 Merge commit 'df86ffdee340b33c359d7e6b57598a70c1a1c006' into Drilling 2023-06-05 08:27:00 +02:00
DarioS df86ffdee3 EgtMachKernel :
- migliorato controllo gestione chiave di rete.
2023-05-30 10:29:13 +02:00
DarioS 05a6f56cfe EgtMachKernel 2.5e5 :
- in fresatura modifiche a retrazione di frese NoTip e lame per allontanarsi quanto necessario dal pezzo in tutti i casi.
2023-05-29 15:53:50 +02:00
DarioS 8f7fdc3a80 EgtMachKernel 2.5e4 :
- negli angoli macchina suggeriti ora si tiene conto di Invert e di Offset (quindi per l'utente sono i valori che vede in simulazione e sul CN).
2023-05-26 08:43:48 +02:00
DarioS 90dbb068a9 EgtMachKernel 2.5e3 :
- correzzioni a svuotature ottimizzate per attacchi e sucite sui lati aperti (distanze).
2023-05-20 12:04:46 +02:00
DarioS 577143d176 EgtMachKernel 2.5e2 :
- correzione a Disposizione per gestire correttamente errori in casi senza testa equivalente.
2023-05-18 18:34:34 +02:00
DarioS c6aa83ccd5 EgtMachKernel 2.5e1 :
- ricompilazione per aggiornamento lua.
2023-05-03 09:46:50 +02:00
DarioS 9e12f9d3b6 EgtMachKernel :
- corretto Virtual Milling in Simulazione per frese che non lavorano di testa ma che si muovono con un piccolo angolo verso il basso (max 5deg).
2023-04-18 09:47:45 +02:00
DarioS fc6af5de55 EgtMachKernel :
- in svuotature con utensili che non possono lavorare di testa aggiunto controllo che effettivamente gli ingressi siano fatti a spirale o zigzag
- aggiunti controlli su Set di Frame3d con due versori per verificare non siano allineati.
2023-04-18 08:00:55 +02:00
DarioS 8afece4a6c EgtMachKernel :
- corretto errore visualizzazione Versori di oggetti CamData quando allineati
- nel calcolo angoli alzata tolleranza direzione richiesta allineata a direzione singolare a 0.001deg (tramite GetRotation con tolleranza SIN_EPS_ANG_SMALL).
2023-04-17 09:32:20 +02:00
DarioS dc3ed5ea0a EgtMachKernel :
- correzione in fresature a ZigZag per passaggio da uno step al successivo.
2023-04-14 10:00:04 +02:00
DarioS 27a23bcdaa EgtMachKernel 2.5d3 :
- ricompilazione con cambio versione.
2023-04-11 19:38:44 +02:00
DarioS 7d554efe60 EgtMachKernel 2.5d2 :
- in taglio con lama modificato riconsocimento Fsta e Fend ora devono essere del tipo "Key=F,PuRed;" .
2023-04-06 18:03:24 +02:00
DarioS 075c0f4e95 EgtMachKernel :
- in svuotatura aggiunta gestione minima sicurezza su ingresso da lato aperto tramite nota "OpenMinSafe=Val" in Note utente.
2023-04-04 12:58:27 +02:00
DarioS 6378dddcdf EgtMachKernel 2.5d1 :
- eliminata la necessità di testa dummy per disposizioni con comandi StartAux o EndAux e senza movimenti diretti.
2023-04-03 08:50:46 +02:00
DarioS 025eea9c0f EgtMachKernel :
- aggiustamenti per PtrOwner nuova funzione Set.
2023-03-27 20:42:33 +02:00
DarioS 4b93557efe EgtMachKernel 2.5c2 :
- nelle lavorazioni all'aggiornamento utensile si prendono i dati opportuni anche dall'attrezzaggio corrente.
2023-03-23 19:08:44 +01:00
DarioS 04cf5a69a8 EgtMachKernel :
- migliorata gestione approcci/retrazione in fresature di utensili che non lavorano di testa
- corretta gestione passaggio da aperto a chiuso (curve a J) in svuotature.
- corretta gestione angolo di fianco in tagli con lama con variazioni di Z sulla linea da seguire.
2023-03-20 08:29:18 +01:00
DarioS 7d819a9500 EgtMachKernel :
- modifiche a fresature per approcci e retrazioni di lame e frese che non lavorano di testa
- in simulatore migliorati controlli per frese che non lavorano di testa.
2023-03-13 08:14:28 +01:00
DarioS a0da9d4e7d EgtMachKernel 2.5c1 :
- cambiato nome parametro a Operation::GetExtraZ per renderlo piùsignificativo.
2023-03-05 20:27:02 +01:00
DarioS dd960cb8a4 EgtMachKernel :
- modifiche in svuotature per gestione di lati aperti concatenati con rientranze.
2023-03-01 13:16:47 +01:00
DarioS 44af4a5bf4 EgtMachKernel 2.5b6 :
- ricompilazione con cambio versione.
2023-02-27 08:18:32 +01:00
DarioS 8ac85f6754 EgtMachKernel :
- in fresatura e svuotatura corretto calcolo direzione di approccio per testa da sopra con aggregato da sotto in presenza di geometria che esce dal grezzo.
2023-02-23 17:04:14 +01:00
DarioS e3cfe48da3 EgtMachKernel 2.5b5 :
- correzione in ApproxWithArcsIfUseful di Operation (non riconosceva i percorsi piani su piani diversi da XY).
2023-02-23 15:33:12 +01:00
DarioS 068e99df97 EgtMachKernel 2.5b4 :
- ricompilazione con cambio versione.
2023-02-20 09:17:12 +01:00
DarioS e3121ff553 EgtMachKernel 2.5b3 :
- modifiche quote approccio e retrazione
2023-02-17 12:08:10 +01:00
Riccardo Elitropi 0e8c41192d EgtMachKernel :
- Fori con più tools.
2023-02-16 15:11:47 +01:00
DarioS 15931dc304 EgtMachKernel 2.5b2 :
- nel calcolo spostamenti in disposizioni (movimenti di pezzi con ventose) è ora possibile fare rotazioni non minime pur di stare nelle corse.
2023-02-10 16:28:00 +01:00
DarioS c97cc00cdc EgtMachKernel 2.5b1 :
- modifiche per gestione gambo utensile in calcolo MaxDepth e in disegno dello stesso.
2023-02-09 10:39:27 +01:00
DarioS 8b0bbe4ab0 EgtMachKernel 2.5a4 :
- corretto controllo e modifica approcci e retrazioni lame in milling.
2023-01-31 19:53:35 +01:00
DarioS 4f264ee64e EgtMachKernel 2.5a3 :
- correzione calcolo assi rotanti nel caso indeterminato con corsa asse che non comprende lo zero.
2023-01-26 10:07:05 +01:00
DarioS 4e8953e864 EgtMachKernel :
- ritorno a stato pre svuotature con isole.
2023-01-23 17:26:31 +01:00
Riccardo Elitropi bca5dbb6dd Merge remote-tracking branch 'origin/master' 2023-01-23 08:14:14 +01:00
Riccardo Elitropi e009429d93 EgtmachKernel:
- svuotature con isole ( Spiral In, Out, ZigZag, OneWay)
- piccola modifica funzione GetDistanceFromRawBottom.
2023-01-23 08:12:27 +01:00
DarioS c3fa0bad11 EgtMachKernel :
- correzione di Operation::CalculateAxesValues per ricalcolo assi rotanti con testa 4 assi.
2023-01-18 11:20:01 +01:00
DarioS b2dacc0cef EgtMachKernel :
- aggiunto flag bToolOn a EmtAddCollisionObjEx per dichiarare che è utensile in lavoro (necessario quando si usano più utensili contemporaneamente).
2023-01-18 08:43:12 +01:00
DarioS 4af09db198 EgtMachKernel :
- miglioria alla funzione EmtMoveAxes per gestire anche rappresentazioni simboliche delle feed (con interi negativi).
2023-01-17 18:19:49 +01:00
DarioS 1507f18b88 EgtMachKernel :
- aggiunta gestione Vmill a EmtMoveAxes.
2023-01-17 16:30:23 +01:00
DarioS abbc7ee12b EgtMachKernel 2.5a2 :
- in simulazione corretta gestione collisione rilevata durante ToolDeselect che non deve far saltare le successive operazioni
- aggiunta funzione lua EmtMoveAxes per consentire movimento assi in simulazione da esterno.
2023-01-17 11:33:37 +01:00
DarioS 3375e316bd EgtMachKernel :
- nella scelta angoli quando delta dal precedente vale +/-180 si privilegia 180.
2023-01-10 08:38:06 +01:00
DarioS 961fce5aa4 EgtMachKernel :
- corretto errore in assegnazione versione 2.5a1 di R32
- reso più stabile ingresso in tasche con lati aperti.
2023-01-09 10:15:52 +01:00
DarioS e076e09ab3 EgtMachKernel 2.5a1 :
- ricompilazione con cambio versione.
2023-01-03 08:55:51 +01:00
DarioS e5a072c896 EgtMachKernel 2.4l4 :
- modifiche per virtual milling con più utensili in simulazione.
2022-12-28 19:40:24 +01:00
DarioS f0b00ea95e EgtMachKernel :
- in fresature ammesso step negativo con utensili che lavorano di lato( frese non di testa e lame).
2022-12-22 15:17:50 +01:00
DarioS 3ef50b6a90 EgtMachKernel 2.4l3 :
- modifiche a fesature per spostare punto di attacco su percorsi chiusi (sovrapposizione > 0.001 e allungamento attacco diventa spostamento inizio).
2022-12-21 09:44:49 +01:00
DarioS 992249f687 EgtMachKernel :
- modifiche estetiche.
2022-12-12 07:57:52 +01:00
DarioS dfa857c533 EgtMachKernel 2.4l2 :
- ottimizzazione movimenti tra passate di lavorazione fresatura a step di tipo OneWay.
2022-12-08 18:52:40 +01:00
DarioS 84455e27db EgtMachKernel :
- in milling con fresa capovolta rispetto alla faccia tolto spessore utensile da calcoli (ha significato solo per la forma dell'utensile e non per il punto di lavoro).
2022-12-07 15:53:57 +01:00
DarioS 748845e4a8 EgtMachKernel 2.4l1 :
- ricompilazione con cambio versione.
2022-12-05 08:13:23 +01:00
DarioS 1c78841664 EgtMachkernel :
- in fresature sistemazione approcci/retrazioni per macchine con TiltingTable.
2022-11-30 09:51:34 +01:00
DarioS 4d19a52590 EgtMachKernel 2.4k4 :
- migliorato calcolo elevazione in fresature con utensili di grosso diametro.
2022-11-29 09:04:59 +01:00
DarioS caf2176a3c EgtMachKernel 2.4k3 :
- aggiunto ricalcolo di AuxDir (se necessario) dopo modifiche di SpecialMoveZup.
2022-11-09 13:14:22 +01:00
DarioS 7f1e0ac8d8 EgtMachKernel 2.4k2 :
- migliorati log in Apply e Update di disposizioni e lavorazioni
- aggiunta funzione GetName a Operation.
2022-11-07 16:37:34 +01:00
DarioS 4f22c9c578 EgtMachKernel 2.4k1 :
- migliorati messaggi di log su Apply lavorazioni.
2022-11-03 15:52:26 +01:00
DarioS b4fba50c15 EgtMachKernel 2.4j3 :
- in tutte le lavorazioni ora Apply esegue sempre Update (aggiornamento assi macchina e collegamento con operazione precedente) anche se non è necessario il ricalcolo della lavorazione.
2022-10-27 11:06:22 +02:00
DarioS b6b0432721 EgtMachKernel :
- modifiche per calcolo approccio/retrazione in fresatura per macchine con tavola tilting o similare.
2022-10-20 10:21:28 +02:00
SaraP 877215969e EgtMachKernel 2.4j2 :
- in Pocketing correzioni per svuotatura a zigzag ottimizzata.
2022-10-19 11:26:30 +02:00
DarioS f70218a432 EgtMachKernel 2.4j1 :
- aggiunta possibilità di definire direzione principale di approccio per rinvio da sotto con massima deviazione angolare di 95deg.
2022-10-14 10:47:40 +02:00
DarioS b47a32c628 EgtMachKernel 2.4i6 :
- corretta GetMachines di MachMgr per evitare di inserire in lista due volte la stessa macchina.
2022-10-04 11:12:55 +02:00
DarioS 677a8466dd EgtMachKernel 2.4i5 :
- aggiunta gestione flag MaxDeltaR2OnFirst su testa per disabilitare controllo massimo delta su secondo asse rotante all'inizio di una lavorazione.
2022-10-03 08:56:46 +02:00
DarioS f8f23ed713 EgtMachKerenel :
- per simulazione AXESMASK portato a MASK come in generazione.
2022-09-26 07:45:45 +02:00
DarioS ff6aae071a EgtMachKernel 2.4i :
- aggiunta gestione offset assi per visualizzazione
- correzioni in Milling e Pocketing per approcci e retrazioni con TiltingTab (comprende asse rotante tipo ralla).
2022-09-24 18:53:47 +02:00
DarioS dffc7ec956 EgtMachKernel 2.4i3 :
- in lavorazione WaterJet aggiunta gestione ponticelli.
2022-09-20 07:50:41 +02:00
DarioS b5d15e4a11 EgtMachKernel 2.4h2 :
- aggiunta gestione più direttori di base per le macchine (in MachMgr::Init sono tutti nella stessa stringa separati da "|")
- aggiunta funzione GetMachines di MachMgr per restituire elenco nome/direttorio di tutte le macchine trovate
- sistemazioni varie per le modifiche sopra indicate.
2022-09-13 08:15:14 +02:00
DarioS cf6c628876 EgtMachKernel :
- modifiche per permettere assi lineari controversi con assi principali XYZ.
2022-08-29 07:24:34 +02:00
DarioS 6399c41598 EgtMachKernel 2.4h2 :
- correzioni e migliorie a VerifyPathFromBottom di Milling e Pocketing.
2022-08-24 17:39:47 +02:00
DarioS 49854f8045 EgtMachKernel :
- modifiche a svuotatura per regressione nella gestione del caso slot con ingresso e uscita aperti di larghezza pari al diametro utensile.
2022-08-17 19:20:18 +02:00
DarioS c5c0503018 EgtMachKernel :
- correzioni in mortasatura quando inclinata per calcolo massimo affondamento.
2022-08-08 18:16:00 +02:00
SaraP ee513969fa EgtMachKernel :
- correzioni per svuotatura a spirale ottimizzata.
2022-08-08 17:44:25 +02:00
SaraP 22933e6f3d EgtMachKernel 2.4h1 :
- corretto caso di pulizia angoli per svuotatura a spirale ottimizzata.
2022-08-08 12:02:56 +02:00
DarioS 5cde54467a EgtMachKernel :
- in mortasatura sistemato calcolo affondamento quando inclinata rispetto al movimento
- corretto calcolo spessore da associare a curva derivata da contorno superficie con TOOL_PAR_SLANT.
2022-08-05 07:25:45 +02:00
DarioS 6b3343a98e EgtMachKernel 2.4g7 :
- in Mortising si considerano concatenabili lati di facce con delta angolare non oltre 31 gradi (prima il limite era di 46).
2022-08-04 19:58:05 +02:00
DarioS 4d158ec9fd EgtMachKernel 2.4g6 :
- in Mortising plunge corretta gestione affondamento.
2022-08-01 12:30:20 +02:00
DarioS d48b1c969e EgtMachKernel 2.4g5 :
- corretto calcolo elevazione in forature.
2022-07-29 15:12:44 +02:00
DarioS 3e33be0552 EgtMachKernel 2.4g4 :
- modifica a ApproxWithArcsIfUseful per evitare problemi con percorsi piani su piani diversi da XY.
2022-07-21 07:02:04 +02:00
DarioS 0ec3726fc6 EgtMachKernel 2.4g3 :
- altra correzione per asse rotante con corsa nulla.
2022-07-15 07:40:16 +02:00
DarioS 91005b36ba EgtMachKernel 2.4g2 :
- correzione calcolo angolo di asse rotante con corsa nulla.
2022-07-13 18:29:36 +02:00
DarioS 8f224a6b61 EgtMachkernel :
- in lavorazione Mortising calcolo degli step con più tolleranza.
2022-07-05 08:54:30 +02:00
DarioS 0e38ae1f66 EgtMachKernel 2.4g1 :
- modifiche a forature per gestione precisa MaxElev.
2022-07-04 11:02:46 +02:00
DarioS 2142ebda4e EgtMachKernel 2.4f5 :
- in svuotature corretta gestione casi speciali che falliscono e rimandano al caso standard.
2022-06-29 16:07:19 +02:00
DarioS 16a283e1bc EgtMachKernel :
- modifiche varie per plunge di Mortising.
2022-06-19 11:07:07 +02:00
SaraP ddc91c60e9 EgtMachKernel :
- aggiunta lavorazione a tuffo su tutto il percorso in mortasatura.
2022-06-17 17:55:47 +02:00
DarioS d61450cf20 EgtMachKernel 2.4f4 :
- aggiunta lavorazione a tuffo (su inizio o fine) in mortasatura
- aggiunta Distanza (per mortasatrici) a dati utensili.
2022-06-17 07:39:24 +02:00
DarioS 2db7bcaefa EgtMachKernel :
- in fresatura OneWay più passate l'affondamento alla successiva è ora con feed di attacco.
2022-06-13 07:57:35 +02:00
DarioS f674c50f89 EgtMachKernel 2.4f3 :
- migliorata gestione parametri porta-utensile in DB utensili.
2022-06-10 11:55:28 +02:00
DarioS 7ab0f5c4a2 EgtMachKernel 2.4f2 :
- modifiche a fresature per caso con tavola tilting/asse a ralla
- corretta in simulazione gestione errore collisione.
2022-06-08 11:41:32 +02:00
DarioS 83c399215d EgtMachKernel 2.4f1 :
- alle macro di disegno utensile si passa anche TipFeed per sapere se taglia in testa.
2022-06-06 07:03:10 +02:00
SaraP 7b0258205f EgtMachKernel 2.4e8 :
- nelle svuotature a zigzag agguinto nuovo caso ottimizzato con 3 lati chiusi.
2022-05-31 11:52:59 +02:00
DarioS f901adadab EgtMachKernel 2.4e7 :
- in WaterJet possibilità di definire inizio lavoraziona anche tramite coordinate punto vicino in note utente (START=x,y,z).
2022-05-31 00:31:03 +02:00
DarioS cdbc4bfb63 EgtMachKernel :
- aggiunta gestione quota di base del tool holder ( se negativa indica spazio libero su testa).
2022-05-29 16:40:26 +02:00
DarioS bc7a89856d EgtMachKernel :
- modifiche a svuotature SpiralIn per ingresso su lato aperto da considerare fuori grezzo anche se dentro (da OpenOutRaw=1 in Note Utente).
2022-05-27 09:12:10 +02:00
DarioS de2539388c EgtMachKernel :
- corretta gestione ventose utilizzate e rimosse.
2022-05-26 10:57:58 +02:00
SaraP a0f655a767 EgtMachKernel :
- piccola correzione svuotature ottimizzate.
2022-05-25 09:48:01 +02:00
DarioS a1a4c85024 EgtMachKernel 2.4e6 :
- correzione calcolo lunghezza attacchi/uscite di svuotature ottimizzate.
2022-05-25 08:35:12 +02:00
DarioS 8a780e6fc7 EgtMachKernel 2.4e5 :
- aggiunti dati EMT.MOVEID e EMT.MOVEIND ai parametri passati agli script di movimento in Generazione e Stima.
2022-05-20 15:56:08 +02:00
DarioS 9bb22b11bd EgtMachKernel 2.4e4 :
- piccole migliorie nell'approccio e retrazione delle svuotature.
2022-05-19 08:37:05 +02:00
DarioS 156f0f8ef8 EgtMachKernel 2.4e3 :
- modifiche per prima versione chiave di rete.
2022-05-17 08:26:38 +02:00
DarioS 88912bf524 EgtMachKernel :
- aggiunta gestione lunghezza ingombro portautensile negativa per indicare spazio libero sulla testa.
2022-05-16 18:35:15 +02:00
DarioS a677bb991f EgtMachKernel 2.4e2 :
- corretta GetPartDirFromAngles per asse rotante di testa speciale (ralla).
2022-05-14 12:11:40 +02:00
DarioS b7bfccdfeb EgtMachKernel :
- in svuotature ZigZag consentite con utensili che non lavorano di testa se iniziano dall'esterno (quindi anche ottimizzate).
2022-05-05 00:00:56 +02:00
DarioS 5869f8ab01 EgtMachKernel 2.4e1 :
- ricompilazione con cambio versione.
2022-05-04 08:07:32 +02:00
DarioS a4fa53a7e9 EgtMachKernel 2.4d4 :
- ricompilate versioni a 32bit con v141_xp (VisualStudio 2017 C++ per XP).
2022-04-24 17:09:39 +02:00
DarioS dc0b055480 EgtMachKernel :
- migliorie su approcci eretrazioni di fresature con lame.
2022-04-22 08:53:59 +02:00
DarioS 6bb714e581 EgtMachKernel 2.4d2 :
- modifiche per gestire macchina con asse rotante tipo ralla che porta due assi lineari ad esso perpendicolare (terzo lineare diretto come ralla).
2022-04-19 11:24:41 +02:00
SaraP 33090bc9e0 EgtMachKernel 2.4d1 :
- in Pocketing corretti errori nella svuotatura a spirale ottimizzata.
2022-04-15 10:48:27 +02:00
DarioS c18b4deef2 EgtMachKernel 2.4c2 :
- modifica a simulatore per gestire correttamente gli assi ausiliari dipendenti da assi principali.
2022-03-22 08:25:41 +01:00
DarioS d3922eb897 EgtMachKernel :
- migliorata gestione approcci e retrazioni in fresature con lame.
2022-03-20 18:51:56 +01:00
SaraP d8f72d02f7 EgtMachKernel 2.4c1 :
- in svuotatura a spirale ottimizzata per trapezoidi aggiunta rimozione di materiale residuo negli angoli.
2022-03-16 09:26:21 +01:00
DarioS b059fe9486 EgtMachKernel 2.4b8 :
- migliorata gestione direzione utensile da lavorazione faccia in parallelo.
2022-03-08 11:19:52 +01:00
DarioS b82cdd0bc7 EgtMachKernel :
- corretto link tra lavorazioni quando HomeZ standard non va bene ma serve GetExtraZ
- disabilitate svuotature a spirale ottimizzate per problemi quando ci sono tre lati aperti
- sistemate maiuscole/minuscole nei nomi dei file inclusi.
2022-02-26 17:53:11 +01:00
SaraP d18b15f209 EgtMachKernel :
- in Pocketing correzione per svuotature a spirale ottimizzate.
2022-02-25 17:29:14 +01:00
SaraP a4b462d6ab EgtMachKernel 2.4b7 :
- in Pocketing aggiunta svuotatura a spirale ottimizzata nel caso di trapezoidi.
2022-02-25 12:51:05 +01:00
DarioS 869b9e0ebe EgtMachKernel 2.4b6 :
- in taglio con lama quando si prende il percorso da superficie si limita la deviazione angolare a 16.1 gradi
- in fresatura la direzione utensile parallela da parte di contorno superficie si calcola nel punto medio (per favorire il lato lungo).
2022-02-23 10:51:54 +01:00
DarioS 0905ebebc7 EgtMachKernel 2.4b5 :
- migliorato CalcOffset di WaterJet.
2022-02-20 19:32:19 +01:00
DarioS d66fdb0e5e EgtMachKernel :
- corretto collegamento tra lavorazioni per problemi macchine tipo PF con pezzi alti.
2022-02-17 22:25:55 +01:00
DarioS 516679bc3b EgtMachKernel :
- modifica calcolo miglior lato aperto per svuotatura SpiralIn.
2022-02-17 16:23:46 +01:00
DarioS 0074ab9003 EgtMachKernel :
- migliorie in Pocketing per zigzag ottimizzato.
2022-02-17 14:41:40 +01:00
DarioS b0cb253299 EgtMachKernel 2.4b4 :
- altre correzioni su svuotature a zigzag ottimizzate.
2022-02-15 19:13:05 +01:00
SaraP 9ef40618f9 EgtMachKernel :
- rimozione aree residue nelle svuotature a zigzag ottimizzate
- altre modifiche per le svuotature a zigzag ottimizzate.
2022-02-15 13:10:55 +01:00
DarioS 360d116eab EgtMachKernel 2.4b3 :
- altre modifiche a svuotature zigzag ottimizzate.
2022-02-15 08:20:11 +01:00
DarioS ea0ab12521 EgtMachKernel :
- altre modifiche alle svuotature ZigZag ottimizzate.
2022-02-14 17:46:24 +01:00
DarioS 78d717cb39 EgtMachKernel :
- modifiche a Pocketing per svuotature a ZigZag ottimizzate.
2022-02-14 12:56:09 +01:00
DarioS bdb7234fbb EgtMachKernel 2.4b2 :
- corretto salvataggio lavorazioni con nuovi parametri opzionali da non salvare se coincidono con default.
2022-02-09 09:50:28 +01:00
SaraP 170d3f7638 EgtMachKernel :
- in Pocketing corretti attacchi e raccordi per lucidature con epicicli.
2022-02-08 14:42:55 +01:00
DarioS 75669fdfc0 EgtMachKernel :
- in Pocketing corretto salvataggio parametri opzionali.
2022-02-06 17:24:13 +01:00
DarioS c47095e52b EgtMachKernel :
- sistemata gestione nuovi parametri per svuotature con epicicli di lucidatura.
2022-02-04 18:31:35 +01:00
SaraP 9edecc23c3 EgtMachKernel 2.4b1 :
- in Pocketing aggiunto percorso a spirale con epicicli per lucidatura.
2022-02-01 10:25:19 +01:00
DarioS ca1aa4c9ac EgtMachKernel 2.4a4 :
- aggiunti massimi e minimi di posizioni e assi anche a gruppi CL e suoi sottogruppi di Disposizioni
- si esegue la scrittura di questi estremi per lavorazioni e disposizioni solo quando definiti.
2022-01-31 18:43:17 +01:00
DarioS 798e0bcb70 EgtMachKernel 2.4a3 :
- corretto controllo attacchi di svuotature con utensili che non lavorano di testa.
2022-01-17 16:27:02 +01:00
DarioS 9ceb1759b5 EgtMachKernel :
- in Sawing su tratti lineari aumentato ingombro lama per calcolo elevazione.
2022-01-14 18:56:38 +01:00
DarioS a5c8d50c55 EgtMachKernel :
- piccole modifiche estetiche.
2022-01-14 16:45:07 +01:00
DarioS c59164f0fb EgtMachKernel :
- migliorato calcolo PreView di tagli di lama lineari inclinati.
2022-01-10 09:41:47 +01:00
DarioS 25473ff787 EgtMachKernel :
- inserita opzione in compilazioni 64bit per evitare Warning su verifica riferimenti non nulli.
2022-01-09 15:50:55 +01:00
DarioS 0c8fec9146 EgtMachKernel 2.4a2 :
- ricompilazione con cambio versione.
2022-01-07 10:02:37 +01:00
DarioS 6df3b2dace EgtMachKernel 2.4a1 :
- ricompilazione per cambio versione.
2022-01-04 08:08:55 +01:00
DarioS 339c0260f8 EgtMachKernel 2.3l3 :
- sicurezza minima di collisione ridotta a 5 mm nelle verifiche dei link.
2021-12-29 20:39:07 +01:00
DarioS 46d433296b EgtMachKernel 2.3l2 :
- in simulazione aggiunta gestione assi linkati ad altri assi.
2021-12-28 08:39:00 +01:00
DarioS 7ee1253b3c EgtMachKernel :
- eliminato prototipo inutile.
2021-12-17 09:00:13 +01:00
DarioS f535ed5a9b EgtMachKernel :
- correzione in import lavorazioni.
2021-12-12 10:37:43 +01:00
DarioS 25c382aa71 EgtMachKernel :
- aggiunte in interfaccia funzioni per export/import lavorazioni
- modifiche varie in export/import utensili e lavorazioni.
2021-12-08 16:43:32 +01:00
SaraP 75b4601ecc EgtMachKernel :
- aggiunte funzioni per esportazione e importazione lavorazioni.
2021-12-07 17:35:23 +01:00
SaraP a136631c94 EgtMachKernel 2.3l1 :
- in Pocketing aggiunto caso ottimizzato per svuotature a zigzag.
2021-12-07 11:47:48 +01:00
DarioS 8483c1609a EgtMachKernel 2.3k3 :
- ricompilazione per cambio versione.
2021-11-27 12:08:35 +01:00
DarioS 17c7be3a56 EgtMachKernel 2.3k2 :
- nella gestione link tra lavorazioni aggiunta possibilità di utilizzo script OnSpecialGetMaxZ che determina la Zmassima raggiungibile nel collegamento in funzione delle posizioni testa iniziale e finale.
2021-11-22 11:10:03 +01:00
DarioS cfb2fea0bd EgtMachKernel 2.3k1 :
- modifiche a Mortising per ricalcolo elevazione su attacco uscita indipendente da MaxElev.
2021-11-15 09:53:18 +01:00
DarioS ac17810065 EgtMachKernel 2.3j8 :
- aggiunta funzione lua EmtGetAllLinkedRawParts
- corretto calcolo GetPointUnderRaw.
2021-11-02 08:21:07 +01:00
DarioS 543afd4c7a EgtMachKernel 2.3j6 :
- adattamenti per modifiche a GeomKernel.
2021-10-24 18:10:31 +02:00
DarioS 73ce1f1018 EgtMachKernel 2.3j5 :
- aggiunta funzione EmtModifyHeadAuxDirection
- corretto scambio parametri attacco/uscita in fresatura cquando percorso invertito
- assi bloccati ora impostabili da lavorazione con nome asse oppure con suo token.
2021-10-14 11:07:49 +02:00
DarioS 23c0e1c8d5 EgtMachKernel 2.3j4 :
- in fresatura corretta gestione elevazione di attacco e uscita con OneWay.
2021-10-10 20:04:54 +02:00
DarioS 8e64f0ad00 EgtMachKernel 2.3j3 :
- in svuotature con lati aperti corretta elevazione attacco con testa da sotto.
2021-10-07 06:54:49 +02:00
DarioS 5a8fb790b0 EgtMachKernel 2.3j2 :
- corretto aggiornamento disegni utensili e dimensioni portautensili.
2021-10-05 20:19:21 +02:00
DarioS fa6928c593 EgtMachKernel :
- in Svuotature Oneway corretto errore con contorno esterno circonferenza.
2021-10-05 11:42:03 +02:00
DarioS 52a26ceb52 EgtMachKernel 2.3j1 :
- corretto controlli attacchi/uscite lame in fresature con testa da sotto.
2021-10-04 09:15:29 +02:00
DarioS bb8b6b9fc1 EgtMachKernel :
- aggiustamento per nuovo parametro richiesto da ISurfTriMesh::GetSilhouette.
2021-09-26 16:29:34 +02:00
DarioS 7b90e2b152 EgtMachKernel 2.3i7 :
- in fresature aggiunto Attacco Tang+Perp e Uscita Perp+Tang.
2021-09-25 12:50:10 +02:00
DarioS 5c6ad44bb5 EgtMachKernel 2.3i6 :
- aggiunta gestione anima per lame (CORE in SysNotes).
2021-09-16 12:44:41 +02:00
DarioS af688d4fb7 EgtMachKernel 2.3i5 :
- a MachMgr e sua interfaccia IMachMgr aggiunta funzione ChangeTable.
2021-09-13 15:50:39 +02:00
DarioS 01cb04ac96 EgtMachKernel 2.3i4 :
- migliorato controllo risalita tra percorsi di lavorazione e migliorata assegnazione Flag2 (se 1 allora a MaxZ).
2021-09-09 15:49:08 +02:00
DarioS 0c3ad1ebe5 EgtMachKernel 2.3i3 :
- corretta recente modifica per calcolo Zsafe in link tra lavorazioni.
2021-09-07 18:44:54 +02:00
DarioS 7b3a544c9f EgtMachKernel 2.3i2 :
- modifiche alla verifica Z sicura per link tra lavorazioni.
2021-09-07 18:04:02 +02:00
DarioS b3a13a94bb EgtMachKernel 2.3i1 :
- link tra lavorazioni con maggiori sicurezze
- corretta gestione svuotature da sotto con testa da sotto.
2021-09-06 10:24:14 +02:00
DarioS 8318dcc2a8 EgtMachKernel :
- nella lavorazione di Finitura Superfici è ora specificare quali superfici considerare (se non si specificano sono considerate tutte).
2021-08-29 19:31:35 +02:00
DarioS b18c309344 EgtMachKernel 2.3h2 :
- correzioni a Milling per lavorazioni con fresa inclinata rispetto ad un percorso piano.
2021-08-25 15:06:01 +02:00
87 changed files with 12007 additions and 3438 deletions
+21 -16
View File
@@ -17,9 +17,11 @@
#include "Axis.h"
#include "MachConst.h"
#include "/EgtDev/Include/EGkGdbConst.h"
#include "/EgtDev/Include/EGkGeoVector3d.h"
#include "/EgtDev/Include/EGkUserObjFactory.h"
#include "/EgtDev/Include/EGkStringUtils3d.h"
#include "/EgtDev/Include/EGkUiUnits.h"
#include "/EgtDev/Include/EgtNumUtils.h"
using namespace std ;
@@ -46,6 +48,7 @@ Axis::Clone( void) const
pAx->m_sName = m_sName ;
pAx->m_sToken = m_sToken ;
pAx->m_bInvert = m_bInvert ;
pAx->m_dOffset = m_dOffset ;
pAx->m_nType = m_nType ;
pAx->m_ptPos = m_ptPos ;
pAx->m_vtDir = m_vtDir ;
@@ -109,19 +112,20 @@ Axis::GetGeomDB( void) const
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
Axis::Axis( void)
: m_nOwnerId( GDB_ID_NULL), m_pGeomDB( nullptr),
: m_nOwnerId( GDB_ID_NULL), m_pGeomDB( nullptr), m_bInvert( false), m_dOffset( 0),
m_nType( MCH_AT_NONE), m_Stroke( {{0,0}}), m_dHomeVal( 0), m_dCurrVal( 0)
{
}
//----------------------------------------------------------------------------
bool
Axis::Set( const string& sName, const string& sToken, bool bInvert, int nType,
const Point3d& ptPos, const Vector3d& vtDir, const STROKE& Stroke, double dHome)
Axis::Set( const string& sName, const string& sToken, bool bInvert, double dOffset,
int nType, const Point3d& ptPos, const Vector3d& vtDir, const STROKE& Stroke, double dHome)
{
m_sName = sName ;
m_sToken = sToken ;
m_bInvert = bInvert ;
m_dOffset = dOffset ;
m_nType = nType ;
m_ptPos = ptPos ;
m_vtDir = vtDir ;
@@ -135,9 +139,8 @@ Axis::Set( const string& sName, const string& sToken, bool bInvert, int nType,
bool
Axis::Modify( const Point3d& ptPos, double dAxisMaxAdjust)
{
// Verifico che lo spostamento non superi il massimo ammesso
Vector3d vtDelta = ptPos - m_ptPos ;
Vector3d vtDeltaPerp = vtDelta - ( vtDelta * m_vtDir) * m_vtDir ;
// Verifico che lo spostamento perpendicolare alla sua direzione non superi il massimo ammesso
Vector3d vtDeltaPerp = OrthoCompo( ptPos - m_ptPos, m_vtDir) ;
if ( vtDeltaPerp.Len() > dAxisMaxAdjust) {
string sOut = " Modify Axis " + m_sName + " Position (" + ToString( ptPos) + ") failed" ;
LOG_ERROR( GetEMkLogger(), sOut.c_str()) ;
@@ -145,6 +148,11 @@ Axis::Modify( const Point3d& ptPos, double dAxisMaxAdjust)
}
// Assegno la nuova posizione
m_ptPos = ptPos ;
// Sistemo la geometria dell'asse
int nV = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, m_sName) ;
IGeoVector3d* pGV = GetGeoVector3d( m_pGeomDB->GetGeoObj( nV)) ;
if ( pGV != nullptr)
pGV->ChangeBase( m_ptPos) ;
return true ;
}
@@ -162,6 +170,11 @@ Axis::Modify( const Vector3d& vtDir, double dAxisMaxRotAdj)
}
// Assegno la nuova direzione
m_vtDir = vtDirN ;
// Sistemo la geometria dell'asse
int nV = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, m_sName) ;
IGeoVector3d* pGV = GetGeoVector3d( m_pGeomDB->GetGeoObj( nV)) ;
if ( pGV != nullptr)
pGV->ChangeVector( m_vtDir) ;
return true ;
}
@@ -170,10 +183,7 @@ bool
Axis::Modify( const STROKE& Stroke)
{
m_Stroke = Stroke ;
if ( m_dHomeVal < m_Stroke.Min)
m_dHomeVal = m_Stroke.Min ;
else if ( m_dHomeVal > m_Stroke.Max)
m_dHomeVal = m_Stroke.Max ;
m_dHomeVal = Clamp( m_dHomeVal, m_Stroke.Min, m_Stroke.Max) ;
return true ;
}
@@ -181,12 +191,7 @@ Axis::Modify( const STROKE& Stroke)
bool
Axis::Modify( double dHome)
{
if ( dHome < m_Stroke.Min)
m_dHomeVal = m_Stroke.Min ;
else if ( dHome > m_Stroke.Max)
m_dHomeVal = m_Stroke.Max ;
else
m_dHomeVal = dHome ;
m_dHomeVal = Clamp( dHome, m_Stroke.Min, m_Stroke.Max) ;
return true ;
}
+7 -4
View File
@@ -1,7 +1,7 @@
//----------------------------------------------------------------------------
// EgalTech 2015-2015
// EgalTech 2015-2022
//----------------------------------------------------------------------------
// File : Axis.h Data : 24.05.15 Versione : 1.6e7
// File : Axis.h Data : 21.09.22 Versione : 2.4i
// Contenuto : Dichiarazione della classe Axis.
//
//
@@ -30,8 +30,8 @@ class Axis : public IUserObj
public :
Axis( void) ;
bool Set( const std::string& sName, const std::string& sToken, bool bInvert, int nType,
const Point3d& ptPos, const Vector3d& vtDir, const STROKE& Stroke, double dHome) ;
bool Set( const std::string& sName, const std::string& sToken, bool bInvert, double dOffset,
int nType, const Point3d& ptPos, const Vector3d& vtDir, const STROKE& Stroke, double dHome) ;
bool Modify( const Point3d& ptPos, double dAxisMaxAdjust) ;
bool Modify( const Vector3d& vtDir, double dAxisMaxRotAdj) ;
bool Modify( const STROKE& Stroke) ;
@@ -44,6 +44,8 @@ class Axis : public IUserObj
{ return m_sToken ; }
bool GetInvert( void) const
{ return m_bInvert ; }
double GetOffset( void) const
{ return m_dOffset ; }
int GetType( void) const
{ return m_nType ; }
const Point3d& GetPos( void) const
@@ -63,6 +65,7 @@ class Axis : public IUserObj
std::string m_sName ;
std::string m_sToken ;
bool m_bInvert ;
double m_dOffset ;
int m_nType ;
Point3d m_ptPos ;
Vector3d m_vtDir ;
+29 -8
View File
@@ -1,13 +1,14 @@
//----------------------------------------------------------------------------
// EgalTech 2015-2016
// EgalTech 2015-2023
//----------------------------------------------------------------------------
// File : CamData.cpp Data : 24.02.16 Versione : 1.6n8
// File : CamData.cpp Data : 22.11.23 Versione : 2.5k3
// Contenuto : Implementazione informazioni Cam di ogni movimento.
//
//
//
// Modifiche : 10.06.15 DS Creazione modulo.
// 24.02.16 DS Versione 2 (aggiunti m_nMove e m_ptCen).
// 22.11.23 DS Aggiunto flag ToolShow (forza in ogni caso la visualizzazione della direzione utensile).
//
//----------------------------------------------------------------------------
@@ -53,7 +54,9 @@ static int CAM_PARAM_V7 = 22 ;
static string CAM_ORIGFEED = "OrFeed" ;
static int CAM_PARAM_V8 = 23 ;
static string CAM_FLAG2 = "Flg2" ;
static int CAM_TOTPARAM =CAM_PARAM_V8 ;
static int CAM_PARAM_V9 = 24 ;
static string CAM_TOOLSHOW = "TSh" ;
static int CAM_TOTPARAM = CAM_PARAM_V9 ;
//----------------------------------------------------------------------------
@@ -79,6 +82,7 @@ CamData::Clone( void) const
pCam->m_pGeomDB = nullptr ;
pCam->m_nMove = m_nMove ;
pCam->m_nCorre = m_nCorre ;
pCam->m_bToolShow = m_bToolShow ;
pCam->m_vtTool = m_vtTool ;
pCam->m_vtCorr = m_vtCorr ;
pCam->m_vtAux = m_vtAux ;
@@ -139,6 +143,7 @@ CamData::Dump( string& sOut, bool bMM, const char* szNewLine) const
sOut += CAM_AXND + "=" + ToString( m_vtMachN) + szNewLine ;
sOut += CAM_NDLT + "=" + ToString( m_dDeltaN) + szNewLine ;
sOut += CAM_BDIR + "=" + ToString( m_vtBackAux) + szNewLine ;
sOut += CAM_TOOLSHOW + "=" + ToString( m_bToolShow) + szNewLine ;
return true ;
}
@@ -149,6 +154,8 @@ CamData::SetOwner( int nId, IGeomDB* pGDB)
{
m_nOwnerId = nId ;
m_pGeomDB = pGDB ;
if ( m_pGeomDB != nullptr)
m_pGeomDB->SetStipple( m_nOwnerId, ( m_nMove == 0 ? 3 : 0), 0x8C8C) ;
return ( m_nOwnerId != GDB_ID_NULL && m_pGeomDB != nullptr) ;
}
@@ -203,6 +210,8 @@ CamData::Save( int nBaseId, STRVECTOR& vString) const
vString[++k] = CAM_ORIGFEED + "=" + ToString( m_dOrigFeed) ;
// parametri aggiunti V8
vString[++k] = CAM_FLAG2 + "=" + ToString( m_nFlag2) ;
// parametri aggiunti V9
vString[++k] = CAM_TOOLSHOW + "=" + ToString( m_bToolShow) ;
}
catch( ...) {
return false ;
@@ -295,6 +304,14 @@ CamData::Load( const STRVECTOR& vString, int nBaseGdbId)
else {
m_nFlag2 = 0 ;
}
// parametri aggiunti V9
if ( int( vString.size()) >= CAM_PARAM_V9) {
if ( ! GetVal( vString[++k], CAM_TOOLSHOW, m_bToolShow))
return false ;
}
else {
m_bToolShow = false ;
}
return true ;
}
@@ -311,7 +328,7 @@ CamData::GetDrawPolyLines( POLYLINELIST& lstPL) const
PolyLine& PL = lstPL.back() ;
// dimensioni
const double TLEN = 40 ;
const double ALEN = 4 ;
const double ALEN = 1 ;
// inserisco disegno nella polilinea
PL.AddUPoint( 0, m_ptEnd) ;
Point3d ptTip = m_ptEnd + m_vtTool * TLEN ;
@@ -333,6 +350,9 @@ CamData::GetDrawPolyLines( POLYLINELIST& lstPL) const
ptP6.ToGlob( frF) ;
PL.AddUPoint( 6, ptP6) ;
PL.AddUPoint( 6, ptTip) ;
// da visualizzare sempre se richiesto
if ( m_bToolShow)
PL.SetTempProp( 1) ;
}
// se vettore correzione non nullo
if ( ! m_vtCorr.IsSmall()) {
@@ -342,14 +362,14 @@ CamData::GetDrawPolyLines( POLYLINELIST& lstPL) const
PolyLine& PL = lstPL.back() ;
// dimensioni
const double CLEN = 20 ;
const double ALEN = 2 ;
const double ALEN = 1 ;
// inserisco disegno nella polilinea
PL.AddUPoint( 0, m_ptEnd) ;
Point3d ptTip = m_ptEnd + m_vtCorr * CLEN ;
PL.AddUPoint( 1, ptTip) ;
// aggiungo simil-freccia
Frame3d frF ;
if ( m_vtTool. IsSmall())
if ( m_vtTool. IsSmall() || AreSameOrOppositeVectorApprox( m_vtTool, m_vtCorr))
frF.Set( ptTip, m_vtCorr) ;
else
frF.Set( ptTip, m_vtCorr, m_vtTool) ;
@@ -371,14 +391,14 @@ CamData::GetDrawPolyLines( POLYLINELIST& lstPL) const
PolyLine& PL = lstPL.back() ;
// dimensioni
const double CLEN = 20 ;
const double ALEN = 2 ;
const double ALEN = 1 ;
// inserisco disegno nella polilinea
PL.AddUPoint( 0, m_ptEnd) ;
Point3d ptTip = m_ptEnd + m_vtAux * CLEN ;
PL.AddUPoint( 1, ptTip) ;
// aggiungo simil-freccia
Frame3d frF ;
if ( m_vtTool. IsSmall())
if ( m_vtTool. IsSmall() || AreSameOrOppositeVectorApprox( m_vtTool, m_vtAux))
frF.Set( ptTip, m_vtAux) ;
else
frF.Set( ptTip, m_vtAux, m_vtTool) ;
@@ -546,6 +566,7 @@ CamData::CamData( void)
m_pGeomDB = nullptr ;
m_nMove = 0 ;
m_nCorre = 0 ;
m_bToolShow = false ;
m_dAngCen = 0 ;
m_dDeltaN = 0 ;
m_dFeed = 0 ;
+10 -5
View File
@@ -68,11 +68,13 @@ class CamData : public IUserObj
bool SetAxesAngCen( double dAngCen) ;
bool SetAxesNormDir( const Vector3d& vtDir) ;
bool SetBackAuxDir( const Vector3d& vtDir) ;
const int GetMoveType( void) const
bool SetToolShow( bool bShow)
{ m_bToolShow = bShow ; return true ; }
int GetMoveType( void) const
{ return m_nMove ; }
const bool IsLine( void) const
bool IsLine( void) const
{ return ( m_nMove == 0 || m_nMove == 1) ; }
const bool IsArc( void) const
bool IsArc( void) const
{ return ( m_nMove == 2 || m_nMove == 3) ; }
const Vector3d& GetToolDir( void) const
{ return m_vtTool ; }
@@ -108,14 +110,16 @@ class CamData : public IUserObj
{ return m_vMachAxes ; }
const Point3d& GetAxesCen( void) const
{ return m_ptMachCen ; }
const double GetAxesRad( void) const
double GetAxesRad( void) const
{ return m_dMachRad ; }
const double GetAxesAngCen( void) const
double GetAxesAngCen( void) const
{ return m_dMachAngCen ; }
const Vector3d& GetAxesNormDir( void) const
{ return m_vtMachN ; }
const Vector3d& GetBackAuxDir( void) const
{ return m_vtBackAux ; }
bool GetToolShow( void) const
{ return m_bToolShow ; }
public :
enum { AS_NONE = 0,
@@ -139,6 +143,7 @@ class CamData : public IUserObj
IGeomDB* m_pGeomDB ;
int m_nMove ; // tipo movimento (0=rapido, 1=lineare, 2=arco CW, 3=arco CCW)
int m_nCorre ; // tipo correzione (0, 41, 42, 141, 142, 40)
bool m_bToolShow ; // flag per forzare la visualizzazione della direzione utensile in ogni caso
Vector3d m_vtTool ; // versore fresa
Vector3d m_vtCorr ; // versore correzione
Vector3d m_vtAux ; // versore ausiliario
+37 -13
View File
@@ -504,8 +504,14 @@ Chiseling::Apply( bool bRecalc, bool bPostApply)
// verifico se necessario continuare nell'aggiornamento
if ( ! bRecalc && ! bToolChanged &&
( m_nStatus == MCH_ST_OK || ( ! bPostApply && m_nStatus == MCH_ST_NO_POSTAPPL))) {
// confermo i percorsi di lavorazione
m_nChisels = nCurrChisels ;
LOG_DBG_INFO( GetEMkLogger(), "Chiseling apply skipped : status already ok") ;
// eseguo aggiornamento assi macchina e collegamento con operazione precedente
if ( ! Update( bPostApply))
return false ;
LOG_DBG_INFO( GetEMkLogger(), "Update done") ;
// esco con successo
return true ;
}
m_nStatus = MCH_ST_TO_VERIFY ;
@@ -570,6 +576,8 @@ Chiseling::Apply( bool bRecalc, bool bPostApply)
// dichiaro successiva da aggiornare
UpdateFollowingOperationsStatus( MCH_ST_OTH_MODIF) ;
LOG_DBG_INFO( GetEMkLogger(), "Chiseling apply done") ;
return true ;
}
@@ -587,15 +595,11 @@ Chiseling::Update( bool bPostApply)
return true ;
}
// elimino le entità CLIMB, RISE e HOME della lavorazione, potrebbero falsare i calcoli degli assi (in ogni casi vengono riaggiunte dopo)
RemoveClimbRiseHome() ;
// imposto eventuale asse bloccato da lavorazione
if ( ! m_Params.m_sBlockedAxis.empty()) {
string sAxis, sVal ;
Split( m_Params.m_sBlockedAxis, "=", true, sAxis, sVal) ;
double dVal = 0 ;
FromString( sVal, dVal) ;
m_pMchMgr->ClearRotAxisBlock() ;
m_pMchMgr->SetRotAxisBlock( sAxis, dVal) ;
}
SetBlockedRotAxis( m_Params.m_sBlockedAxis) ;
// calcolo gli assi macchina
string sHint = ExtractHint( m_Params.m_sUserNotes) ;
@@ -767,11 +771,31 @@ Chiseling::UpdateToolData( bool* pbChanged)
const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ;
if ( pTdata == nullptr)
return false ;
// verifico se sono diversi (ad esclusione del nome)
m_TParams.m_sName = pTdata->m_sName ;
bool bChanged = ! SameTool( m_TParams, *pTdata) ;
// salvo posizione TC, testa e uscita originali
string sOrigTcPos = m_TParams.m_sTcPos ;
string sOrigHead = m_TParams.m_sHead ;
int nOrigExit = m_TParams.m_nExit ;
// verifico se sono diversi (ad esclusione di nome, posizione TC, testa e uscita)
bool bChanged = ( ! SameTool( m_TParams, *pTdata, false)) ;
// aggiorno comunque i parametri
m_TParams = *pTdata ;
// se definito attrezzaggio, aggiorno i parametri che ne possono derivare
string sTcPos ; string sHead ; int nExit ;
if ( m_pMchMgr->GetCurrSetupMgr().GetToolData( m_TParams.m_sName, sTcPos, sHead, nExit)) {
if ( sOrigTcPos != sTcPos ||
sOrigHead != sHead ||
nOrigExit != nExit)
bChanged = true ;
m_TParams.m_sTcPos = sTcPos ;
m_TParams.m_sHead = sHead ;
m_TParams.m_nExit = nExit ;
}
else {
if ( sOrigTcPos != pTdata->m_sTcPos ||
sOrigHead != pTdata->m_sHead ||
nOrigExit != pTdata->m_nExit)
bChanged = true ;
}
// eventuali segnalazioni
if ( ! EqualNoCase( m_Params.m_sToolName, m_TParams.m_sName)) {
string sInfo = "Warning in Chiseling : tool name changed (" +
@@ -1012,8 +1036,8 @@ Chiseling::GetCurves( SelData Id, ICURVEPLIST& lstPC)
for ( int nC = nCstart ; nC < nCend ; ++ nC) {
// recupero i contorni del chunk
for ( int nL = 0 ; nL < pReg->GetLoopCount( nC) ; ++ nL) {
PtrOwner<ICurveComposite> pCrvCompo( CreateCurveComposite()) ;
if ( IsNull( pCrvCompo) || ! pCrvCompo->AddCurve( pReg->GetLoop( nC, nL)))
PtrOwner<ICurveComposite> pCrvCompo ;
if ( ! pCrvCompo.Set( ConvertCurveToComposite( pReg->GetLoop( nC, nL))))
return false ;
// assegno l'estrusione dalla normale alla regione
pCrvCompo->SetExtrusion( vtN) ;
+6 -2
View File
@@ -71,6 +71,10 @@ struct ChiselingData : public MachiningData
//----------------------------------------------------------------------------
inline const ChiselingData* GetChiselingData( const MachiningData* pMdata)
{ return (dynamic_cast<const ChiselingData*>( pMdata)) ; }
{ if ( pMdata == nullptr || pMdata->GetType() != MT_CHISELING)
return nullptr ;
return ( static_cast<const ChiselingData*>( pMdata)) ; }
inline ChiselingData* GetChiselingData( MachiningData* pMdata)
{ return (dynamic_cast<ChiselingData*>( pMdata)) ; }
{ if ( pMdata == nullptr || pMdata->GetType() != MT_CHISELING)
return nullptr ;
return ( static_cast<ChiselingData*>( pMdata)) ; }
+34 -5
View File
@@ -86,6 +86,8 @@ Disposition::Clone( void) const
// eseguo copia dei dati
if ( pDisp != nullptr) {
try { pDisp->m_sTabName = m_sTabName ;
pDisp->m_pMchMgr = m_pMchMgr ;
pDisp->m_nPhase = m_nPhase ;
pDisp->m_ptRef1 = m_ptRef1 ;
pDisp->m_b3Area1 = m_b3Area1 ;
pDisp->m_dAreaOffset = m_dAreaOffset ;
@@ -306,7 +308,7 @@ Disposition::Load( const STRVECTOR& vString, int nBaseGdbId)
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
Disposition::Disposition( void)
: m_bTabOk( false), m_nExit( 0), m_nStatus( MCH_ST_TO_VERIFY), m_nShifts( 0), m_bSomeByHand( false), m_dAreaOffset({{0,0,0,0}})
: m_bTabOk( false), m_dAreaOffset({{0,0,0,0}}), m_nExit( 0), m_nStatus( MCH_ST_TO_VERIFY), m_nShifts( 0), m_bSomeByHand( false)
{
}
@@ -1205,6 +1207,23 @@ Disposition::InsertMoveInfoInList( int nRawId, int nType, const Point3d& ptP, in
return true ;
}
//----------------------------------------------------------------------------
bool
Disposition::UpdateRawPartId( int nRawId, int nNewRawId)
{
// aggiorno i movimenti registrati per questo grezzo
while ( true) {
auto iIter = find_if( m_vMvrData.begin(), m_vMvrData.end(),
[ nRawId]( const MoveRawData& Mrv)
{ return ( Mrv.nRawId == nRawId) ; }) ;
if ( iIter == m_vMvrData.end())
break ;
else
iIter->nRawId = nNewRawId ;
}
return true ;
}
//----------------------------------------------------------------------------
bool
Disposition::RemoveRawPart( int nRawId)
@@ -1294,6 +1313,7 @@ Disposition::SpecialApply( bool bRecalc)
static const string ON_SPECIAL_APPLY = "OnSpecialApplyDisposition" ;
if ( ! pMch->LuaExistsFunction( ON_SPECIAL_APPLY)) {
m_nStatus = MCH_ST_OK ;
LOG_DBG_INFO( GetEMkLogger(), "Disposition special apply not provided") ;
return true ;
}
@@ -1304,7 +1324,7 @@ Disposition::SpecialApply( bool bRecalc)
m_nShifts = nCurrShifts ;
m_bSomeByHand = bCurrSomeByHand ;
m_sTcPos = sCurrTcPos ;
LOG_DBG_INFO( GetEMkLogger(), "Disposition postapply skipped : status already ok") ;
LOG_DBG_INFO( GetEMkLogger(), "Disposition special apply skipped : status already ok") ;
return true ;
}
m_nStatus = MCH_ST_TO_VERIFY ;
@@ -1352,7 +1372,8 @@ Disposition::SpecialApply( bool bRecalc)
bOk = bOk && pMch->LuaResetGlobVar( EMC_VAR) ;
// segnalo errori ed esco
if ( ! bOk || nErr > 0) {
m_nShifts = - 1 ;
if ( m_nShifts != -1)
m_nShifts = -2 ;
string sOut = sMsg ;
if ( IsEmptyOrSpaces( sOut))
sOut = " Error in " + ON_SPECIAL_APPLY + " (" + ToString( nErr) + ")" ;
@@ -1367,6 +1388,10 @@ Disposition::SpecialApply( bool bRecalc)
m_pMchMgr->SetWarning( 2053, sOut) ;
}
// assegno ingombri dei vari percorsi di lavorazione e della lavorazione nel suo complesso
nClId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_CL) ;
CalcAndSetBBox( nClId) ;
// eseguo aggiornamento assi macchina e collegamento con operazione precedente
if ( ! SpecialUpdate())
return false ;
@@ -1374,6 +1399,7 @@ Disposition::SpecialApply( bool bRecalc)
// aggiorno stato
m_nStatus = MCH_ST_OK ;
LOG_DBG_INFO( GetEMkLogger(), "Disposition special apply ok") ;
return true ;
}
@@ -1387,12 +1413,12 @@ Disposition::SpecialUpdate( void)
// se disposizione vuota, esco
if ( m_nShifts <= 0) {
if ( m_nShifts < 0)
if ( m_nShifts == -2)
m_pMchMgr->SetWarning( 2052, "Warning in Disposition : No shifts") ;
return true ;
}
// calcolo assi macchina
if ( ! CalculateAxesValues( "")) {
if ( ! CalculateAxesValues( "", false)) {
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
if ( sInfo.empty())
m_pMchMgr->SetLastError( 2007, "Error in Disposition : axes values not calculable") ;
@@ -1409,6 +1435,9 @@ Disposition::SpecialUpdate( void)
m_pMchMgr->SetLastError( 2010, "Error in Disposition : link outstroke ") ;
return false ;
}
// assegno estremi degli assi dei vari percorsi di lavorazione e della lavorazione nel suo complesso
CalcAndSetAxesBBox() ;
return true ;
}
+10 -7
View File
@@ -56,14 +56,14 @@ class Disposition : public Operation
{ return true ; }
bool Save( int nBaseId, STRVECTOR& vString) const override ;
bool Load( const STRVECTOR& vString, int nBaseGdbId) override ;
public : // Operation
int GetType( void) const override
{ return OPER_DISP ; }
bool IsEmpty( void) const override
{ return ( m_nShifts == 0) ; }
int GetType( void) const override
{ return OPER_DISP ; }
bool IsEmpty( void) const override
{ return ( m_nShifts == 0) ; }
bool UpdateStatus( int nModif) override
{ m_nStatus |= nModif ; return true ; }
{ m_nStatus |= nModif ; return true ; }
protected : // Operation
const std::string& GetToolName( void) const override ;
@@ -71,7 +71,7 @@ class Disposition : public Operation
int GetExitNbr( void) const override ;
const std::string& GetToolTcPos( void) const override ;
int GetSolCh( void) const override
{ return 0 ; }
{ return 0 ; }
bool NeedPrevHome( void) const override ;
public :
@@ -102,6 +102,7 @@ class Disposition : public Operation
bool MoveRawPart( int nRawId, const Vector3d& vtMove) ;
bool RotateRawPart( int nRawId, const Vector3d& vtAx, double dAngRotDeg) ;
bool ApplyRotationToRawPart( int nRawId, double dAngCDeg, double dAngADeg, double dAngC1Deg, bool bAddToList = true) ;
bool UpdateRawPartId( int nRawId, int nNewRawId) ;
bool RemoveRawPart( int nRawId) ;
bool GetFixtureData( int nInd, std::string& sName, int& nId, Point3d& ptPos,
double& dAngDeg, double& dMov) const ;
@@ -111,6 +112,8 @@ class Disposition : public Operation
bool GetToolData( std::string& sName, std::string& sHead, int& nExit, std::string& sTcPos) const ;
bool GetSomeByHand( void) const
{ return m_bSomeByHand ; }
bool IsWithTool( void)
{ return ( m_nShifts != -1) ;}
private :
bool InsertMoveInfoInList( int nRawId, int nType, const Point3d& ptP, int nFlag) ;
+1
View File
@@ -21,3 +21,4 @@
std::string GetEMkVer( void) ;
ILogger* GetEMkLogger( void) ;
const std::string& GetEMkKey( void) ;
bool GetEMkNetHwKey( void) ;
+702 -61
View File
File diff suppressed because it is too large Load Diff
+16 -3
View File
@@ -19,7 +19,13 @@
#include "MachiningConst.h"
struct Hole ;
struct MHDrill ;
struct HoleInfo ;
struct ToolInfo ;
class ICurve ;
typedef std::vector<std::vector<MHDrill>> TABMHDRILL ;
typedef std::vector<HoleInfo> VECTORHOLE ;
typedef std::vector<ToolInfo> VECTORTOOL ;
//----------------------------------------------------------------------------
class Drilling : public Machining
@@ -68,18 +74,24 @@ class Drilling : public Machining
private :
bool GetHoleData( SelData Id, Hole& hole) ;
bool StdandardProcess( bool bRecalc, int nPvId, int nClId) ;
bool StandardProcess( bool bRecalc, int nPvId, int nClId) ;
bool AlongCurveProcess( bool bRecalc, int nPvId, int nClId) ;
bool Chain( int nGrpDestId) ;
ICurve* GetCurve( SelData Id) ;
bool ProcessPath( int nPathId, int nPvId, int nClId) ;
bool GenerateHolePv( int nInd, const SelData& nCircId, const std::string& sPName, int nPvId) ;
bool GenerateHoleCl( int nInd, const SelData& nCircId, const std::string& sPName, int nClId) ;
bool GenerateHoleCl( int nInd, const SelData& nCircId, const std::string& sPName, int nClId, double dMHOff = .0, Vector3d vtAux = V_NULL) ;
bool GenerateHoleRegionPv( int nFirstId, int nCount, int nPvId) ;
bool VerifyDiameter( double dHdiam, double dTdiam, double ddiamTol) ;
bool VerifyHoleFromBottom( const Hole& hole, SelData Id) ;
bool DoStandardDrilling( const Hole& hole, SelData Id, int nPathId) ;
bool DoStandardDrilling( const Hole& hole, SelData Id, int nPathId, double nMHOff, Vector3d vtA) ;
bool DoPeckDrilling( const Hole& hole, SelData Id, int nPathId) ;
bool MultiHeadDrilling( const SELVECTOR& vId, int nClId, TABMHDRILL& vDrills, double& dMHOff, bool bOrd = true) ;
bool CalcMask( VECTORHOLE& vHoles, const VECTORTOOL& vTools, int nIndMT, const Vector3d& vtTool, const Vector3d& vtAux) ;
bool CheckOtherHolesWithTools( VECTORHOLE& vHoles, const VECTORTOOL& vTools, int nIndTM, int nIndHTM, Hole holeICP,
const Frame3d& frHTM, const Frame3d& frHMTOP, double dDiamToler, int& nDrills) ;
bool MultiHeadVerifyHole( Hole& hole, const ToolData* Tool, double dDiamToler, SelData Id) ;
bool VerifyMultiParallelFixedDrills( void) ;
private :
double GetSpeed() const
@@ -100,6 +112,7 @@ class Drilling : public Machining
int m_nStatus ; // stato di aggiornamento della lavorazione
int m_nDrillings ; // numero di fori generati
bool m_bTiltingTab ; // flag utilizzo tavola basculante
Vector3d m_vtTiltingAx ; // versore direzione eventuale asse basculante
bool m_bAboveHead ; // flag utilizzo testa da sopra
bool m_bAggrBottom ; // flag di utilizzo dell'aggregato da sotto
Vector3d m_vtAggrBottom ; // vettore direzione ausiliaria aggregato da sotto
+6 -2
View File
@@ -75,6 +75,10 @@ struct DrillingData : public MachiningData
//----------------------------------------------------------------------------
inline const DrillingData* GetDrillingData( const MachiningData* pMdata)
{ return (dynamic_cast<const DrillingData*>( pMdata)) ; }
{ if ( pMdata == nullptr || pMdata->GetType() != MT_DRILLING)
return nullptr ;
return ( static_cast<const DrillingData*>( pMdata)) ; }
inline DrillingData* GetDrillingData( MachiningData* pMdata)
{ return (dynamic_cast<DrillingData*>( pMdata)) ; }
{ if ( pMdata == nullptr || pMdata->GetType() != MT_DRILLING)
return nullptr ;
return ( static_cast<DrillingData*>( pMdata)) ; }
+15
View File
@@ -98,6 +98,7 @@ GetEMkLogger( void)
//-----------------------------------------------------------------------------
static std::string s_sKey ;
static bool s_bNetHwKey = false ;
//-----------------------------------------------------------------------------
void
@@ -106,9 +107,23 @@ SetEMkKey( const std::string& sKey)
s_sKey = sKey ;
}
//-----------------------------------------------------------------------------
void
SetEMkNetHwKey( bool bNetHwKey)
{
s_bNetHwKey = bNetHwKey ;
}
//-----------------------------------------------------------------------------
const std::string&
GetEMkKey( void)
{
return s_sKey ;
}
//-----------------------------------------------------------------------------
bool
GetEMkNetHwKey( void)
{
return s_bNetHwKey ;
}
BIN
View File
Binary file not shown.
+9 -5
View File
@@ -21,13 +21,13 @@
<PropertyGroup Label="Globals">
<ProjectGuid>{0BD58222-92F3-48B2-B656-4497D1956874}</ProjectGuid>
<RootNamespace>EgtMachKernel</RootNamespace>
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0.20348.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v120_xp</PlatformToolset>
<PlatformToolset>v141_xp</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
@@ -39,7 +39,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v120_xp</PlatformToolset>
<PlatformToolset>v141_xp</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
@@ -102,9 +102,10 @@
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<PreprocessorDefinitions>WIN32;_WINDOWS;I_AM_EMK;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>false</MinimalRebuild>
<OpenMPSupport>true</OpenMPSupport>
<OpenMPSupport>false</OpenMPSupport>
<PrecompiledHeader>Use</PrecompiledHeader>
<CompileAs>CompileAsCpp</CompileAs>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
@@ -132,6 +133,7 @@ copy $(TargetPath) \EgtProg\DllD32</Command>
<PrecompiledHeader>Use</PrecompiledHeader>
<CompileAs>CompileAsCpp</CompileAs>
<LanguageStandard>stdcpp17</LanguageStandard>
<AdditionalOptions>-Wno-tautological-undefined-compare</AdditionalOptions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
@@ -165,6 +167,7 @@ copy $(TargetPath) \EgtProg\DllD64</Command>
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
<WholeProgramOptimization>false</WholeProgramOptimization>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
<GenerateDebugInformation>false</GenerateDebugInformation>
@@ -192,7 +195,7 @@ copy $(TargetPath) \EgtProg\Dll32</Command>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<PreprocessorDefinitions>WIN32;_WINDOWS;I_AM_EMK;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<EnableEnhancedInstructionSet>AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
<EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
<OpenMPSupport>false</OpenMPSupport>
<PrecompiledHeader>Use</PrecompiledHeader>
<CompileAs>CompileAsCpp</CompileAs>
@@ -200,6 +203,7 @@ copy $(TargetPath) \EgtProg\Dll32</Command>
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
<WholeProgramOptimization>false</WholeProgramOptimization>
<LanguageStandard>stdcpp17</LanguageStandard>
<AdditionalOptions>-Wno-tautological-undefined-compare</AdditionalOptions>
</ClCompile>
<Link>
<GenerateDebugInformation>false</GenerateDebugInformation>
+3
View File
@@ -124,6 +124,9 @@ Exit::Modify( const Point3d& ptPos, double dExitMaxAdjust)
}
// Assegno la nuova posizione
m_ptPos = ptPos ;
// Sistemo la geometria dell'uscita
if ( ! vtDelta.IsZero())
m_pGeomDB->Translate( m_nOwnerId, vtDelta) ;
return true ;
}
+69 -12
View File
@@ -20,7 +20,7 @@
#include "/EgtDev/Include/EGkCurveLine.h"
#include "/EgtDev/Include/EGkCurveArc.h"
#include "/EgtDev/Include/EGkCurveComposite.h"
#include "/EgtDev/Include/EgkArcSpecial.h"
#include "/EgtDev/Include/EGkArcSpecial.h"
#include "/EgtDev/Include/EGkSfrCreate.h"
#include "/EgtDev/Include/EGkSurfTriMesh.h"
#include "/EgtDev/Include/EGkUserObjFactory.h"
@@ -55,6 +55,17 @@ static const string EVAR_STARTPOS = ".STARTPOS" ; // IN (num) quota di inizio l
static const string EVAR_OFFSR = ".OFFSR" ; // IN (num) offset radiale
static const string EVAR_OFFSL = ".OFFSL" ; // IN (num) offset longitudinale
static const string EVAR_TOOL = ".TOOL" ; // IN (string) nome dell'utensile
static const string EVAR_HEAD = ".HEAD" ; // IN (string) nome testa
static const string EVAR_EXIT = ".EXIT" ; // IN (int) indice uscita
static const string EVAR_TTYPE = ".TTYPE" ; // IN (int) tipo utensile
static const string EVAR_TMAXMAT = ".TMAXMAT" ; // IN (num) massimo materiale
static const string EVAR_TDIAM = ".TDIAM" ; // IN (num) diametro utensile
static const string EVAR_TTOTDIAM = ".TTOTDIAM" ; // IN (num) diametro totale utensile
static const string EVAR_TLEN = ".TLEN" ; // IN (num) lunghezza utensile
static const string EVAR_TTOTLEN = ".TTOTLEN" ; // IN (num) lunghezza totale utensile
static const string EVAR_TTHICK = ".THICK" ; // IN (num) spessore per lame o altezza taglienti
static const string EVAR_TCORNRAD = ".TCORNRAD" ; // IN (num) raggio corner
static const string EVAR_TSIDEANG = ".TSIDEANG" ; // IN (num) angolo del fianco rispetto all'asse
static const string EVAR_FEED = ".FEED" ; // IN (num) feed dell'utensile
static const string EVAR_STARTFEED = ".STARTFEED" ;// IN (num) feed di inizio dell'utensile
static const string EVAR_ENDFEED = ".ENDFEED" ; // IN (num) feed di fine dell'utensile
@@ -481,6 +492,17 @@ GenMachining::Preview( bool bRecalc)
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_OFFSR, GetOffsR()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_OFFSL, GetOffsL()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TOOL, m_TParams.m_sName) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_HEAD, m_TParams.m_sHead) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_EXIT, m_TParams.m_nExit) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TTYPE, m_TParams.m_nType) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TMAXMAT, m_TParams.m_dMaxMat) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TDIAM, m_TParams.m_dDiam) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TTOTDIAM, m_TParams.m_dTDiam) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TLEN, m_TParams.m_dLen) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TTOTLEN, m_TParams.m_dTLen) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TTHICK, m_TParams.m_dThick) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TCORNRAD, m_TParams.m_dCornRad) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TSIDEANG, m_TParams.m_dSideAng) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_FEED, GetFeed()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_STARTFEED, GetStartFeed()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_ENDFEED, GetEndFeed()) ;
@@ -527,8 +549,14 @@ GenMachining::Apply( bool bRecalc, bool bPostApply)
// verifico se necessario continuare nell'aggiornamento
if ( ! bRecalc && ! bToolChanged &&
( m_nStatus == MCH_ST_OK || ( ! bPostApply && m_nStatus == MCH_ST_NO_POSTAPPL))) {
// confermo i percorsi di lavorazione
m_nMills = nCurrMills ;
LOG_DBG_INFO( GetEMkLogger(), "GenMachining apply skipped : status already ok") ;
// eseguo aggiornamento assi macchina e collegamento con operazione precedente
if ( ! Update( bPostApply))
return false ;
LOG_DBG_INFO( GetEMkLogger(), "Update done") ;
// esco con successo
return true ;
}
m_nStatus = MCH_ST_TO_VERIFY ;
@@ -578,6 +606,17 @@ GenMachining::Apply( bool bRecalc, bool bPostApply)
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_OFFSR, GetOffsR()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_OFFSL, GetOffsL()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TOOL, m_TParams.m_sName) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_HEAD, m_TParams.m_sHead) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_EXIT, m_TParams.m_nExit) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TTYPE, m_TParams.m_nType) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TMAXMAT, m_TParams.m_dMaxMat) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TDIAM, m_TParams.m_dDiam) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TTOTDIAM, m_TParams.m_dTDiam) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TLEN, m_TParams.m_dLen) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TTOTLEN, m_TParams.m_dTLen) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TTHICK, m_TParams.m_dThick) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TCORNRAD, m_TParams.m_dCornRad) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TSIDEANG, m_TParams.m_dSideAng) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_FEED, GetFeed()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_STARTFEED, GetStartFeed()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_ENDFEED, GetEndFeed()) ;
@@ -611,6 +650,8 @@ GenMachining::Apply( bool bRecalc, bool bPostApply)
// dichiaro successiva da aggiornare
UpdateFollowingOperationsStatus( MCH_ST_OTH_MODIF) ;
LOG_DBG_INFO( GetEMkLogger(), "GenMachining apply done") ;
return true ;
}
@@ -628,15 +669,11 @@ GenMachining::Update( bool bPostApply)
return true ;
}
// elimino le entità CLIMB, RISE e HOME della lavorazione, potrebbero falsare i calcoli degli assi (in ogni casi vengono riaggiunte dopo)
RemoveClimbRiseHome() ;
// imposto eventuale asse bloccato da lavorazione
if ( ! m_Params.m_sBlockedAxis.empty()) {
string sAxis, sVal ;
Split( m_Params.m_sBlockedAxis, "=", true, sAxis, sVal) ;
double dVal = 0 ;
FromString( sVal, dVal) ;
m_pMchMgr->ClearRotAxisBlock() ;
m_pMchMgr->SetRotAxisBlock( sAxis, dVal) ;
}
SetBlockedRotAxis( m_Params.m_sBlockedAxis) ;
// calcolo gli assi macchina
string sHint = ExtractHint( m_Params.m_sUserNotes) ;
@@ -805,11 +842,31 @@ GenMachining::UpdateToolData( bool* pbChanged)
const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ;
if ( pTdata == nullptr)
return false ;
// verifico se sono diversi (ad esclusione del nome)
m_TParams.m_sName = pTdata->m_sName ;
bool bChanged = ! SameTool( m_TParams, *pTdata) ;
// salvo posizione TC, testa e uscita originali
string sOrigTcPos = m_TParams.m_sTcPos ;
string sOrigHead = m_TParams.m_sHead ;
int nOrigExit = m_TParams.m_nExit ;
// verifico se sono diversi (ad esclusione di nome, posizione TC, testa e uscita)
bool bChanged = ( ! SameTool( m_TParams, *pTdata, false)) ;
// aggiorno comunque i parametri
m_TParams = *pTdata ;
// se definito attrezzaggio, aggiorno i parametri che ne possono derivare
string sTcPos ; string sHead ; int nExit ;
if ( m_pMchMgr->GetCurrSetupMgr().GetToolData( m_TParams.m_sName, sTcPos, sHead, nExit)) {
if ( sOrigTcPos != sTcPos ||
sOrigHead != sHead ||
nOrigExit != nExit)
bChanged = true ;
m_TParams.m_sTcPos = sTcPos ;
m_TParams.m_sHead = sHead ;
m_TParams.m_nExit = nExit ;
}
else {
if ( sOrigTcPos != pTdata->m_sTcPos ||
sOrigHead != pTdata->m_sHead ||
nOrigExit != pTdata->m_nExit)
bChanged = true ;
}
// eventuali segnalazioni
if ( ! EqualNoCase( m_Params.m_sToolName, m_TParams.m_sName)) {
string sInfo = "Warning in GenMachining : tool name changed (" +
+6 -2
View File
@@ -67,6 +67,10 @@ struct GenMachiningData : public MachiningData
//----------------------------------------------------------------------------
inline const GenMachiningData* GetGenMachiningData( const MachiningData* pMdata)
{ return (dynamic_cast<const GenMachiningData*>( pMdata)) ; }
{ if ( pMdata == nullptr || pMdata->GetType() != MT_GENMACHINING)
return nullptr ;
return ( static_cast<const GenMachiningData*>( pMdata)) ; }
inline GenMachiningData* GetGenMachiningData( MachiningData* pMdata)
{ return (dynamic_cast<GenMachiningData*>( pMdata)) ; }
{ if ( pMdata == nullptr || pMdata->GetType() != MT_GENMACHINING)
return nullptr ;
return ( static_cast<GenMachiningData*>( pMdata)) ; }
+29 -4
View File
@@ -19,6 +19,7 @@
#include "OutputConst.h"
#include "/EgtDev/Include/EMkDllMain.h"
#include "/EgtDev/Include/EGnFileUtils.h"
#include "/EgtDev/Include/EGnGetKeyData.h"
using namespace std ;
@@ -46,12 +47,31 @@ Generator::Init( MachMgr* pMchMgr)
bool
Generator::Run( const string& sCncFile, const string& sInfo)
{
// verifico sia abilitato dalla licenza
// Controllo della licenza
unsigned int nOpt1, nOpt2 ;
int nOptExpDays ;
int nRet = GetKeyOptions( GetEMkKey(), KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV,
nOpt1, nOpt2, nOptExpDays) ;
if ( nRet == KEY_OK && ( nOpt1 & KEYOPT_EMK_NC_OFF) == 0) {
int nRet = GetEGnKeyOptions( KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV,
nOpt1, nOpt2, nOptExpDays) ;
if ( ! GetEMkNetHwKey())
int nRet = GetKeyOptions( GetEMkKey(), KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV,
nOpt1, nOpt2, nOptExpDays) ;
// Verifica della abilitazione
bool bMinTime = false ;
if ( nOptExpDays >= GetMinDay())
bMinTime = true ;
bool bCurrTime = false ;
if ( nOptExpDays >= GetCurrDay())
bCurrTime = true ;
bool bKey = false ;
if ( nRet == KEY_OK)
bKey = true ;
bool bOption = false ;
if ( ( nOpt1 & KEYOPT_EMK_NC_OFF) == 0)
bOption = true ;
// Esecuzione
if ( bMinTime && bCurrTime && bKey && bOption) {
// emetto info di log
{ string sOut = "Generator Run : " + sCncFile ;
@@ -72,6 +92,11 @@ Generator::Run( const string& sCncFile, const string& sInfo)
return bOk ;
}
// cancello l'eventuale file di uscita (e anche il file errore)
EraseFile( sCncFile) ;
string sErrFile = ChangeFileExtension( sCncFile, ERR_EXT) ;
EraseFile( sErrFile) ;
// Generazione non abilitata
m_pMchMgr->SetLastError( 1000, "NC_OFF") ;
std::string sErr = "Warning on Key (MKC/NCO)" ;
+1 -1
View File
@@ -82,7 +82,7 @@ GetRotationComponent( const Vector3d& vtDir1, double dComp, const Vector3d& vtDi
double dDenom = dT0uv * dSinG ;
double dNumer = dComp - dT0w * dCosG ;
// due angoli possibili
if ( abs( dDenom) > abs( dNumer)) {
if ( abs( dDenom) > abs( dNumer) + SIN_EPS_ANG_ZERO) {
double dDeltaAngRad = acos( dNumer / dDenom) ;
dAng1Deg = ( dOffsAngRad + dDeltaAngRad) * RADTODEG ;
dAng2Deg = ( dOffsAngRad - dDeltaAngRad) * RADTODEG ;
+3 -1
View File
@@ -19,8 +19,10 @@
//----------- Costanti per approssimazioni con polilinee o poliarchi --------
const double LIN_TOL_STD = 0.1 ;
const double LIN_TOL_MID = 0.05 ;
const double ANG_TOL_MAX_DEG = 90 ;
const double LIN_TOL_RAW = 0.5 ;
const double ANG_TOL_STD_DEG = 15 ;
const double ANG_TOL_MID_DEG = 45 ;
const double ANG_TOL_MAX_DEG = 90 ;
const double LIN_FEA_STD = 20 ;
//----------- Costante per offset salva spigoli di lama su cornici curve ----
+23 -5
View File
@@ -1,7 +1,7 @@
//----------------------------------------------------------------------------
// EgalTech 2015-2017
// EgalTech 2015-2021
//----------------------------------------------------------------------------
// File : Head.cpp Data : 11.01.17 Versione : 1.6x6
// File : Head.cpp Data : 14.10.21 Versione : 2.3j5
// Contenuto : Oggetto testa per gruppo testa di macchina.
//
//
@@ -49,8 +49,10 @@ Head::Clone( void) const
pHead->m_vsHSet = m_vsHSet ;
pHead->m_vtADir = m_vtADir ;
pHead->m_dRot1W = m_dRot1W ;
pHead->m_bMaxDeltaR2On1 = m_bMaxDeltaR2On1 ;
pHead->m_Rot2Stroke = m_Rot2Stroke ;
pHead->m_nSolCh = m_nSolCh ;
pHead->m_vsOtherColl = m_vsOtherColl ;
}
catch( ...) {
delete pHead ;
@@ -72,6 +74,7 @@ Head::Dump( string& sOut, bool bMM, const char* szNewLine) const
sOut += "ExitCount=" + ToString( m_nExitCount) + szNewLine ;
sOut += "HSet=" + ToString( m_vsHSet) + szNewLine ;
sOut += "ADir=" + ToString( m_vtADir) + szNewLine ;
sOut += "OtherColl=" + ToString( m_vsOtherColl) + szNewLine ;
return true ;
}
@@ -102,7 +105,7 @@ Head::GetGeomDB( void) const
//----------------------------------------------------------------------------
Head::Head( void)
: m_nOwnerId( GDB_ID_NULL), m_pGeomDB( nullptr), m_nType( MCH_HT_NONE), m_nExitCount( 0),
m_dRot1W( 1), m_nSolCh( MCH_SCC_NONE)
m_nSelectType( MCH_SLT_FIXEDEXITS), m_dRot1W( 1), m_bMaxDeltaR2On1( true), m_nSolCh( MCH_SCC_NONE)
{
m_Rot2Stroke.Min = - INFINITO ;
m_Rot2Stroke.Max = INFINITO ;
@@ -110,8 +113,8 @@ Head::Head( void)
//----------------------------------------------------------------------------
bool
Head::Set( const string& sName, int nType, int nExitCount, const string& sHSet, const Vector3d& vtADir,
double dRot1W, const STROKE& Rot2Stroke, int nSolCh, const STRVECTOR& vsOthColl)
Head::Set( const string& sName, int nType, int nExitCount, const string& sHSet, int nSelectType, const Vector3d& vtADir,
double dRot1W, bool bMaxDeltaR2On1, const STROKE& Rot2Stroke, int nSolCh, const STRVECTOR& vsOthColl)
{
m_sName = sName ;
m_nType = nType ;
@@ -121,8 +124,14 @@ Head::Set( const string& sName, int nType, int nExitCount, const string& sHSet,
m_nExitCount = 1 ;
m_vsHSet.clear() ;
m_vsHSet.push_back( sHSet) ;
if ( nSelectType == MCH_SLT_FIXEDEXITS || nSelectType == MCH_SLT_ONEEXIT || nSelectType == MCH_SLT_MULTIEXITS)
m_nSelectType = nSelectType ;
else
m_nSelectType = MCH_SLT_FIXEDEXITS ;
m_vtADir = vtADir ;
m_vtADir.Normalize() ;
m_dRot1W = dRot1W ;
m_bMaxDeltaR2On1 = bMaxDeltaR2On1 ;
m_Rot2Stroke = Rot2Stroke ;
if ( IsValidHeadScc( nSolCh))
m_nSolCh = nSolCh ;
@@ -142,3 +151,12 @@ Head::AddHeadToHSet( const string& sHead)
m_vsHSet.emplace_back( sHead) ;
return true ;
}
//----------------------------------------------------------------------------
bool
Head::ModifyHeadAuxDirection( const Vector3d& vtADir)
{
m_vtADir = vtADir ;
m_vtADir.Normalize() ;
return true ;
}
+11 -4
View File
@@ -1,7 +1,7 @@
//----------------------------------------------------------------------------
// EgalTech 2015-2015
// EgalTech 2015-2021
//----------------------------------------------------------------------------
// File : Head.h Data : 25.05.15 Versione : 1.6e7
// File : Head.h Data : 14.10.21 Versione : 2.3j5
// Contenuto : Dichiarazione della classe Head.
//
//
@@ -30,10 +30,11 @@ class Head : public IUserObj
public :
Head( void) ;
bool Set( const std::string& sName, int nType, int nExitCount, const std::string& sHSet,
const Vector3d& vtADir, double dRot1W, const STROKE& Rot2Stroke, int nSolCh,
bool Set( const std::string& sName, int nType, int nExitCount, const std::string& sHSet, int nSelectType,
const Vector3d& vtADir, double dRot1W, bool bMaxDeltaR2On1, const STROKE& Rot2Stroke, int nSolCh,
const STRVECTOR& vsOthColl) ;
bool AddHeadToHSet( const std::string& sHead) ;
bool ModifyHeadAuxDirection( const Vector3d& vtADir) ;
const std::string& GetName( void) const
{ return m_sName ; }
int GetType( void) const
@@ -42,10 +43,14 @@ class Head : public IUserObj
{ return m_nExitCount ; }
const STRVECTOR& GetHSet(void) const
{ return m_vsHSet ; }
int GetSelectType( void) const
{ return m_nSelectType ; }
const Vector3d& GetADir( void) const
{ return m_vtADir ; }
double GetRot1W( void) const
{ return m_dRot1W ; }
bool GetMaxDeltaR2On1( void) const
{ return m_bMaxDeltaR2On1 ; }
const STROKE& GetRot2Stroke( void) const
{ return m_Rot2Stroke ; }
int GetSolCh( void) const
@@ -60,8 +65,10 @@ class Head : public IUserObj
int m_nType ;
int m_nExitCount ;
STRVECTOR m_vsHSet ;
int m_nSelectType ;
Vector3d m_vtADir ;
double m_dRot1W ;
bool m_bMaxDeltaR2On1 ;
STROKE m_Rot2Stroke ;
int m_nSolCh ;
STRVECTOR m_vsOtherColl ;
+7
View File
@@ -31,6 +31,8 @@ const std::string MACH_FIXT_GROUP = "Fixt" ;
const std::string MACH_SETUP_GROUP = "Setup" ;
// Gruppo dei grezzi in una macchinata
const std::string MACH_RAW_GROUP = "Raws" ;
// Gruppo dei collegamenti per waterjet in una macchinata
const std::string MACH_BRIDGES_GROUP = "Bridges" ;
// Gruppo delle operazioni in una macchinata
const std::string MACH_OPER_GROUP = "Opers" ;
// Chiave per info fase di appartenenza di una fixture
@@ -45,6 +47,10 @@ const std::string MACH_RAW_SOLID = "RawSolid" ;
const std::string MACH_RAW_CENTER = "RawCenter" ;
// Nome del contorno esterno del grezzo
const std::string MACH_RAW_OUTLINE = "RawOutline" ;
// Nome della regione superiore del grezzo
const std::string MACH_RAW_UP_REG = "RawUpReg" ;
// Nome della regione inferiore del grezzo
const std::string MACH_RAW_DOWN_REG = "RawDwnReg" ;
// Nome del kerf del grezzo
const std::string MACH_RAW_KERF = "Kerf" ;
@@ -129,6 +135,7 @@ const double LIO_ELEV_TOL = 2.0 ;
//----------------------------------------------------------------------------
// Per FlatParts (vedi Nesting di EgtExecutor)
const std::string NST_EXT_LAYER = "OutLoop" ;
const std::string NST_PARTREG_LAYER = "Region" ;
//----------------------------------------------------------------------------
// Minima componente zeta di versore utensile per lavorazione da sopra (-45deg)
+38 -11
View File
@@ -1,7 +1,7 @@
//----------------------------------------------------------------------------
// EgalTech 2015-2021
// EgalTech 2015-2024
//----------------------------------------------------------------------------
// File : MachMgr.h Data : 24.05.21 Versione : 2.3e3
// File : MachMgr.h Data : 02.04.24 Versione : 2.6d1
// Contenuto : Dichiarazione della classe MachMgr.
//
//
@@ -10,6 +10,11 @@
// 16.05.19 DS Aggiunto parametro sToolMakersDir a Init.
// 17.08.20 DS Aggiunte GetAxisMin e GetAxisMax.
// 17.03.21 DS Aggiunte funzioni per import/export utensili.
// 21.09.22 DS Aggiunta GetAxisOffset.
// 25.08.23 DS Aggiunta CopyMachGroup.
// 28.10.23 DS Aggiunte GetClEntAxesVal e GetToolSetupPosInCurrSetup.
// 30.03.24 DS Aggiunte GetAllAxesNames e GetCalcTable.
// 02.04.24 DS Aggiunta GetClEntAxesMask.
//
//----------------------------------------------------------------------------
@@ -51,14 +56,15 @@ struct AxisBlock {
//----------------------------------------------------------------------------
struct MachineData {
std::string sName ;
std::string sName ;
std::string sDir ;
Machine* pMachine ;
ToolsMgr* pTsMgr ;
MachiningsMgr* pMsMgr ;
MachineData( void)
: pMachine( nullptr), pTsMgr( nullptr), pMsMgr( nullptr) {}
MachineData( const std::string& sN, Machine* pM, ToolsMgr* pTM, MachiningsMgr* pMM)
{ sName = sN ; pMachine = pM ; pTsMgr = pTM ; pMsMgr = pMM ; }
MachineData( const std::string& sN, const std::string& sD, Machine* pM, ToolsMgr* pTM, MachiningsMgr* pMM)
{ sName = sN ; sDir = sD ; pMachine = pM ; pTsMgr = pTM ; pMsMgr = pMM ; }
} ;
//----------------------------------------------------------------------------
@@ -80,6 +86,7 @@ class MachMgr : public IMachMgr
std::string GetWarningString( int nInd) const override
{ if ( nInd < 0 || nInd >= int( m_Warnings.size())) return "" ; return m_Warnings[ nInd].second ; }
// Machines
bool GetMachines( STRVECTOR& vsMachineNames, STRVECTOR& vsMachineDirs) const override ;
bool SetCurrMachine( const std::string& sMachineName) override ;
bool GetCurrMachineName( std::string& sMachineName) const override ;
bool GetCurrMachineDir( std::string& sMachineDir) const override ;
@@ -92,7 +99,9 @@ class MachMgr : public IMachMgr
int GetPrevMachGroup( int nId) const override ;
bool GetMachGroupNewName( std::string& sName) const override ;
int AddMachGroup( const std::string& sName, const std::string& sMachineName) override ;
int CopyMachGroup( const std::string& sSouName, const std::string& sName) override ;
bool RemoveMachGroup( int nId) override ;
bool ChangeMachGroupName( int nId, const std::string& sNewName) override ;
std::string GetMachGroupName( int nId) const override ;
std::string GetMachGroupMachineName( int nId) const override ;
int GetMachGroupId( const std::string& sName) const override ;
@@ -144,6 +153,7 @@ class MachMgr : public IMachMgr
bool GetTableRef( int nInd, Point3d& ptPos) const override ;
bool GetTableArea( int nInd, BBox3d& b3Area) const override ;
bool GetTableAreaOffset( int nInd, BBox3d& b3AreaOffs) const override ;
bool ChangeTable( const std::string& sTable, bool bUpdateDisp) override ;
bool ShowOnlyTable( bool bVal) override ;
int AddFixture( const std::string& sName, const Point3d& ptPos, double dAngRotDeg, double dMov) override ;
bool KeepFixture( int nFxtId, int nSouPhase) override ;
@@ -199,6 +209,7 @@ class MachMgr : public IMachMgr
bool ImportSetup( const std::string& sName) override ;
bool VerifyCurrSetup( STRVECTOR& vsErrors) override ;
bool FindToolInCurrSetup( const std::string& sTool) override ;
bool GetToolSetupPosInCurrSetup( const std::string& sTool, std::string& sTcPos) override ;
bool GetToolsInCurrSetupPos( const std::string& sTcPos, STRVECTOR& vsTools) override ;
bool UpdateCurrSetup( void) override ;
bool EraseCurrSetup( void) override ;
@@ -230,6 +241,10 @@ class MachMgr : public IMachMgr
bool MdbReload( void) override ;
bool MdbSave( void) const override ;
bool MdbGetMachiningDir( std::string& sMchDir) const override ;
bool MdbExport( const STRVECTOR& vsMachiningsNames, const std::string& sOutFile) const override ;
bool MdbToBeImported( const std::string& sFile, STRVECTOR& vsMachiningsNames, INTVECTOR& vMachiningsTypes) const override ;
bool MdbImport( const std::string& sFile, const STRVECTOR& vsMachiningsToImport, const STRVECTOR& vsMachiningsNames,
STRVECTOR& vsImported) override ;
// Operations : general
int GetOperationCount( void) const override ;
int GetFirstOperation( void) const override ;
@@ -293,8 +308,10 @@ class MachMgr : public IMachMgr
bool GetMachiningEndPoint( Point3d& ptEnd) const override ;
// CL Entities Interrogations
bool GetClEntMove( int nEntId, int& nMove) const override ;
bool GetClEntFlag( int nEntId, int& nFlag) const override ;
bool GetClEntFlag( int nEntId, int& nFlag, int& nFlag2) const override ;
bool GetClEntIndex( int nEntId, int& nIndex) const override ;
bool GetClEntAxesMask( int nEntId, int& nMask) const override ;
bool GetClEntAxesVal( int nEntId, DBLVECTOR& vAxes) const override ;
// Simulation
bool SimInit( void) override ;
bool SimStart( bool bFirst) override ;
@@ -313,8 +330,10 @@ 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 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 ;
@@ -346,6 +365,7 @@ class MachMgr : public IMachMgr
bool GetAxisToken( const std::string& sAxis, std::string& sToken) const override ;
bool GetAxisType( const std::string& sAxis, bool& bLinear) const override ;
bool GetAxisInvert( const std::string& sAxis, bool& bInvert) const override ;
bool GetAxisOffset( const std::string& sAxis, double& dOffset) const override ;
bool SetAxisPos( const std::string& sAxis, double dVal, double* pdNewVal = nullptr) override ;
bool GetAxisPos( const std::string& sAxis, double& dVal) const override ;
bool GetAxisMin( const std::string& sAxis, double& dMin) const override ;
@@ -354,6 +374,7 @@ class MachMgr : public IMachMgr
bool ResetAxisPos( const std::string& sAxis) override ;
bool ResetAllAxesPos( void) override ;
bool GetAllTablesNames( STRVECTOR& vNames) const override ;
bool GetAllAxesNames( STRVECTOR& vNames) const override ;
bool GetAllHeadsNames( STRVECTOR& vNames) const override ;
bool GetAllTcPosNames( STRVECTOR& vNames) const override ;
bool LoadTool( const std::string& sHead, int nExit, const std::string& sTool) override ;
@@ -421,9 +442,11 @@ class MachMgr : public IMachMgr
// MachineCalc
int GetCurrLinAxes( void) const ;
int GetCurrRotAxes( void) const ;
bool GetAllCurrAxesName( STRVECTOR& vAxName) const ;
bool GetAllCurrAxesHomePos( DBLVECTOR& vAxHomeVal) const ;
bool GetCurrAxisHomePos( int nInd, double& dHome) const ;
const Frame3d& GetCurrLinAxesFrame( void) const ;
bool GetCurrIsCenter( void) const ;
bool GetCurrIsRobot( void) const ;
bool ApplyRotAxisBlock( void) ;
void ClearRotAxisBlock( void)
{ m_vAxisBlock.clear() ; }
@@ -432,6 +455,7 @@ class MachMgr : public IMachMgr
int GetCalcHead( void) const ;
int GetCalcExit( void) const ;
double GetCalcRot1W( void) const ;
bool GetCalcMaxDeltaR2OnFirst( void) const ;
bool GetCalcPartDirFromAngles( const Vector3d& vtPart, const DBLVECTOR& vAng, Vector3d& vtDir) const ;
bool SetCalcSolCh( int nScc, bool bExact) ;
bool VerifyAngleOutstroke( int nInd, double dAng) const ;
@@ -441,9 +465,11 @@ class MachMgr : public IMachMgr
bool GetOperationNewName( std::string& sName) const ;
const ToolData* GetMachiningToolData( void) const ;
// Simulation
bool SimAddCollisionObj( int nInd, int nFrameId, int nType, const Vector3d& vtMove, double dPar1, double dPar2, double dPar3) ;
bool SimAddCollisionObj( int nInd, bool bToolOn, int nFrameId, int nType, const Vector3d& vtMove, double dPar1, double dPar2, double dPar3) ;
bool SimExecCollisionCheck( int& nCdInd, int& nObjInd, int nMoveType) ;
bool SimOnCollision( int nCdInd, int nObjInd, int& nErr) ;
bool SimSetToolForVmill( const std::string& sTool, const std::string& sHead, int nExit, const INTVECTOR& vVmill, bool bFirst) ;
int SimMoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt) ;
// Machine
bool GetHeadAbove( const std::string& sHead) const ;
double GetDeltaSafeZ( const std::string& sHead) const ;
@@ -473,6 +499,7 @@ class MachMgr : public IMachMgr
// RawParts
int AddRawPart( int nCrvId, double dOverMat, double dZmin, double dHeight, Color cCol) ;
int AddRawPart( int nSurfId, Color cCol) ;
int AddRawPart( int nSurfUpId, int nSurfDownId, double dHeight, Color cCol) ;
bool SetRawPartCenter( int nRawId) ;
bool ResetRawPartCenter( int nRawId) ;
// Parts
@@ -483,11 +510,11 @@ class MachMgr : public IMachMgr
bool ShowRootParts( bool bShow) ;
// Tools DataBase
bool UpdateAllToolDraws( void) const ;
bool UpdateToolDraw( const EgtUUID& UuidTool) const ;
bool UpdateToolDraw( const EgtUUID& UuidTool, double& dTHoldBase, double& dTHoldLen, double& dTHoldDiam) const ;
int UpdateStandardToolDraw( const ToolData* pTdata, int nGenCtx, int nToolCtx, bool bToSave) const ;
int UpdateCustomToolDraw( const ToolData* pTdata, int nGenCtx, int nToolCtx, bool bToSave) const ;
std::string GetToolMakerKeyFromType( int nType) const ;
std::string GetToolHolderPath( const std::string& sHeadName, int nExit, int nType) const ;
std::string GetToolHolderPath( const std::string& sHeadName, int nExit, int nType, const std::string& sUserNotes) const ;
// Operations : general
bool InitOperation( int nId) ;
// Operations : dispositions
@@ -500,7 +527,7 @@ class MachMgr : public IMachMgr
private :
int m_nContextId ; // indice contesto corrente (1-based)
IGeomDB* m_pGeomDB ; // puntatore al DB geometrico del contesto corrente
std::string m_sMachinesDir ; // direttorio delle macchine
STRVECTOR m_vMachinesBaseDir ; // direttori di base delle macchine (ordine molto importante)
std::string m_sToolMakersDir ; // direttorio dei generatori di disegni utensili standard
std::string m_sLuaLibsDir ; // direttorio delle librerie lua
std::string m_sLuaLastRequire ; // nome ultima libreria caricata
+16 -4
View File
@@ -18,7 +18,7 @@
#include "DllMain.h"
#include "/EgtDev/Include/EMkDllMain.h"
#include "/EgtDev/Include/EGnStringUtils.h"
#include "/EgtDev/Include/EgnFileUtils.h"
#include "/EgtDev/Include/EGnFileUtils.h"
#include "/EgtDev/Include/EgtKeyCodes.h"
#include "/EgtDev/Include/SELkKeyProc.h"
#include <new>
@@ -30,7 +30,7 @@ IMachMgr*
CreateMachMgr( void)
{
// verifico la chiave e le opzioni
if ( ! TestKeyForEMk( GetEMkKey(), 0, GetEMkLogger()))
if ( ! GetEMkNetHwKey() && ! TestKeyForEMk( GetEMkKey(), 0, GetEMkLogger()))
return nullptr ;
// creo il MachMgr
return static_cast<IMachMgr*> ( new(nothrow) MachMgr) ;
@@ -94,7 +94,19 @@ MachMgr::Init( const string& sMachinesDir, const string& sToolMakersDir, IGeomDB
{
m_nContextId = nContextId ;
m_pGeomDB = pGeomDB ;
m_sMachinesDir = sMachinesDir ;
STRVECTOR vsDir ;
Tokenize( sMachinesDir, "|", vsDir) ;
for ( int i = 0 ; i < int( vsDir.size()) ; ++ i) {
string sDir = vsDir[i] ;
TrimRight( sDir, " \\") ;
if ( ExistsDirectory( vsDir[i]) &&
find_if( m_vMachinesBaseDir.begin(), m_vMachinesBaseDir.end(),
[ sDir]( const string& sItem)
{ return ( EqualNoCase( sDir, sItem)) ; }) == m_vMachinesBaseDir.end()) {
m_vMachinesBaseDir.emplace_back( sDir) ;
}
}
m_sToolMakersDir = sToolMakersDir ;
m_sLuaLibsDir = sLuaLibsDir ;
m_sLuaLastRequire = sLuaLastRequire ;
@@ -103,7 +115,7 @@ MachMgr::Init( const string& sMachinesDir, const string& sToolMakersDir, IGeomDB
m_nCurrMGrpId = GDB_ID_NULL ;
m_nCurrMch = - 1 ;
m_stuMgr.Reset() ;
return ( m_nContextId > 0 && m_pGeomDB != nullptr && ExistsDirectory( m_sMachinesDir)) ;
return ( m_nContextId > 0 && m_pGeomDB != nullptr && ! m_vMachinesBaseDir.empty()) ;
}
//----------------------------------------------------------------------------
+42 -4
View File
@@ -1,7 +1,7 @@
//----------------------------------------------------------------------------
// EgalTech 2019-2019
// EgalTech 2019-2023
//----------------------------------------------------------------------------
// File : MachMgrClEntities.cpp Data : 15.10.19 Versione : 2.1j4
// File : MachMgrClEntities.cpp Data : 27.10.23 Versione : 2.5j4
// Contenuto : Implementazione interrogazione entità CL della classe MachMgr.
//
//
@@ -39,10 +39,11 @@ MachMgr::GetClEntMove( int nEntId, int& nMove) const
//----------------------------------------------------------------------------
bool
MachMgr::GetClEntFlag( int nEntId, int& nFlag) const
MachMgr::GetClEntFlag( int nEntId, int& nFlag, int& nFlag2) const
{
// default
nFlag = 0 ;
nFlag2 = 0 ;
// verifico validita GeomDB
if ( m_pGeomDB == nullptr)
return false ;
@@ -50,8 +51,9 @@ MachMgr::GetClEntFlag( int nEntId, int& nFlag) const
const CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nEntId)) ;
if ( pCamData == nullptr)
return false ;
// recupero il flag
// recupero i flag
nFlag = pCamData->GetFlag() ;
nFlag2 = pCamData->GetFlag2() ;
return true ;
}
@@ -72,3 +74,39 @@ MachMgr::GetClEntIndex( int nEntId, int& nIndex) const
nIndex = pCamData->GetIndex() ;
return true ;
}
//----------------------------------------------------------------------------
bool
MachMgr::GetClEntAxesMask( int nEntId, int& nMask) const
{
// default
nMask = 0 ;
// verifico validita GeomDB
if ( m_pGeomDB == nullptr)
return false ;
// recupero l'oggetto CamData
const CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nEntId)) ;
if ( pCamData == nullptr)
return false ;
// recupero il tipo di movimento
nMask = pCamData->GetAxesMask() ;
return true ;
}
//----------------------------------------------------------------------------
bool
MachMgr::GetClEntAxesVal( int nEntId, DBLVECTOR& vAxes) const
{
// default
vAxes.clear() ;
// verifico validita GeomDB
if ( m_pGeomDB == nullptr)
return false ;
// recupero l'oggetto CamData
const CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nEntId)) ;
if ( pCamData == nullptr)
return false ;
// recupero i valori degli assi
vAxes = pCamData->GetAxesVal() ;
return true ;
}
+66 -5
View File
@@ -1,7 +1,7 @@
//----------------------------------------------------------------------------
// EgalTech 2015-2015
// EgalTech 2015-2024
//----------------------------------------------------------------------------
// File : MachMgrDBMachinings.cpp Data : 11.11.15 Versione : 1.6k5
// File : MachMgrDBMachinings.cpp Data : 29.03.24 Versione : 2.6d1
// Contenuto : Implementazione gestione DB lavorazioni della classe MachMgr.
//
//
@@ -15,6 +15,7 @@
#include "stdafx.h"
#include "DllMain.h"
#include "MachMgr.h"
#include "/EgtDev/Include/EGnFileUtils.h"
using namespace std ;
@@ -303,6 +304,8 @@ MachMgr::MdbSetGeneralParam( int nType, double dVal)
return pMsMgr->SetSafeAggrBottZ( dVal) ;
case MGP_MAXDEPTHSAFE :
return pMsMgr->SetMaxDepthSafe( dVal) ;
case MGP_APPROXLINTOL :
return pMsMgr->SetApproxLinTol( dVal) ;
}
return false ;
}
@@ -378,6 +381,9 @@ MachMgr::MdbGetGeneralParam( int nType, double& dVal) const
case MGP_MAXDEPTHSAFE :
dVal = pMsMgr->GetMaxDepthSafe() ;
return true ;
case MGP_APPROXLINTOL :
dVal = pMsMgr->GetApproxLinTol() ;
return true ;
}
return false ;
}
@@ -410,9 +416,64 @@ MachMgr::MdbSave( void) const
bool
MachMgr::MdbGetMachiningDir( string& sMchDir) const
{
string sMachineName ;
if ( ! GetCurrMachineName( sMachineName))
string sMachineDir, sMachineName ;
if ( ! GetCurrMachineDir( sMachineDir) || ! GetCurrMachineName( sMachineName))
return false ;
sMchDir = m_sMachinesDir + "\\" + sMachineName + "\\" + MACHININGS_DIR ;
sMchDir = sMachineDir + "\\" + MACHININGS_DIR ;
return true ;
}
//----------------------------------------------------------------------------
bool
MachMgr::MdbExport( const STRVECTOR& vsMachiningsNames, const string& sOutFile) const
{
if ( vsMachiningsNames.empty())
return true ;
// recupero il gestore di lavorazioni della macchina corrente
MachiningsMgr* pMsMgr = GetCurrMachiningsMgr() ;
if ( pMsMgr == nullptr)
return false ;
return pMsMgr->Export( vsMachiningsNames, sOutFile) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::MdbToBeImported( const string& sFile, STRVECTOR& vsMachiningsNames, INTVECTOR& vMachiningsTypes) const
{
if ( ! ExistsFile( sFile)) {
LOG_ERROR( GetEMkLogger(), "MdbToBeImported Error : File does not exist") ;
return false ;
}
// recupero il gestore di lavorazioni della macchina corrente
MachiningsMgr* pMsMgr = GetCurrMachiningsMgr() ;
if ( pMsMgr == nullptr)
return false ;
return pMsMgr->ToBeImported( sFile, vsMachiningsNames, vMachiningsTypes) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::MdbImport( const string& sFile, const STRVECTOR& vsMachiningsToImport, const STRVECTOR& vsMachiningsNames, STRVECTOR& vsImported)
{
if ( vsMachiningsToImport.empty())
return true ;
if ( ! ExistsFile( sFile)) {
LOG_ERROR( GetEMkLogger(), "MdbImport Error : File does not exist") ;
return false ;
}
if ( vsMachiningsToImport.size() != vsMachiningsNames.size())
return false ;
// recupero il gestore di lavorazioni della macchina corrente
MachiningsMgr* pMsMgr = GetCurrMachiningsMgr() ;
if ( pMsMgr == nullptr)
return false ;
return pMsMgr->Import( sFile, vsMachiningsToImport, vsMachiningsNames, vsImported) ;
}
+59 -23
View File
@@ -481,10 +481,10 @@ MachMgr::TdbSave( void) const
bool
MachMgr::TdbGetToolDir( string& sToolDir) const
{
string sMachineName ;
if ( ! GetCurrMachineName( sMachineName))
string sMachineDir, sMachineName ;
if ( ! GetCurrMachineDir( sMachineDir) || ! GetCurrMachineName( sMachineName))
return false ;
sToolDir = m_sMachinesDir + "\\" + sMachineName + "\\" + TOOLS_DIR ;
sToolDir = sMachineDir + "\\" + TOOLS_DIR ;
return true ;
}
@@ -492,10 +492,10 @@ MachMgr::TdbGetToolDir( string& sToolDir) const
bool
MachMgr::TdbGetToolHolderDir( string& sToolHolderDir) const
{
string sMachineName ;
if ( ! GetCurrMachineName( sMachineName))
string sMachineDir, sMachineName ;
if ( ! GetCurrMachineDir( sMachineDir) || ! GetCurrMachineName( sMachineName))
return false ;
sToolHolderDir = m_sMachinesDir + "\\" + sMachineName + "\\" + TOOLHOLDERS_DIR ;
sToolHolderDir = sMachineDir + "\\" + TOOLHOLDERS_DIR ;
return true ;
}
@@ -526,9 +526,15 @@ MachMgr::UpdateAllToolDraws( void) const
// verifico se non esiste il disegno associato
string sDraw ; pTdata->GetParam( TPA_DRAW, sDraw) ;
bool bNoDraw = ( ! sDraw.empty() && ! ExistsFile( sToolDir + "\\" + sDraw)) ;
// se modificato o senza disegno, ne lancio la creazione
if ( bModif || bNoDraw)
UpdateToolDraw( UuidTool) ;
// se modificato o senza disegno, ne lancio la creazione e aggiorno dati portautensile
if ( bModif || bNoDraw) {
double dTHoldBase = 0, dTHoldLen = 0, dTHoldDiam = 0 ;
UpdateToolDraw( UuidTool, dTHoldBase, dTHoldLen, dTHoldDiam) ;
pTsMgr->SetCurrTool( sName) ;
pTsMgr->UpdateCurrToolHolderData( dTHoldBase, dTHoldLen, dTHoldDiam) ;
pTsMgr->SaveCurrTool() ;
pTsMgr->SetCurrTool( "") ;
}
// passo al successivo
bNext = pTsMgr->GetNextTool( TF_ALL, sName, nType) ;
}
@@ -542,7 +548,7 @@ MachMgr::UpdateAllToolDraws( void) const
//----------------------------------------------------------------------------
bool
MachMgr::UpdateToolDraw( const EgtUUID& UuidTool) const
MachMgr::UpdateToolDraw( const EgtUUID& UuidTool, double& dTHoldBase, double& dTHoldLen, double& dTHoldDiam) const
{
// recupero il gestore di utensili della macchina corrente
ToolsMgr* pTsMgr = GetCurrToolsMgr() ;
@@ -581,6 +587,14 @@ MachMgr::UpdateToolDraw( const EgtUUID& UuidTool) const
// Salvo il disegno
ExeSetCurrentContext( nToolCtx) ;
bOk = bOk && ExeSaveFile( sDrawPath, GDB_SV_BIN) ;
// Recupero i dati del portautensile
int nToolId = ExeGetFirstGroupInGroup( GDB_ID_ROOT) ;
if ( ! ExeGetInfo( nToolId, TTH_BASE, dTHoldBase))
dTHoldBase = 0 ;
if ( ! ExeGetInfo( nToolId, TTH_LEN, dTHoldLen))
dTHoldLen = 0 ;
if ( ! ExeGetInfo( nToolId, TTH_DIAM, dTHoldDiam))
dTHoldDiam = 0 ;
// Ripristino il contesto originale
ExeSetCurrentContext( nGenCtx) ;
ExeDeleteContext( nToolCtx) ;
@@ -617,6 +631,8 @@ MachMgr::UpdateStandardToolDraw( const ToolData* pTdata, int nGenCtx, int nToolC
pTdata->GetParam( TPA_TOTDIAM, dTotDiam) ;
double dDist = 0 ;
pTdata->GetParam( TPA_DIST, dDist) ;
double dStemDiam = 0 ;
pTdata->GetParam( TPA_STEMDIAM, dStemDiam) ;
double dMaxMat = 0 ;
pTdata->GetParam( TPA_MAXMAT, dMaxMat) ;
double dCornRad = 0 ;
@@ -625,10 +641,18 @@ MachMgr::UpdateStandardToolDraw( const ToolData* pTdata, int nGenCtx, int nToolC
pTdata->GetParam( TPA_SIDEANG, dSideAng) ;
double dThick = 0 ;
pTdata->GetParam( TPA_THICK, dThick) ;
double dCore = 0 ;
pTdata->GetParam( TPA_CORE, dCore) ;
if ( dCore < EPS_SMALL && ( nType == TT_SAW_STD || nType == TT_SAW_FLAT))
dCore = ( dLen >= dThick ? dThick - 1 : 2 * dLen - dThick) ;
double dSpeed = 0 ;
pTdata->GetParam( TPA_SPEED, dSpeed) ;
double dTipFeed = 0 ;
pTdata->GetParam( TPA_TIPFEED, dTipFeed) ;
string sUserNotes ;
pTdata->GetParam( TPA_USERNOTES, sUserNotes) ;
// Recupero la path dell'eventuale portautensile
string sThPath = GetToolHolderPath( sHeadName, nExit, nType) ;
string sThPath = GetToolHolderPath( sHeadName, nExit, nType, sUserNotes) ;
// Carico generatore disegno utensile
string sMaker = GetPrivateProfileStringUtf8( TOOLS_SEC.c_str(), GetToolMakerKeyFromType( nType).c_str(), "", sMachIni.c_str()) ;
if ( sMaker.empty())
@@ -642,6 +666,7 @@ MachMgr::UpdateStandardToolDraw( const ToolData* pTdata, int nGenCtx, int nToolC
// Assegno i dati utensile
bool bOk = ExeLuaSetGlobIntVar( "TOOL.TYPE", nType) ;
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.SPEED", dSpeed) ;
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.TIPFEED", dTipFeed) ;
switch ( nType) {
case TT_DRILL_STD :
case TT_DRILL_LONG :
@@ -657,7 +682,7 @@ MachMgr::UpdateStandardToolDraw( const ToolData* pTdata, int nGenCtx, int nToolC
bOk = bOk && ExeLuaSetGlobStringVar( "TOOL.TOOLHOLDER", sThPath) ;
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.LEN", dLen) ;
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.DIAM", dDiam) ;
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.CORE", ( dLen >= dThick ? dThick - 1 : 2 * dLen - dThick)) ;
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.CORE", dCore) ;
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.THICK", dThick) ;
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.MAXMAT", dMaxMat) ;
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.CORNRAD", dCornRad) ;
@@ -671,6 +696,7 @@ MachMgr::UpdateStandardToolDraw( const ToolData* pTdata, int nGenCtx, int nToolC
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.LEN", dLen) ;
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.TOTDIAM", dTotDiam) ;
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.DIAM", dDiam) ;
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.STEMDIAM", dStemDiam) ;
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.MAXMAT", dMaxMat) ;
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.HEIGHT", dThick) ;
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.SIDEANG", dSideAng) ;
@@ -695,7 +721,7 @@ MachMgr::UpdateStandardToolDraw( const ToolData* pTdata, int nGenCtx, int nToolC
if ( ! ExeLuaGetGlobIntVar( "TOOL.ERR", &nErr) || nErr != 0)
return nErr ;
// Se per salvataggio
if ( bOk && bToSave) {
if ( bOk && bToSave) {
// Nascondo layer ausiliario
int nAuxId = ExeGetFirstNameInGroup( ExeGetFirstGroupInGroup( GDB_ID_ROOT), "AUX") ;
ExeSetStatus( { nAuxId}, GDB_ST_OFF) ;
@@ -705,6 +731,16 @@ MachMgr::UpdateStandardToolDraw( const ToolData* pTdata, int nGenCtx, int nToolC
ExeRotate( { nPartId}, ORIG, Z_AX, -90, RTY_GLOB) ;
}
}
// altrimenti per visualizzazione
else if ( bOk) {
// Nascondo oggetto/i Carter
int nSolidId = ExeGetFirstNameInGroup( ExeGetFirstGroupInGroup( GDB_ID_ROOT), "SOLID") ;
int nCarterId = ExeGetFirstNameInGroup( nSolidId, "Carter") ;
while ( nCarterId != GDB_ID_NULL) {
ExeSetStatus( { nCarterId}, GDB_ST_OFF) ;
nCarterId = ExeGetNextName( nCarterId, "Carter") ;
}
}
return ( bOk ? 0 : TD_INT_ERR) ;
}
@@ -724,9 +760,8 @@ MachMgr::UpdateCustomToolDraw( const ToolData* pTdata, int nGenCtx, int nToolCtx
pTdata->GetParam( TPA_DIAM, dDiam) ;
double dDist = 0 ;
pTdata->GetParam( TPA_DIST, dDist) ;
// Non più limitato alle sole frese
//if ( nType != TT_MILL_STD && nType != TT_MILL_NOTIP && nType != TT_MILL_POLISHING)
// return TD_INT_ERR ;
double dSpeed = 0 ;
pTdata->GetParam( TPA_SPEED, dSpeed) ;
// Imposto contesto per il disegno utensile
if ( ! ExeSetCurrentContext( nToolCtx))
return TD_INT_ERR ;
@@ -736,6 +771,7 @@ MachMgr::UpdateCustomToolDraw( const ToolData* pTdata, int nGenCtx, int nToolCtx
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.LEN", dLen) ;
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.DIAM", dDiam) ;
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.DIST", dDist) ;
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.SPEED", dSpeed) ;
// Eseguo aggiornamento utensile
bOk = bOk && ExeLuaCallFunction( "AdjustCustomTool") ;
// Recupero errore
@@ -774,7 +810,7 @@ MachMgr::GetToolMakerKeyFromType( int nType) const
//----------------------------------------------------------------------------
string
MachMgr::GetToolHolderPath( const string& sHeadName, int nExit, int nType) const
MachMgr::GetToolHolderPath( const string& sHeadName, int nExit, int nType, const std::string& sUserNotes) const
{
// Verifiche su testa e uscita
if ( sHeadName.empty() || nExit == 0)
@@ -821,9 +857,9 @@ MachMgr::GetToolHolderPath( const string& sHeadName, int nExit, int nType) const
sToolHolder = GetPrivateProfileStringUtf8( TOOLS_SEC.c_str(), MILLHOLDER_KEY.c_str(), "", sMachIni.c_str()) ;
}
// Verifico se sovrascritto da nota dell'utensile
string sNotes, sVal ;
if ( TdbGetCurrToolParam( TPA_USERNOTES, sNotes) &&
GetValInNotes( sNotes, "TH", sVal) &&
string sVal ;
if ( ! sUserNotes.empty() &&
GetValInNotes( sUserNotes, "TH", sVal) &&
ExistsFile( sToolHolderDir + "\\" + sVal))
sToolHolder = sVal ;
// Se non trovato ancora, esco
@@ -840,7 +876,7 @@ MachMgr::TdbExport( const STRVECTOR& vsToolsNames, const string& sOutFile) const
if ( vsToolsNames.empty())
return true ;
// recupero il gestore di utensili della macchina corrente
// recupero il gestore di utensili della macchina corrente
ToolsMgr* pTsMgr = GetCurrToolsMgr() ;
if ( pTsMgr == nullptr)
return false ;
@@ -875,7 +911,7 @@ MachMgr::TdbImport( const string& sFile, const STRVECTOR& vsToolsToImport, const
if ( vsToolsToImport.empty())
return true ;
if ( ! ExistsFile( sFile)){
if ( ! ExistsFile( sFile)) {
LOG_ERROR( GetEMkLogger(), "TdbImport Error : File does not exist") ;
return false ;
}
@@ -884,7 +920,7 @@ MachMgr::TdbImport( const string& sFile, const STRVECTOR& vsToolsToImport, const
return false ;
ToolsMgr* pTsMgr = GetCurrToolsMgr() ;
if ( pTsMgr == nullptr){
if ( pTsMgr == nullptr) {
LOG_ERROR( GetEMkLogger(), "TdbImport Error : no current ToolsMgr") ;
return false ;
}
+24 -7
View File
@@ -44,6 +44,26 @@ MachMgr::GetTable( string& sTable) const
return pDisp->GetTable( sTable) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::ChangeTable( const string& sTable, bool bUpdateDisp)
{
bool bOk = true ;
// imposto la tavola per tutte le disposizioni ( e il calcolo)
for ( int nPhase = 1 ; nPhase <= GetPhaseCount() && bOk ; ++ nPhase) {
Disposition* pDisp = ::GetDisposition( m_pGeomDB->GetUserObj( GetPhaseDisposition( nPhase))) ;
if ( pDisp != nullptr && pDisp->Init( this) && pDisp->SetTable( sTable) && pDisp->ResetAreaOffset()) {
if ( bUpdateDisp)
bOk = SetCurrPhase( nPhase, true) && bOk ;
}
else
bOk = false ;
}
SetCurrPhase( 1) ;
return bOk ;
}
//----------------------------------------------------------------------------
bool
MachMgr::GetTableRef( int nInd, Point3d& ptPos) const
@@ -273,9 +293,8 @@ MachMgr::GetFixturePhases( int nFxtId, INTVECTOR& vPhase) const
// verifica validità bloccaggio
if ( ! VerifyFixtureInGroup( nFxtId))
return false ;
// recupero le fasi in cui è presente la fixture (se manca è fase 1)
if ( ! m_pGeomDB->GetInfo( nFxtId, MACH_FXT_PHASE, vPhase) || vPhase.empty())
vPhase.emplace_back( 1) ;
// recupero le fasi in cui è presente la fixture (se manca è non usata)
m_pGeomDB->GetInfo( nFxtId, MACH_FXT_PHASE, vPhase) ;
return true ;
}
@@ -293,8 +312,7 @@ MachMgr::GetUnusedFixture( const string& sName, int nPhase) const
while ( nId != GDB_ID_NULL) {
// recupero le fasi in cui è già usato
INTVECTOR vPhase ;
if ( ! m_pGeomDB->GetInfo( nId, MACH_FXT_PHASE, vPhase) || vPhase.empty())
vPhase.emplace_back( 1) ;
m_pGeomDB->GetInfo( nId, MACH_FXT_PHASE, vPhase) ;
// se non c'è la fase corrente, è libero
if ( find( vPhase.begin(), vPhase.end(), nPhase) == vPhase.end())
return nId ;
@@ -317,8 +335,7 @@ MachMgr::IsUnusedFixture( int nId, int nPhase) const
// Verifico non sia usata nella fase indicata
// recupero le fasi in cui è già usato
INTVECTOR vPhase ;
if ( ! m_pGeomDB->GetInfo( nId, MACH_FXT_PHASE, vPhase) || vPhase.empty())
vPhase.emplace_back( 1) ;
m_pGeomDB->GetInfo( nId, MACH_FXT_PHASE, vPhase) ;
// se non c'è la fase corrente, è libero
if ( find( vPhase.begin(), vPhase.end(), nPhase) == vPhase.end())
return true ;
+80 -21
View File
@@ -182,6 +182,52 @@ MachMgr::AddMachGroup( const string& sName, const string& sMachineName)
return nNewId ;
}
//----------------------------------------------------------------------------
int
MachMgr::CopyMachGroup( const string& sSouName, const string& sName)
{
// recupero il gruppo sorgente
int nSouMGrpId = GetMachGroupId( sSouName) ;
if ( nSouMGrpId == GDB_ID_NULL)
return GDB_ID_NULL ;
// verifico esista la sua macchina
string sMachineName ;
m_pGeomDB->GetInfo( nSouMGrpId, MACH_MACHINE_KEY, sMachineName) ;
if ( sMachineName.empty() || ! LoadMachine( sMachineName))
return GDB_ID_NULL ;
// verifico nome nuovo gruppo (non deve essere vuoto e non deve esserci già un gruppo con questo nome)
if ( &sName == nullptr || sName.empty() || GetMachGroupId( sName) != GDB_ID_NULL)
return GDB_ID_NULL ;
// reset gruppo corrente
ResetCurrMachGroup() ;
// eseguo la copia del gruppo sorgente e la metto in coda
int nNewMGrpId = m_pGeomDB->Copy( nSouMGrpId, GDB_ID_NULL, m_nMachBaseId) ;
if ( nNewMGrpId == GDB_ID_NULL)
return GDB_ID_NULL ;
// assegno il nome
m_pGeomDB->SetName( nNewMGrpId, sName) ;
// converto opportunamente gli indicativi dei grezzi nelle disposizioni
int nSouRawPartId = m_pGeomDB->GetFirstGroupInGroup( m_pGeomDB->GetFirstNameInGroup( nSouMGrpId, MACH_RAW_GROUP)) ;
int nNewRawPartId = m_pGeomDB->GetFirstGroupInGroup( m_pGeomDB->GetFirstNameInGroup( nNewMGrpId, MACH_RAW_GROUP)) ;
while ( nSouRawPartId != GDB_ID_NULL && nNewRawPartId != GDB_ID_NULL) {
// ciclo sulle disposizioni del nuovo gruppo di lavoro
int nOperId = m_pGeomDB->GetFirstGroupInGroup( m_pGeomDB->GetFirstNameInGroup( nNewMGrpId, MACH_OPER_GROUP)) ;
while ( nOperId != GDB_ID_NULL) {
Disposition* pDisp = GetDisposition( m_pGeomDB->GetUserObj( nOperId)) ;
if ( pDisp != nullptr)
pDisp->UpdateRawPartId( nSouRawPartId, nNewRawPartId) ;
nOperId = m_pGeomDB->GetNextGroup( nOperId) ;
}
// passo alla coppia successiva
nSouRawPartId = m_pGeomDB->GetNextGroup( nSouRawPartId) ;
nNewRawPartId = m_pGeomDB->GetNextGroup( nNewRawPartId) ;
}
// lo rendo corrente
SetCurrMachGroup( nNewMGrpId) ;
// restituisco l'identificativo del gruppo
return nNewMGrpId ;
}
//----------------------------------------------------------------------------
bool
MachMgr::RemoveMachGroup( int nId)
@@ -222,44 +268,60 @@ MachMgr::VerifyMachGroup( int nId, MachGrp& mgData) const
// verifica della macchina
bool bMName = m_pGeomDB->GetInfo( nId, MACH_MACHINE_KEY, mgData.MGeoName) ;
// scansiono i sottogruppi
PtrOwner<IGdbIterator> pIter( CreateGdbIterator( m_pGeomDB)) ;
if ( IsNull( pIter))
return false ;
bool bSetup = false ;
bool bFixt = false ;
bool bRaw = false ;
bool bOper = false ;
bool bIter = pIter->GoToFirstGroupInGroup( nId) ;
while ( bIter) {
int nGrpId = m_pGeomDB->GetFirstGroupInGroup( nId) ;
while ( nGrpId != GDB_ID_NULL) {
string sName ;
if ( pIter->GetName( sName)) {
if ( m_pGeomDB->GetName( nGrpId, sName)) {
if ( sName == MACH_SETUP_GROUP) {
if ( ! bSetup)
mgData.SetupGroupId = pIter->GetId() ;
mgData.SetupGroupId = nGrpId ;
bSetup = true ;
}
else if ( sName == MACH_FIXT_GROUP) {
if ( ! bFixt)
mgData.FixtGroupId = pIter->GetId() ;
mgData.FixtGroupId = nGrpId ;
bFixt = true ;
}
else if ( sName == MACH_RAW_GROUP) {
if ( ! bRaw)
mgData.RawGroupId = pIter->GetId() ;
mgData.RawGroupId = nGrpId ;
bRaw = true ;
}
else if ( sName == MACH_OPER_GROUP) {
if ( ! bOper)
mgData.OperGroupId = pIter->GetId() ;
mgData.OperGroupId = nGrpId ;
bOper = true ;
}
}
// passo al successivo
bIter = pIter->GoToNextGroup() ;
nGrpId = m_pGeomDB->GetNextGroup( nGrpId) ;
}
return ( bMName && bSetup && bRaw && bOper) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::ChangeMachGroupName( int nId, const string& sNewName)
{
// verifica del gruppo base per le lavorazioni
if ( ! VerifyMachBase())
return false ;
// verifico che il gruppo ricevuto sia corretto
if ( m_pGeomDB->GetParentId( nId) != m_nMachBaseId)
return false ;
// verifico nome non vuoto e non esista già un gruppo con lo stesso nome
if ( &sNewName == nullptr || sNewName.empty() || GetMachGroupId( sNewName) != GDB_ID_NULL)
return false ;
// cambio il nome del gruppo di lavoro
if ( ! m_pGeomDB->SetName( nId, sNewName))
return false ;
return true ;
}
//----------------------------------------------------------------------------
string
MachMgr::GetMachGroupName( int nId) const
@@ -298,22 +360,19 @@ MachMgr::GetMachGroupId( const string& sName) const
{
// verifica dei parametri
if ( &sName == nullptr || sName.empty())
return false ;
return GDB_ID_NULL ;
// verifica del gruppo base per le lavorazioni
if ( ! VerifyMachBase())
return false ;
return GDB_ID_NULL ;
// recupero l'identificativo del gruppo con il nome indicato
PtrOwner<IGdbIterator> pIter( CreateGdbIterator( m_pGeomDB)) ;
if ( IsNull( pIter))
return false ;
bool bIter = pIter->GoToFirstGroupInGroup( m_nMachBaseId) ;
while( bIter) {
int nGrpId = m_pGeomDB->GetFirstGroupInGroup( m_nMachBaseId) ;
while ( nGrpId != GDB_ID_NULL) {
// verifico il nome
string sMGroupName ;
if ( pIter->GetName( sMGroupName) && EqualNoCase( sMGroupName, sName))
return pIter->GetId() ;
if ( m_pGeomDB->GetName( nGrpId, sMGroupName) && EqualNoCase( sMGroupName, sName))
return nGrpId ;
// passo al successivo
bIter = pIter->GoToNextGroup() ;
nGrpId = m_pGeomDB->GetNextGroup( nGrpId) ;
}
return GDB_ID_NULL ;
}
+133 -42
View File
@@ -19,12 +19,43 @@
#include "MachiningsMgr.h"
#include "SawingData.h"
#include "/EgtDev/Include/EGkGdbIterator.h"
#include "/EgtDev/Include/EgnStringUtils.h"
#include "/EgtDev/Include/EgnFileUtils.h"
#include "/EgtDev/Include/EGnStringUtils.h"
#include "/EgtDev/Include/EGnFileUtils.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
using namespace std ;
//----------------------------------------------------------------------------
bool
MachMgr::GetMachines( STRVECTOR& vsMachineNames, STRVECTOR& vsMachineDirs) const
{
// pulisco elenco delle macchine
vsMachineNames.clear() ;
// eseguo ricerca delle macchine nei direttori base
for ( int i = 0 ; i < int( m_vMachinesBaseDir.size()) ; ++ i) {
STRVECTOR vsDirNames ;
if ( FindAllDirectories( m_vMachinesBaseDir[i] + "\\*", vsDirNames)) {
for ( int j = 0 ; j < int( vsDirNames.size()) ; ++ j) {
// nome e direttorio della macchina
string sMachName = vsDirNames[j] ;
string sMachDir = m_vMachinesBaseDir[i] + "\\" + vsDirNames[j] ;
// verifico esista il file mlde ( o mde) della macchina
string sMachineMlde = sMachDir + "\\" + sMachName + ".Mlde" ;
string sMachineMde = sMachDir + "\\" + sMachName + ".Mde" ;
if ( ( ExistsFile( sMachineMlde) || ExistsFile( sMachineMde)) &&
find_if( vsMachineNames.begin(), vsMachineNames.end(),
[ &sMachName]( const string& sName)
{ return EqualNoCase( sName, sMachName) ; }) == vsMachineNames.end()) {
vsMachineNames.emplace_back( sMachName) ;
vsMachineDirs.emplace_back( sMachDir) ;
}
}
}
}
return true ;
}
//----------------------------------------------------------------------------
bool
MachMgr::LoadMachine( const string& sMachineName)
@@ -35,14 +66,25 @@ MachMgr::LoadMachine( const string& sMachineName)
// se macchina già caricata, non devo fare alcunchè
if ( GetMachine( sMachineName) != - 1)
return true ;
// cerco il direttorio della macchina
string sMachDir ;
for ( int i = 0 ; i < int( m_vMachinesBaseDir.size()) ; ++ i) {
string sTemp = m_vMachinesBaseDir[i] + "\\" + sMachineName ;
if ( ExistsDirectory( sTemp)) {
sMachDir = sTemp ;
break ;
}
}
if ( IsEmptyOrSpaces( sMachDir))
return false ;
// verifico esista il file mlde ( o mde) della macchina
string sMachineMlde = m_sMachinesDir + "\\" + sMachineName + "\\" + sMachineName + ".Mlde" ;
string sMachineMlde = sMachDir + "\\" + sMachineName + ".Mlde" ;
if ( ! ExistsFile( sMachineMlde))
sMachineMlde = ChangeFileExtension( sMachineMlde, ".Mde") ;
if ( ! ExistsFile( sMachineMlde))
return false ;
// salvo nel vettore
m_vMachines.emplace_back( sMachineName, nullptr, nullptr, nullptr) ;
m_vMachines.emplace_back( sMachineName, sMachDir, nullptr, nullptr, nullptr) ;
return true ;
}
@@ -97,7 +139,7 @@ MachMgr::GetCurrMachineDir( string& sMachineDir) const
if ( m_nCurrMch < 0 || m_nCurrMch >= int( m_vMachines.size()))
return false ;
// assegno il direttorio
sMachineDir = m_sMachinesDir + "\\" + m_vMachines[m_nCurrMch].sName ;
sMachineDir = m_vMachines[m_nCurrMch].sDir ;
return true ;
}
@@ -126,7 +168,7 @@ MachMgr::GetCurrMachine( void) const
return nullptr ;
// creo e carico la macchina
PtrOwner<Machine> pMch( new( nothrow) Machine) ;
if ( IsNull( pMch) || ! pMch->Init( m_sMachinesDir, m_vMachines[m_nCurrMch].sName, const_cast<MachMgr*>(this)))
if ( IsNull( pMch) || ! pMch->Init( m_vMachines[m_nCurrMch].sName, m_vMachines[m_nCurrMch].sDir, const_cast<MachMgr*>(this)))
return nullptr ;
// nascondo la macchina
if ( m_pGeomDB != nullptr)
@@ -148,7 +190,7 @@ MachMgr::GetCurrToolsMgr( void) const
// se DB utensili non esiste, provo a crearlo e caricarlo
if ( m_vMachines[m_nCurrMch].pTsMgr == nullptr) {
PtrOwner<ToolsMgr> pTsMgr( new( nothrow) ToolsMgr) ;
string sToolsDir = m_sMachinesDir + "\\" + m_vMachines[m_nCurrMch].sName + "\\" + TOOLS_DIR ;
string sToolsDir = m_vMachines[m_nCurrMch].sDir + "\\" + TOOLS_DIR ;
if ( IsNull( pTsMgr) || ! pTsMgr->Load( sToolsDir, TOOLS_FILE))
return nullptr ;
// salvo nel vettore
@@ -168,7 +210,7 @@ MachMgr::GetCurrMachiningsMgr( void) const
// se DB lavorazioni non esiste, provo a crearlo e caricarlo
if ( m_vMachines[m_nCurrMch].pMsMgr == nullptr) {
PtrOwner<MachiningsMgr> pMsMgr( new( nothrow) MachiningsMgr) ;
string sMachsFile = m_sMachinesDir + "\\" + m_vMachines[m_nCurrMch].sName + "\\" + MACHININGS_DIR + "\\" + MACHININGS_FILE ;
string sMachsFile = m_vMachines[m_nCurrMch].sDir + "\\" + MACHININGS_DIR + "\\" + MACHININGS_FILE ;
if ( IsNull( pMsMgr) || ! pMsMgr->Load( sMachsFile, GetCurrToolsMgr()))
return nullptr ;
// salvo nel vettore
@@ -300,12 +342,21 @@ MachMgr::GetAxisInvert( const string& sAxis, bool& bInvert) const
return ( ( pMch != nullptr) ? pMch->GetAxisInvert( sAxis, bInvert) : false) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::GetAxisOffset( const string& sAxis, double& dOffset) const
{
Machine* pMch = GetCurrMachine() ;
// restituisco il valore di offset asse in visualizzazione
return ( ( pMch != nullptr) ? pMch->GetAxisOffset( sAxis, dOffset) : false) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::SetAxisPos( const string& sAxis, double dVal, double* pdNewVal)
{
Machine* pMch = GetCurrMachine() ;
return ( ( pMch != nullptr) ? pMch->SetAxisPos( sAxis, dVal, pdNewVal) : false) ;
return ( ( pMch != nullptr) ? pMch->SetAxisPos( sAxis, dVal, true, pdNewVal) : false) ;
}
//----------------------------------------------------------------------------
@@ -483,6 +534,14 @@ MachMgr::SetCalcSolCh( int nScc, bool bExact)
return pMch->SetSolCh( nScc, bExact) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::GetCalcTable( string& sTable) const
{
Machine* pMch = GetCurrMachine() ;
return ( ( pMch != nullptr) ? pMch->GetCurrTable( sTable) : false) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::GetCalcTool( string& sTool) const
@@ -536,7 +595,15 @@ double
MachMgr::GetCalcRot1W( void) const
{
Machine* pMch = GetCurrMachine() ;
return ( ( pMch != nullptr) ? pMch->GetCurrRot1W() : false) ;
return ( ( pMch != nullptr) ? pMch->GetCurrRot1W() : 1) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::GetCalcMaxDeltaR2OnFirst( void) const
{
Machine* pMch = GetCurrMachine() ;
return ( ( pMch != nullptr) ? pMch->GetCurrMaxDeltaR2OnFirst() : true) ;
}
//----------------------------------------------------------------------------
@@ -545,12 +612,20 @@ MachMgr::GetAllTablesNames( STRVECTOR& vNames) const
{
// pulisco il vettore
vNames.clear() ;
// recupero la macchina corrente
// richiedo elenco tavole alla macchina corrente
Machine* pMch = GetCurrMachine() ;
if ( pMch == nullptr)
return false ;
// richiedo elenco tavole alla macchina
return pMch->GetAllTablesNames( vNames) ;
return ( ( pMch != nullptr) ? pMch->GetAllTablesNames( vNames) : false) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::GetAllAxesNames( STRVECTOR& vNames) const
{
// pulisco il vettore
vNames.clear() ;
// richiedo elenco assi alla macchina corrente
Machine* pMch = GetCurrMachine() ;
return ( ( pMch != nullptr) ? pMch->GetAllAxesNames( vNames) : false) ;
}
//----------------------------------------------------------------------------
@@ -559,12 +634,9 @@ MachMgr::GetAllHeadsNames( STRVECTOR& vNames) const
{
// pulisco il vettore
vNames.clear() ;
// recupero la macchina corrente
// richiedo elenco teste alla macchina corrente
Machine* pMch = GetCurrMachine() ;
if ( pMch == nullptr)
return false ;
// richiedo elenco teste alla macchina
return pMch->GetAllHeadsNames( vNames) ;
return ( ( pMch != nullptr) ? pMch->GetAllHeadsNames( vNames) : false) ;
}
//----------------------------------------------------------------------------
@@ -573,12 +645,9 @@ MachMgr::GetAllTcPosNames( STRVECTOR& vNames) const
{
// pulisco il vettore
vNames.clear() ;
// recupero la macchina corrente
// richiedo elenco posizioni cambio utensile alla macchina corrente
Machine* pMch = GetCurrMachine() ;
if ( pMch == nullptr)
return false ;
// richiedo elenco posizioni cambio utensile alla macchina
return pMch->GetAllTcPosNames( vNames) ;
return ( ( pMch != nullptr) ? pMch->GetAllTcPosNames( vNames) : false) ;
}
//----------------------------------------------------------------------------
@@ -599,10 +668,10 @@ MachMgr::GetCurrRotAxes( void) const
//----------------------------------------------------------------------------
bool
MachMgr::GetAllCurrAxesName( STRVECTOR& vAxName) const
MachMgr::GetAllCurrAxesNames( STRVECTOR& vAxName) const
{
Machine* pMch = GetCurrMachine() ;
return ( ( pMch != nullptr) ? pMch->GetAllCurrAxesName( vAxName) : false) ;
return ( ( pMch != nullptr) ? pMch->GetAllCurrAxesNames( vAxName) : false) ;
}
//----------------------------------------------------------------------------
@@ -621,6 +690,38 @@ MachMgr::GetCurrAxisHomePos( int nInd, double& dHome) const
return ( ( pMch != nullptr) ? pMch->GetCurrAxisHomePos( nInd, dHome) : false) ;
}
//----------------------------------------------------------------------------
const Frame3d&
MachMgr::GetCurrLinAxesFrame( void) const
{
Machine* pMch = GetCurrMachine() ;
if ( pMch == nullptr) {
static Frame3d frDummy ;
return frDummy ;
}
return pMch->GetCurrLinAxesFrame() ;
}
//----------------------------------------------------------------------------
bool
MachMgr::GetCurrIsCenter( void) const
{
Machine* pMch = GetCurrMachine() ;
if ( pMch == nullptr)
return false ;
return ( pMch->GetCurrKinematicChainType() == KIN_CHAIN_CENTER) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::GetCurrIsRobot( void) const
{
Machine* pMch = GetCurrMachine() ;
if ( pMch == nullptr)
return false ;
return ( pMch->GetCurrKinematicChainType() == KIN_CHAIN_ROBOT) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::GetCalcAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
@@ -682,9 +783,7 @@ bool
MachMgr::GetCalcToolDirFromAngles( const DBLVECTOR& vAng, Vector3d& vtDir) const
{
Machine* pMch = GetCurrMachine() ;
if ( pMch == nullptr)
return false ;
return pMch->GetToolDirFromAngles( vAng, vtDir) ;
return ( ( pMch != nullptr) ? pMch->GetToolDirFromAngles( vAng, vtDir) : false) ;
}
//----------------------------------------------------------------------------
@@ -692,9 +791,7 @@ bool
MachMgr::GetCalcAuxDirFromAngles( const DBLVECTOR& vAng, Vector3d& vtDir) const
{
Machine* pMch = GetCurrMachine() ;
if ( pMch == nullptr)
return false ;
return pMch->GetAuxDirFromAngles( vAng, vtDir) ;
return ( ( pMch != nullptr) ? pMch->GetAuxDirFromAngles( vAng, vtDir) : false) ;
}
//----------------------------------------------------------------------------
@@ -702,9 +799,7 @@ bool
MachMgr::GetCalcPartDirFromAngles( const Vector3d& vtPart, const DBLVECTOR& vAng, Vector3d& vtDir) const
{
Machine* pMch = GetCurrMachine() ;
if ( pMch == nullptr)
return false ;
return pMch->GetPartDirFromAngles( vtPart, vAng, vtDir) ;
return ( ( pMch != nullptr) ? pMch->GetPartDirFromAngles( vtPart, vAng, vtDir) : false) ;
}
//----------------------------------------------------------------------------
@@ -760,9 +855,7 @@ string
MachMgr::GetOutstrokeInfo( bool bMM) const
{
Machine* pMch = GetCurrMachine() ;
if ( pMch == nullptr)
return "" ;
return pMch->GetOutstrokeInfo( bMM) ;
return ( ( pMch != nullptr) ? pMch->GetOutstrokeInfo( bMM) : "") ;
}
//----------------------------------------------------------------------------
@@ -778,7 +871,5 @@ int
MachMgr::GetMachineLook( void) const
{
Machine* pMch = GetCurrMachine() ;
if ( pMch == nullptr)
return MCH_LOOK_NONE ;
return pMch->GetLook() ;
return ( ( pMch != nullptr) ? pMch->GetLook() : MCH_LOOK_NONE) ;
}
+12
View File
@@ -642,6 +642,9 @@ MachMgr::DispositionSpecialApply( int nId, bool bRecalc)
Disposition* pDisp = ::GetDisposition( m_pGeomDB->GetUserObj( nId)) ;
if ( pDisp == nullptr)
return false ;
// Eventuale log
string sOut = "DispositionSpecialApply start --> " + pDisp->GetName() ;
LOG_DBG_INFO( GetEMkLogger(), sOut.c_str()) ;
// lancio l'azione
return pDisp->SpecialApply( bRecalc) ;
}
@@ -662,6 +665,9 @@ MachMgr::DispositionSpecialUpdate( int nId)
Disposition* pDisp = ::GetDisposition( m_pGeomDB->GetUserObj( nId)) ;
if ( pDisp == nullptr)
return false ;
// Eventuale log
string sOut = "DispositionSpecialUpdate start --> " + pDisp->GetName() ;
LOG_DBG_INFO( GetEMkLogger(), sOut.c_str()) ;
// lancio l'azione
return pDisp->SpecialUpdate() ;
}
@@ -1041,6 +1047,9 @@ MachMgr::MachiningApply( bool bRecalc, bool bPostApply)
Machining* pMch = GetMachining( m_pGeomDB->GetUserObj( nCurrMchId)) ;
if ( pMch == nullptr)
return false ;
// Log
string sOut = "MachiningApply start --> " + pMch->GetName() ;
LOG_DBG_INFO( GetEMkLogger(), sOut.c_str()) ;
// imposto fase della lavorazione come temporaneamente corrente
SetTempPhase TmpPhase( this, pMch->GetPhase()) ;
// imposto visualizzazione completa della macchina come temporaneamente corrente
@@ -1069,6 +1078,9 @@ MachMgr::MachiningUpdate( bool bPostApply)
Machining* pMch = GetMachining( m_pGeomDB->GetUserObj( nCurrMchId)) ;
if ( pMch == nullptr)
return false ;
// Log
string sOut = "MachiningUpdate start --> " + pMch->GetName() ;
LOG_DBG_INFO( GetEMkLogger(), sOut.c_str()) ;
// imposto fase della lavorazione come temporaneamente corrente
SetTempPhase TmpPhase( this, pMch->GetPhase()) ;
// imposto visualizzazione completa della macchina come temporaneamente corrente
+412 -136
View File
@@ -24,11 +24,12 @@
#include "/EgtDev/Include/EGkGeoPoint3d.h"
#include "/EgtDev/Include/EGkCurveAux.h"
#include "/EgtDev/Include/EGkOffsetCurve.h"
#include "/EgtDev/Include/EgkDistPointCurve.h"
#include "/EgtDev/Include/EGkDistPointCurve.h"
#include "/EgtDev/Include/EGkSfrCreate.h"
#include "/EgtDev/Include/EGkStmStandard.h"
#include "/EgtDev/Include/EGkStmFromCurves.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
#include "/EgtDev/Include/EXeConst.h"
using namespace std ;
@@ -96,7 +97,7 @@ MachMgr::AddRawPart( const Point3d& ptOrig, double dLen, double dWidth, double d
m_pGeomDB->SetInfo( nRawId, MACH_RAW_PHASE, m_nCurrPhase) ;
// creo solido e outline
bOk = bOk && ModifyRawPart( nRawId, ptOrig, dLen, dWidth, dHeight, cCol) ;
// se qualcosa è andato storto, cancello tutto
// se qualcosa è andato storto, cancello tutto
if ( ! bOk) {
m_pGeomDB->Erase( nRawId) ;
return GDB_ID_NULL ;
@@ -112,7 +113,7 @@ MachMgr::ModifyRawPart( int nRawId, const Point3d& ptOrig, double dLen, double d
// le dimensioni non possono essere nulle
if ( dLen < EPS_SMALL || dWidth < EPS_SMALL || dHeight < EPS_SMALL)
return false ;
// verifica validità grezzo
// verifica validità grezzo
if ( ! VerifyRawPart( nRawId))
return false ;
// creo il solido
@@ -171,7 +172,7 @@ MachMgr::AddRawPartWithPart( int nPartId, int nCrvSrfId, double dOverMat, Color
// verifico il gruppo dei grezzi nella macchinata corrente
if ( GetCurrRawGroupId() == GDB_ID_NULL)
return GDB_ID_NULL ;
// verifico che il pezzo non sia già usato nella macchinata corrente
// verifico che il pezzo non sia già usato nella macchinata corrente
if ( m_pGeomDB->GetParentId( nPartId) != GDB_ID_ROOT)
return GDB_ID_NULL ;
// recupero il tipo di oggetto per definire il grezzo
@@ -180,7 +181,7 @@ MachMgr::AddRawPartWithPart( int nPartId, int nCrvSrfId, double dOverMat, Color
Point3d ptRef ;
// costruzione del grezzo
int nRawId = GDB_ID_NULL ;
// se grezzo da superficie (per ora senza possibilità di offset)
// se grezzo da superficie (per ora senza possibilità di offset)
if ( ( nGtype & GEO_SURF) != 0) {
// inserisco il grezzo
nRawId = AddRawPart( nCrvSrfId, cCol) ;
@@ -284,7 +285,7 @@ MachMgr::AddRawPart( int nCrvId, double dOverMat, double dZmin, double dHeight,
m_pGeomDB->SetInfo( nRawId, MACH_RAW_PHASE, m_nCurrPhase) ;
// creo solido e outline
bOk = bOk && ModifyRawPart( nRawId, nCrvId, dOverMat, dZmin, dHeight, cCol) ;
// se qualcosa è andato storto, cancello tutto
// se qualcosa è andato storto, cancello tutto
if ( ! bOk) {
m_pGeomDB->Erase( nRawId) ;
return GDB_ID_NULL ;
@@ -297,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)
{
// verifica validità grezzo
// verifica validità grezzo
if ( ! VerifyRawPart( nRawId))
return false ;
// recupero il riferimento della curva
@@ -321,7 +322,7 @@ MachMgr::ModifyRawPart( int nRawId, int nCrvId, double dOverMat, double dZmin, d
// la schiaccio a Z = 0
if ( ! pMyCrv->Scale( Frame3d(), 1, 1, 0))
return false ;
// se non è chiusa, la chiudo
// se non è chiusa, la chiudo
pMyCrv->Close() ;
// la oriento in senso CCW
double dAreaXY ;
@@ -375,11 +376,11 @@ MachMgr::AddRawPart( int nSurfId, Color cCol)
if ( nRawGroupId == GDB_ID_NULL)
return GDB_ID_NULL ;
// recupero l'ingombro della superficie in globale
BBox3d b3Crv ;
if ( ! m_pGeomDB->GetGlobalBBox( nSurfId, b3Crv))
BBox3d b3Surf ;
if ( ! m_pGeomDB->GetGlobalBBox( nSurfId, b3Surf))
return GDB_ID_NULL ;
// inserisco il gruppo del grezzo nella macchinata
Frame3d frRaw( b3Crv.GetMin()) ;
Frame3d frRaw( b3Surf.GetMin()) ;
int nRawId = m_pGeomDB->AddGroup( GDB_ID_NULL, nRawGroupId, frRaw) ;
if ( nRawId == GDB_ID_NULL)
return GDB_ID_NULL ;
@@ -414,7 +415,7 @@ MachMgr::AddRawPart( int nSurfId, Color cCol)
// ne calcolo la silhouette secondo Z+
POLYLINEVECTOR vPL ;
bool bSilh = false ;
if ( pStm->GetSilhouette( Z_AX, vPL) && vPL.size() > 0) {
if ( pStm->GetSilhouette( Z_AX, 10.0, vPL) && vPL.size() > 0) {
// cerco il contorno esterno
int nInd = - 1 ;
double dMaxArea = 0 ;
@@ -456,11 +457,11 @@ MachMgr::AddRawPart( int nSurfId, Color cCol)
int nCrvId = ( bOk ? m_pGeomDB->AddGeoObj( GDB_ID_NULL, nRawId, Release( pCrvCompo)) : GDB_ID_NULL) ;
bOk = bOk && ( nCrvId != GDB_ID_NULL) ;
// assegno il nome alla curva
bOk = bOk && m_pGeomDB->SetName( nCrvId, MACH_RAW_SOLID) ;
bOk = bOk && m_pGeomDB->SetName( nCrvId, MACH_RAW_OUTLINE) ;
// assegno il colore alla curva
bOk = bOk && m_pGeomDB->SetMaterial( nCrvId, cCol) ;
bOk = bOk && m_pGeomDB->SetMaterial( nCrvId, cCol) ;
}
// se qualcosa è andato storto, cancello tutto
// se qualcosa è andato storto, cancello tutto
if ( ! bOk) {
m_pGeomDB->Erase( nRawId) ;
return GDB_ID_NULL ;
@@ -471,6 +472,156 @@ MachMgr::AddRawPart( int nSurfId, Color cCol)
return nRawId ;
}
//----------------------------------------------------------------------------
int
MachMgr::AddRawPart( int nSfrUpId, int nSfrDownId, double dHeight, Color cCol)
{
// recupero il gruppo dei grezzi nella macchinata corrente
int nRawGroupId = GetCurrRawGroupId() ;
if ( nRawGroupId == GDB_ID_NULL)
return GDB_ID_NULL ;
// recupero l'ingombro della superficie up in globale
BBox3d b3Surf ;
if ( ! m_pGeomDB->GetGlobalBBox( nSfrUpId, b3Surf))
return GDB_ID_NULL ;
// inserisco il gruppo del grezzo nella macchinata
Frame3d frRaw( b3Surf.GetMin()) ;
int nRawId = m_pGeomDB->AddGroup( GDB_ID_NULL, nRawGroupId, frRaw) ;
if ( nRawId == GDB_ID_NULL)
return GDB_ID_NULL ;
// assegno il nome al gruppo
bool bOk = m_pGeomDB->SetName( nRawId, MACH_RAW_PART) ;
// assegno la fase al gruppo
bOk = bOk && m_pGeomDB->SetInfo( nRawId, MACH_RAW_PHASE, m_nCurrPhase) ;
// recupero il frame originale della superficie up ( deve essere lo stesso della down)
Frame3d frSurf ;
bOk = bOk && m_pGeomDB->GetGlobFrame( nSfrUpId, frSurf) ;
// creo il volume in modo approssimativo a partire dalle due superfici considerando soltanto un'approssimazione dei bordi esterni
// regione up
PtrOwner<ISurfFlatRegion> pSurfUp( CloneSurfFlatRegion( m_pGeomDB->GetGeoObj( nSfrUpId))) ;
bOk = bOk && ( ! IsNull( pSurfUp)) ;
// calcolo offset e contro-offset per unificare i chunk ed eliminare eventuali rientranze nella superficie
double dOffs = 8 ;
bOk = bOk && pSurfUp->Offset( dOffs, ICurve::OFF_FILLET) ;
bOk = bOk && pSurfUp->Offset( -dOffs, ICurve::OFF_FILLET) ;
// recupero il chunk di area maggiore
int nKMax = 0 ;
if ( bOk && pSurfUp->GetChunkCount() > 1) {
double dAreaMax = -1 ;
for ( int k = 0 ; k < pSurfUp->GetChunkCount() ; k ++) {
PtrOwner<ISurfFlatRegion> pSfrChunk( pSurfUp->CloneChunk( k)) ;
double dArea = -1 ; pSfrChunk->GetGrossArea( dArea) ;
if ( dArea > dAreaMax) {
nKMax = k ;
dAreaMax = dArea ;
}
}
}
PtrOwner<ICurve> pCrvUp ;
bOk = bOk && pCrvUp.Set( pSurfUp->GetLoop( nKMax, 0)) ;
bOk = bOk && ( ! IsNull( pCrvUp)) ;
// regione down
PtrOwner<ISurfFlatRegion> pSurfDown( CloneSurfFlatRegion( m_pGeomDB->GetGeoObj( nSfrDownId))) ;
bOk = bOk && ( ! IsNull( pSurfDown)) ;
bOk = bOk && pSurfDown->Offset( dOffs, ICurve::OFF_FILLET) ;
bOk = bOk && pSurfDown->Offset( -dOffs, ICurve::OFF_FILLET) ;
nKMax = 0 ;
if ( bOk && pSurfDown->GetChunkCount() > 1) {
double dAreaMax = -1 ;
for ( int k = 0 ; k < pSurfDown->GetChunkCount() ; k ++) {
PtrOwner<ISurfFlatRegion> pSfrChunk( pSurfDown->CloneChunk( k)) ;
double dArea = -1 ; pSfrChunk->GetGrossArea( dArea) ;
if ( dArea > dAreaMax) {
nKMax = k ;
dAreaMax = dArea ;
}
}
}
PtrOwner<ICurveComposite> pCrvDown ;
bOk = bOk && pCrvDown.Set( ConvertCurveToComposite( pSurfDown->GetLoop( nKMax, 0))) ;
bOk = bOk && ( ! IsNull( pCrvDown)) ;
// sposto il punto di inizio il più vicino possibile a quello della curva up per migliorare il calcolo della rigata
if ( bOk) {
Point3d ptS ; pCrvUp->GetStartPoint( ptS) ;
DistPointCurve distPC( ptS, *pCrvDown) ;
double dPar ; int nFlag ;
bOk = bOk && distPC.GetParamAtMinDistPoint( 0, dPar, nFlag) ;
bOk = bOk && pCrvDown->ChangeStartPoint( dPar) ;
}
// volume
PtrOwner<ISurfTriMesh> pStmRaw ;
bOk = bOk && pStmRaw.Set( GetSurfTriMeshByFlatContour( pCrvUp)) ;
bOk = bOk && ( ! IsNull( pStmRaw)) ;
PtrOwner<ISurfTriMesh> pStmLat ;
bOk = bOk && pStmLat.Set( GetSurfTriMeshRuled( pCrvDown, pCrvUp, ISurfTriMesh::RLT_MINDIST)) ;
bOk = bOk && ( ! IsNull( pStmLat)) ;
bOk = bOk && pStmRaw->DoSewing( *pStmLat) ;
PtrOwner<ISurfTriMesh> pStmDown ;
bOk = bOk && pStmDown.Set( GetSurfTriMeshByFlatContour( pCrvDown)) ;
bOk = bOk && pStmDown->Invert() ;
bOk = bOk && pStmRaw->DoSewing( *pStmDown) ;
bOk = bOk && pStmRaw->DoCompacting() ;
bOk = bOk && pStmRaw->Repair() ;
bOk = bOk && pStmRaw->LocToLoc( frSurf, frRaw) ;
int nId = bOk ? m_pGeomDB->AddGeoObj( GDB_ID_NULL, nRawId, Release( pStmRaw)) : GDB_ID_NULL ;
bOk = bOk && ( nId != GDB_ID_NULL) ;
// assegno il nome al solido
bOk = bOk && m_pGeomDB->SetName( nId, MACH_RAW_SOLID) ;
// assegno il colore al solido
bOk = bOk && m_pGeomDB->SetMaterial( nId, cCol) ;
// rendo visibile il solido
bOk = bOk && m_pGeomDB->SetStatus( nId, GDB_ST_ON) ;
// calcolo il punto centro del solido
bOk = bOk && SetRawPartCenter( nRawId) ;
if ( bOk) {
// costruisco la curva di contorno
PtrOwner<ISurfFlatRegion> pSfrUp( CloneSurfFlatRegion( m_pGeomDB->GetGeoObj( nSfrUpId))) ;
PtrOwner<ISurfFlatRegion> pSfrDown( CloneSurfFlatRegion( m_pGeomDB->GetGeoObj( nSfrDownId))) ;
bOk = bOk && ( ! IsNull( pSfrUp)) && ( ! IsNull( pSfrDown)) ;
if ( bOk)
pSfrUp->Add( *pSfrDown) ;
PtrOwner<ICurve> pCrv ;
bOk = bOk && pCrv.Set( pSfrUp->GetLoop( 0, 0)) ;
bOk = bOk && ( ! IsNull( pCrv)) ;
bOk = bOk && pCrv->LocToLoc( frSurf, frRaw) ;
int nLoop = bOk ? m_pGeomDB->AddGeoObj( GDB_ID_NULL, nRawId, Release( pCrv)) : GDB_ID_NULL ;
bOk = bOk && ( nLoop != GDB_ID_NULL) ;
bOk = bOk && ExeMove( {nLoop}, -dHeight * Z_AX, RTY_LOC) ;
// assegno il nome alla curva
bOk = bOk && m_pGeomDB->SetName( nLoop, MACH_RAW_OUTLINE) ;
// assegno il colore alla curva
bOk = bOk && m_pGeomDB->SetMaterial( nLoop, cCol) ;
// recupero le superfici up e down
int nSurfUpId = ( bOk ? m_pGeomDB->CopyGlob( nSfrUpId, GDB_ID_NULL, nRawId) : GDB_ID_NULL) ;
bOk = bOk && ( nSurfUpId != GDB_ID_NULL) ;
bOk = bOk && m_pGeomDB->SetName( nSurfUpId, MACH_RAW_UP_REG) ;
bOk = bOk && m_pGeomDB->SetMaterial( nSurfUpId, cCol) ;
bOk = bOk && m_pGeomDB->SetStatus( nSurfUpId, GDB_ST_OFF) ;
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) ;
}
// se qualcosa è andato storto, cancello tutto
if ( ! bOk) {
m_pGeomDB->Erase( nRawId) ;
return GDB_ID_NULL ;
}
// tutto ok
return nRawId ;
}
//----------------------------------------------------------------------------
bool
MachMgr::ModifyRawPartSize( int nRawId, double dLength, double dWidth, double dHeight)
@@ -478,7 +629,7 @@ MachMgr::ModifyRawPartSize( int nRawId, double dLength, double dWidth, double dH
// le nuove dimensioni non possono essere nulle
if ( dLength < EPS_SMALL || dWidth < EPS_SMALL || dHeight < EPS_SMALL)
return false ;
// verifica validità grezzo
// verifica validità grezzo
if ( ! VerifyRawPart( nRawId))
return false ;
// recupero il solido del grezzo
@@ -520,10 +671,10 @@ MachMgr::ModifyRawPartSize( int nRawId, double dLength, double dWidth, double dH
bool
MachMgr::ModifyRawPartHeight( int nRawId, double dHeight)
{
// la nuova altezza non può essere nulla
// la nuova altezza non può essere nulla
if ( dHeight < EPS_SMALL)
return false ;
// verifica validità grezzo
// verifica validità grezzo
if ( ! VerifyRawPart( nRawId))
return false ;
// recupero il solido del grezzo
@@ -552,10 +703,10 @@ MachMgr::GetRawPartPhases( int nRawId, INTVECTOR& vPhase) const
{
// pulisco parametro di ritorno
vPhase.clear() ;
// verifica validità grezzo
// verifica validità grezzo
if ( ! VerifyRawPart( nRawId))
return false ;
// recupero le fasi in cui è presente il grezzo (se manca è fase 1)
// recupero le fasi in cui è presente il grezzo (se manca è fase 1)
if ( ! m_pGeomDB->GetInfo( nRawId, MACH_RAW_PHASE, vPhase) || vPhase.empty())
vPhase.emplace_back( 1) ;
return true ;
@@ -565,11 +716,11 @@ MachMgr::GetRawPartPhases( int nRawId, INTVECTOR& vPhase) const
bool
MachMgr::KeepRawPart( int nRawId, int nSouPhase)
{
// verifico validità e recupero fasi in cui è presente
// verifico validità e recupero fasi in cui è presente
INTVECTOR vPhase ;
if ( ! GetRawPartPhases( nRawId, vPhase))
return false ;
// se fase corrente già presente, non devo fare alcunché
// se fase corrente già presente, non devo fare alcunché
if ( find( vPhase.begin(), vPhase.end(), m_nCurrPhase) != vPhase.end())
return true ;
// aggiungo la fase corrente
@@ -621,10 +772,11 @@ MachMgr::KeepRawPart( int nRawId, int nSouPhase)
bool
MachMgr::VerifyRawPartPhase( int nRawId, int nPhase) const
{
// verifico validità e recupero fasi in cui è presente
// verifico validità e recupero fasi in cui è presente
INTVECTOR vPhase ;
if ( ! GetRawPartPhases( nRawId, vPhase))
return false ;
// verifico presenza nella fase indicata
return ( find( vPhase.begin(), vPhase.end(), nPhase) != vPhase.end()) ;
}
@@ -632,11 +784,11 @@ MachMgr::VerifyRawPartPhase( int nRawId, int nPhase) const
bool
MachMgr::RemoveRawPartFromCurrPhase( int nRawId)
{
// verifico validità e recupero fasi in cui è presente
// verifico validità e recupero fasi in cui è presente
INTVECTOR vPhase ;
if ( ! GetRawPartPhases( nRawId, vPhase))
return false ;
// se non appartiene alla fase corrente, non devo fare alcunché
// se non appartiene alla fase corrente, non devo fare alcunché
auto iIter = find( vPhase.begin(), vPhase.end(), m_nCurrPhase) ;
if ( iIter == vPhase.end())
return true ;
@@ -663,7 +815,7 @@ MachMgr::RemoveRawPartFromCurrPhase( int nRawId)
bool
MachMgr::RemoveRawPart( int nRawId)
{
// verifica validità grezzo
// verifica validità grezzo
if ( ! VerifyRawPart( nRawId))
return false ;
// tolgo dalle disposizioni in cui compare gli eventuali movimenti registrati di questo grezzo
@@ -687,7 +839,7 @@ MachMgr::VerifyRawPart( int nRawId, bool bLinkedAllowed) const
int nRawGroupId = GetCurrRawGroupId() ;
if ( nRawGroupId != GDB_ID_NULL && m_pGeomDB->GetParentId( nRawId) == nRawGroupId)
return true ;
// se consentito linkaggio ed il grezzo è linkato ad un gruppo della macchina corrente, va bene
// se consentito linkaggio ed il grezzo è linkato ad un gruppo della macchina corrente, va bene
if ( bLinkedAllowed) {
Machine* pMch = GetCurrMachine() ;
if ( pMch != nullptr && pMch->IsLinkedRawPart( nRawId))
@@ -807,12 +959,12 @@ MachMgr::ResetRawPartCenter( int nRawId)
bool
MachMgr::GetRawPartCenter( int nRawId, Point3d& ptCen)
{
// verifica validità grezzo
// verifica validità grezzo
if ( ! VerifyRawPart( nRawId))
return false ;
// cerco di recuperare l'oggetto
int nGPntId = m_pGeomDB->GetFirstNameInGroup( nRawId, MACH_RAW_CENTER) ;
// ne verifico la validità
// ne verifico la validità
int nMode ;
if ( nGPntId == GDB_ID_NULL ||
! m_pGeomDB->GetMode( nGPntId, nMode) || nMode != GDB_MD_STD) {
@@ -840,7 +992,7 @@ MachMgr::GetRawPartCenter( int nRawId, Point3d& ptCen)
bool
MachMgr::GetRawPartBBox( int nRawId, BBox3d& b3Raw)
{
// verifica validità grezzo
// verifica validità grezzo
if ( ! VerifyRawPart( nRawId))
return false ;
// recupero solido del grezzo
@@ -848,6 +1000,103 @@ MachMgr::GetRawPartBBox( int nRawId, BBox3d& b3Raw)
return m_pGeomDB->GetGlobalBBox( nRawSolidId, b3Raw) ;
}
//---------------------------------------------------------------------------
static bool
AssociateSurfs( IGeomDB* pGeomDB, int nSurfUpId, int nSurfDownId, vector<pair<int,int>>& vRawSurfs)
{
// vRawSurfs contiene tutte le coppie ( id regioneUp, id regioneDown) che definiscono i nuovi grezzi
vRawSurfs.clear() ;
int nUpCnt = ExeSurfFrChunkCount( nSurfUpId) ;
int nDownCnt = ExeSurfFrChunkCount( nSurfDownId) ;
// se non sono stati creati più grezzi
if ( nUpCnt == 1 || nDownCnt == 1) {
vRawSurfs.emplace_back( nSurfUpId, nSurfDownId) ;
return true ;
}
int nUpFirstId = ExeExplodeSurface( nSurfUpId, &nUpCnt) ;
int nDownFirstId = ExeExplodeSurface( nSurfDownId, &nDownCnt) ;
// ad ogni chunk della regione up associo i chunk corrispondenti della regione down
INTVECTOR vChunks( nUpCnt, GDB_ID_NULL) ;
for ( int nIdD = nDownFirstId ; nIdD < nDownFirstId + nDownCnt ; nIdD ++) {
ISurfFlatRegion* pSfrD = GetSurfFlatRegion( pGeomDB->GetGeoObj( nIdD)) ;
if ( pSfrD == nullptr)
return false ;
BBox3d bBoxD ; ExeGetBBox( nIdD, BBF_STANDARD, bBoxD) ;
// inidividuo il chunk della superficie up che interagisce maggiormente con il chunk corrente della superficie down
int k = -1 ;
double dMaxArea = -1 ;
for ( int j = 0 ; j < nUpCnt ; j ++) {
BBox3d bBoxU ; ExeGetBBox( nUpFirstId + j, BBF_STANDARD, bBoxU) ;
if ( bBoxU.OverlapsXY( bBoxD)) {
PtrOwner<ISurfFlatRegion> pSfrU( CloneSurfFlatRegion( pGeomDB->GetGeoObj( nUpFirstId + j))) ;
if ( IsNull( pSfrU))
return false ;
// le due superfici sono nello stesso frame
pSfrU->Intersect( *pSfrD) ;
double dArea = -1 ; pSfrU->GetArea( dArea) ;
if ( dArea > dMaxArea) {
k = j ;
dMaxArea = dArea ;
}
}
}
// aggiorno le superfici con l'associazione trovata
if ( k == -1)
return false ;
if ( vChunks[k] == GDB_ID_NULL)
vChunks[k] = nIdD ;
else {
ExeSurfFrAdd( vChunks[k], nIdD) ;
ExeErase( {nIdD}) ;
}
}
// controllo per ogni chunk della superficie up il corrispondente della nuova superficie down
for ( int i = 0 ; i < nUpCnt ; i ++) {
ISurfFlatRegion* pSfrU = GetSurfFlatRegion( pGeomDB->GetGeoObj( nUpFirstId + i)) ;
if ( pSfrU == nullptr)
return false ;
BBox3d bBoxU ; ExeGetBBox( nUpFirstId + i, BBF_STANDARD, bBoxU) ;
// individuo il chunk della superficie down che interagisce maggiormente con il chunk corrente della superficie up
int k = -1 ;
double dMaxArea = -1 ;
for ( int j = 0 ; j < int( vChunks.size()) ; j ++) {
BBox3d bBoxD ; ExeGetBBox( vChunks[j], BBF_STANDARD, bBoxD) ;
// se i box interferiscono allora verifico di quanto si sovrappongono le due regioni
if ( bBoxD.OverlapsXY( bBoxU)) {
PtrOwner<ISurfFlatRegion> pSfrD( CloneSurfFlatRegion( pGeomDB->GetGeoObj( vChunks[j]))) ;
if ( IsNull( pSfrD))
return false ;
pSfrD->Intersect( *pSfrU) ;
double dArea = -1 ; pSfrD->GetArea( dArea) ;
if ( dArea > dMaxArea) {
k = j ;
dMaxArea = dArea ;
}
}
}
if ( k == -1)
return false ;
// se è la stessa associazione individuata da vChunks allora aggiorno il vettore finale dei grezzi
if ( k == i)
vRawSurfs.emplace_back( nUpFirstId + i, vChunks[i]) ;
else {
// altrimenti unisco le regioni associate appena individuate sia per la superficie up sia per la down
ExeSurfFrAdd( nUpFirstId + k, nUpFirstId + i) ;
ExeErase( {nUpFirstId + i}) ;
ExeSurfFrAdd( vChunks[k], vChunks[i]) ;
ExeErase( {vChunks[i]}) ;
}
}
return true ;
}
//----------------------------------------------------------------------------
int
MachMgr::SplitFlatRawPartWithMachinings( int nRawId, const INTVECTOR& vMchId)
@@ -871,7 +1120,6 @@ MachMgr::SplitFlatRawPartWithMachinings( int nRawId, const INTVECTOR& vMchId)
BBox3d b3Raw ;
if ( ! m_pGeomDB->GetGlobalBBox( nRawSolId, b3Raw))
return GDB_ID_NULL ;
double dZmin = b3Raw.GetMin().z ;
double dHeight = b3Raw.GetMax().z - b3Raw.GetMin().z ;
// il colore del grezzo
Color cCol = AQUA ;
@@ -880,19 +1128,31 @@ MachMgr::SplitFlatRawPartWithMachinings( int nRawId, const INTVECTOR& vMchId)
Frame3d frRaw ;
if ( ! m_pGeomDB->GetGroupGlobFrame( nRawId, frRaw))
return GDB_ID_NULL ;
// creo la regione del grezzo a partire dal suo contorno
// recupero il contorno
int nOutCrvId = m_pGeomDB->GetFirstNameInGroup( nRawId, MACH_RAW_OUTLINE) ;
if ( nOutCrvId == GDB_ID_NULL)
return GDB_ID_NULL ;
// creo la regione
INTVECTOR vCrvIds ;
vCrvIds.emplace_back( nOutCrvId) ;
int nSfrId = ExeCreateSurfFlatRegion( nRawId, vCrvIds, nullptr) ;
if ( nSfrId == GDB_ID_NULL)
return GDB_ID_NULL ;
m_pGeomDB->SetLevel( nSfrId, GDB_LV_TEMP) ;
// creo le regioni inferiore e superiore del grezzo da aggiornare con le lavorazioni
int nSfrDownId = GDB_ID_NULL, nSfrUpId = GDB_ID_NULL ;
int nSfrDownOrigId = m_pGeomDB->GetFirstNameInGroup( nRawId, MACH_RAW_DOWN_REG) ;
int nSfrUpOrigId = m_pGeomDB->GetFirstNameInGroup( nRawId, MACH_RAW_UP_REG) ;
if ( nSfrDownOrigId == GDB_ID_NULL || nSfrUpOrigId == GDB_ID_NULL) {
// se le regioni del grezzo di partenza non sono definite, le creo a partire dall'outline
nSfrDownId = ExeCreateSurfFlatRegion( nRawId, {nOutCrvId}, nullptr) ;
if ( nSfrDownId == GDB_ID_NULL)
return GDB_ID_NULL ;
nSfrUpId = ExeCopyGlob( nSfrDownId, nRawId, GDB_LAST_SON) ;
if ( nSfrUpId == GDB_ID_NULL)
return GDB_ID_NULL ;
ExeMove( { nSfrUpId}, dHeight * Z_AX, RTY_LOC) ;
}
else {
nSfrDownId = ExeCopyGlob( nSfrDownOrigId, nRawId, GDB_LAST_SON) ;
nSfrUpId = ExeCopyGlob( nSfrUpOrigId, nRawId, GDB_LAST_SON) ;
if ( nSfrDownId == GDB_ID_NULL || nSfrUpId == GDB_ID_NULL)
return GDB_ID_NULL ;
}
// se esiste il kerf, ne creo la regione
PtrOwner<ISurfFlatRegion> pSfrKerf ;
@@ -907,7 +1167,8 @@ MachMgr::SplitFlatRawPartWithMachinings( int nRawId, const INTVECTOR& vMchId)
}
// recupero le regioni delle lavorazioni
INTVECTOR vMchRReg ;
INTVECTOR vMchRRegUp ;
INTVECTOR vMchRRegDown ;
for ( auto nMchId : vMchId) {
// recupero gruppo preview lavorazioni nella lavorazione
int nPVGrp = m_pGeomDB->GetFirstNameInGroup( nMchId, MCH_PV) ;
@@ -915,94 +1176,110 @@ MachMgr::SplitFlatRawPartWithMachinings( int nRawId, const INTVECTOR& vMchId)
return GDB_ID_NULL ;
// se vuoto, cerco il rimando al preview nel pezzo
if ( m_pGeomDB->GetGroupObjs( nPVGrp) == 0 &&
! m_pGeomDB->GetInfo( nPVGrp, MCH_PV_KEY_RELOCATE, nPVGrp))
! m_pGeomDB->GetInfo( nPVGrp, MCH_PV_KEY_RELOCATE, nPVGrp))
return GDB_ID_NULL ;
// ciclo sui percorsi utensile (CL)
int nClId = m_pGeomDB->GetFirstGroupInGroup( nPVGrp) ;
while ( nClId != GDB_ID_NULL) {
// tagli ridotti
int nCrId = m_pGeomDB->GetFirstNameInGroup( nClId, MCH_PV_RRCUT) ;
while ( nCrId != GDB_ID_NULL) {
vMchRReg.emplace_back( nCrId) ;
nCrId = m_pGeomDB->GetNextName( nCrId, MCH_PV_RRCUT) ;
}
// lavorazioni per regione inferiore
int nCrDownId = m_pGeomDB->GetFirstNameInGroup( nClId, MCH_PV_DOWN_RAWCUT) ;
// se non esiste la regione inferiore la lavorazione non è passante quindi può essere ignorata
if ( nCrDownId != GDB_ID_NULL) {
while ( nCrDownId != GDB_ID_NULL) {
vMchRRegDown.emplace_back( nCrDownId) ;
nCrDownId = m_pGeomDB->GetNextName( nCrDownId, MCH_PV_DOWN_RAWCUT) ;
}
// lavorazioni per regione superiore
int nCrUpId = m_pGeomDB->GetFirstNameInGroup( nClId, MCH_PV_UP_RAWCUT) ;
while ( nCrUpId != GDB_ID_NULL) {
vMchRRegUp.emplace_back( nCrUpId) ;
nCrUpId = m_pGeomDB->GetNextName( nCrUpId, MCH_PV_UP_RAWCUT) ;
}
}
// passo al successivo percorso utensile
nClId = m_pGeomDB->GetNextGroup( nClId) ;
}
}
// sottraggo queste regioni a quella del grezzo
for ( auto nMchRReg : vMchRReg) {
ExeSurfFrSubtract( nSfrId, nMchRReg) ;
}
// sottraggo le lavorazioni alle superfici del grezzo
for ( auto nMchRReg : vMchRRegUp)
ExeSurfFrSubtract( nSfrUpId, nMchRReg) ;
for ( auto nMchRReg : vMchRRegDown)
ExeSurfFrSubtract( nSfrDownId, nMchRReg) ;
// classifico i chunks della regione up e down per individuare le regioni che definiscono i nuovi grezzi
vector<pair<int,int>> vSurfRaws ;
AssociateSurfs( m_pGeomDB, nSfrUpId, nSfrDownId, vSurfRaws) ;
// creo i grezzi risultanti
// creo i nuovi grezzi
INTVECTOR vNewIds ;
int nCount ;
int nChunk = 0 ;
int nFirstLoopId = ExeExtractSurfFrChunkLoops( nSfrId, nChunk, nRawId, &nCount) ;
while ( nFirstLoopId != GDB_ID_NULL) {
// !!! in attesa di gestire i grezzi con i buchi !!!
// cancello le eventuali curve successive (sono i loop interni ovvero i buchi)
for ( int i = 1 ; i < nCount ; ++ i) {
m_pGeomDB->Erase( nFirstLoopId + i) ;
}
// dichiaro temporanea la curva
m_pGeomDB->SetLevel( nFirstLoopId, GDB_LV_TEMP) ;
// creo il grezzo
int nId = AddRawPart( nFirstLoopId, 0, dZmin, dHeight, cCol) ;
if ( nId == GDB_ID_NULL)
return GDB_ID_NULL ;
vNewIds.emplace_back( nId) ;
// imposto lo stato del contorno di questo grezzo come quello del grezzo di partenza
int nStat = GDB_ST_ON ;
if ( m_pGeomDB->GetStatus( nOutCrvId, nStat) && nStat == GDB_ST_OFF)
m_pGeomDB->SetStatus( m_pGeomDB->GetFirstNameInGroup( nId, MACH_RAW_OUTLINE), nStat) ;
// assegno la fase al gruppo
m_pGeomDB->SetInfo( nId, MACH_RAW_PHASE, m_nCurrPhase) ;
// se esiste il kerf uso questa curva per creare il kerf del nuovo grezzo
if ( ! IsNull( pSfrKerf)) {
// creo la regione con la curva
SurfFlatRegionByContours SfrCntr ;
SfrCntr.AddCurve( GetCurve( m_pGeomDB->RemoveGeoObjAndErase( nFirstLoopId))) ;
PtrOwner<ISurfFlatRegion> pSfrNewKerf( SfrCntr.GetSurf()) ;
if ( IsNull( pSfrNewKerf))
return GDB_ID_NULL ;
// la limito con la regione di kerf precedente (va bene anche se fallisce)
pSfrNewKerf->Intersect( *pSfrKerf) ;
// se risultato non vuoto
if ( pSfrNewKerf->IsValid()) {
// riferimento del nuovo grezzo
Frame3d frNewRaw ;
if ( ! m_pGeomDB->GetGroupGlobFrame( nId, frNewRaw))
return GDB_ID_NULL ;
// la porto dal riferimento del grezzo originale al riferimento di questo grezzo
pSfrNewKerf->LocToLoc( frRaw, frNewRaw) ;
// la porto sulla faccia sopra del grezzo
pSfrNewKerf->Translate( Vector3d( 0, 0, dHeight)) ;
// recupero il contorno e lo inserisco come kerf del nuovo grezzo
PtrOwner<ICurve> pCrv( pSfrNewKerf->GetLoop( 0, 0)) ;
int nNewKerfId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nId, Release( pCrv)) ;
if ( nNewKerfId == GDB_ID_NULL)
return GDB_ID_NULL ;
m_pGeomDB->CopyMaterial( nKerfId, nNewKerfId) ;
m_pGeomDB->SetName( nNewKerfId, MACH_RAW_KERF) ;
}
}
// altrimenti la cancello
else
m_pGeomDB->Erase( nFirstLoopId) ;
// passo alla prossima curva
++ nChunk ;
nFirstLoopId = ExeExtractSurfFrChunkLoops( nSfrId, nChunk, nRawId, &nCount) ;
}
// cancello la regione
m_pGeomDB->Erase( nSfrId) ;
// verifico esista almeno un nuovo grezzo
if ( vNewIds.empty())
return GDB_ID_NULL ;
INTVECTOR vNewIds ;
for ( int i = 0 ; i < int( vSurfRaws.size()) ; i++) {
// aggiungo il grezzo
int nId = AddRawPart( vSurfRaws[i].first, vSurfRaws[i].second, dHeight, cCol) ;
m_pGeomDB->Erase( vSurfRaws[i].first) ;
m_pGeomDB->Erase( vSurfRaws[i].second) ;
if ( nId == GDB_ID_NULL)
return GDB_ID_NULL ;
vNewIds.emplace_back( nId) ;
// imposto lo stato del contorno di questo grezzo come quello del grezzo di partenza
int nStat = GDB_ST_ON ;
if ( m_pGeomDB->GetStatus( nOutCrvId, nStat) && nStat == GDB_ST_OFF)
m_pGeomDB->SetStatus( m_pGeomDB->GetFirstNameInGroup( nId, MACH_RAW_OUTLINE), nStat) ;
// assegno la fase al gruppo
m_pGeomDB->SetInfo( nId, MACH_RAW_PHASE, m_nCurrPhase) ;
// se esiste il kerf uso questa curva per creare il kerf del nuovo grezzo
if ( ! IsNull( pSfrKerf)) {
// riferimento del nuovo grezzo
Frame3d frNewRaw ;
if ( ! m_pGeomDB->GetGroupGlobFrame( nId, frNewRaw))
return GDB_ID_NULL ;
// considero il nuovo kerf come la regione superiore del nuovo grezzo
int nSfrUpId = m_pGeomDB->GetFirstNameInGroup( nId, MACH_RAW_UP_REG) ;
if ( nSfrUpId == GDB_ID_NULL)
return GDB_ID_NULL ;
PtrOwner<ISurfFlatRegion> pSfrNewKerf( CloneSurfFlatRegion( m_pGeomDB->GetGeoObj( nSfrUpId))) ;
if ( IsNull( pSfrNewKerf))
return GDB_ID_NULL ;
// porto nello stesso riferimento del grezzo originale
pSfrNewKerf->LocToLoc( frNewRaw, frRaw) ;
// la limito con la regione di kerf precedente ( va bene anche se fallisce)
pSfrNewKerf->Intersect( *pSfrKerf) ;
// se risultato non vuoto
if ( pSfrNewKerf->IsValid()) {
// la porto dal riferimento del grezzo originale al riferimento di questo grezzo
pSfrNewKerf->LocToLoc( frRaw, frNewRaw) ;
// recupero il contorno esterno del chunk più grande e lo inserisco come kerf del nuovo grezzo
double dAreaMax = -1 ;
int nKMax = 0 ;
for ( int k = 0 ; k < pSfrNewKerf->GetChunkCount() ; k ++) {
PtrOwner<ISurfFlatRegion> pSfrChunk( pSfrNewKerf->CloneChunk( k)) ;
double dArea = -1 ; pSfrChunk->GetGrossArea( dArea) ;
if ( dArea > dAreaMax) {
nKMax = k ;
dAreaMax = dArea ;
}
}
PtrOwner<ICurve> pCrv( pSfrNewKerf->GetLoop( nKMax, 0)) ;
if ( IsNull( pCrv))
return GDB_ID_NULL ;
int nNewKerfId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nId, Release( pCrv)) ;
if ( nNewKerfId == GDB_ID_NULL)
return GDB_ID_NULL ;
m_pGeomDB->CopyMaterial( nKerfId, nNewKerfId) ;
m_pGeomDB->SetName( nNewKerfId, MACH_RAW_KERF) ;
}
}
}
// cancello le regioni usate per i conti
m_pGeomDB->Erase( nSfrUpId) ;
m_pGeomDB->Erase( nSfrDownId) ;
// verifico esista almeno un nuovo grezzo
if ( vNewIds.empty())
return GDB_ID_NULL ;
// inserisco i pezzi del grezzo originale nei nuovi grezzi
int nGroupId = m_pGeomDB->GetFirstGroupInGroup( nRawId) ;
while ( nGroupId != GDB_ID_NULL) {
@@ -1012,32 +1289,31 @@ MachMgr::SplitFlatRawPartWithMachinings( int nRawId, const INTVECTOR& vMchId)
// scambio con pezzo
int nPartId = SwapRawPartPart( nNewGroupId, true) ;
// verifico se il pezzo sta nel grezzo
int nLayerId = m_pGeomDB->GetFirstNameInGroup( nPartId, NST_EXT_LAYER) ;
int nLayerId = m_pGeomDB->GetFirstNameInGroup( nPartId, NST_PARTREG_LAYER) ;
if ( nLayerId == GDB_ID_NULL || m_pGeomDB->GetGdbType( nLayerId) != GDB_TY_GROUP)
nLayerId = m_pGeomDB->GetFirstGroupInGroup( nPartId) ;
int nEntId = m_pGeomDB->GetFirstInGroup( nLayerId) ;
int nEntGeoType = m_pGeomDB->GetGeoType( nEntId) ;
Point3d ptTest ;
if ( ( ( nEntGeoType & GEO_CURVE) != 0 && ExeMidPoint( nEntId, nNewId, ptTest)) ||
( ( nEntGeoType & GEO_CURVE) == 0 && ExeCenterPoint( nEntId, nNewId, ptTest))) {
// cerco la regione del pezzo
int nEntId = m_pGeomDB->GetFirstInGroup( nLayerId) ;
while ( nEntId != GDB_ID_NULL) {
int nEntGeoType = m_pGeomDB->GetGeoType( nEntId) ;
if ( nEntGeoType == SRF_FLATRGN)
break ;
nEntId = m_pGeomDB->GetNext( nEntId) ;
}
if ( nEntId != GDB_ID_NULL) {
// verifico se è interna al grezzo
int nOutCrvId = m_pGeomDB->GetFirstNameInGroup( nNewId, MACH_RAW_OUTLINE) ;
BBox3d b3Raw ; m_pGeomDB->GetGlobalBBox( nOutCrvId, b3Raw) ;
double dRawDiam = 0 ; b3Raw.GetDiameter( dRawDiam) ;
BBox3d b3Part ; m_pGeomDB->GetGlobalBBox( nEntId, b3Part) ;
double dPartDiam = 0 ; b3Part.GetDiameter( dPartDiam) ;
if ( dRawDiam > 0.9 * dPartDiam) {
ICurve* pCurve = GetCurve( m_pGeomDB->GetGeoObj( nOutCrvId)) ;
if ( pCurve != nullptr) {
int nSide ;
double dDist ;
DistPointCurve distPC( ptTest, *pCurve) ;
if ( distPC.GetDist( dDist) &&
( dDist < 100 * EPS_SMALL ||
( distPC.GetSideAtMinDistPoint( 0, Z_AX, nSide) && nSide != MDS_RIGHT)))
break ;
}
}
}
int nSfrUp = m_pGeomDB->GetFirstNameInGroup( nNewId, MACH_RAW_UP_REG) ;
if ( ! ExeSurfFrTestExternal( nSfrUp, nEntId, EPS_SMALL))
break ;
}
}
// altrimenti scambio pezzo ed elimino gruppo
nNewGroupId = SwapRawPartPart( nPartId, false) ;
m_pGeomDB->Erase( nNewGroupId) ;
@@ -1045,5 +1321,5 @@ MachMgr::SplitFlatRawPartWithMachinings( int nRawId, const INTVECTOR& vMchId)
nGroupId = m_pGeomDB->GetNextGroup( nGroupId) ;
}
return vNewIds[0] ;
return vNewIds[0] ;
}
+7
View File
@@ -130,6 +130,13 @@ MachMgr::FindToolInCurrSetup( const string& sTool)
return m_stuMgr.FindTool( sTool) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::GetToolSetupPosInCurrSetup( const string& sTool, string& sTcPos)
{
return m_stuMgr.GetToolSetupPos( sTool, sTcPos) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::GetToolsInCurrSetupPos( const string& sTcPos, STRVECTOR& vsTools)
+26 -4
View File
@@ -1,7 +1,7 @@
//----------------------------------------------------------------------------
// EgalTech 2015-2015
// EgalTech 2015-2023
//----------------------------------------------------------------------------
// File : MachMgrSimulation.cpp Data : 20.10.15 Versione : 1.6j2
// File : MachMgrSimulation.cpp Data : 16.01.23 Versione : 2.5a2
// Contenuto : Implementazione gestione simulazione della classe MachMgr.
//
//
@@ -150,13 +150,13 @@ MachMgr::SimExit( void)
//----------------------------------------------------------------------------
bool
MachMgr::SimAddCollisionObj( int nInd, int nFrameId, int nType, const Vector3d& vtMove, double dPar1, double dPar2, double dPar3)
MachMgr::SimAddCollisionObj( int nInd, bool bToolOn, int nFrameId, int nType, const Vector3d& vtMove, double dPar1, double dPar2, double dPar3)
{
// verifico simulatore
if ( m_pSimul == nullptr)
return false ;
// aggiungo un oggetto da verificare per la collisione con il grezzo
return m_pSimul->AddCollisionObj( nInd, nFrameId, nType, vtMove, dPar1, dPar2, dPar3) ;
return m_pSimul->AddCollisionObj( nInd, bToolOn, nFrameId, nType, vtMove, dPar1, dPar2, dPar3) ;
}
//----------------------------------------------------------------------------
@@ -180,3 +180,25 @@ MachMgr::SimOnCollision( int nCdInd, int nObjInd, int& nErr)
// lancio funzione di gestione collisione
return m_pSimul->OnCollision( nCdInd, nObjInd, nErr) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::SimSetToolForVmill( const string& sTool, const string& sHead, int nExit, const INTVECTOR& vVmill, bool bFirst)
{
// verifico simulatore
if ( m_pSimul == nullptr)
return false ;
// imposto utensile per Vmill
return m_pSimul->SetToolForVmill( sTool, sHead, nExit, vVmill, bFirst) ;
}
//----------------------------------------------------------------------------
int
MachMgr::SimMoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt)
{
// verifico simulatore
if ( m_pSimul == nullptr)
return SIM_AXMV_RES_ERR ;
// lancio movimento assi
return m_pSimul->MoveAxes( nMoveType, vAxNaEpSt) ;
}
+121 -22
View File
@@ -1,7 +1,7 @@
//----------------------------------------------------------------------------
// EgalTech 2015-2015
// EgalTech 2015-2021
//----------------------------------------------------------------------------
// File : Machine.cpp Data : 06.05.15 Versione : 1.6e3
// File : Machine.cpp Data : 14.10.21 Versione : 2.3j5
// Contenuto : Implementazione gestione macchina.
//
//
@@ -46,11 +46,20 @@ Machine::Machine( void)
m_nCalcExitId = GDB_ID_NULL ;
m_nCalcToolId = GDB_ID_NULL ;
m_dCalcRot1W = 1 ;
m_bCalcMaxDeltaR2On1 = true ;
m_nCalcSolCh = MCH_SCC_NONE ;
m_dCalcTLen = 0 ;
m_dCalcTRad = 0 ;
m_dCalcTOvLen = 0 ;
m_dCalcTOvRad = 0 ;
m_nTabLinAxes = 0 ;
m_nTabRotAxes = 0 ;
m_nHeadLinAxes = 0 ;
m_nHeadRotAxes = 0 ;
m_nHeadSpecRotAxis = -1 ;
m_frLinAx.Reset( false) ;
m_frRobot.Reset( false) ;
m_nCalcChainType = KIN_CHAIN_NONE ;
m_nMachineLook = MCH_LOOK_NONE ;
}
@@ -86,7 +95,7 @@ Machine::Clear( void)
//----------------------------------------------------------------------------
bool
Machine::Init( const string& sMachinesDir, const string& sMachineName, MachMgr* pMchMgr)
Machine::Init( const string& sMachineName, const string& sMachineDir, MachMgr* pMchMgr)
{
// pulisco
Clear() ;
@@ -96,7 +105,7 @@ Machine::Init( const string& sMachinesDir, const string& sMachineName, MachMgr*
m_pMchMgr = pMchMgr ;
m_pGeomDB = m_pMchMgr->GetGeomDB() ;
// verifico direttorio dati macchina
m_sMachineDir = sMachinesDir + "\\" + sMachineName ;
m_sMachineDir = sMachineDir ;
if ( ! ExistsDirectory( m_sMachineDir))
return false ;
// creo il gruppo per la macchina
@@ -134,6 +143,8 @@ Machine::Init( const string& sMachinesDir, const string& sMachineName, MachMgr*
m_nMachineLook = ( bOk ? MCH_LOOK_ALL : MCH_LOOK_NONE) ;
// metto tutti gli assi in posizione home
bOk = bOk && ResetAllAxesPos() ;
// reset catena cinematica corrente
m_nCalcChainType = KIN_CHAIN_NONE ;
return bOk ;
}
@@ -202,7 +213,7 @@ Machine::AdjustAuxGeometry( const STRVECTOR& vsAux, int nLay)
bool
Machine::LoadMachineTable( const string& sName, const string& sParent, int nType,
const Point3d& ptRef1, double dCoeffX, double dCoeffY, double dCoeffZ,
const string& sGeo, const STRVECTOR& vsAux)
const STRVECTOR& vsColl, const string& sGeo, const STRVECTOR& vsAux)
{
// recupero pezzo e layer della geometria originale della tavola
string sPart, sLay ;
@@ -241,7 +252,7 @@ Machine::LoadMachineTable( const string& sName, const string& sParent, int nType
Table* pTab = new(nothrow) Table ;
if ( pTab == nullptr)
return false ;
pTab->Set( sName, nType, ptRef1, b3Area1) ;
pTab->Set( sName, nType, ptRef1, b3Area1, vsColl) ;
m_pGeomDB->SetUserObj( nLay, pTab) ;
// lo inserisco nel dizionario dei gruppi della macchina
return m_mapGroups.emplace( sName, nLay).second ;
@@ -280,7 +291,7 @@ Machine::AdjustTable( int nLay, const Point3d& ptRef1)
//----------------------------------------------------------------------------
bool
Machine::LoadMachineAxis( const string& sName, const string& sParent, const string& sToken, bool bInvert,
int nType, const Point3d& ptPos, const Vector3d& vtDir, const STROKE& Stroke,
double dOffset, int nType, const Point3d& ptPos, const Vector3d& vtDir, const STROKE& Stroke,
double dHome, bool bAdjustAux, const string& sGeo, const STRVECTOR& vsAux)
{
// verifico sia di tipo ammesso
@@ -321,7 +332,7 @@ Machine::LoadMachineAxis( const string& sName, const string& sParent, const stri
Axis* pAxis = new(nothrow) Axis ;
if ( pAxis == nullptr)
return false ;
pAxis->Set( sName, sToken, bInvert, nType, ptPos, vtDir, Stroke, dHome) ;
pAxis->Set( sName, sToken, bInvert, dOffset, nType, ptPos, vtDir, Stroke, dHome) ;
m_pGeomDB->SetUserObj( nLay, pAxis) ;
// verifico il vettore rappresentativo dell'asse
if ( ! AdjustAxis( nLay, sPart, sName, nType, ptPos, vtDir, bAdjustAux))
@@ -434,8 +445,16 @@ Machine::ModifyMachineAxisPosition( const string& sName, const Point3d& ptPos)
Axis* pAx = GetAxis( nAxGrp) ;
if ( pAx == nullptr)
return false ;
// se valore dell'asse non nullo, lo annullo
double dCurrVal = pAx->GetCurrVal() ;
if ( abs( dCurrVal) > EPS_ZERO)
SetAxisPos( sName, 0, false) ;
// eseguo la modifica
return pAx->Modify( ptPos, m_dAxisMaxAdjust) ;
bool bOk = pAx->Modify( ptPos, m_dAxisMaxAdjust) ;
// ripristino l'asse al valore corrente
if ( abs( dCurrVal) > EPS_ZERO)
SetAxisPos( sName, dCurrVal, false) ;
return bOk ;
}
//----------------------------------------------------------------------------
@@ -451,8 +470,16 @@ Machine::ModifyMachineAxisDirection( const string& sName, const Vector3d& vtDir)
Axis* pAx = GetAxis( nAxGrp) ;
if ( pAx == nullptr)
return false ;
// se valore dell'asse non nullo, lo annullo
double dCurrVal = pAx->GetCurrVal() ;
if ( abs( dCurrVal) > EPS_ZERO)
SetAxisPos( sName, 0, false) ;
// eseguo la modifica
return pAx->Modify( vtDir, m_dAxisMaxRotAdj) ;
bool bOk = pAx->Modify( vtDir, m_dAxisMaxRotAdj) ;
// ripristino l'asse al valore corrente
if ( abs( dCurrVal) > EPS_ZERO)
SetAxisPos( sName, dCurrVal, false) ;
return bOk ;
}
//----------------------------------------------------------------------------
@@ -493,7 +520,7 @@ Machine::ModifyMachineAxisHome( const string& sName, double dHome)
bool
Machine::LoadMachineStdHead( const string& sName, const string& sParent, const string& sHSet,
const Point3d& ptPos, const Vector3d& vtTDir, const Vector3d& vtADir,
double dRot1W, const STROKE& Rot2Stroke, int nSolCh, const STRVECTOR& vsOthColl,
double dRot1W, bool bMaxDeltaR2On1, const STROKE& Rot2Stroke, int nSolCh, const STRVECTOR& vsOthColl,
const string& sGeo, const STRVECTOR& vsAux)
{
// recupero pezzo e layer della geometria originale della testa
@@ -521,7 +548,7 @@ Machine::LoadMachineStdHead( const string& sName, const string& sParent, const s
Head* pHead = new(nothrow) Head ;
if ( pHead == nullptr)
return false ;
pHead->Set( sName, MCH_HT_STD, 1, sHSet, vtADir, dRot1W, Rot2Stroke, nSolCh, vsOthColl) ;
pHead->Set( sName, MCH_HT_STD, 1, sHSet, 0, vtADir, dRot1W, bMaxDeltaR2On1, Rot2Stroke, nSolCh, vsOthColl) ;
m_pGeomDB->SetUserObj( nLay, pHead) ;
// aggiorno la testa capostipite
if ( ! AddHeadToSet( sHSet, sName))
@@ -541,8 +568,8 @@ Machine::LoadMachineStdHead( const string& sName, const string& sParent, const s
//----------------------------------------------------------------------------
bool
Machine::LoadMachineMultiHead( const string& sName, const string& sParent, const string& sHSet,
const MUEXITVECTOR& vMuExit, const Vector3d& vtADir,
double dRot1W, const STROKE& Rot2Stroke, int nSolCh, const STRVECTOR& vsOthColl,
int nSelectType, const MUEXITVECTOR& vMuExit, const Vector3d& vtADir,
double dRot1W, bool bMaxDeltaR2On1, const STROKE& Rot2Stroke, int nSolCh, const STRVECTOR& vsOthColl,
const string& sGeo, const STRVECTOR& vsAux)
{
// recupero pezzo e layer della geometria originale della testa
@@ -570,7 +597,8 @@ Machine::LoadMachineMultiHead( const string& sName, const string& sParent, const
Head* pHead = new(nothrow) Head ;
if ( pHead == nullptr)
return false ;
pHead->Set( sName, MCH_HT_MULTI, int( vMuExit.size()), sHSet, vtADir, dRot1W, Rot2Stroke, nSolCh, vsOthColl) ;
pHead->Set( sName, MCH_HT_MULTI, int( vMuExit.size()), sHSet, nSelectType,
vtADir, dRot1W, bMaxDeltaR2On1, Rot2Stroke, nSolCh, vsOthColl) ;
m_pGeomDB->SetUserObj( nLay, pHead) ;
// aggiorno la testa capostipite
if ( ! AddHeadToSet( sHSet, sName))
@@ -589,7 +617,7 @@ Machine::LoadMachineMultiHead( const string& sName, const string& sParent, const
bool
Machine::LoadMachineSpecialHead( const string& sName, const string& sParent, const string& sHSet,
const Point3d& ptPos, const Vector3d& vtTDir, const Vector3d& vtADir,
double dRot1W, const STROKE& Rot2Stroke, int nSolCh, const STRVECTOR& vsOthColl,
double dRot1W, bool bMaxDeltaR2On1, const STROKE& Rot2Stroke, int nSolCh, const STRVECTOR& vsOthColl,
const string& sGeo, const STRVECTOR& vsAux)
{
// recupero pezzo e layer della geometria originale della testa
@@ -617,7 +645,7 @@ Machine::LoadMachineSpecialHead( const string& sName, const string& sParent, con
Head* pHead = new(nothrow) Head ;
if ( pHead == nullptr)
return false ;
pHead->Set( sName, MCH_HT_SPECIAL, 1, sHSet, vtADir, dRot1W, Rot2Stroke, nSolCh, vsOthColl) ;
pHead->Set( sName, MCH_HT_SPECIAL, 1, sHSet, 0, vtADir, dRot1W, bMaxDeltaR2On1, Rot2Stroke, nSolCh, vsOthColl) ;
m_pGeomDB->SetUserObj( nLay, pHead) ;
// aggiorno la testa capostipite
if ( ! AddHeadToSet( sHSet, sName))
@@ -636,9 +664,9 @@ Machine::LoadMachineSpecialHead( const string& sName, const string& sParent, con
//----------------------------------------------------------------------------
bool
Machine::LoadMachineTcPos( const string& sName, const string& sParent,
const Point3d& ptPos, const Vector3d& vtTDir, const Vector3d& vtADir,
const string& sGeo, const STRVECTOR& vsAux)
Machine::LoadMachineStdTcPos( const string& sName, const string& sParent,
const Point3d& ptPos, const Vector3d& vtTDir, const Vector3d& vtADir,
const string& sGeo, const STRVECTOR& vsAux)
{
// recupero pezzo e layer della geometria originale della posizione nel cambio utensile
string sPart, sLay ;
@@ -678,6 +706,48 @@ Machine::LoadMachineTcPos( const string& sName, const string& sParent,
return m_mapGroups.emplace( sName, nLay).second ;
}
//----------------------------------------------------------------------------
bool
Machine::LoadMachineMultiTcPos( const string& sName, const string& sParent,
const MUEXITVECTOR& vMuExit, const Vector3d& vtADir,
const string& sGeo, const STRVECTOR& vsAux)
{
// recupero pezzo e layer della geometria originale della posizione nel cambio utensile
string sPart, sLay ;
Split( sGeo, "/", true, sPart, sLay) ;
// cerco il gruppo nella geometria originale
int nPart = m_pGeomDB->GetFirstNameInGroup( m_nTempGroupId, sPart) ;
int nLay = m_pGeomDB->GetFirstNameInGroup( nPart, sLay) ;
if ( nLay == GDB_ID_NULL)
return false ;
// cerco il gruppo padre per spostarvelo
int nParentId = GetGroup( sParent) ;
if ( nParentId == GDB_ID_NULL ||
! m_pGeomDB->RelocateGlob( nLay, nParentId, GDB_LAST_SON))
return false ;
// sistemo lo stato di visualizzazione
m_pGeomDB->SetStatus( nLay, GDB_ST_ON) ;
// gli assegno il nome
m_pGeomDB->SetName( nLay, sName) ;
// sistemo la geometria ausiliaria
if ( ! AdjustAuxGeometry( vsAux, nLay))
return false ;
// installo e inizializzo il gestore della posizione nel cambio utensile
TcPos* pTcPos = new(nothrow) TcPos ;
if ( pTcPos == nullptr)
return false ;
pTcPos->Set( sName, vtADir) ;
m_pGeomDB->SetUserObj( nLay, pTcPos) ;
// sistemo il riferimento dell'uscita rispetto alla direzione ausiliaria
if ( ! AdjustExitFrames( nLay, vMuExit, vtADir))
return false ;
// trasformazione del riferimento di uscita in gruppo di uscita
if ( ! CreateExitGroups( nLay, vMuExit))
return false ;
// lo inserisco nel dizionario dei gruppi della macchina
return m_mapGroups.emplace( sName, nLay).second ;
}
//----------------------------------------------------------------------------
int
Machine::GetGroup( const string& sGroup) const
@@ -801,6 +871,22 @@ Machine::EnableHeadInSet( const string& sHead)
return true ;
}
//----------------------------------------------------------------------------
bool
Machine::ModifyMachineHeadAuxDirection( const string& sHead, const Vector3d& vtADir)
{
// controllo GeomDB
if ( m_pGeomDB == nullptr)
return false ;
// recupero testa
int nHeadId = GetGroup( sHead) ;
Head* pHead = GetHead( nHeadId) ;
if ( pHead == nullptr)
return false ;
// eseguo la modifica
return pHead->ModifyHeadAuxDirection( vtADir) ;
}
//----------------------------------------------------------------------------
bool
Machine::AdjustExitFrames( int nLay, const MUEXITVECTOR& vMuExit, const Vector3d& vtADir)
@@ -895,7 +981,7 @@ Machine::CreateExitGroups( int nLay, const MUEXITVECTOR& vMuExit)
return false ;
}
else {
Vector3d vtRotAx = vtTDir ^ vtDirN ; vtRotAx.Normalize() ;
Vector3d vtRotAx = vtTDir ^ vtDirN ; vtRotAx.Normalize( EPS_ZERO) ;
string sOut = " Exit " + sName + " rotation = (" + ToString( dAngRot) + "/" + ToString( vtRotAx) + ")" ;
LOG_DBG_INFO( GetEMkLogger(), sOut.c_str()) ;
vtRotAx.ToLoc( frHead) ;
@@ -953,7 +1039,11 @@ Machine::ModifyMachineExitPosition( const string& sHead, int nExit, const Point3
if ( pExit == nullptr)
return false ;
// eseguo la modifica
return pExit->Modify( ptPos, m_dExitMaxAdjust) ;
if ( ! pExit->Modify( ptPos, m_dExitMaxAdjust))
return false ;
// eventuale aggiornamento variabile lua EMC.EXITPOS con la nuova posizione
LuaSetGlobVar( "EMC.EXITPOS", ptPos) ;
return true ;
}
//----------------------------------------------------------------------------
@@ -977,6 +1067,8 @@ Machine::SetLook( int nFlag)
nTabId = GetFirstTable() ;
if ( nTabId == GDB_ID_NULL)
return false ;
// il gruppo tavola corrente deve essere sempre visibile
m_pGeomDB->SetStatus( nTabId, GDB_ST_ON) ;
// nascondo o visualizzo i fratelli e tutti i fratelli degli ascendenti della tavola
bool bTabOnly = ( nFlag != MCH_LOOK_ALL) ;
int nTabCurrId = nTabId ;
@@ -1081,6 +1173,13 @@ Machine::IsLinkedRawPart( int nRawId) const
return ( find( m_vLinkedRawParts.begin(), m_vLinkedRawParts.end(), nRawId) != m_vLinkedRawParts.end()) ;
}
//----------------------------------------------------------------------------
const INTVECTOR&
Machine:: GetAllLinkedRawParts( void) const
{
return m_vLinkedRawParts ;
}
//----------------------------------------------------------------------------
bool
Machine::UnlinkRawPartFromGroup( int nRawPartId)
+61 -20
View File
@@ -1,7 +1,7 @@
//----------------------------------------------------------------------------
// EgalTech 2015-2015
// EgalTech 2015-2023
//----------------------------------------------------------------------------
// File : Machine.h Data : 06.05.15 Versione : 1.6e3
// File : Machine.h Data : 16.01.23 Versione : 2.5a2
// Contenuto : Dichiarazione della classe Machine.
//
//
@@ -34,7 +34,7 @@ class Machine
public :
Machine( void) ;
~Machine( void) ;
bool Init( const std::string& sMachinesDir, const std::string& sMachineName, MachMgr* pMchMgr) ;
bool Init( const std::string& sMachineName, const std::string& sMachineDir, MachMgr* pMchMgr) ;
const std::string& GetMachineName( void) const
{ return m_sName ; }
const std::string& GetMachineDir( void) const
@@ -53,16 +53,22 @@ class Machine
int GetHeadId( const std::string& sHead) const
{ int nId = GetGroup( sHead) ;
return ( IsHeadGroup( nId) ? nId : GDB_ID_NULL) ; }
int GetExitId( const std::string& sHead, int nExit) const
{ int nHeadId = GetHeadId( sHead) ;
int nId = ( m_pGeomDB != nullptr ? m_pGeomDB->GetFirstNameInGroup( nHeadId, MCH_EXIT + ToString( nExit)) : GDB_ID_NULL) ;
return ( IsExitGroup( nId) ? nId : GDB_ID_NULL) ; }
int GetTcPosId( const std::string& sTcPos) const
{ int nId = GetGroup( sTcPos) ;
return ( IsTcPosGroup( nId) ? nId : GDB_ID_NULL) ; }
bool GetAllTablesNames( STRVECTOR& vNames) const ;
bool GetAllAxesNames( STRVECTOR& vNames) const ;
bool GetAllHeadsNames( STRVECTOR& vNames) const ;
bool GetAllTcPosNames( STRVECTOR& vNames) const ;
int GetFirstTable( void) const ;
int GetHeadExitCount( const std::string& sHead) const ;
int GetHeadExitPosDirAux( const std::string& sHead, int nExit, Point3d& ptPos, Vector3d& vtDir, Vector3d& vtAux) const ;
int GetHeadSolCh( const std::string& sHead) const ;
int GetHeadSelectType(const std::string& sHead) const ;
double GetAngDeltaMinForHome( void) const
{ return m_dAngDeltaMinForHome ; }
bool LoadTool( const std::string& sHead, int nExit, const std::string& sTool) ;
@@ -75,8 +81,9 @@ class Machine
bool ResetHeadSet( const std::string& sHead) ;
bool GetAxisToken( const std::string& sAxis, std::string& sToken) const ;
bool GetAxisInvert( const std::string& sAxis, bool& bInvert) const ;
bool GetAxisOffset( const std::string& sAxis, double& dOffset) const ;
bool GetAxisType( const std::string& sAxis, bool& bLinear) const ;
bool SetAxisPos( const std::string& sAxis, double dVal, double* pdNewVal = nullptr) ;
bool SetAxisPos( const std::string& sAxis, double dVal, bool bInStroke = true, double* pdNewVal = nullptr) ;
bool GetAxisPos( const std::string& sAxis, double& dVal) const ;
bool GetAxisMin( const std::string& sAxis, double& dMin) const ;
bool GetAxisMax( const std::string& sAxis, double& dMax) const ;
@@ -90,7 +97,8 @@ class Machine
bool GetCurrTableRef1( Point3d& ptRef1) const ;
bool GetCurrTableArea1( BBox3d& b3Area1) const ;
bool GetCurrTableDeltaRef1( Vector3d& vtDelta1) const ;
bool GetCurrTableIsTilting( bool& bTilting) const ;
bool GetCurrTableIsTilting( bool& bTilting, Vector3d& vtTiltingAx) const ;
bool GetCurrTableCollGroups( INTVECTOR& vIds) const ;
bool SetCurrTool( const std::string& sTool, const std::string& sHead, int nExit) ;
bool ResetCurrTool( void) ;
int GetCurrTool( void) const ;
@@ -100,7 +108,10 @@ class Machine
int GetCurrExit( void) const ;
bool GetCurrExit( int& nExit) const ;
bool GetCurrHeadCollGroups( INTVECTOR& vIds) const ;
double GetCurrRot1W( void) const ;
double GetCurrRot1W( void) const
{ return m_dCalcRot1W ; }
bool GetCurrMaxDeltaR2OnFirst( void) const
{ return m_bCalcMaxDeltaR2On1 ; }
std::string GetKinematicAxis( int nInd) const ;
bool BlockKinematicRotAxis( const std::string& sName, double dVal) ;
bool BlockKinematicRotAxis( int nId, double dVal) ;
@@ -112,21 +123,27 @@ class Machine
int GetCurrLinAxes( void) const ;
int GetCurrRotAxes( void) const ;
bool GetCurrAxisName( int nInd, std::string& sAxName) const ;
bool GetAllCurrAxesName( STRVECTOR& vAxName) const ;
bool GetAllCurrAxesNames( STRVECTOR& vAxName) const ;
bool GetCurrAxisToken( int nInd, std::string& sAxToken) const ;
bool GetAllCurrAxesToken( STRVECTOR& vAxToken) const ;
bool GetAllCurrAxesTokens( STRVECTOR& vAxToken) const ;
bool GetCurrAxisMin( int nInd, double& dMin) const ;
bool GetCurrAxisMax( int nInd, double& dMax) const ;
bool GetCurrAxisOffset( int nInd, double& dOffset) const ;
bool GetCurrAxisInvert( int nInd, bool& bInvert) const ;
bool GetCurrAxisHomePos( int nInd, double& dHome) const ;
bool GetAllCurrAxesHomePos( DBLVECTOR& vAxHomeVal) const ;
const Frame3d& GetCurrLinAxesFrame( void) const
{ return m_frLinAx ; }
int GetCurrKinematicChainType( void) const
{ return m_nCalcChainType ; }
bool GetAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
int& nStat, double& dAngA1, double& dAngB1, double& dAngA2, double& dAngB2) const ;
bool GetAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
int& nStat, DBLVECTOR& vAng1, DBLVECTOR& vAng2) const ;
bool GetPositions( const Point3d& ptP, const DBLVECTOR& vAng,
int& nStat, double& dX, double& dY, double& dZ) const ;
bool GetHeadOffsetDelta( const DBLVECTOR& vAng,
double& dRecX, double& dRecY, double& dRecZ) const ;
bool GetRobotAngles( const Point3d& ptP, const Vector3d& vtDirT, const Vector3d& vtDirA,
DBLVECTOR& vAng1, DBLVECTOR& vAng2) const ;
bool GetNoseFromPositions( double dX, double dY, double dZ, const DBLVECTOR& vAng,
Point3d& ptNose) const ;
bool GetTipFromPositions( double dX, double dY, double dZ, const DBLVECTOR& vAng,
@@ -151,6 +168,7 @@ class Machine
{ return m_nMachineLook ; }
bool LinkRawPartToGroup( int nRawPartId, const std::string& sGroupName) ;
bool IsLinkedRawPart( int nRawId) const ;
const INTVECTOR& GetAllLinkedRawParts( void) const ;
bool UnlinkRawPartFromGroup( int nRawPartId) ;
bool UnlinkAllRawPartsFromGroups( void) ;
bool LinkFixtureToGroup( int nFxtId, const std::string& sGroupName) ;
@@ -181,10 +199,10 @@ class Machine
bool AdjustAuxGeometry( const STRVECTOR& vsAux, int nLay) ;
bool LoadMachineTable( const std::string& sName, const std::string& sParent, int nType,
const Point3d& ptRef1, double dCoeffX, double dCoeffY, double dCoeffZ,
const std::string& sGeo, const STRVECTOR& vsAux) ;
const STRVECTOR& vsColl, const std::string& sGeo, const STRVECTOR& vsAux) ;
bool AdjustTable( int nLay, const Point3d& ptRef1) ;
bool LoadMachineAxis( const std::string& sName, const std::string& sParent, const std::string& sToken,
bool bInvert, int nType, const Point3d& ptPos, const Vector3d& vtDir, const STROKE& Stroke,
bool LoadMachineAxis( const std::string& sName, const std::string& sParent, const std::string& sToken, bool bInvert,
double dOffset, int nType, const Point3d& ptPos, const Vector3d& vtDir, const STROKE& Stroke,
double dHome, bool bAdjustAux, const std::string& sGeo, const STRVECTOR& vsAux) ;
bool AdjustAxis( int nLay, const std::string& sPart, const std::string& sName,
int nType, const Point3d& ptPos, const Vector3d& vtDir, bool bAdjustAux) ;
@@ -194,19 +212,22 @@ class Machine
bool ModifyMachineAxisHome( const std::string& sName, double dHome) ;
bool LoadMachineStdHead( const std::string& sName, const std::string& sParent, const std::string& sHSet,
const Point3d& ptPos, const Vector3d& vtTDir, const Vector3d& vtADir,
double dRot1W, const STROKE& Rot2Stroke, int nSolCh, const STRVECTOR& vsOthColl,
double dRot1W, bool bMaxDeltaR2On1, const STROKE& Rot2Stroke, int nSolCh, const STRVECTOR& vsOthColl,
const std::string& sGeo, const STRVECTOR& vsAux) ;
bool LoadMachineMultiHead( const std::string& sName, const std::string& sParent, const std::string& sHSet,
const MUEXITVECTOR& vMuExit, const Vector3d& vtADir,
double dRot1W, const STROKE& Rot2Stroke, int nSolCh, const STRVECTOR& vsOthColl,
int nSelectType, const MUEXITVECTOR& vMuExit, const Vector3d& vtADir,
double dRot1W, bool bMaxDeltaR2On1, const STROKE& Rot2Stroke, int nSolCh, const STRVECTOR& vsOthColl,
const std::string& sGeo, const STRVECTOR& vsAux) ;
bool LoadMachineSpecialHead( const std::string& sName, const std::string& sParent, const std::string& sHSet,
const Point3d& ptPos, const Vector3d& vtTDir, const Vector3d& vtADir,
double dRot1W, const STROKE& Rot2Stroke, int nSolCh, const STRVECTOR& vsOthColl,
double dRot1W, bool bMaxDeltaR2On1, const STROKE& Rot2Stroke, int nSolCh, const STRVECTOR& vsOthColl,
const std::string& sGeo, const STRVECTOR& vsAux) ;
bool LoadMachineTcPos( const std::string& sName, const std::string& sParent,
const Point3d& ptPos, const Vector3d& vtTDir, const Vector3d& vtADir,
const std::string& sGeo, const STRVECTOR& vsAux) ;
bool LoadMachineStdTcPos( const std::string& sName, const std::string& sParent,
const Point3d& ptPos, const Vector3d& vtTDir, const Vector3d& vtADir,
const std::string& sGeo, const STRVECTOR& vsAux) ;
bool LoadMachineMultiTcPos( const std::string& sName, const std::string& sParent,
const MUEXITVECTOR& vMuExit, const Vector3d& vtADir,
const std::string& sGeo, const STRVECTOR& vsAux) ;
int GetGroup( const std::string& sGroup) const ;
bool IsBaseGroup( int nGroup) const ;
Axis* GetAxis( int nGroup) const ;
@@ -230,6 +251,7 @@ class Machine
const STRVECTOR& GetHSet( const std::string& sHead) const ;
bool EnableHeadInSet( const std::string& sHead) ;
bool LoadTool( Exit* pExit, const std::string& sTool) ;
bool ModifyMachineHeadAuxDirection( const std::string& sHead, const Vector3d& vtADir) ;
bool AdjustExitFrames( int nLay, const MUEXITVECTOR& vMuExit, const Vector3d& vtADir) ;
bool CreateExitGroups( int nLay, const MUEXITVECTOR& vMuExit) ;
bool ModifyMachineExitPosition( const std::string& sHead, int nExit, const Point3d& ptPos) ;
@@ -277,6 +299,7 @@ class Machine
int m_nCalcExitId ; // uscita corrente per calcoli
int m_nCalcToolId ; // utensile corrente per calcoli
double m_dCalcRot1W ; // peso del primo asse rotante per i confronti
bool m_bCalcMaxDeltaR2On1 ; // flag utilizzo controllo massimo delta secondo asse rotante su inizio lavorazione
int m_nCalcSolCh ; // criterio di scelta della soluzione
bool m_bSolChExact ; // flag per scelta soluzione da soddisfare esattamente
Point3d m_ptCalcPos ; // posizione utensile a riposo per calcoli
@@ -286,8 +309,18 @@ class Machine
double m_dCalcTRad ; // raggio utensile corrente per calcoli
double m_dCalcTOvLen ; // lunghezza di ingombro utensile corrente per calcoli
double m_dCalcTOvRad ; // raggio di ingombro utensile corrente per calcoli
int m_nTabLinAxes ; // numero assi lineari attivi di tavola per calcoli
int m_nTabRotAxes ; // numero assi rotanti attivi di tavola per calcoli
int m_nHeadLinAxes ; // numero assi lineari attivi di testa per calcoli
int m_nHeadRotAxes ; // numero assi rotanti attivi di testa per calcoli
int m_nHeadSpecRotAxis ; // indice eventuale asse rotante speciale di testa prima dei lineari di testa (-1 non esiste)
KINAXISVECTOR m_vCalcLinAx ; // vettore assi lineari attivi per calcoli
KINAXISVECTOR m_vCalcRotAx ; // vettore assi rotanti attivi per calcoli
Frame3d m_frLinAx ; // sistema di riferimento definito dagli assi lineari
Frame3d m_frRobot ; // sistema di riferimento canonico del robot
int m_nCalcChainType ; // tipologia testa attiva (nulla, centro di lavoro o robot)
Point3d m_ptWristCen ; // centro del polso sferico nel riferimento testa/uscita di calcolo
Vector3d m_vtWristRef ; // direzione del polso sferico nel riferimento testa/uscita di calcolo
mutable OutStroke m_OutstrokeInfo ; // informazioni su ultima extra corsa
// stato di visualizzazione
int m_nMachineLook ; // stato di visualizzazione della macchina
@@ -306,10 +339,13 @@ class Machine
static int LuaEmtMultiHead( lua_State* L) ;
static int LuaEmtSpecialHead( lua_State* L) ;
static int LuaEmtTcPos( lua_State* L) ;
static int LuaEmtStdTcPos( lua_State* L) ;
static int LuaEmtMultiTcPos( lua_State* L) ;
static int LuaEmtModifyAxisPosition( lua_State* L) ;
static int LuaEmtModifyAxisDirection( lua_State* L) ;
static int LuaEmtModifyAxisStroke( lua_State* L) ;
static int LuaEmtModifyAxisHome( lua_State* L) ;
static int LuaEmtModifyHeadAuxDirection( lua_State* L) ;
static int LuaEmtModifyExitPosition( lua_State* L) ;
static int LuaEmtAddRapidStart( lua_State* L) ;
static int LuaEmtAddRapidMove( lua_State* L) ;
@@ -319,6 +355,7 @@ class Machine
static int LuaEmtGetAxesPos( lua_State* L) ;
static int LuaEmtGetBackAuxDir( lua_State* L) ;
static int LuaEmtLinkRawPartToGroup( lua_State* L) ;
static int LuaEmtGetAllLinkedRawParts( lua_State* L) ;
static int LuaEmtUnlinkRawPartFromGroup( lua_State* L) ;
static int LuaEmtUnlinkAllRawPartsFromGroups( lua_State* L) ;
static int LuaEmtLinkFixtureToGroup( lua_State* L) ;
@@ -335,6 +372,10 @@ class Machine
static int LuaEmtAddCollisionObjEx( lua_State* L) ;
static int LuaEmtExecCollisionCheck( lua_State* L) ;
static int LuaEmtOnCollision( lua_State* L) ;
static int LuaEmtSetToolForVmill( lua_State* L) ;
static int LuaEmtAddToolForVmill( lua_State* L) ;
static int LuaEmtMoveAxes( lua_State* L) ;
} ;
//----------------------------------------------------------------------------
+35 -5
View File
@@ -19,9 +19,26 @@
#include "/EgtDev/Include/EGkGeoVector3d.h"
#include "/EgtDev/Include/EGnStringUtils.h"
#include "/EgtDev/Include/EGnFileUtils.h"
#include "/EgtDev/Include/EgtNumUtils.h"
using namespace std ;
//----------------------------------------------------------------------------
bool
Machine::GetAllAxesNames( STRVECTOR& vNames) const
{
// reset lista nomi
vNames.clear() ;
// ricerca degli assi
for ( const auto& snGro : m_mapGroups) {
if ( IsAxisGroup( snGro.second))
vNames.push_back( snGro.first) ;
}
// ordino alfabeticamente
sort( vNames.begin(), vNames.end()) ;
return true ;
}
//----------------------------------------------------------------------------
bool
Machine::GetAxisToken( const string& sAxis, string& sToken) const
@@ -54,6 +71,22 @@ Machine::GetAxisInvert( const string& sAxis, bool& bInvert) const
return true ;
}
//----------------------------------------------------------------------------
bool
Machine::GetAxisOffset( const string& sAxis, double& dOffset) const
{
// controllo GeomDB
if ( m_pGeomDB == nullptr)
return false ;
// recupero il relativo gestore
Axis* pAx = GetAxis( GetGroup( sAxis)) ;
if ( pAx == nullptr)
return false ;
// recupero il valore di offset dell'asse in visualizzazione
dOffset = pAx->GetOffset() ;
return true ;
}
//----------------------------------------------------------------------------
bool
Machine::GetAxisType( const string& sAxis, bool& bLinear) const
@@ -72,7 +105,7 @@ Machine::GetAxisType( const string& sAxis, bool& bLinear) const
//----------------------------------------------------------------------------
bool
Machine::SetAxisPos( const string& sAxis, double dVal, double* pdNewVal)
Machine::SetAxisPos( const string& sAxis, double dVal, bool bInStroke, double* pdNewVal)
{
// controllo GeomDB
if ( m_pGeomDB == nullptr)
@@ -98,10 +131,7 @@ Machine::SetAxisPos( const string& sAxis, double dVal, double* pdNewVal)
Vector3d vtDir = pGV->GetVector() ;
vtDir.Normalize() ;
// limito il movimento alla corsa dell'asse
if ( dVal > Stroke.Max)
dVal = Stroke.Max ;
else if ( dVal < Stroke.Min)
dVal = Stroke.Min ;
dVal = Clamp( dVal, Stroke.Min, Stroke.Max) ;
// eseguo il movimento
if ( bLinear)
m_pGeomDB->TranslateGroup( nAxGrp, vtDir * ( dVal - dCurrVal)) ;
+523 -117
View File
@@ -24,11 +24,13 @@
#include "/EgtDev/Include/EGkGeoVector3d.h"
#include "/EgtDev/Include/EGnStringUtils.h"
#include "/EgtDev/Include/EGnFileUtils.h"
#include "/EgtDev/Include/EgtNumUtils.h"
using namespace std ;
//----------------------------------------------------------------------------
static const string EMC_VAR = "EMC" ; // tabella variabili locali per calcolo
static const string EVAR_VER = ".VER" ; // (string) versione della Dll
static const string EVAR_TABNAME = ".TABNAME" ; // (string) nome della tavola macchina
static const string EVAR_HEAD = ".HEAD" ; // (string) nome della testa
static const string EVAR_EXIT = ".EXIT" ; // (int) numero dell'uscita
@@ -37,6 +39,7 @@ static const string EVAR_TOTDIAM = ".TOTDIAM" ; // (num) diametro di in
static const string EVAR_TOTLEN = ".TOTLEN" ; // (num) lunghezza di ingombro dell'utensile
static const string EVAR_DIST = ".DIST" ; // (num) distanza dell'utensile (per seghe a catena)
static const string EVAR_EXITPOS = ".EXITPOS" ; // (point) posizione attuale dell'uscita
static const string EVAR_USERNOTES = ".USERNOTES" ; // (string) note utente dell'utensile
static const string EVAR_TCPOS = ".TCPOS" ; // (string) posizione nell'attrezzaggio
static const string EVAR_L1 = ".L1" ; // (num) valore del primo asse lineare
static const string EVAR_L2 = ".L2" ; // (num) valore del secondo asse lineare
@@ -68,12 +71,15 @@ Machine::SetCurrTable( const string& sTable)
m_nCalcTabId = GDB_ID_NULL ;
return false ;
}
// il gruppo tavola corrente deve essere sempre visibile
m_pGeomDB->SetStatus( m_nCalcTabId, GDB_ST_ON) ;
// lancio eventuale funzione lua di personalizzazione
if ( LuaExistsFunction( ON_SET_TABLE)) {
// salvo eventuale variabile EMC_VAR già presente
bool bOldEMC = LuaChangeNameGlobVar( EMC_VAR, EMC_VAR_BACKUP) ;
// definisco variabili
bool bOk = LuaCreateGlobTable( EMC_VAR) ;
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_VER, GetEMkVer()) ;
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_TABNAME, sTable) ;
// chiamo funzione
bOk = bOk && LuaCallFunction( ON_SET_TABLE) ;
@@ -167,13 +173,25 @@ Machine::GetCurrTableDeltaRef1( Vector3d& vtDelta1) const
//----------------------------------------------------------------------------
bool
Machine::GetCurrTableIsTilting( bool& bTilting) const
Machine::GetCurrTableIsTilting( bool& bTilting, Vector3d& vtTiltingAx) const
{
// default
bTilting = false ;
vtTiltingAx = V_NULL ;
// verifico esistenza tavola
if ( m_nCalcTabId == GDB_ID_NULL)
return false ;
// verifico se presente flag che lo forza come tale
int nTiltingLike ;
if ( m_pGeomDB->GetInfo( m_nCalcTabId, MCH_TILTINGLIKE, nTiltingLike) && nTiltingLike != 0) {
bTilting = true ;
switch ( abs( nTiltingLike)) {
default : vtTiltingAx = X_AX ; break ;
case 2 : vtTiltingAx = Y_AX ; break ;
case 3 : vtTiltingAx = Z_AX ; break ;
}
return true ;
}
// recupero gli eventuali assi rotanti della tavola
int nTParId = m_pGeomDB->GetParentId( m_nCalcTabId) ;
if ( nTParId == GDB_ID_NULL)
@@ -186,6 +204,7 @@ Machine::GetCurrTableIsTilting( bool& bTilting) const
// verifico se asse rotante orizzontale
if ( pAx->GetType() == MCH_AT_ROTARY && abs( pAx->GetDir().z) < EPS_SMALL) {
bTilting = true ;
vtTiltingAx = pAx->GetDir() ;
return true ;
}
// risalgo lungo la catena
@@ -195,6 +214,31 @@ Machine::GetCurrTableIsTilting( bool& bTilting) const
return true ;
}
//----------------------------------------------------------------------------
bool
Machine::GetCurrTableCollGroups( INTVECTOR& vIds) const
{
// controllo GeomDB
if ( m_pGeomDB == nullptr)
return false ;
// recupero la tavola corrente
Table* pTab = GetTable( m_nCalcTabId) ;
if ( pTab == nullptr)
return false ;
// recupero stringhe con gruppi ausiliari di collisione
const STRVECTOR& vsColl = pTab->GetCollGroups() ;
for ( const auto& sColl : vsColl) {
string sGrp, sSub ;
Split( sColl, "/", true, sGrp, sSub) ;
int nId = GetGroup( sGrp) ;
if ( ! sSub.empty() && nId != GDB_ID_NULL)
nId = m_pGeomDB->GetFirstNameInGroup( nId, sSub) ;
if ( nId != GDB_ID_NULL)
vIds.push_back( nId) ;
}
return true ;
}
//----------------------------------------------------------------------------
bool
Machine::SetCurrTool( const string& sTool, const string& sHead, int nExit)
@@ -209,7 +253,9 @@ Machine::SetCurrTool( const string& sTool, const string& sHead, int nExit)
// recupero i dati della testa
Head* pHead = GetHead( nHeadId) ;
if ( pHead == nullptr) {
string sOut = "Missing head " + sHead + " for tool " + sTool ;
string sOutHead = ( IsEmptyOrSpaces( sHead) ? "???" : sHead) ;
string sOutTool = ( IsEmptyOrSpaces( sTool) ? "???" : sTool) ;
string sOut = "Missing head " + sOutHead + " for tool " + sOutTool ;
LOG_ERROR( GetEMkLogger(), sOut.c_str())
return false ;
}
@@ -230,6 +276,7 @@ Machine::SetCurrTool( const string& sTool, const string& sHead, int nExit)
double dTOvLen = 0 ;
double dTOvDiam = 0 ;
double dTDist = 0 ;
string sTUserNotes = "" ;
string sTcPos = "" ;
// se definito
if ( ! sTool.empty()) {
@@ -248,7 +295,8 @@ Machine::SetCurrTool( const string& sTool, const string& sHead, int nExit)
! m_pMchMgr->TdbGetCurrToolParam( TPA_LEN, dTLen) ||
! m_pMchMgr->TdbGetCurrToolParam( TPA_DIAM, dTDiam) ||
! m_pMchMgr->TdbGetCurrToolParam( TPA_TOTLEN, dTOvLen) ||
! m_pMchMgr->TdbGetCurrToolParam( TPA_TOTDIAM, dTOvDiam))
! m_pMchMgr->TdbGetCurrToolParam( TPA_TOTDIAM, dTOvDiam) ||
! m_pMchMgr->TdbGetCurrToolParam( TPA_USERNOTES, sTUserNotes))
return false ;
m_pMchMgr->TdbGetCurrToolParam( TPA_DIST, dTDist) ; // opzionale
if ( ! m_pMchMgr->GetCurrSetupMgr().GetToolSetupPos( sTool, sTcPos))
@@ -273,6 +321,7 @@ Machine::SetCurrTool( const string& sTool, const string& sHead, int nExit)
m_nCalcExitId = nExitId ;
m_nCalcToolId = nToolId ;
m_dCalcRot1W = pHead->GetRot1W() ;
m_bCalcMaxDeltaR2On1 = pHead->GetMaxDeltaR2On1() ;
m_nCalcSolCh = pHead->GetSolCh() ;
m_ptCalcPos = pExit->GetPos() ;
m_vtCalcDir = pExit->GetTDir() ;
@@ -287,6 +336,7 @@ Machine::SetCurrTool( const string& sTool, const string& sHead, int nExit)
bool bOldEMC = LuaChangeNameGlobVar( EMC_VAR, EMC_VAR_BACKUP) ;
// definisco variabili
bool bOk = LuaCreateGlobTable( EMC_VAR) ;
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_VER, GetEMkVer()) ;
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_HEAD, sHead) ;
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_EXIT, nExit) ;
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_TOOL, sTool) ;
@@ -294,6 +344,7 @@ Machine::SetCurrTool( const string& sTool, const string& sHead, int nExit)
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_TOTDIAM, dTOvDiam) ;
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_TOTLEN, dTOvLen) ;
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_DIST, dTDist) ;
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_USERNOTES, sTUserNotes) ;
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_TCPOS, sTcPos) ;
// chiamo funzione
bOk = bOk && LuaCallFunction( ON_SET_HEAD) ;
@@ -427,14 +478,6 @@ Machine::GetCurrHeadCollGroups( INTVECTOR& vIds) const
return true ;
}
//----------------------------------------------------------------------------
double
Machine::GetCurrRot1W( void) const
{
// restituisco il peso del primo asse rotante nei confronti di movimento
return m_dCalcRot1W ;
}
//----------------------------------------------------------------------------
bool
Machine::CalculateKinematicChain( void)
@@ -443,8 +486,16 @@ Machine::CalculateKinematicChain( void)
if ( m_pGeomDB == nullptr)
return false ;
// azzero tutti gli assi della catena cinematica
m_nTabLinAxes = 0 ;
m_nTabRotAxes = 0 ;
m_nHeadLinAxes = 0 ;
m_nHeadRotAxes = 0 ;
m_nHeadSpecRotAxis = -1 ;
m_vCalcLinAx.clear() ;
m_vCalcRotAx.clear() ;
m_frLinAx.Reset( false) ;
m_frRobot.Reset( false) ;
m_nCalcChainType = KIN_CHAIN_NONE ;
// recupero gli assi di tavola
if ( m_nCalcTabId == GDB_ID_NULL)
return false ;
@@ -467,35 +518,120 @@ Machine::CalculateKinematicChain( void)
return false ;
nHParId = m_pGeomDB->GetParentId( nHParId) ;
}
// verifiche sugli assi lineari :
// devono essere 3
if ( m_vCalcLinAx.size() != 3)
// se non ci sono assi, né lineari né rotanti, sicuramente errore
if ( m_nTabLinAxes == 0 && m_nHeadLinAxes == 0 &&
m_nTabRotAxes == 0 && m_nHeadRotAxes == 0) {
LOG_ERROR( GetEMkLogger(), "Errors in Axes : none have been found")
return false ;
}
// se nessun asse lineare deve essere un robot (in futuro va permesso un lineare di tavola)
if ( m_nTabLinAxes == 0 && m_nHeadLinAxes == 0) {
// verifico ci siano 6 assi rotanti tutti di testa (in futuro va permesso un rotante di tavola)
if ( m_nTabRotAxes != 0 || m_nHeadRotAxes != 6) {
LOG_ERROR( GetEMkLogger(), "Robot with errors in Rotary Axes : number or type")
return false ;
}
// riordino gli assi rotanti
swap( m_vCalcRotAx[0], m_vCalcRotAx[5]) ;
swap( m_vCalcRotAx[1], m_vCalcRotAx[4]) ;
swap( m_vCalcRotAx[2], m_vCalcRotAx[3]) ;
// determino il riferimento canonico del robot
if ( ! m_frRobot.Set( m_vCalcRotAx[0].ptPos, m_vCalcRotAx[0].vtDir, m_vCalcRotAx[3].vtDir)) {
LOG_ERROR( GetEMkLogger(), "Robot with errors in Rotary Axes : impossible canonic frame")
return false ;
}
// porto tutti gli assi cinematici e i dati testa nel riferimento canonico
for ( int i = 0 ; i < m_nHeadRotAxes ; ++ i) {
m_vCalcRotAx[i].ptPos.ToLoc( m_frRobot) ;
m_vCalcRotAx[i].vtDir.ToLoc( m_frRobot) ;
}
m_ptCalcPos.ToLoc( m_frRobot) ;
m_vtCalcDir.ToLoc( m_frRobot) ;
m_vtCalcADir.ToLoc( m_frRobot) ;
// direzione assi rotanti deve essere Z Y Y X Y X
if ( ! m_vCalcRotAx[0].vtDir.IsZ() ||
! m_vCalcRotAx[1].vtDir.IsY() ||
! m_vCalcRotAx[2].vtDir.IsY() ||
! m_vCalcRotAx[3].vtDir.IsX() ||
! m_vCalcRotAx[4].vtDir.IsY() ||
! m_vCalcRotAx[5].vtDir.IsX()) {
LOG_ERROR( GetEMkLogger(), "Robot with errors in Rotary Axes : not ZYY-XYX")
return false ;
}
// verifico che gli ultimi 3 assi formino un polso sferico (ovvero passino per uno stesso punto)
if ( abs( m_vCalcRotAx[3].ptPos.y - m_vCalcRotAx[5].ptPos.y) > EPS_SMALL ||
abs( m_vCalcRotAx[3].ptPos.z - m_vCalcRotAx[5].ptPos.z) > EPS_SMALL ||
abs( m_vCalcRotAx[4].ptPos.z - m_vCalcRotAx[3].ptPos.z) > EPS_SMALL) {
LOG_ERROR( GetEMkLogger(), "Robot with errors in Rotary Axes : not spherical Wrist")
return false ;
}
// calcolo il centro del polso in coordinate globali (R5.x, R6.y, R5.z)
Point3d ptCenG( m_vCalcRotAx[4].ptPos.x, m_vCalcRotAx[5].ptPos.y, m_vCalcRotAx[4].ptPos.z) ;
// recupero il riferimento dell'uscita (da posizione, direzione utensile e direzione ausiliaria)
Frame3d frExit ;
if ( ! frExit.Set( m_ptCalcPos, m_vtCalcDir, m_vtCalcADir))
return false ;
// calcolo il centro del polso in locale a questo riferimento
m_ptWristCen = GetToLoc( ptCenG, frExit) ;
// calcolo la direzione di riferimento del polso in locale a questo riferimento
m_vtWristRef = GetToLoc( m_vCalcRotAx[5].vtDir, frExit) ;
// dichiaro tipo robot
m_nCalcChainType = KIN_CHAIN_ROBOT ;
return true ;
}
// verifiche sugli assi lineari :
// aggiusto gli indici di ordine sulla sua catena cinematica (1-based)
for ( int i = 0 ; i < int( m_vCalcLinAx.size()) ; ++ i) {
if ( m_vCalcLinAx[i].bHead)
m_vCalcLinAx[i].nInd += m_nHeadLinAxes + m_nHeadRotAxes + 1 ;
else
m_vCalcLinAx[i].nInd *= -1 ;
}
// devono essere 3
if ( m_vCalcLinAx.size() != 3) {
LOG_ERROR( GetEMkLogger(), "Linear Axes are not 3 in number")
return false ;
}
// devono essere ordinabili come XYZ
if ( ! m_vCalcLinAx[0].vtDir.IsXplus()) {
if ( m_vCalcLinAx[1].vtDir.IsXplus())
if ( ! m_vCalcLinAx[0].vtDir.IsX()) {
if ( m_vCalcLinAx[1].vtDir.IsX())
swap( m_vCalcLinAx[0], m_vCalcLinAx[1]) ;
else if ( m_vCalcLinAx[2].vtDir.IsXplus())
else if ( m_vCalcLinAx[2].vtDir.IsX())
swap( m_vCalcLinAx[0], m_vCalcLinAx[2]) ;
else {
LOG_ERROR( GetEMkLogger(), "Linear Axes not aligned with Global XYZ")
LOG_ERROR( GetEMkLogger(), "Linear Axes are not aligned with Global XYZ")
return false ;
}
}
if ( ! m_vCalcLinAx[1].vtDir.IsYplus()) {
if ( m_vCalcLinAx[2].vtDir.IsYplus())
if ( ! m_vCalcLinAx[1].vtDir.IsY()) {
if ( m_vCalcLinAx[2].vtDir.IsY())
swap( m_vCalcLinAx[1], m_vCalcLinAx[2]) ;
else {
LOG_ERROR( GetEMkLogger(), "Linear Axes not aligned with Global XYZ")
LOG_ERROR( GetEMkLogger(), "Linear Axes are not aligned with Global XYZ")
return false ;
}
}
if ( ! m_frLinAx.Set( ORIG, m_vCalcLinAx[0].vtDir, m_vCalcLinAx[1].vtDir, m_vCalcLinAx[2].vtDir)) {
LOG_ERROR( GetEMkLogger(), "Linear Axes are not a Rigth-handed Frame")
return false ;
}
// verifiche sugli assi rotanti :
// aggiusto gli indici di ordine sulla sua catena cinematica (1-based)
for ( int i = 0 ; i < int( m_vCalcRotAx.size()) ; ++ i) {
if ( m_vCalcRotAx[i].bHead)
m_vCalcRotAx[i].nInd += m_nHeadLinAxes + m_nHeadRotAxes + 1 ;
else
m_vCalcRotAx[i].nInd *= -1 ;
}
// se 0 o 1 va bene
if ( m_vCalcRotAx.size() <= 1)
return true ;
;
// se 2 va bene
if ( m_vCalcRotAx.size() == 2) {
else if ( m_vCalcRotAx.size() == 2) {
// se entrambi di testa devo invertirne l'ordine
if ( m_vCalcRotAx[0].bHead && m_vCalcRotAx[1].bHead)
swap( m_vCalcRotAx[0], m_vCalcRotAx[1]) ;
@@ -507,10 +643,9 @@ Machine::CalculateKinematicChain( void)
m_vCalcRotAx[1].stroke.Max = min( m_vCalcRotAx[1].stroke.Max, pHead->GetRot2Stroke().Max) ;
}
}
return true ;
}
// se 3 va bene ( uno dovrà poi avere valore assegnato)
if ( m_vCalcRotAx.size() == 3) {
else if ( m_vCalcRotAx.size() == 3) {
int n2ndHeadRotAx = - 1 ;
// se tutti e tre di testa, devo invertire il primo con il terzo
if ( m_vCalcRotAx[0].bHead && m_vCalcRotAx[1].bHead && m_vCalcRotAx[2].bHead) {
@@ -530,12 +665,51 @@ Machine::CalculateKinematicChain( void)
m_vCalcRotAx[n2ndHeadRotAx].stroke.Max = min( m_vCalcRotAx[n2ndHeadRotAx].stroke.Max, pHead->GetRot2Stroke().Max) ;
}
}
return true ;
}
// altrimenti non ancora gestito, quindi errore
LOG_ERROR( GetEMkLogger(), "Rotary Axes not manageable")
return false ;
// se più di 3
else {
// altrimenti non ancora gestito, quindi errore
LOG_ERROR( GetEMkLogger(), "Rotary Axes not manageable")
return false ;
}
// verifico esistenza eventuale asse rotante speciale di testa
if ( m_nHeadRotAxes > 0 && m_nHeadLinAxes > 0) {
// indice di posizione primo asse di testa
int nHeadFirst = 1 ;
// ricerco sui rotanti
for ( int i = 0 ; i < int( m_vCalcRotAx.size()) ; ++ i) {
// se asse di testa
if ( m_vCalcRotAx[i].bHead && m_vCalcRotAx[i].nInd <= nHeadFirst) {
// non sono ammessi due assi di questo tipo
if ( m_nHeadSpecRotAxis != -1)
return false ;
// la tavola non deve avere più di un asse lineare
if ( m_nTabLinAxes > 1)
return false ;
// se ha un asse lineare deve essere allineato con il rotante speciale
else if ( m_nTabLinAxes == 1) {
// ne recupero la direzione
Vector3d vtTabLinDir ;
for ( int j = 0 ; j < int( m_vCalcLinAx.size()) ; ++ j) {
if ( ! m_vCalcLinAx[i].bHead) {
vtTabLinDir = m_vCalcLinAx[i].vtDir ;
break ;
}
}
// la confronto con quella dell'asse rotante speciale
if ( ! AreSameOrOppositeVectorApprox( vtTabLinDir, m_vCalcRotAx[i].vtDir))
return false ;
}
// ne salvo l'indice
m_nHeadSpecRotAxis = i ;
// incremento indice di posizione posibile primo asse lineare di testa
++ nHeadFirst ;
}
}
}
// dichiaro tipo centro di lavoro
m_nCalcChainType = KIN_CHAIN_CENTER ;
return true ;
}
//----------------------------------------------------------------------------
@@ -553,11 +727,20 @@ Machine::AddKinematicAxis( bool bOnHead, int nId)
KinAxis kAx ;
kAx.nGrpId = nId ;
kAx.bLinear = ( pAx->GetType() != MCH_AT_ROTARY) ;
kAx.bHead = bOnHead ; // posizione su catena cinematica
kAx.bHead = bOnHead ; // catena cinematica di appartenenza (testa o tavola)
kAx.ptPos = pAx->GetPos() ;
kAx.vtDir = pAx->GetDir() ;
kAx.stroke = pAx->GetStroke() ;
kAx.dHomeVal = pAx->GetHomeVal() ;
// ne determino l'indice di posizione nella sua catena cinematica (assegno valore negato perchè provvisorio)
if ( kAx.bHead) {
( kAx.bLinear ? ++ m_nHeadLinAxes : ++ m_nHeadRotAxes) ;
kAx.nInd = - ( m_nHeadLinAxes + m_nHeadRotAxes) ;
}
else {
( kAx.bLinear ? ++ m_nTabLinAxes : ++ m_nTabRotAxes) ;
kAx.nInd = - ( m_nTabLinAxes + m_nTabRotAxes) ;
}
// se lineare di tavola, devo invertirlo
if ( kAx.bLinear && ! kAx.bHead)
kAx.vtDir.Invert() ;
@@ -873,8 +1056,8 @@ Machine::GetMyAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
vtAx2.Invert() ;
// calcolo secondo angolo di rotazione
nStat = GetRotationComponent( vtDirHn, dCompTSuAxR1, vtAx1, vtAx2, dAngB1, dAngB2, bDet) ;
// se indeterminato con richiesta direzione ausiliaria esatta, ricalcolo con direzione aux
if ( nStat >= 1 && ! bDet && m_bSolChExact) {
// se indeterminato, provo ricalcolo con direzione aux
if ( nStat >= 1 && ! bDet) {
// componente versore ausiliario desiderato su direzione primo asse rotante
Vector3d vtSccDir ;
if ( GetSccDir( m_nCalcSolCh, vtDirAn, vtSccDir)) {
@@ -924,7 +1107,7 @@ Machine::GetMyAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
// calcolo primo angolo di rotazione per seconda soluzione
bool bDet2 = true ;
if ( nStat == 2) {
if ( ! vtDirH2.GetRotation( vtDirTn, vtAx1, dAngA2, bDet2) )
if ( ! vtDirH2.GetRotation( vtDirTn, vtAx1, SIN_EPS_ANG_SMALL, dAngA2, bDet2))
nStat = 1 ;
else {
// se indeterminato, provo a determinarlo con la direzione ausiliaria
@@ -947,7 +1130,7 @@ Machine::GetMyAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
// calcolo primo angolo di rotazione per prima soluzione
bool bDet1 = true ;
if ( nStat >= 1) {
if ( ! vtDirH1.GetRotation( vtDirTn, vtAx1, dAngA1, bDet1) )
if ( ! vtDirH1.GetRotation( vtDirTn, vtAx1, SIN_EPS_ANG_SMALL, dAngA1, bDet1))
nStat = 0 ;
else {
// se indeterminato, provo a determinarlo con la direzione ausiliaria
@@ -992,7 +1175,7 @@ Machine::GetMyAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
}
if ( nStat >= 1) {
// se non riesco ad aggiustare, elimino
if ( ! AdjustAngleInStroke( RotAx1.stroke, dAngA1) ||
if ( ( bDet1 && ! AdjustAngleInStroke( RotAx1.stroke, dAngA1)) ||
( nNumRotAx == 2 && ! AdjustAngleInStroke( RotAx2.stroke, dAngB1))) {
-- nStat ;
// riloco eventuale soluzione rimasta
@@ -1025,26 +1208,33 @@ Machine::GetPositions( const Point3d& ptP, const DBLVECTOR& vAng,
// aggiorno punto di lavoro mediante ciclo diretto sugli assi di tavola
Point3d ptW = ptP ;
// annullo la posizione home degli assi lineari
for ( size_t i = 0 ; i < m_vCalcLinAx.size() ; ++ i) {
for ( int i = 0 ; i < int( m_vCalcLinAx.size()) ; ++ i) {
// se asse di tavola
if ( ! m_vCalcLinAx[i].bHead)
ptW.Translate( - m_vCalcLinAx[i].dHomeVal * ( - m_vCalcLinAx[i].vtDir)) ;
}
// effettuo rotazione diminuita della posizione home degli assi rotanti
for ( size_t i = 0 ; i < m_vCalcRotAx.size() ; ++ i) {
for ( int i = 0 ; i < int( m_vCalcRotAx.size()) ; ++ i) {
// se asse di tavola
if ( ! m_vCalcRotAx[i].bHead)
ptW.Rotate( m_vCalcRotAx[i].ptPos, m_vCalcRotAx[i].vtDir, vAng[i] - m_vCalcRotAx[i].dHomeVal) ;
}
// effettuo rotazione inversa per asse rotante di testa speciale
if ( m_nHeadSpecRotAxis != -1) {
if ( m_nHeadSpecRotAxis < 0 || m_nHeadSpecRotAxis >= int( m_vCalcRotAx.size()))
return false ;
int i = m_nHeadSpecRotAxis ;
ptW.Rotate( m_vCalcRotAx[i].ptPos, m_vCalcRotAx[i].vtDir, -vAng[i]) ;
}
// aggiorno posizione e direzione fresa su testa a riposo mediante ciclo inverso sugli assi di testa
Point3d ptPosH = m_ptCalcPos ;
Vector3d vtDirH = m_vtCalcDir ;
for ( size_t i = m_vCalcRotAx.size() ; i >= 1 ; -- i) {
// se asse di testa
if ( m_vCalcRotAx[i-1].bHead) {
ptPosH.Rotate( m_vCalcRotAx[i-1].ptPos, m_vCalcRotAx[i-1].vtDir, vAng[i-1]) ;
vtDirH.Rotate( m_vCalcRotAx[i-1].vtDir, vAng[i-1]) ;
for ( int i = int( m_vCalcRotAx.size()) - 1 ; i >= 0 ; -- i) {
// se asse di testa non speciale
if ( m_vCalcRotAx[i].bHead && i != m_nHeadSpecRotAxis) {
ptPosH.Rotate( m_vCalcRotAx[i].ptPos, m_vCalcRotAx[i].vtDir, vAng[i]) ;
vtDirH.Rotate( m_vCalcRotAx[i].vtDir, vAng[i]) ;
}
}
@@ -1057,56 +1247,20 @@ Machine::GetPositions( const Point3d& ptP, const DBLVECTOR& vAng,
// calcolo il recupero di lunghezza utensile
Vector3d vtDtTL = vtDirH * m_dCalcTLen ;
// calcolo le posizioni degli assi lineari
dX = ptW.x + vtDtHe.x + vtDtAx.x + vtDtTL.x ;
dY = ptW.y + vtDtHe.y + vtDtAx.y + vtDtTL.y ;
dZ = ptW.z + vtDtHe.z + vtDtAx.z + vtDtTL.z ;
// calcolo i valori degli assi lineari (posizioni)
Point3d ptPos( ptW.x + vtDtHe.x + vtDtAx.x + vtDtTL.x,
ptW.y + vtDtHe.y + vtDtAx.y + vtDtTL.y,
ptW.z + vtDtHe.z + vtDtAx.z + vtDtTL.z) ;
ptPos.ToLoc( m_frLinAx) ;
dX = ptPos.x ;
dY = ptPos.y ;
dZ = ptPos.z ;
// tutto ok
nStat = 0 ;
return true ;
}
//----------------------------------------------------------------------------
bool
Machine::GetHeadOffsetDelta( const DBLVECTOR& vAng,
double& dRecX, double& dRecY, double& dRecZ) const
{
// ovviamente tutto è espresso nel riferimento ZERO MACCHINA
// verifico che siano stati assegnati gli angoli necessari, altrimenti errore
if ( vAng.size() < m_vCalcRotAx.size())
return false ;
// aggiorno posizione e direzione fresa su testa a riposo mediante ciclo inverso sugli assi di testa
Point3d ptPosH = m_ptCalcPos ;
Vector3d vtDirH = m_vtCalcDir ;
for ( size_t i = m_vCalcRotAx.size() ; i >= 1 ; -- i) {
// se asse di testa
if ( m_vCalcRotAx[i-1].bHead) {
ptPosH.Rotate( m_vCalcRotAx[i-1].ptPos, m_vCalcRotAx[i-1].vtDir, vAng[i-1]) ;
vtDirH.Rotate( m_vCalcRotAx[i-1].vtDir, vAng[i-1]) ;
}
}
// assegno l'offset testa
Vector3d vtDtHe = ORIG - m_ptCalcPos ;
// calcolo il recupero degli assi : è l'opposto dello spostamento della posizione
Vector3d vtDtAx = m_ptCalcPos - ptPosH ;
// calcolo il recupero di lunghezza utensile
Vector3d vtDtTL = vtDirH * m_dCalcTLen ;
// calcolo le posizioni degli assi lineari
dRecX = vtDtHe.x + vtDtAx.x + vtDtTL.x ;
dRecY = vtDtHe.y + vtDtAx.y + vtDtTL.y ;
dRecZ = vtDtHe.z + vtDtAx.z + vtDtTL.z ;
// tutto ok
return true ;
}
//----------------------------------------------------------------------------
bool
Machine::GetDirection( const Vector3d& vtDir, const DBLVECTOR& vAng, Vector3d& vtNew) const
@@ -1127,6 +1281,10 @@ Machine::GetDirection( const Vector3d& vtDir, const DBLVECTOR& vAng, Vector3d& v
vtNew.Rotate( m_vCalcRotAx[i-1].vtDir, vAng[i-1]) ;
}
// nel caso di robot devo passare dal riferimento canonico robot a quello di macchina
if ( m_nCalcChainType == KIN_CHAIN_ROBOT)
vtNew.ToGlob( m_frRobot) ;
return true ;
}
@@ -1164,19 +1322,47 @@ Machine::GetNoseFromPositions( double dX, double dY, double dZ, const DBLVECTOR&
// la posizione deve essere espressa rispetto allo ZERO MACCHINA
// è espressa nel riferimento di macchina (tiene conto delle sole traslazioni e rotazioni di testa)
// aggiorno posizione testa a riposo mediante ciclo inverso sugli assi rotanti di testa
ptNose = m_ptCalcPos ;
for ( size_t i = m_vCalcRotAx.size() ; i >= 1 ; -- i) {
// se asse di testa
if ( m_vCalcRotAx[i-1].bHead)
ptNose.Rotate( m_vCalcRotAx[i-1].ptPos, m_vCalcRotAx[i-1].vtDir, vAng[i-1]) ;
// verifico dimensione vettore angoli rispetto al numero di assi rotanti
if ( vAng.size() < m_vCalcRotAx.size())
return false ;
// se centro di lavoro
if ( m_nCalcChainType == KIN_CHAIN_CENTER) {
// aggiorno posizione testa a riposo mediante ciclo inverso sugli assi rotanti di testa
ptNose = m_ptCalcPos ;
for ( int i = int( m_vCalcRotAx.size()) - 1 ; i >= 0 ; -- i) {
// se asse di testa non speciale
if ( m_vCalcRotAx[i].bHead && i != m_nHeadSpecRotAxis)
ptNose.Rotate( m_vCalcRotAx[i].ptPos, m_vCalcRotAx[i].vtDir, vAng[i]) ;
}
// aggiorno posizione testa con assi lineari di testa
DBLVECTOR vMov( {dX, dY, dZ}) ;
for ( int i = 0 ; i < int( m_vCalcLinAx.size()) ; ++ i) {
if ( m_vCalcLinAx[i].bHead)
ptNose += m_vCalcLinAx[i].vtDir * vMov[i] ;
}
// eseguo rotazione eventuale asse rotante speciale di testa
if ( m_nHeadSpecRotAxis != -1) {
if ( m_nHeadSpecRotAxis < 0 || m_nHeadSpecRotAxis >= int( m_vCalcRotAx.size()))
return false ;
int i = m_nHeadSpecRotAxis ;
ptNose.Rotate( m_vCalcRotAx[i].ptPos, m_vCalcRotAx[i].vtDir, vAng[i]) ;
}
}
// aggiorno posizione testa con assi lineari di testa
DBLVECTOR vMov( {dX, dY, dZ}) ;
for ( size_t i = 1 ; i <= m_vCalcLinAx.size() ; ++ i) {
if ( m_vCalcLinAx[i-1].bHead)
ptNose += m_vCalcLinAx[i-1].vtDir * vMov[i-1] ;
// se robot
else if ( m_nCalcChainType == KIN_CHAIN_ROBOT) {
// aggiorno posizione testa a riposo mediante ciclo inverso sugli assi rotanti di testa
ptNose = m_ptCalcPos ;
for ( int i = int( m_vCalcRotAx.size()) - 1 ; i >= 0 ; -- i) {
// se asse di testa
if ( m_vCalcRotAx[i].bHead)
ptNose.Rotate( m_vCalcRotAx[i].ptPos, m_vCalcRotAx[i].vtDir, vAng[i]) ;
}
}
// altrimenti errore
else
return false ;
return true ;
}
@@ -1188,11 +1374,50 @@ Machine::GetTipFromPositions( double dX, double dY, double dZ, const DBLVECTOR&
// la posizione deve essere espressa rispetto allo ZERO MACCHINA
// è espressa nel riferimento di macchina (tiene conto delle sole rotazioni di testa)
// Calcoli recuperi della testa e lunghezza utensile per orientamento
double dRecX, dRecY, dRecZ ;
if ( ! GetHeadOffsetDelta( vAng, dRecX, dRecY, dRecZ))
// verifico dimensione vettore angoli rispetto al numero di assi rotanti
if ( vAng.size() < m_vCalcRotAx.size())
return false ;
ptTip.Set( dX - dRecX, dY - dRecY, dZ - dRecZ) ;
// se centro di lavoro
if ( m_nCalcChainType == KIN_CHAIN_CENTER) {
// aggiorno posizione tip utensile a riposo mediante ciclo inverso sugli assi rotanti di testa
ptTip = m_ptCalcPos - m_vtCalcDir * m_dCalcTLen ;
for ( int i = int( m_vCalcRotAx.size()) - 1 ; i >= 0 ; -- i) {
// se asse di testa non speciale
if ( m_vCalcRotAx[i].bHead && i != m_nHeadSpecRotAxis)
ptTip.Rotate( m_vCalcRotAx[i].ptPos, m_vCalcRotAx[i].vtDir, vAng[i]) ;
}
// aggiorno posizione tip utensile con assi lineari di testa
DBLVECTOR vMov( {dX, dY, dZ}) ;
for ( int i = 0 ; i < int( m_vCalcLinAx.size()) ; ++ i) {
if ( m_vCalcLinAx[i].bHead)
ptTip += m_vCalcLinAx[i].vtDir * vMov[i] ;
}
// eseguo rotazione eventuale asse rotante speciale di testa
if ( m_nHeadSpecRotAxis != -1) {
if ( m_nHeadSpecRotAxis < 0 || m_nHeadSpecRotAxis >= int( m_vCalcRotAx.size()))
return false ;
int i = m_nHeadSpecRotAxis ;
ptTip.Rotate( m_vCalcRotAx[i].ptPos, m_vCalcRotAx[i].vtDir, vAng[i]) ;
}
}
// se robot
else if ( m_nCalcChainType == KIN_CHAIN_ROBOT) {
// aggiorno posizione tip utensile a riposo mediante ciclo inverso sugli assi rotanti di testa
ptTip = m_ptCalcPos - m_vtCalcDir * m_dCalcTLen ;
for ( int i = int( m_vCalcRotAx.size()) - 1 ; i >= 0 ; -- i) {
// se asse di testa
if ( m_vCalcRotAx[i].bHead)
ptTip.Rotate( m_vCalcRotAx[i].ptPos, m_vCalcRotAx[i].vtDir, vAng[i]) ;
}
}
// altrimenti errore
else
return false ;
// nel caso di robot devo passare dal riferimento canonico robot a quello di macchina
if ( m_nCalcChainType == KIN_CHAIN_ROBOT)
ptTip.ToGlob( m_frRobot) ;
// Se richiesto ingombro totale o punto sotto del tip utensile
if ( bOverall || bBottom) {
@@ -1236,7 +1461,7 @@ Machine::GetAuxDirFromAngles( const DBLVECTOR& vAng, Vector3d& vtDir) const
bool
Machine::GetPartDirFromAngles( const Vector3d& vtPart, const DBLVECTOR& vAng, Vector3d& vtDir) const
{
// è espressa nel riferimento di macchina (tiene conto delle sole rotazioni di tavola)
// è espressa nel riferimento di macchina (tiene conto delle sole rotazioni di tavola e asse rotante speciale di testa)
// verifico dimensione vettore angoli rispetto al numero di assi rotanti
if ( vAng.size() < m_vCalcRotAx.size())
@@ -1252,6 +1477,14 @@ Machine::GetPartDirFromAngles( const Vector3d& vtPart, const DBLVECTOR& vAng, Ve
vtDir.Rotate( m_vCalcRotAx[i-1].vtDir, vAng[i-1]) ;
}
// eseguo rotazione inversa eventuale asse rotante speciale di testa
if ( m_nHeadSpecRotAxis != -1) {
if ( m_nHeadSpecRotAxis < 0 || m_nHeadSpecRotAxis >= int( m_vCalcRotAx.size()))
return false ;
int i = m_nHeadSpecRotAxis ;
vtDir.Rotate( m_vCalcRotAx[i].vtDir, -vAng[i]) ;
}
return true ;
}
@@ -1341,12 +1574,33 @@ Machine::VerifyScc( const Vector3d& vtDirI, const Vector3d& vtDirA, int nSolCh,
bool
Machine::AdjustAngleInStroke( const STROKE& Stroke, double& dAng) const
{
// eseguo gli aggiustamenti
while ( dAng < Stroke.Min)
dAng += ANG_FULL ;
while ( dAng > Stroke.Max)
dAng -= ANG_FULL ;
return ( dAng >= Stroke.Min && dAng <= Stroke.Max) ;
// se asse rotante vero
if ( Stroke.Max - Stroke.Min > EPS_ANG_SMALL) {
// eseguo gli aggiustamenti
while ( dAng < Stroke.Min)
dAng += ANG_FULL ;
while ( dAng > Stroke.Max)
dAng -= ANG_FULL ;
// verifico
return ( dAng >= Stroke.Min && dAng <= Stroke.Max) ;
}
// altrimenti asse rotante senza corsa
else {
// angolo di riferimento
double dStrokeMid = ( Stroke.Min + Stroke.Max) / 2 ;
// eseguo gli aggiustamenti
while ( dAng < dStrokeMid - EPS_ANG_SMALL)
dAng += ANG_FULL ;
while ( dAng > dStrokeMid + EPS_ANG_SMALL)
dAng -= ANG_FULL ;
// verifico
if ( abs( dAng - dStrokeMid) < EPS_ANG_SMALL) {
dAng = dStrokeMid ;
return true ;
}
else
return false ;
}
}
//----------------------------------------------------------------------------
@@ -1357,9 +1611,9 @@ Machine::GetNearestAngleInStroke( int nInd, double dAngRef, double& dAng) const
if ( nInd < 0 || nInd >= int( m_vCalcRotAx.size()))
return true ;
// cerco l'angolo più vicino stando nella corsa
while ( dAng - dAngRef > ANG_STRAIGHT && dAng - ANG_FULL >= m_vCalcRotAx[nInd].stroke.Min)
while ( dAng - dAngRef > ANG_STRAIGHT + EPS_ANG_ZERO && dAng - ANG_FULL >= m_vCalcRotAx[nInd].stroke.Min)
dAng -= ANG_FULL ;
while ( dAng - dAngRef < -ANG_STRAIGHT && dAng + ANG_FULL <= m_vCalcRotAx[nInd].stroke.Max)
while ( dAng - dAngRef < -ANG_STRAIGHT + EPS_ANG_ZERO && dAng + ANG_FULL <= m_vCalcRotAx[nInd].stroke.Max)
dAng += ANG_FULL ;
return ( dAng >= m_vCalcRotAx[nInd].stroke.Min &&
dAng <= m_vCalcRotAx[nInd].stroke.Max) ;
@@ -1373,10 +1627,7 @@ Machine::LimitAngleToStroke( int nInd, double& dAng) const
if ( nInd < 0 || nInd >= int( m_vCalcRotAx.size()))
return true ;
// se angolo fuori corsa, lo porto all'estremo più vicino
if ( dAng < m_vCalcRotAx[nInd].stroke.Min)
dAng = m_vCalcRotAx[nInd].stroke.Min ;
else if ( dAng > m_vCalcRotAx[nInd].stroke.Max)
dAng = m_vCalcRotAx[nInd].stroke.Max ;
dAng = Clamp( dAng, m_vCalcRotAx[nInd].stroke.Min, m_vCalcRotAx[nInd].stroke.Max) ;
return true ;
}
@@ -1471,6 +1722,7 @@ Machine::VerifyProtectedAreas( double dX, double dY, double dZ, const DBLVECTOR&
bool bOldEMC = LuaChangeNameGlobVar( EMC_VAR, EMC_VAR_BACKUP) ;
// definisco variabili
bOk = bOk && LuaCreateGlobTable( EMC_VAR) ;
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_VER, GetEMkVer()) ;
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_L1, dX) ;
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_L2, dY) ;
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_L3, dZ) ;
@@ -1601,7 +1853,7 @@ Machine::GetCurrAxisName( int nInd, string& sAxName) const
//----------------------------------------------------------------------------
bool
Machine::GetAllCurrAxesName( STRVECTOR& vAxName) const
Machine::GetAllCurrAxesNames( STRVECTOR& vAxName) const
{
vAxName.clear() ;
bool bOk = true ;
@@ -1650,7 +1902,7 @@ Machine::GetCurrAxisToken( int nInd, string& sAxToken) const
//----------------------------------------------------------------------------
bool
Machine::GetAllCurrAxesToken( STRVECTOR& vAxToken) const
Machine::GetAllCurrAxesTokens( STRVECTOR& vAxToken) const
{
vAxToken.clear() ;
bool bOk = true ;
@@ -1719,6 +1971,52 @@ Machine::GetCurrAxisMax( int nInd, double& dMax) const
return false ;
}
//----------------------------------------------------------------------------
bool
Machine::GetCurrAxisOffset( int nInd, double& dOffset) const
{
int nLinAxes = int( m_vCalcLinAx.size()) ;
int nRotAxes = int( m_vCalcRotAx.size()) ;
if ( nInd >= 0 && nInd < nLinAxes) {
Axis* pAx = GetAxis( m_vCalcLinAx[nInd].nGrpId) ;
if ( pAx == nullptr)
return false ;
dOffset = pAx->GetOffset() ;
return true ;
}
else if ( nInd >= nLinAxes && nInd < nLinAxes + nRotAxes) {
Axis* pAx = GetAxis( m_vCalcRotAx[nInd-nLinAxes].nGrpId) ;
if ( pAx == nullptr)
return false ;
dOffset = pAx->GetOffset() ;
return true ;
}
return false ;
}
//----------------------------------------------------------------------------
bool
Machine::GetCurrAxisInvert( int nInd, bool& bInvert) const
{
int nLinAxes = int( m_vCalcLinAx.size()) ;
int nRotAxes = int( m_vCalcRotAx.size()) ;
if ( nInd >= 0 && nInd < nLinAxes) {
Axis* pAx = GetAxis( m_vCalcLinAx[nInd].nGrpId) ;
if ( pAx == nullptr)
return false ;
bInvert = pAx->GetInvert() ;
return true ;
}
else if ( nInd >= nLinAxes && nInd < nLinAxes + nRotAxes) {
Axis* pAx = GetAxis( m_vCalcRotAx[nInd-nLinAxes].nGrpId) ;
if ( pAx == nullptr)
return false ;
bInvert = pAx->GetInvert() ;
return true ;
}
return false ;
}
//----------------------------------------------------------------------------
bool
Machine::GetCurrAxisHomePos( int nInd, double& dHome) const
@@ -1766,3 +2064,111 @@ Machine::GetAllCurrAxesHomePos( DBLVECTOR& vAxHomeVal) const
}
return bOk ;
}
//----------------------------------------------------------------------------
bool
Machine::GetRobotAngles( const Point3d& ptP, const Vector3d& vtDirT, const Vector3d& vtDirA,
DBLVECTOR& vAng1, DBLVECTOR& vAng2) const
{
// pulisco il risultato
vAng1.clear() ;
vAng2.clear() ;
// porto i dati nel riferimento robot
Point3d ptPL = GetToLoc( ptP, m_frRobot) ;
Vector3d vtDirTL = GetToLoc( vtDirT, m_frRobot) ;
Vector3d vtDirAL = GetToLoc( vtDirA, m_frRobot) ;
// riferimento utensile
Frame3d frTool ;
frTool.Set( ORIG, vtDirTL, vtDirAL) ;
// deduco la posizione richiesta del centro del polso
Point3d ptCen = ptPL + m_ptWristCen.x * frTool.VersX() +
m_ptWristCen.y * frTool.VersY() +
( m_dCalcTLen + m_ptWristCen.z) * frTool.VersZ() ;
// deduco la direzione richiesta del centro del polso
Vector3d vtCen = m_vtWristRef.x * frTool.VersX() +
m_vtWristRef.y * frTool.VersY() +
m_vtWristRef.z * frTool.VersZ() ;
// calcolo il primo asse rotante
Vector3d vtArm = ptCen - m_vCalcRotAx[0].ptPos ;
double dAng1 ; bool bDet1 ;
if ( ! X_AX.GetRotation( vtArm, m_vCalcRotAx[0].vtDir, EPS_SMALL, dAng1, bDet1) || ! bDet1) {
LOG_ERROR( GetEMkLogger(), "Error : direction unreachable (robot)")
return false ;
}
vAng1.push_back( dAng1) ;
vAng2.push_back( dAng1) ;
// calcolo secondo e terzo asse rotante
Point3d ptR2 = m_vCalcRotAx[1].ptPos ;
ptR2.Rotate( m_vCalcRotAx[0].ptPos, m_vCalcRotAx[0].vtDir, dAng1) ;
Vector3d vtR2 = m_vCalcRotAx[1].vtDir ;
vtR2.Rotate( m_vCalcRotAx[0].vtDir, dAng1) ;
Vector3d vtR2Cen = ptCen - ( ptR2 + ( ptCen - ptR2) * vtR2 * vtR2) ;
double dDistR2Cen = vtR2Cen.Len() ;
double dDistR2R3 = m_vCalcRotAx[2].ptPos.z - m_vCalcRotAx[1].ptPos.z ;
Vector3d vtR3R5 = m_vCalcRotAx[4].ptPos - m_vCalcRotAx[2].ptPos ; vtR3R5.y = 0 ;
double dDistR3R5 = vtR3R5.Len() ;
double dAngR3R5 = atan2( vtR3R5.z, vtR3R5.x) * RADTODEG ;
double dCosB = ( dDistR2R3 * dDistR2R3 + dDistR2Cen * dDistR2Cen - dDistR3R5 * dDistR3R5) / ( 2 * dDistR2R3 * dDistR2Cen) ;
double dCosC = ( dDistR3R5 * dDistR3R5 + dDistR2Cen * dDistR2Cen - dDistR2R3 * dDistR2R3) / ( 2 * dDistR3R5 * dDistR2Cen) ;
if ( abs( dCosB) > 1 || abs( dCosC) > 1) {
LOG_ERROR( GetEMkLogger(), "Error : position unreachable (robot)")
return false ;
}
double dAngB = acos( dCosB) * RADTODEG ;
double dAng2 ; bool bDet2 ;
if ( ! Z_AX.GetRotation( vtR2Cen, vtR2, EPS_SMALL, dAng2, bDet2) || ! bDet2) {
LOG_ERROR( GetEMkLogger(), "Error : R2 not calculable (robot)")
return false ;
}
dAng2 -= dAngB ;
vAng1.push_back( dAng2) ;
vAng2.push_back( dAng2) ;
double dAngC = acos( dCosC) * RADTODEG ;
double dAng3 = dAngB + dAngC + dAngR3R5 - ANG_RIGHT ;
vAng1.push_back( dAng3) ;
vAng2.push_back( dAng3) ;
// calcolo i primi due assi rotanti del polso
Frame3d frWrist ;
frWrist.Set( m_vCalcRotAx[3].ptPos, m_vCalcRotAx[3].vtDir, m_vCalcRotAx[4].vtDir ^ m_vCalcRotAx[3].vtDir) ;
frWrist.Rotate( m_vCalcRotAx[2].ptPos, m_vCalcRotAx[2].vtDir, dAng3) ;
frWrist.Rotate( m_vCalcRotAx[1].ptPos, m_vCalcRotAx[1].vtDir, dAng2) ;
frWrist.Rotate( m_vCalcRotAx[0].ptPos, m_vCalcRotAx[0].vtDir, dAng1) ;
Vector3d vtCenL = GetToLoc( vtCen, frWrist) ;
double dAng4, dAng5 ;
vtCenL.ToSpherical( nullptr, &dAng5, &dAng4) ;
if ( dAng4 > ANG_STRAIGHT)
dAng4 -= ANG_FULL ;
if ( dAng4 > ANG_RIGHT) {
dAng4 -= ANG_STRAIGHT ;
dAng5 = -dAng5 ;
}
else if ( dAng4 < -ANG_RIGHT) {
dAng4 += ANG_STRAIGHT ;
dAng5 = -dAng5 ;
}
vAng1.push_back( dAng4) ;
vAng1.push_back( dAng5) ;
vAng2.push_back( dAng4 + ( dAng4 > EPS_ANG_ZERO ? -ANG_STRAIGHT : ANG_STRAIGHT)) ;
vAng2.push_back( -dAng5) ;
// calcolo il terzo asse rotante del polso
Vector3d vtR6 = m_vCalcRotAx[5].vtDir ;
for ( int i = 4; i >= 0 ; --i)
vtR6.Rotate( m_vCalcRotAx[i].vtDir, vAng1[i]) ;
Vector3d vtTool = m_vtCalcDir ;
for ( int i = 4; i >= 0 ; --i)
vtTool.Rotate( m_vCalcRotAx[i].vtDir, vAng1[i]) ;
double dAng6 ; bool bDet6 ;
if ( ! vtTool.GetRotation( vtDirTL, vtR6, EPS_SMALL, dAng6, bDet6) || ! bDet6) {
Vector3d vtAux = m_vtCalcADir ;
for ( int i = 4; i >= 0 ; --i)
vtAux.Rotate( m_vCalcRotAx[i].vtDir, vAng1[i]) ;
if ( ! vtAux.GetRotation( vtDirAL, vtR6, EPS_SMALL, dAng6, bDet6) || ! bDet6) {
LOG_ERROR( GetEMkLogger(), "Error : R6 not calculable (robot)")
return false ;
}
}
vAng1.push_back( dAng6) ;
vAng2.push_back( dAng6 + ( dAng6 > EPS_ANG_ZERO ? -ANG_STRAIGHT : ANG_STRAIGHT)) ;
return true ;
}
+14
View File
@@ -98,6 +98,18 @@ Machine::GetHeadSolCh( const string& sHead) const
return pHead->GetSolCh() ;
}
//----------------------------------------------------------------------------
int
Machine::GetHeadSelectType( const string& sHead) const
{
// recupero testa
Head* pHead = GetHead( GetGroup( sHead)) ;
if ( pHead == nullptr)
return MCH_SCC_NONE ;
// recupero tipo di selezione delle uscite della testa
return pHead->GetSelectType() ;
}
//----------------------------------------------------------------------------
bool
Machine::LoadTool( const string& sHead, int nExit, const string& sTool)
@@ -171,6 +183,8 @@ Machine::LoadTool( Exit* pExit, const string& sTool)
return false ;
// sposto eventuali info relative al porta utensile (ToolHolder) nel gruppo SOLID
double dVal ;
if ( m_pGeomDB->GetInfo( nTGrpId, TTH_BASE, dVal))
m_pGeomDB->SetInfo( nSolidId, TTH_BASE, dVal) ;
if ( m_pGeomDB->GetInfo( nTGrpId, TTH_LEN, dVal))
m_pGeomDB->SetInfo( nSolidId, TTH_LEN, dVal) ;
if ( m_pGeomDB->GetInfo( nTGrpId, TTH_DIAM, dVal))
+257 -24
View File
@@ -1,7 +1,7 @@
//----------------------------------------------------------------------------
// EgalTech 2015-2020
// EgalTech 2015-2021
//----------------------------------------------------------------------------
// File : MachineLua.cpp Data : 26.04.20 Versione : 2.2d4
// File : MachineLua.cpp Data : 14.10.21 Versione : 2.3j5
// Contenuto : Implementazione gestione macchina : funzioni Lua.
//
//
@@ -41,20 +41,25 @@ static const string FLD_AUX = "Aux" ;
static const string FLD_TOKEN = "Token" ;
static const string FLD_TYPE = "Type" ;
static const string FLD_INVERT = "Invert" ;
static const string FLD_AXIS_OFFSET = "Offset" ;
static const string FLD_REF1 = "Ref1" ;
static const string FLD_SCALE = "Scale" ;
static const string FLD_EXIT_NBR = "ExitNbr" ;
static const string FLD_POS = "Pos" ;
static const string FLD_DIR = "Dir" ;
static const string FLD_STROKE = "Stroke" ;
static const string FLD_HOME = "Home" ;
static const string FLD_ADJUSTAUX = "AdjustAux" ;
static const string FLD_HSET = "HSet" ;
static const string FLD_SEL_TYPE = "SelType" ;
static const string FLD_TDIR = "TDir" ;
static const string FLD_ADIR = "ADir" ;
static const string FLD_ROT1W = "Rot1W" ;
static const string FLD_MAXDELTAR2ON1 = "MaxDeltaR2OnFirst" ;
static const string FLD_ROT2STROKE = "Rot2Stroke" ;
static const string FLD_SOLCH = "SolCh" ;
static const string FLD_OTHCOLL = "OthColl" ;
static const string FLD_COLL = "Coll" ;
//----------------------------------------------------------------------------
Machine* Machine::m_pMchLua = nullptr ;
@@ -93,8 +98,10 @@ Machine::LuaInit( const string& sMachineName)
m_LuaMgr.RegisterFunction( "EmtModifyAxisDirection", Machine::LuaEmtModifyAxisDirection) ;
m_LuaMgr.RegisterFunction( "EmtModifyAxisStroke", Machine::LuaEmtModifyAxisStroke) ;
m_LuaMgr.RegisterFunction( "EmtModifyAxisHome", Machine::LuaEmtModifyAxisHome) ;
m_LuaMgr.RegisterFunction( "EmtModifyHeadAuxDirection", Machine::LuaEmtModifyHeadAuxDirection) ;
m_LuaMgr.RegisterFunction( "EmtModifyExitPosition", Machine::LuaEmtModifyExitPosition) ;
m_LuaMgr.RegisterFunction( "EmtLinkRawPartToGroup", Machine::LuaEmtLinkRawPartToGroup) ;
m_LuaMgr.RegisterFunction( "EmtGetAllLinkedRawParts", Machine::LuaEmtGetAllLinkedRawParts) ;
m_LuaMgr.RegisterFunction( "EmtUnlinkRawPartFromGroup", Machine::LuaEmtUnlinkRawPartFromGroup) ;
m_LuaMgr.RegisterFunction( "EmtUnlinkAllRawPartsFromGroups", Machine::LuaEmtUnlinkAllRawPartsFromGroups) ;
m_LuaMgr.RegisterFunction( "EmtLinkFixtureToGroup", Machine::LuaEmtLinkFixtureToGroup) ;
@@ -128,6 +135,12 @@ Machine::LuaInit( const string& sMachineName)
m_LuaMgr.RegisterFunction( "EmtExecCollisionCheck", Machine::LuaEmtExecCollisionCheck) ;
// registro la funzione di gestione della collisione in simulazione
m_LuaMgr.RegisterFunction( "EmtOnCollision", Machine::LuaEmtOnCollision) ;
// registro la funzione di impostazione del primo utensile per virtual milling in simulazione
m_LuaMgr.RegisterFunction( "EmtSetToolForVmill", Machine::LuaEmtSetToolForVmill) ;
// registro la funzione di impostazione di utensile aggiuntivo per virtual milling in simulazione
m_LuaMgr.RegisterFunction( "EmtAddToolForVmill", Machine::LuaEmtAddToolForVmill) ;
// registro la funzione di movimento assi in simulazione
m_LuaMgr.RegisterFunction( "EmtMoveAxes", Machine::LuaEmtMoveAxes) ;
return true ;
}
@@ -440,6 +453,9 @@ Machine::LuaEmtTable( lua_State* L)
// lettura eventuale campo 'Scale' dalla tabella
double vScale[3] = {1.0, 1.0, 1.0} ;
LuaGetTabFieldParam( L, 1, FLD_SCALE, vScale) ;
// lettura eventuale campo 'Coll' dalla tabella
STRVECTOR vsColl ;
LuaGetTabFieldParam( L, 1, FLD_COLL, vsColl) ;
// lettura campo 'Geo' dalla tabella
string sGeo ;
LuaCheckTabFieldParam( L, 1, FLD_GEO, sGeo)
@@ -457,7 +473,7 @@ Machine::LuaEmtTable( lua_State* L)
return luaL_error( L, " Unknown Machine") ;
// carico i dati della tavola
if ( ! m_pMchLua->LoadMachineTable( sName, sParent, nType, Ref1, vScale[0], vScale[1], vScale[2], sGeo, vsAux))
if ( ! m_pMchLua->LoadMachineTable( sName, sParent, nType, Ref1, vScale[0], vScale[1], vScale[2], vsColl, sGeo, vsAux))
return luaL_error( L, " Load Machine Table failed") ;
// restituisco l'indice della tavola
@@ -488,6 +504,9 @@ Machine::LuaEmtAxis( lua_State* L)
// lettura eventuale campo 'Invert' dalla tabella (default false)
bool bInvert = false ;
LuaGetTabFieldParam( L, 1, FLD_INVERT, bInvert) ;
// lettura eventuale campo 'Offset' dalla tabella (default 0)
double dOffset = 0 ;
LuaGetTabFieldParam( L, 1, FLD_AXIS_OFFSET, dOffset) ;
// lettura campo 'Type' dalla tabella
int nType ;
LuaCheckTabFieldParam( L, 1, FLD_TYPE, nType)
@@ -523,8 +542,8 @@ Machine::LuaEmtAxis( lua_State* L)
return luaL_error( L, " Unknown Machine") ;
// carico i dati dell'asse
if ( ! m_pMchLua->LoadMachineAxis( sName, sParent, sToken, bInvert, nType, ptPos, vtDir,
Stroke, dHome, bAdjustAux, sGeo, vsAux))
if ( ! m_pMchLua->LoadMachineAxis( sName, sParent, sToken, bInvert, dOffset,
nType, ptPos, vtDir, Stroke, dHome, bAdjustAux, sGeo, vsAux))
return luaL_error( L, " Load Machine Axis failed") ;
// restituisco l'indice dell'asse
@@ -588,8 +607,11 @@ Machine::LuaEmtStdHead( lua_State* L)
// lettura eventuale campo 'Rot1W' dalla tabella (default 1)
double dRot1W = 1 ;
LuaGetTabFieldParam( L, 1, FLD_ROT1W, dRot1W) ;
// lettura eventuale campo 'MaxDeltaR2OnFirst' dalla tabella (default true)
bool bMaxDeltaR2On1 = true ;
LuaGetTabFieldParam( L, 1, FLD_MAXDELTAR2ON1, bMaxDeltaR2On1) ;
// lettura eventuale campo 'Rot2Stroke' dalla tabella
STROKE Rot2Stroke{ -INFINITO, INFINITO} ;
STROKE Rot2Stroke{{ -INFINITO, INFINITO}} ;
LuaGetTabFieldParam( L, 1, FLD_ROT2STROKE, Rot2Stroke.v) ;
// lettura eventuale campo 'SolCh' dalla tabella
int nSolCh = MCH_SCC_NONE ;
@@ -615,7 +637,7 @@ Machine::LuaEmtStdHead( lua_State* L)
// carico i dati della testa standard
if ( ! m_pMchLua->LoadMachineStdHead( sName, sParent, sHSet, ptPos, vtTDir, vtADir,
dRot1W, Rot2Stroke, nSolCh, vsOthColl, sGeo, vsAux))
dRot1W, bMaxDeltaR2On1, Rot2Stroke, nSolCh, vsOthColl, sGeo, vsAux))
return luaL_error( L, " Load Machine Standard Head failed") ;
// restituisco l'indice della testa
@@ -643,9 +665,12 @@ Machine::LuaEmtMultiHead( lua_State* L)
// lettura campo 'HSet' dalla tabella
string sHSet ;
LuaCheckTabFieldParam( L, 1, FLD_HSET, sHSet)
// lettura eventuale campo tipo di selezione ammessa per le uscite
int nSelectType = MCH_SLT_FIXEDEXITS ;
LuaGetTabFieldParam( L, 1, FLD_SEL_TYPE, nSelectType) ;
// lettura campo 'ExitNbr' dalla tabella
int nExitNbr ;
LuaCheckTabFieldParam( L, 1, "ExitNbr", nExitNbr)
LuaCheckTabFieldParam( L, 1, FLD_EXIT_NBR, nExitNbr)
// lettura campi 'PosN' e 'TDirN' per ogni uscita dalla tabella
MUEXITVECTOR vMuExit ;
vMuExit.reserve( nExitNbr) ;
@@ -660,14 +685,17 @@ Machine::LuaEmtMultiHead( lua_State* L)
// inserimento nell'array
vMuExit.emplace_back( ptPos, vtTDir) ;
}
// lettura campo 'ADir' dalla tabella
// lettura eventuale campo 'ADir' dalla tabella
Vector3d vtADir ;
LuaGetTabFieldParam( L, 1, FLD_ADIR, vtADir) ;
// lettura eventuale campo 'Rot1W' dalla tabella (default 1)
double dRot1W = 1 ;
LuaGetTabFieldParam( L, 1, FLD_ROT1W, dRot1W) ;
// lettura eventuale campo 'MaxDeltaR2OnFirst' dalla tabella (default true)
bool bMaxDeltaR2On1 = true ;
LuaGetTabFieldParam( L, 1, FLD_MAXDELTAR2ON1, bMaxDeltaR2On1) ;
// lettura eventuale campo 'Rot2Stroke' dalla tabella
STROKE Rot2Stroke{ -INFINITO, INFINITO} ;
STROKE Rot2Stroke{{ -INFINITO, INFINITO}} ;
LuaGetTabFieldParam( L, 1, FLD_ROT2STROKE, Rot2Stroke.v) ;
// lettura eventuale campo 'SolCh' dalla tabella
int nSolCh = MCH_SCC_NONE ;
@@ -692,9 +720,9 @@ Machine::LuaEmtMultiHead( lua_State* L)
return luaL_error( L, " Unknown Machine") ;
// carico i dati della testa multipla
if ( ! m_pMchLua->LoadMachineMultiHead( sName, sParent, sHSet, vMuExit, vtADir,
dRot1W, Rot2Stroke, nSolCh, vsOthColl, sGeo, vsAux))
return luaL_error( L, " Load Machine Standard Head failed") ;
if ( ! m_pMchLua->LoadMachineMultiHead( sName, sParent, sHSet, nSelectType, vMuExit, vtADir,
dRot1W, bMaxDeltaR2On1, Rot2Stroke, nSolCh, vsOthColl, sGeo, vsAux))
return luaL_error( L, " Load Machine Multi Head failed") ;
// restituisco l'indice della testa
int nHeadId = m_pMchLua->GetHeadId( sName) ;
@@ -733,8 +761,11 @@ Machine::LuaEmtSpecialHead( lua_State* L)
// lettura eventuale campo 'Rot1W' dalla tabella (default 1)
double dRot1W = 1 ;
LuaGetTabFieldParam( L, 1, FLD_ROT1W, dRot1W) ;
// lettura eventuale campo 'MaxDeltaR2OnFirst' dalla tabella (default true)
bool bMaxDeltaR2On1 = true ;
LuaGetTabFieldParam( L, 1, FLD_MAXDELTAR2ON1, bMaxDeltaR2On1) ;
// lettura eventuale campo 'Rot2Stroke' dalla tabella
STROKE Rot2Stroke{ -INFINITO, INFINITO} ;
STROKE Rot2Stroke{{ -INFINITO, INFINITO}} ;
LuaGetTabFieldParam( L, 1, FLD_ROT2STROKE, Rot2Stroke.v) ;
// lettura eventuale campo 'SolCh' dalla tabella
int nSolCh = MCH_SCC_NONE ;
@@ -760,7 +791,7 @@ Machine::LuaEmtSpecialHead( lua_State* L)
// carico i dati della testa standard
if ( ! m_pMchLua->LoadMachineSpecialHead( sName, sParent, sHSet, ptPos, vtTDir, vtADir,
dRot1W, Rot2Stroke, nSolCh, vsOthColl, sGeo, vsAux))
dRot1W, bMaxDeltaR2On1, Rot2Stroke, nSolCh, vsOthColl, sGeo, vsAux))
return luaL_error( L, " Load Machine Special Head failed") ;
// restituisco l'indice della testa
@@ -775,6 +806,26 @@ Machine::LuaEmtSpecialHead( lua_State* L)
//----------------------------------------------------------------------------
int
Machine::LuaEmtTcPos( lua_State* L)
{
// Il parametro 1 deve essere una tabella
if ( ! lua_istable( L, 1))
return luaL_error( L, " Invalid Parameter, required a table") ;
// lettura campo opzionale 'ExitNbr' dalla tabella
int nExitNbr = 1 ;
LuaGetTabFieldParam( L, 1, FLD_EXIT_NBR, nExitNbr) ;
// Procedo alla lettura a seconda del tnumero di uscite
if ( nExitNbr == 1)
return LuaEmtStdTcPos( L) ;
else if ( nExitNbr > 1)
return LuaEmtMultiTcPos( L) ;
else
return luaL_error( L, " Tc Position type unknown") ;
}
//----------------------------------------------------------------------------
int
Machine::LuaEmtStdTcPos( lua_State* L)
{
// Il parametro 1 deve essere una tabella
if ( ! lua_istable( L, 1))
@@ -811,8 +862,70 @@ Machine::LuaEmtTcPos( lua_State* L)
return luaL_error( L, " Unknown Machine") ;
// carico i dati della posizione cambio utensile
if ( ! m_pMchLua->LoadMachineTcPos( sName, sParent, ptPos, vtTDir, vtADir, sGeo, vsAux))
return luaL_error( L, " Load Machine Tc Position failed") ;
if ( ! m_pMchLua->LoadMachineStdTcPos( sName, sParent, ptPos, vtTDir, vtADir, sGeo, vsAux))
return luaL_error( L, " Load Machine Standard Tc Position failed") ;
// restituisco l'indice della posizione cambio utensile
int nTcPosId = m_pMchLua->GetTcPosId( sName) ;
if ( nTcPosId != GDB_ID_NULL)
LuaSetParam( L, nTcPosId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//----------------------------------------------------------------------------
int
Machine::LuaEmtMultiTcPos( lua_State* L)
{
// Il parametro 1 deve essere una tabella
if ( ! lua_istable( L, 1))
return luaL_error( L, " Invalid Parameter, required a table") ;
// lettura campo 'Name' dalla tabella
string sName ;
LuaCheckTabFieldParam( L, 1, FLD_NAME, sName)
// lettura campo 'Parent' dalla tabella
string sParent ;
LuaCheckTabFieldParam( L, 1, FLD_PARENT, sParent)
// lettura campo 'ExitNbr' dalla tabella
int nExitNbr ;
LuaCheckTabFieldParam( L, 1, FLD_EXIT_NBR, nExitNbr)
// lettura campi 'PosN' e 'TDirN' per ogni uscita dalla tabella
MUEXITVECTOR vMuExit ;
vMuExit.reserve( nExitNbr) ;
for ( int i = 0 ; i < nExitNbr ; ++ i) {
// lettura
string sPos = FLD_POS + ToString( i + 1) ;
Point3d ptPos ;
LuaCheckTabFieldParam( L, 1, sPos.c_str(), ptPos)
string sTDir = FLD_TDIR + ToString( i + 1) ;
Vector3d vtTDir ;
LuaCheckTabFieldParam( L, 1, sTDir.c_str(), vtTDir)
// inserimento nell'array
vMuExit.emplace_back( ptPos, vtTDir) ;
}
// lettura eventuale campo 'ADir' dalla tabella
Vector3d vtADir ;
LuaGetTabFieldParam( L, 1, FLD_ADIR, vtADir) ;
// lettura campo 'Geo' dalla tabella
string sGeo ;
LuaCheckTabFieldParam( L, 1, FLD_GEO, sGeo)
// lettura eventuale campo 'Aux' dalla tabella
STRVECTOR vsAux ;
LuaGetTabFieldParam( L, 1, FLD_AUX, vsAux) ;
LuaClearStack( L) ;
// info
string sOut = "LuaEmtTcPos : " + sName ;
LOG_DBG_INFO( GetEMkLogger(), sOut.c_str())
// verifico ci sia una macchina attiva
if ( m_pMchLua == nullptr)
return luaL_error( L, " Unknown Machine") ;
// carico i dati della posizione cambio utensile
if ( ! m_pMchLua->LoadMachineMultiTcPos( sName, sParent, vMuExit, vtADir, sGeo, vsAux))
return luaL_error( L, " Load Machine Multi Tc Position failed") ;
// restituisco l'indice della posizione cambio utensile
int nTcPosId = m_pMchLua->GetTcPosId( sName) ;
@@ -903,6 +1016,26 @@ Machine::LuaEmtModifyAxisHome( lua_State* L)
return 1 ;
}
//----------------------------------------------------------------------------
int
Machine::LuaEmtModifyHeadAuxDirection( lua_State* L)
{
// 2 parametri : sHead, vtADir
string sHead ;
LuaCheckParam( L, 1, sHead)
Vector3d vtADir ;
LuaCheckParam( L, 2, vtADir)
LuaClearStack( L) ;
// verifico ci sia una macchina attiva
if ( m_pMchLua == nullptr)
return luaL_error( L, " Unknown Machine") ;
// modifico la direzione ausiliaria della testa
bool bOk = m_pMchLua->ModifyMachineHeadAuxDirection( sHead, vtADir) ;
// assegno risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//----------------------------------------------------------------------------
int
Machine::LuaEmtModifyExitPosition( lua_State* L)
@@ -963,6 +1096,22 @@ Machine::LuaEmtUnlinkRawPartFromGroup( lua_State* L)
return 1 ;
}
//----------------------------------------------------------------------------
int
Machine::LuaEmtGetAllLinkedRawParts( lua_State* L)
{
// nessun parametro
LuaClearStack( L) ;
// verifico ci sia una macchina attiva
if ( m_pMchLua == nullptr)
return luaL_error( L, " Unknown Machine") ;
// recupero l'elenco dei grezzi agganciati ad un gruppo macchina
const INTVECTOR& vLinkedRawParts = m_pMchLua->GetAllLinkedRawParts() ;
// assegno risultato
LuaSetParam( L, vLinkedRawParts) ;
return 1 ;
}
//----------------------------------------------------------------------------
int
Machine::LuaEmtUnlinkAllRawPartsFromGroups( lua_State* L)
@@ -1150,7 +1299,7 @@ Machine::LuaEmtSetLastError( lua_State* L)
// verifico ci sia una macchina attiva
if ( m_pMchLua == nullptr)
return luaL_error( L, " Unknown Machine") ;
// assegno i dati
// imposto informazioni di errore
bool bOk = ( m_pMchLua->m_pMchMgr != nullptr && m_pMchLua->m_pMchMgr->SetLastError( nErrId, sErrDesc)) ;
string sOut = "(" + ToString( nErrId) + ") " + sErrDesc ;
// se uscita dolce
@@ -1175,7 +1324,7 @@ Machine::LuaEmtSetWarning( lua_State* L)
// verifico ci sia una macchina attiva
if ( m_pMchLua == nullptr)
return luaL_error( L, " Unknown Machine") ;
// assegno i dati
// imposto informazioni di warning
bool bOk = ( m_pMchLua->m_pMchMgr != nullptr && m_pMchLua->m_pMchMgr->SetWarning( nWarnId, sWarnDesc)) ;
// assegno risultato
LuaSetParam( L, bOk) ;
@@ -1204,7 +1353,7 @@ Machine::LuaEmtAddCollisionObj( lua_State* L)
if ( m_pMchLua == nullptr)
return luaL_error( L, " Unknown Machine") ;
// assegno i dati
bool bOk = ( m_pMchLua->m_pMchMgr != nullptr && m_pMchLua->m_pMchMgr->SimAddCollisionObj( nInd, nFrameId, nType, Vector3d(), dPar1, dPar2, dPar3)) ;
bool bOk = ( m_pMchLua->m_pMchMgr != nullptr && m_pMchLua->m_pMchMgr->SimAddCollisionObj( nInd, false, nFrameId, nType, Vector3d(), dPar1, dPar2, dPar3)) ;
// assegno risultato
LuaSetParam( L, bOk) ;
return 1 ;
@@ -1214,7 +1363,7 @@ Machine::LuaEmtAddCollisionObj( lua_State* L)
int
Machine::LuaEmtAddCollisionObjEx( lua_State* L)
{
// 7 parametri : nInd, nFrameId, nType, vtMove, dPar1, dPar2, dPar3
// 7 o 8 parametri : nInd, nFrameId, nType, vtMove, dPar1, dPar2, dPar3 [,bToolOn]
int nInd ;
LuaCheckParam( L, 1, nInd)
int nFrameId ;
@@ -1229,12 +1378,14 @@ Machine::LuaEmtAddCollisionObjEx( lua_State* L)
LuaCheckParam( L, 6, dPar2)
double dPar3 ;
LuaCheckParam( L, 7, dPar3)
bool bToolOn = false ;
LuaGetParam( L, 8, bToolOn) ;
LuaClearStack( L) ;
// verifico ci sia una macchina attiva
if ( m_pMchLua == nullptr)
return luaL_error( L, " Unknown Machine") ;
// assegno i dati
bool bOk = ( m_pMchLua->m_pMchMgr != nullptr && m_pMchLua->m_pMchMgr->SimAddCollisionObj( nInd, nFrameId, nType, vtMove, dPar1, dPar2, dPar3)) ;
bool bOk = ( m_pMchLua->m_pMchMgr != nullptr && m_pMchLua->m_pMchMgr->SimAddCollisionObj( nInd, bToolOn, nFrameId, nType, vtMove, dPar1, dPar2, dPar3)) ;
// assegno risultato
LuaSetParam( L, bOk) ;
return 1 ;
@@ -1244,7 +1395,7 @@ Machine::LuaEmtAddCollisionObjEx( lua_State* L)
int
Machine::LuaEmtExecCollisionCheck( lua_State* L)
{
// 1 parametro opzionale
// 1 parametro opzionale : [nMoveType = 0]
int nMoveType = 0 ;
LuaGetParam( L, 1, nMoveType) ;
LuaClearStack( L) ;
@@ -1274,7 +1425,7 @@ Machine::LuaEmtOnCollision( lua_State* L)
// verifico ci sia una macchina attiva
if ( m_pMchLua == nullptr)
return luaL_error( L, " Unknown Machine") ;
// eseguo la verifica di collisione (nessuna collisione -> true)
// eseguo gestione della collisione in simulazione
int nErr = 0 ;
bool bOk = ( m_pMchLua->m_pMchMgr != nullptr && m_pMchLua->m_pMchMgr->SimOnCollision( nCdInd, nObjInd, nErr)) ;
// assegno risultato
@@ -1282,3 +1433,85 @@ Machine::LuaEmtOnCollision( lua_State* L)
LuaSetParam( L, nErr) ;
return 2 ;
}
//----------------------------------------------------------------------------
int
Machine::LuaEmtSetToolForVmill( lua_State* L)
{
// 4 parametri : sTool, sHead, nExit, vVmill
string sTool ;
LuaGetParam( L, 1, sTool) ;
string sHead ;
LuaGetParam( L, 2, sHead) ;
int nExit = 0 ;
LuaGetParam( L, 3, nExit) ;
INTVECTOR vVmill ;
LuaGetParam( L, 4, vVmill) ;
LuaClearStack( L) ;
// verifico ci sia una macchina attiva
if ( m_pMchLua == nullptr)
return luaL_error( L, " Unknown Machine") ;
// imposto dati primo utensile per virtual milling in simulazione
bool bOk = ( m_pMchLua->m_pMchMgr != nullptr && m_pMchLua->m_pMchMgr->SimSetToolForVmill( sTool, sHead, nExit, vVmill, true)) ;
// assegno risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//----------------------------------------------------------------------------
int
Machine::LuaEmtAddToolForVmill( lua_State* L)
{
// 4 parametri : sTool, sHead, nExit, vVmill
string sTool ;
LuaGetParam( L, 1, sTool) ;
string sHead ;
LuaGetParam( L, 2, sHead) ;
int nExit = 0 ;
LuaGetParam( L, 3, nExit) ;
INTVECTOR vVmill ;
LuaGetParam( L, 4, vVmill) ;
LuaClearStack( L) ;
// verifico ci sia una macchina attiva
if ( m_pMchLua == nullptr)
return luaL_error( L, " Unknown Machine") ;
// imposto dati utensile aggiuntivo per virtual milling in simulazione
bool bOk = ( m_pMchLua->m_pMchMgr != nullptr && m_pMchLua->m_pMchMgr->SimSetToolForVmill( sTool, sHead, nExit, vVmill, false)) ;
// assegno risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//----------------------------------------------------------------------------
int
Machine::LuaEmtMoveAxes( lua_State* L)
{
// 4, ..., 31 parametri : nMoveType, sAx1, dPos1, dStep1 [, sAx2, dPos2, dStep2] ... [, sAx10, dPos10, dStep10]
int nMoveType = 0 ;
LuaGetParam( L, 1, nMoveType) ;
SAMVECTOR vAxNaEpSt ;
for ( int i = 0 ; i < 10 ; ++ i) {
int nInd = 2 + 3 * i ;
string sAxN ;
double dEndN ;
double dStepN ;
if ( LuaGetParam( L, nInd, sAxN) && LuaGetParam( L, nInd + 1, dEndN) && LuaGetParam( L, nInd + 2, dStepN))
vAxNaEpSt.emplace_back( sAxN, dEndN, dStepN) ;
else
break ;
}
LuaClearStack( L) ;
// verifico ci sia una macchina attiva
if ( m_pMchLua == nullptr)
return luaL_error( L, " Unknown Machine") ;
// eseguo movimento in simulazione
int nRes = 0 ;
if ( m_pMchLua->m_pMchMgr != nullptr)
nRes = m_pMchLua->m_pMchMgr->SimMoveAxes( nMoveType, vAxNaEpSt) ;
// assegno risultato
if ( nRes == SIM_AXMV_RES_STOP)
return luaL_error( L, "STOP") ;
else
LuaSetParam( L, ( nRes == SIM_AXMV_RES_OK)) ;
return 1 ;
}
+16 -4
View File
@@ -31,7 +31,7 @@ using namespace std ;
int
Machine::LuaEmtAddRapidStart( lua_State* L)
{
// 6 parametri : nPathId, ptP, vtTool, vtCorr, vtAux, nFlag
// 6 o 7 parametri : nPathId, ptP, vtTool, vtCorr, vtAux, nFlag [, bToolShow]
int nPathId ;
LuaCheckParam( L, 1, nPathId)
Point3d ptP ;
@@ -44,6 +44,8 @@ Machine::LuaEmtAddRapidStart( lua_State* L)
LuaCheckParam( L, 5, vtAux)
int nFlag ;
LuaCheckParam( L, 6, nFlag)
bool bToolShow = false ;
LuaGetParam( L, 7, bToolShow) ;
LuaClearStack( L) ;
// verifico ci sia una macchina attiva valida
if ( m_pMchLua == nullptr ||
@@ -69,6 +71,7 @@ Machine::LuaEmtAddRapidStart( lua_State* L)
pCam->SetEndPoint( ptP) ;
pCam->SetFeed( 0) ;
pCam->SetFlag( nFlag) ;
pCam->SetToolShow( bToolShow) ;
// associo questo oggetto a quello geometrico
m_pMchLua->m_pGeomDB->SetUserObj( nId, Release( pCam)) ;
}
@@ -84,7 +87,7 @@ Machine::LuaEmtAddRapidStart( lua_State* L)
int
Machine::LuaEmtAddRapidMove( lua_State* L)
{
// 7 parametri : nPathId, ptIni, ptFin, vtTool, vtCorr, vtAux, nFlag
// 7 o 8 parametri : nPathId, ptIni, ptFin, vtTool, vtCorr, vtAux, nFlag [, bToolShow]
int nPathId ;
LuaCheckParam( L, 1, nPathId)
Point3d ptIni ;
@@ -99,6 +102,8 @@ Machine::LuaEmtAddRapidMove( lua_State* L)
LuaCheckParam( L, 6, vtAux)
int nFlag ;
LuaCheckParam( L, 7, nFlag)
bool bToolShow = false ;
LuaGetParam( L, 8, bToolShow) ;
LuaClearStack( L) ;
// verifico ci sia una macchina attiva valida
if ( m_pMchLua == nullptr ||
@@ -124,6 +129,7 @@ Machine::LuaEmtAddRapidMove( lua_State* L)
pCam->SetEndPoint( ptFin) ;
pCam->SetFeed( 0) ;
pCam->SetFlag( nFlag) ;
pCam->SetToolShow( bToolShow) ;
// associo questo oggetto a quello geometrico
m_pMchLua->m_pGeomDB->SetUserObj( nId, Release( pCam)) ;
}
@@ -139,7 +145,7 @@ Machine::LuaEmtAddRapidMove( lua_State* L)
int
Machine::LuaEmtAddLinearMove( lua_State* L)
{
// 8 parametri : nPathId, ptIni, ptFin, vtTool, vtCorr, vtAux, dFeed, nFlag
// 8 o 9 parametri : nPathId, ptIni, ptFin, vtTool, vtCorr, vtAux, dFeed, nFlag [, bToolShow]
int nPathId ;
LuaCheckParam( L, 1, nPathId)
Point3d ptIni ;
@@ -156,6 +162,8 @@ Machine::LuaEmtAddLinearMove( lua_State* L)
LuaCheckParam( L, 7, dFeed)
int nFlag ;
LuaCheckParam( L, 8, nFlag)
bool bToolShow = false ;
LuaGetParam( L, 9, bToolShow) ;
LuaClearStack( L) ;
// verifico ci sia una macchina attiva valida
if ( m_pMchLua == nullptr ||
@@ -181,6 +189,7 @@ Machine::LuaEmtAddLinearMove( lua_State* L)
pCam->SetEndPoint( ptFin) ;
pCam->SetFeed( dFeed) ;
pCam->SetFlag( nFlag) ;
pCam->SetToolShow( bToolShow) ;
// associo questo oggetto a quello geometrico
m_pMchLua->m_pGeomDB->SetUserObj( nId, Release( pCam)) ;
}
@@ -196,7 +205,7 @@ Machine::LuaEmtAddLinearMove( lua_State* L)
int
Machine::LuaEmtAddArcMove( lua_State* L)
{
// 11 parametri : nPathId, ptIni, ptFin, ptCen, dAngCen, vtN, vtTool, vtCorr, vtAux, dFeed, nFlag
// 11 o 12 parametri : nPathId, ptIni, ptFin, ptCen, dAngCen, vtN, vtTool, vtCorr, vtAux, dFeed, nFlag [, bToolShow]
int nPathId ;
LuaCheckParam( L, 1, nPathId)
Point3d ptIni ;
@@ -219,6 +228,8 @@ Machine::LuaEmtAddArcMove( lua_State* L)
LuaCheckParam( L, 10, dFeed)
int nFlag ;
LuaCheckParam( L, 11, nFlag)
bool bToolShow = false ;
LuaGetParam( L, 12, bToolShow) ;
LuaClearStack( L) ;
// verifico ci sia una macchina attiva valida
if ( m_pMchLua == nullptr ||
@@ -252,6 +263,7 @@ Machine::LuaEmtAddArcMove( lua_State* L)
pCam->SetNormDir( vtN) ;
pCam->SetFeed( dFeed) ;
pCam->SetFlag( nFlag) ;
pCam->SetToolShow( bToolShow) ;
// associo questo oggetto a quello geometrico
m_pMchLua->m_pGeomDB->SetUserObj( nId, Release( pCam)) ;
}
+27 -8
View File
@@ -1,7 +1,7 @@
//----------------------------------------------------------------------------
// EgalTech 2015-2015
// EgalTech 2015-2024
//----------------------------------------------------------------------------
// File : MachineStruConst.h Data : 25.05.15 Versione : 1.6e7
// File : MachineStruConst.h Data : 15.01.24 Versione : 2.5l6
// Contenuto : Strutture e costanti di macchina.
//
//
@@ -44,6 +44,7 @@ struct KinAxis {
int nGrpId ;
bool bLinear ;
bool bHead ;
int nInd ;
Point3d ptPos ;
Vector3d vtDir ;
STROKE stroke ;
@@ -51,7 +52,7 @@ struct KinAxis {
bool bFixed ;
double dFixVal ;
KinAxis( void)
: nGrpId( GDB_ID_NULL), bLinear( true), bHead( true), ptPos(), vtDir(), dHomeVal( 0), bFixed( false), dFixVal( 0)
: nGrpId( GDB_ID_NULL), bLinear( true), bHead( true), nInd( 0), ptPos(), vtDir(), dHomeVal( 0), bFixed( false), dFixVal( 0)
{ stroke.Min = 0 ; stroke.Max = 0 ; }
} ;
typedef std::vector<KinAxis> KINAXISVECTOR ;
@@ -87,6 +88,18 @@ enum MchHeadType { MCH_HT_NONE = 0,
MCH_HT_MULTI = 2,
MCH_HT_SPECIAL = 3} ;
//----------------------------------------------------------------------------
// Tipo di selezione ammessa per le uscite
enum MchSelType { MCH_SLT_FIXEDEXITS = 0,
MCH_SLT_ONEEXIT = 1,
MCH_SLT_MULTIEXITS = 2} ;
//----------------------------------------------------------------------------
// Tipo della catena cinematica
enum KinChainType { KIN_CHAIN_NONE = 0,
KIN_CHAIN_CENTER = 1,
KIN_CHAIN_ROBOT = 2} ;
//----------------------------------------------------------------------------
// Identificativo iniziale riferimenti di tavola
const std::string MCH_TREF = "R" ;
@@ -112,17 +125,20 @@ const std::string MCH_ZHOMEDOWN = "ZHOMEDOWN" ;
const std::string MCH_ABOVE = "ABOVE" ;
// Info di testa per una variazione alla Z di sicurezza globale
const std::string MCH_ZSAFEDELTA = "ZSAFEDELTA" ;
// Info di tavola per dichiarare che va considerata come basculante
const std::string MCH_TILTINGLIKE = "TiltingLike" ;
//----------------------------------------------------------------------------
// Dati aggregato rotante da sotto
struct AggrBottom {
int nType ;
double dDMax ;
double dEncH ;
double dEncV ;
int nType ;
double dDMax ;
double dEncH ;
double dEncV ;
Vector3d vtMDir ;
AggrBottom( void) : nType( 0), dDMax( 0), dEncH( 0), dEncV( 0) {}
void Clear( void)
{ nType = 0 ; dDMax= 0 ; dEncH = 0 ; dEncV = 0 ; }
{ nType = 0 ; dDMax= 0 ; dEncH = 0 ; dEncV = 0 ; vtMDir = V_NULL ; }
} ;
//----------------------------------------------------------------------------
@@ -134,3 +150,6 @@ const std::string MCH_AGB_DMAX = "AGB_DMAX" ;
const std::string MCH_AGB_ENCH = "AGB_ENCH" ;
// Info in rinvio rotante da sotto con ingombro verticale
const std::string MCH_AGB_ENCV = "AGB_ENCV" ;
// Info in rinvio rotante da sotto per definire la direzione di approccio preferenziale (consentito delta max di 95deg)
const std::string MCH_AGB_MDIR = "AGB_MDIR" ;
const double MCH_AGB_DELTAMAX_MDIR = cos( 95 * DEGTORAD) ;
+11 -2
View File
@@ -148,6 +148,15 @@ Machining::PrepareToolPreview( void) const
int nId = m_pGeomDB->CopyGlob( nHeadId, GDB_ID_NULL, nStId) ;
m_pGeomDB->SetMode( nId, GDB_MD_STD) ;
m_pGeomDB->SetStatus( nId, GDB_ST_OFF) ;
// elimino eventuali gruppi opportunamente indicati
int nSubId = m_pGeomDB->GetFirstGroupInGroup( nId) ;
while ( nSubId != GDB_ID_NULL) {
int nNextSubId = m_pGeomDB->GetNextGroup( nSubId) ;
bool bShow = true ;
if ( m_pGeomDB->GetInfo( nSubId, KEY_PREVIEWSHOW, bShow) && ! bShow)
m_pGeomDB->Erase( nSubId) ;
nSubId = nNextSubId ;
}
return ( nId != GDB_ID_NULL) ;
}
@@ -287,12 +296,12 @@ Machining::ToolPreview( int nEntId, int nFlag) const
Frame3d frHead ;
m_pGeomDB->GetGroupGlobFrame( nId, frHead) ;
Frame3d frRef ;
if ( vtAux.IsSmall())
if ( vtAux.IsSmall() || AreSameOrOppositeVectorApprox( vtAux, vtDir))
frRef.Set( ptOrig, vtDir) ;
else
frRef.Set( ptOrig, vtDir, vtAux) ;
Frame3d frShow ;
if ( vtBAux.IsSmall())
if ( vtBAux.IsSmall() || AreSameOrOppositeVectorApprox( vtBAux, vtTool))
frShow.Set( ptEnd + vtTool * GetToolData().m_dLen, vtTool) ;
else
frShow.Set( ptEnd + vtTool * GetToolData().m_dLen, vtTool, vtBAux) ;
+10 -1
View File
@@ -103,7 +103,11 @@ GetMachiningTitle( int nMchType)
"SawRoughing",
"SawFinishing",
"GenMachining",
"Chiseling"} ;
"Chiseling",
"SurfRoughing",
"SurfFinishing",
"Waterjetting",
"5axMachining"} ;
switch ( nMchType) {
case MT_DRILLING : return MchTitle[1] ;
case MT_SAWING : return MchTitle[2] ;
@@ -114,6 +118,11 @@ GetMachiningTitle( int nMchType)
case MT_SAWFINISHING : return MchTitle[7] ;
case MT_GENMACHINING : return MchTitle[8] ;
case MT_CHISELING : return MchTitle[9] ;
case MT_SURFROUGHING : return MchTitle[10] ;
case MT_SURFFINISHING : return MchTitle[11] ;
case MT_WATERJETTING : return MchTitle[12] ;
case MT_5AXMACHINING : return MchTitle[13] ;
}
return MchTitle[0] ;
}
+338 -20
View File
@@ -1,7 +1,7 @@
//----------------------------------------------------------------------------
// EgalTech 2015-2020
// EgalTech 2015-2024
//----------------------------------------------------------------------------
// File : MachiningsMgr.cpp Data : 09.11.20 Versione : 2.2k2
// File : MachiningsMgr.cpp Data : 29.03.24 Versione : 2.6d1
// Contenuto : Implementazione gestore database lavorazioni.
//
//
@@ -15,6 +15,8 @@
// 03.06.20 DS Agg. per nuovi parametri Tab in fresatura (MF_CURR_VER = 1009).
// 22.06.20 DS Agg. per nuovi parametri attacco tagli di lama (MF_CURR_VER = 1010).
// 09.11.20 DS Agg. per nuovi parametri tagli di lama (MF_CURR_VER = 1011).
// 04.02.22 DS Agg. per nuovi parametri svuotature con epicicli (MF_CURR_VER = 1012).
// 29.03.24 DS Agg. parametro APPROX_LINTOL (MF_CURR_VER = 1013).
//
//----------------------------------------------------------------------------
@@ -31,7 +33,6 @@
#include "/EgtDev/Include/EGnFileUtils.h"
#include "/EgtDev/Include/EGnScanner.h"
#include "/EgtDev/Include/EGnWriter.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
#include <cassert>
#include <bitset>
@@ -42,7 +43,7 @@ const string MF_HEADER = "[HEADER]" ;
const string MF_VERSION = "VERSION" ;
const string MF_TOTAL = "TOTAL" ;
const string MF_SIZE = "SIZE" ;
const int MF_CURR_VER = 1011 ;
const int MF_CURR_VER = 1013 ;
const string MF_GENERAL = "[GENERAL]" ;
const string MF_3AXCOMP = "3AXCOMP" ;
const bool MF_CURR_3AXCOMP = false ;
@@ -64,6 +65,8 @@ const string MF_INTSAWARCMAXSIDEANG = "INTSAWARCMAXSIDEANG" ;
const double MF_CURR_INTSAWARCMAXSIDEANG = 45 ;
const string MF_SPLITARCS = "SPLITARCS" ;
const int MF_CURR_SPLITARCS = SPLAR_NEVER ;
const string MF_APPROX_LINTOL = "APPROX_LINTOL" ;
const double MF_CURR_APPROX_LINTOL = 0.05 ;
const string MF_MAXDEPTHSAFE = "MAXDEPTHSAFE" ;
const double MF_CURR_MAXDEPTHSAFE = 2.0 ;
@@ -85,6 +88,7 @@ MachiningsMgr::MachiningsMgr( void)
m_dExtSawArcMinRad = MF_CURR_EXTSAWARCMINRAD ;
m_dIntSawArcMaxSideAng = MF_CURR_INTSAWARCMAXSIDEANG ;
m_nSplitArcs = MF_CURR_SPLITARCS ;
m_dApproxLinTol = MF_CURR_APPROX_LINTOL ;
m_dMaxDepthSafe = MF_CURR_MAXDEPTHSAFE ;
}
@@ -189,11 +193,25 @@ MachiningsMgr::Reload( void)
// Ciclo di lettura delle lavorazioni
do {
if ( ! LoadOneMachining( TheScanner, bEnd)) {
PtrOwner<MachiningData> pMch ;
if ( LoadOneMachining( TheScanner, pMch, bEnd)) {
// salvo i dati della lavorazione
if ( ! IsNull( pMch)) {
if ( ! m_umData.emplace( pMch->m_Uuid, Get( pMch)).second ||
! m_suData.emplace( pMch->m_sName, pMch->m_Uuid).second) {
bOk = false ;
string sOut = "ReloadMachinings : Error adding machining " + pMch->m_sName ;
LOG_ERROR( GetEMkLogger(), sOut.c_str())
}
Release( pMch) ;
}
}
else {
bOk = false ;
string sOut = "ReloadMachinings : Error on line " + ToString( TheScanner.GetCurrLineNbr()) ;
LOG_ERROR( GetEMkLogger(), sOut.c_str())
}
} while ( bOk && ! bEnd) ;
// Termino lo scanner
@@ -207,7 +225,7 @@ MachiningsMgr::Reload( void)
//----------------------------------------------------------------------------
bool
MachiningsMgr::LoadHeader( Scanner& TheScanner, int& nVersion, int& nTotal, bool& bEnd)
MachiningsMgr::LoadHeader( Scanner& TheScanner, int& nVersion, int& nTotal, bool& bEnd) const
{
// leggo la prossima linea
string sLine ;
@@ -298,6 +316,8 @@ MachiningsMgr::LoadGeneral( Scanner& TheScanner, bool& bEnd)
bOk = FromString( sVal, m_dIntSawArcMaxSideAng) ;
else if ( ToUpper( sKey) == MF_SPLITARCS)
bOk = FromString( sVal, m_nSplitArcs) ;
else if ( ToUpper( sKey) == MF_APPROX_LINTOL)
bOk = FromString( sVal, m_dApproxLinTol) ;
else if ( ToUpper( sKey) == MF_MAXDEPTHSAFE)
bOk = FromString( sVal, m_dMaxDepthSafe) ;
else
@@ -311,11 +331,12 @@ MachiningsMgr::LoadGeneral( Scanner& TheScanner, bool& bEnd)
//----------------------------------------------------------------------------
bool
MachiningsMgr::LoadOneMachining( Scanner& TheScanner, bool& bEnd)
MachiningsMgr::LoadOneMachining( Scanner& TheScanner, PtrOwner<MachiningData>& pMch, bool& bEnd) const
{
// leggo la prossima linea
string sLine ;
if ( ! TheScanner.GetLine( sLine)) {
pMch.Reset() ;
// fine file
bEnd = true ;
return true ;
@@ -324,12 +345,12 @@ MachiningsMgr::LoadOneMachining( Scanner& TheScanner, bool& bEnd)
if ( sLine.front() != '[' || sLine.back() != ']')
return false ;
Trim( sLine, "[]") ;
// separo tipo da contatore
// separo tipo da contatore
string sType, sCount ;
SplitFirst( sLine, "_", sType, sCount) ;
ToUpper( sType) ;
// alloco la lavorazione del tipo corrispondente
PtrOwner<MachiningData> pMch( MCHDATA_CREATE( MCHDATA_NAMETOTYPE( sType))) ;
pMch.Set( MCHDATA_CREATE( MCHDATA_NAMETOTYPE( sType))) ;
if ( IsNull( pMch))
return false ;
bool bOk = true ;
@@ -366,10 +387,6 @@ MachiningsMgr::LoadOneMachining( Scanner& TheScanner, bool& bEnd)
}
// verifico di aver letto tutti i campi
bOk = bOk && ( Flag.count() == nSize) ;
// salvo i dati della lavorazione
bOk = bOk && m_umData.emplace( pMch->m_Uuid, Get( pMch)).second ;
bOk = bOk && m_suData.emplace( pMch->m_sName, pMch->m_Uuid).second ;
Release( pMch) ;
return bOk ;
}
@@ -438,7 +455,7 @@ MachiningsMgr::Save( bool bCompressed) const
//----------------------------------------------------------------------------
bool
MachiningsMgr::SaveHeader( Writer& TheWriter) const
MachiningsMgr::SaveHeader( Writer& TheWriter, int nTotal) const
{
// scrivo l'intestazione
bool bOk = true ;
@@ -447,7 +464,10 @@ MachiningsMgr::SaveHeader( Writer& TheWriter) const
bOk = bOk && TheWriter.OutText( sOut) ;
sOut = MF_VERSION + "=" + ToString( m_nDbVer) ;
bOk = bOk && TheWriter.OutText( sOut) ;
sOut = MF_TOTAL + "=" + ToString( int( m_umData.size())) ;
if ( nTotal == -1)
sOut = MF_TOTAL + "=" + ToString( int( m_umData.size())) ;
else
sOut = MF_TOTAL + "=" + ToString( nTotal) ;
bOk = bOk && TheWriter.OutText( sOut) ;
return bOk ;
}
@@ -485,6 +505,10 @@ MachiningsMgr::SaveGeneral( Writer& TheWriter) const
sOut = MF_MAXDEPTHSAFE + "=" + ToString( m_dMaxDepthSafe) ;
bOk = bOk && TheWriter.OutText( sOut) ;
}
if ( m_nDbVer >= 1013) {
sOut = MF_APPROX_LINTOL + "=" + ToString( m_dApproxLinTol) ;
bOk = bOk && TheWriter.OutText( sOut) ;
}
return bOk ;
}
@@ -498,14 +522,20 @@ MachiningsMgr::SaveOneMachining( const EgtUUID& Uuid, int& nCounter, Writer& The
if ( iIter == m_umData.end())
return false ;
const MachiningData* pmData = iIter->second ;
// preparo la lista dei dati (quelli vuoti sono opzionali con default)
STRVECTOR vsOut ;
for ( int i = 0 ; i < pmData->GetSize() ; ++ i) {
string sOut = pmData->ToString( i) ;
if ( ! sOut.empty())
vsOut.emplace_back( sOut) ;
}
// scrivo i dati della lavorazione
string sOut = "[" + pmData->GetTitle() + "_" + ToString( ++ nCounter, 3) + "]" ;
bool bOk = TheWriter.OutText( sOut) ;
sOut = MF_SIZE + "=" + ToString( pmData->GetSize()) ;
sOut = MF_SIZE + "=" + ToString( int( vsOut.size())) ;
bOk = bOk && TheWriter.OutText( sOut) ;
for ( int i = 0 ; i < pmData->GetSize() ; ++ i) {
string sOut = pmData->ToString( i) ;
bOk = bOk && ! sOut.empty() && TheWriter.OutText( sOut) ;
for ( const auto& sOut : vsOut) {
bOk = bOk && TheWriter.OutText( sOut) ;
}
return bOk ;
}
@@ -514,7 +544,7 @@ MachiningsMgr::SaveOneMachining( const EgtUUID& Uuid, int& nCounter, Writer& The
bool
MachiningsMgr::GetMachiningNewName( string& sName) const
{
// il parametro nome deve essere valido
// il parametro nome deve essere valido
if ( &sName == nullptr)
return false ;
// se nome vuoto, assegno radice standard
@@ -1155,6 +1185,20 @@ MachiningsMgr::SetSplitArcs( int nFlag)
return true ;
}
//----------------------------------------------------------------------------
bool
MachiningsMgr::SetApproxLinTol( double dLinTol)
{
// verifico non sia inferiore al minimo
dLinTol = max( dLinTol, EPS_SMALL) ;
// se cambiato, salvo e setto modifica
if ( abs( dLinTol - m_dApproxLinTol) > EPS_SMALL) {
m_dApproxLinTol = dLinTol ;
m_bModified = true ;
}
return true ;
}
//----------------------------------------------------------------------------
bool
MachiningsMgr::SetMaxDepthSafe( double dSafe)
@@ -1168,3 +1212,277 @@ MachiningsMgr::SetMaxDepthSafe( double dSafe)
}
return true ;
}
//----------------------------------------------------------------------------
bool
MachiningsMgr::Export( const STRVECTOR& vsMachiningsNames, const string& sOutFile, bool bCompressed) const
{
LOG_INFO( GetEMkLogger(), ( "Export Machinings " + sOutFile).c_str()) ;
// conto le lavorazioni da esportare
int nMachinings = 0 ;
for ( size_t i = 0 ; i < vsMachiningsNames.size() ; i ++) {
if ( m_suData.find( vsMachiningsNames[i]) != m_suData.end())
nMachinings ++ ;
}
// inizializzo il writer
Writer TheWriter ;
if ( ! TheWriter.Init( sOutFile, bCompressed)) {
LOG_ERROR( GetEMkLogger(), " Error Exporting Machinings on Init") ;
return false ;
}
// scrivo linea di inizio file
string sOut = "; --- " + sOutFile + " " + CurrDateTime() + " ---" ;
if ( ! TheWriter.OutText( sOut)) {
LOG_ERROR( GetEMkLogger(), " Error Exporting Machinings on Start") ;
return false ;
}
// scrivo l'intestazione
if ( ! SaveHeader( TheWriter, nMachinings)) {
LOG_ERROR( GetEMkLogger(), " Error Exporting Machinings on Header") ;
return false ;
}
// scrivo i dati generali
if ( m_nDbVer >= 1002 && ! SaveGeneral( TheWriter)) {
LOG_ERROR( GetEMkLogger(), " Error Exporting Machinings on General") ;
return false ;
}
// ciclo su tutti i nomi delle lavorazioni da esportare
int nCounter = 0 ;
for ( size_t i = 0 ; i < vsMachiningsNames.size() ; i ++) {
auto it = m_suData.find( vsMachiningsNames[i]) ;
// se la lavorazione non esiste passo alla sucessiva
if ( it == m_suData.end()) {
string sOut = " Warning Exporting Machinings : " + vsMachiningsNames[i] + " not found. Machining is ignored." ;
LOG_ERROR( GetEMkLogger(), sOut.c_str()) ;
continue ;
}
// esporto la singola lavorazione
if ( ! SaveOneMachining( it->second, nCounter, TheWriter)) {
string sOut = " Error Exporting Machining " + it->first ;
LOG_ERROR( GetEMkLogger(), sOut.c_str()) ;
return false ;
}
}
// scrivo linea di fine file
if ( ! TheWriter.OutText( "; --- End ---")) {
LOG_ERROR( GetEMkLogger(), " Error Exporting Machinings on End") ;
return false ;
}
// chiudo la scrittura
TheWriter.Close() ;
return true ;
}
//----------------------------------------------------------------------------
bool
MachiningsMgr::ToBeImported( const string& sFile, STRVECTOR& vsMachiningsNames, INTVECTOR& vMachiningsTypes) const
{
// inizializzo lo scanner
Scanner TheScanner ;
if ( ! TheScanner.Init( sFile, ";")) {
LOG_ERROR( GetEMkLogger(), "Machinings ToBeImported : Error on Init") ;
return false ;
}
// leggo l'intestazione
int nVersion = 0 ;
int nTotal = 0 ;
bool bEnd = false ;
if ( ! LoadHeader( TheScanner, nVersion, nTotal, bEnd)) {
LOG_ERROR( GetEMkLogger(), "Machinings ToBeImported : Error on Header") ;
return false ;
}
string sLine ;
if ( ! TheScanner.GetLine( sLine))
return true ; // il file è finito, esco
// parte generale
if ( sLine == MF_GENERAL) {
// scorro le linee fino ad arrivare alla sezione successiva
while ( TheScanner.GetLine( sLine)) {
if ( sLine.front() == '[' && sLine.back() == ']')
break ;
}
// se non c'è una sezione successiva esco
if ( sLine.empty())
return true ;
}
else if ( nVersion >= 1002) {
LOG_ERROR( GetEMkLogger(), "Machinings ToBeImported : General section missing") ;
return false ;
}
bool bMachiningName = false ;
bool bAdd = true ;
string sName ;
int nType = 0 ;
TheScanner.UngetLine( sLine) ;
while ( TheScanner.GetLine( sLine)) {
if ( sLine.front() == '[' && sLine.back() == ']') { // se è intestazione
// aggiungo lavorazione precedente se ok
if ( bAdd && bMachiningName && nType != 0) {
vsMachiningsNames.push_back( sName) ;
vMachiningsTypes.push_back( nType) ;
}
bMachiningName = false ;
bAdd = true ;
// salvo il tipo di lavorazione
Trim( sLine, "[]") ;
string sType, sCount ;
SplitFirst( sLine, "_", sType, sCount) ;
ToUpper( sType) ;
nType = MCHDATA_NAMETOTYPE( sType) ;
}
else {
string sKey, sVal ;
SplitFirst( sLine, "=", sKey, sVal) ;
if ( ToUpper( sKey) == "NAME") {
if ( ! bMachiningName) {
bMachiningName = true ;
sName = sVal ;
}
else // se lavorazione ha più nomi è errore, non deve essere importata
bAdd = false ;
}
}
}
// aggiungo ultima lavorazione se ok
if ( bAdd && bMachiningName && nType != 0) {
vsMachiningsNames.push_back( sName) ;
vMachiningsTypes.push_back( nType) ;
}
if ( vsMachiningsNames.size() != vMachiningsTypes.size())
return false ;
return true ;
}
//----------------------------------------------------------------------------
bool
MachiningsMgr::Import( const string& sFile, const STRVECTOR& vsMachiningsToImport, const STRVECTOR& vsMachiningsNames, STRVECTOR& vsImported)
{
LOG_INFO( GetEMkLogger(), ( "Import Machinings : " + sFile).c_str()) ;
for ( size_t i = 0 ; i < vsMachiningsNames.size() ; i ++) {
// se esiste già nel DB una lavorazione con lo stesso nome la rimuovo
if ( m_suData.find( vsMachiningsNames[i]) != m_suData.end()) {
bool bOk = RemoveMachining( vsMachiningsNames[i]) ;
if ( ! bOk) {
LOG_ERROR( GetEMkLogger(), ( " Error Importing Machinings : removing " + vsMachiningsNames[i] + " failed" ).c_str()) ;
return false ;
}
}
// verfico che il nome non sia ripetuto nella lista dei vsMachiningsNames
if ( i != vsMachiningsNames.size() - 1 &&
find( vsMachiningsNames.begin() + i + 1, vsMachiningsNames.end(), vsMachiningsNames[i]) != vsMachiningsNames.end()) {
LOG_ERROR( GetEMkLogger(), ( " Error Importing Machinings : name \"" + vsMachiningsNames[i] + "\" is already used").c_str()) ;
return false ;
}
}
// inizializzo lo scanner
Scanner TheScanner ;
if ( ! TheScanner.Init( sFile, ";")) {
LOG_ERROR( GetEMkLogger(), " Error Importing Machinings on Init") ;
return false ;
}
// leggo l'intestazione
int nVersion = 0 ;
int nTotal = 0 ;
bool bEnd ;
if ( ! LoadHeader( TheScanner, nVersion, nTotal, bEnd)) {
LOG_ERROR( GetEMkLogger(), " Error Importing Machinings on Header") ;
return false ;
}
// leggo i dati generali (da versione 1002) e li ignoro
if ( nVersion >= 1002 && ! SkipGeneral( TheScanner, bEnd)) {
LOG_ERROR( GetEMkLogger(), " Error Importing Machinings on General") ;
return false ;
}
// ciclo di lettura delle lavorazioni
while ( ! bEnd) {
PtrOwner<MachiningData> pMch ;
if ( ! LoadOneMachining( TheScanner, pMch, bEnd)) {
LOG_ERROR( GetEMkLogger(), ( " Error Importing Machinings : reading at line" + ToString( TheScanner.GetCurrLineNbr())).c_str()) ;
continue ;
}
// se non c'è lavorazione (si è alla fine), si prosegue
if ( IsNull( pMch))
continue ;
// se la lavorazione non deve essere importata proseguo con la successiva
auto it = find( vsMachiningsToImport.begin(), vsMachiningsToImport.end(), pMch->m_sName) ;
if ( it == vsMachiningsToImport.end())
continue ;
// assegno il nuovo nome
pMch->m_sName = vsMachiningsNames[ it - vsMachiningsToImport.begin()] ;
// se il suo UUID esiste già nel DB lo modifico
if ( m_umData.find( pMch->m_Uuid) != m_umData.end()) {
LOG_ERROR( GetEMkLogger(), ( " Warning Importing Machinings: " + pMch->m_sName + " UUID changed").c_str()) ;
CreateEgtUUID( pMch->m_Uuid) ;
}
// aggiungo la lavorazione
if ( ! m_umData.emplace( pMch->m_Uuid, pMch).second ||
! m_suData.emplace( pMch->m_sName, pMch->m_Uuid).second) {
LOG_ERROR( GetEMkLogger(), ( " Error Importing Machinings : failed adding " + pMch->m_sName).c_str()) ;
continue ;
}
vsImported.push_back( pMch->m_sName) ;
Release( pMch) ;
}
if ( ! vsImported.empty())
m_bModified = true ;
return true ;
}
//----------------------------------------------------------------------------
bool
MachiningsMgr::SkipGeneral( Scanner& TheScanner, bool& bEnd) const
{
// leggo la prossima linea
string sLine ;
if ( ! TheScanner.GetLine( sLine)) {
// fine file
bEnd = true ;
return true ;
}
// deve essere dati generali
if ( sLine != MF_GENERAL)
return false ;
bool bOk = true ;
// leggo le linee successive
bEnd = true ;
while ( bOk && TheScanner.GetLine( sLine)) {
// se sezione successiva
if ( sLine.front() == '[' && sLine.back() == ']') {
TheScanner.UngetLine( sLine) ;
bEnd = false ;
break ;
}
}
return bOk ;
}
+14 -5
View File
@@ -1,7 +1,7 @@
//----------------------------------------------------------------------------
// EgalTech 2015-2015
// EgalTech 2015-2024
//----------------------------------------------------------------------------
// File : MachiningsMgr.h Data : 02.06.15 Versione : 1.6f1
// File : MachiningsMgr.h Data : 29.03.24 Versione : 2.6d1
// Contenuto : Dichiarazione della classe MachiningsMgr.
//
//
@@ -14,6 +14,7 @@
#pragma once
#include "MachiningData.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
#include <unordered_map>
#include <map>
@@ -78,16 +79,23 @@ class MachiningsMgr
bool SetSplitArcs( int nFlag) ;
int GetSplitArcs( void) const
{ return m_nSplitArcs ; }
bool SetApproxLinTol( double dLinTol) ;
double GetApproxLinTol( void) const
{ return m_dApproxLinTol ; }
bool SetMaxDepthSafe( double dSafe) ;
double GetMaxDepthSafe( void) const
{ return m_dMaxDepthSafe ; }
bool Export( const STRVECTOR& vsMachiningsNames, const std::string& sOutFile, bool bCompressed = true) const ;
bool ToBeImported( const std::string& sFile, STRVECTOR& vsMachiningsNames, INTVECTOR& vMachiningsTypes) const ;
bool Import( const std::string& sFile, const STRVECTOR& vsMachiningsToImport, const STRVECTOR& vsMachiningsNames, STRVECTOR& vsImported) ;
private :
bool Clear( bool bReset) ;
bool LoadHeader( Scanner& TheScanner, int& nVersion, int& nTotal, bool& bEnd) ;
bool LoadHeader( Scanner& TheScanner, int& nVersion, int& nTotal, bool& bEnd) const ;
bool LoadGeneral( Scanner& TheScanner, bool& bEnd) ;
bool LoadOneMachining( Scanner& TheScanner, bool& bEnd) ;
bool SaveHeader( Writer& TheWriter) const ;
bool SkipGeneral( Scanner& TheScanner, bool& bEnd) const ;
bool LoadOneMachining( Scanner& TheScanner, PtrOwner<MachiningData>& pMch, bool& bEnd) const ;
bool SaveHeader( Writer& TheWriter, int nTotal = -1) const ;
bool SaveGeneral( Writer& TheWriter) const ;
bool SaveOneMachining( const EgtUUID& Uuid, int& nCounter, Writer& TheWriter) const ;
bool VerifyCurrMachining( int nType, std::string& sName) const ;
@@ -126,5 +134,6 @@ class MachiningsMgr
double m_dExtSawArcMinRad ;
double m_dIntSawArcMaxSideAng ;
int m_nSplitArcs ;
double m_dApproxLinTol ;
double m_dMaxDepthSafe ;
} ;
+2131 -809
View File
File diff suppressed because it is too large Load Diff
+45 -19
View File
@@ -85,30 +85,37 @@ class Milling : public Machining
bool AdjustPathDrawForSaw( int nClPathId) ;
bool CalcPathElevation( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dRad, double& dElev) const ;
bool VerifyPathFromBottom( const ICurveComposite* pCompo, const Vector3d& vtTool) ;
bool GenerateMillingPv( int nPathId, const ICurveComposite* pCompo) ;
bool GenerateMillingPv( int nPathId, const ICurveComposite* pCompo, double dRbDist, double dDepth) ;
bool AddStandardMilling( const ICurveComposite* pCompo, const Vector3d& vtTool,
double dDepth, double dElev, bool bSplitArcs, bool bPathTabsEnable, bool bPathOscEnable) ;
bool AddZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool,
double dDepth, double dElev, double dOkStep, bool bSplitArcs, bool bPathTabsEnable, bool bPathOscEnable) ;
bool AddOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtTool,
double dDepth, double dElev, double dOkStep, bool bSplitArcs, bool bPathTabsEnable, bool bPathOscEnable) ;
bool AddZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dElev,
double dOkStep, bool bStepUp, bool bSplitArcs, bool bPathTabsEnable, bool bPathOscEnable) ;
bool AddOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dElev,
double dOkStep, bool bStepUp, bool bSplitArcs, bool bPathTabsEnable, bool bPathOscEnable) ;
bool AddSpiralMilling( const ICurveComposite* pCompo, const Vector3d& vtTool,
double dDepth, double dElev, double dOkStep, bool bSplitArcs, bool bPathTabsEnable, bool bPathOscEnable) ;
bool AddSawZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool,
double dDepth, double dElev, double dOkStep, bool bSplitArcs) ;
bool AddSawOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtTool,
double dDepth, double dElev, double dOkStep, bool bSplitArcs) ;
bool AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
double dElev, double dAppr, bool bOutStart, bool bAboveStart) ;
bool AddSawBladeSideApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dStElev, double dAppr) ;
bool AddDirectApproach( const Point3d& ptP) ;
double dElev, double dAppr, bool bOutStart, bool bAboveStart, bool bFirst, bool bSplitArcs) ;
bool AddSawBladeSideApproach( const Point3d& ptP, const Vector3d& vtAppr, const Vector3d& vtTool,
double dSafeZ, double dSawStElev, double dStElev, double dAppr,
bool bFirst, bool bSplitArcs, bool bAddInsert = false) ;
bool AddDirectApproach( const Point3d& ptP, bool bSplitArcs) ;
bool AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
double dElev, double dAppr, bool bAboveEnd) ;
bool AddSawBladeSideRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dEndElev, double dAppr) ;
bool CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtN,
double dStElev, bool bInvert, const ICurveComposite* pCompo, Point3d& ptP1) const ;
double dElev, double dAppr, bool bAboveEnd, bool bSplitArcs) ;
bool AddSawBladeSideRetract( const Point3d& ptP, const Vector3d& vtRetr, const Vector3d& vtTool,
double dSafeZ, double dSawEndElev, double dEndElev, double dAppr, bool bAddExtract = false) ;
bool CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtTool,
double dStElev, bool bInvert, const ICurveComposite* pCompo, Point3d& ptP1, Vector3d& vtDir1) const ;
bool AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d& vtStart,
const Vector3d& vtN, bool bInvert, const ICurveComposite* pCompo, bool bSplitArcs) ;
bool AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d& vtN, double dEndElev,
bool bInvert, const ICurveComposite* pCompo, bool bSplitArcs, Point3d& ptP1) ;
const Vector3d& vtTool, double dStElev, bool bInvert, const ICurveComposite* pCompo, bool bSplitArcs) ;
bool CalcLeadOutEnd( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d& vtTool,
double dEndElev, bool bInvert, const ICurveComposite* pCompo, Point3d& ptP1) const ;
bool AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d& vtTool, double dEndElev,
bool bInvert, const ICurveComposite* pCompo, bool bSplitArcs, Point3d& ptP1, Vector3d& vtDir1) ;
bool AdjustOscillParams( const ICurve* pCrv, bool& bPathOscEnable, double& dRampLen, double& dFlatLen) ;
bool AddOscillLine( const ICurveLine* pLine, const Vector3d& vtTool, double dRampLen, double dFlatLen) ;
bool AddOscillArc( const ICurveArc* pArc, const Vector3d& vtTool, double dRampLen, double dFlatLen) ;
@@ -117,11 +124,14 @@ class Milling : public Machining
bool AddTabsLine( const ICurveLine* pLine, const Vector3d& vtTool, const DBLVECTOR& vdTabs, const TabData& tdTabs) ;
bool AddTabsArc( const ICurveArc* pArc, const Vector3d& vtTool, const DBLVECTOR& vdTabs, const TabData& tdTabs) ;
double GetRadiusForStartEndElevation( bool bExtra = true) const ;
bool GetPointOutOfRaw( const Point3d& ptP, const Vector3d& vtTool, double dElev, double dSafeZ) const ;
bool GetSimplePointOutOfRaw( const Point3d& ptP, const Vector3d& vtTool, const Vector3d& vtCorr) const ;
bool GetPointOutOfRaw( const Point3d& ptP, const Vector3d& vtTool, const Vector3d& vtCorr, double dElev, double dSafeZ) const ;
bool GetPointAboveRaw( const Point3d& ptP, const Vector3d& vtTool) const ;
bool CalcAndSetCorrAuxDir( const ICurveComposite* pCompo, double dU) ;
Vector3d CalcCorrDir( const ICurveComposite* pCompo, double dU) ;
bool GetPointBelowRaw( const Point3d& ptP, const Vector3d& vtTool) const ;
bool CalcAndSetCorrAuxDir( const ICurveComposite* pCompo, double dU, bool bInvertSide = false, bool bSawSpecial = false) ;
Vector3d CalcCorrDir( const ICurveComposite* pCompo, double dU, bool bInvertSide = false, bool bSawSpecial = false) ;
bool CalcOffset( ICurveComposite* pCompo, double dSignOffs) ;
bool TrimExtendCurveToClosedStm( ICurveComposite* pCompo, int nCstmId, bool bInvert) ;
private :
double GetSpeed() const
@@ -143,12 +153,23 @@ class Milling : public Machining
bool IsLeadInHelixOrZigzag() const
{ int nType = GetLeadInType() ;
return ( nType == MILL_LI_ZIGZAG || nType == MILL_LI_HELIX) ; }
friend class LeadIOStatus ;
bool IsLeadInHelixOrZigzagOrGlide() const
{ int nType = GetLeadInType() ;
return ( nType == MILL_LI_ZIGZAG || nType == MILL_LI_HELIX || nType == MILL_LI_GLIDE) ; }
bool LeadInRawIsOk( void) const
{ if ( ( m_TParams.m_nType & TF_SAWBLADE) != 0)
return false ;
if ( m_TParams.m_nType != TT_MILL_NOTIP)
return true ;
return ( IsLeadInHelixOrZigzag() &&
m_Params.m_dLiTang >= 0.9 * m_TParams.m_dDiam && m_Params.m_dLiElev <= 2) ; }
friend class LeadIOStatus ;
private :
SELVECTOR m_vId ; // identificativi entità geometriche da lavorare
MillingData m_Params ; // parametri lavorazione
ToolData m_TParams ; // parametri utensile
double m_dTHoldBase ; // posizione base del porta-utensile
double m_dTHoldLen ; // lunghezza del porta-utensile
double m_dTHoldDiam ; // diametro del porta-utensile
int m_nStatus ; // stato di aggiornamento della lavorazione
@@ -157,10 +178,15 @@ class Milling : public Machining
double m_dAddedOverlap ; // overlap effettivamente aggiunto a percorso chiuso
int m_nHeadSolCh ; // criterio scelta soluzione impostato nella testa
bool m_bTiltingTab ; // flag utilizzo tavola basculante
Vector3d m_vtTiltingAx ; // versore direzione eventuale asse basculante
bool m_bAboveHead ; // flag utilizzo testa da sopra
bool m_bAggrBottom ; // flag utilizzo di aggregato da sotto
Vector3d m_vtAggrBottom ; // vettore direzione ausiliaria aggregato da sotto
AggrBottom m_AggrBottom ; // dati eventuale aggregato da sotto
double m_dCurrOscillLen ; // lunghezza corrente lungo il percorso per l'oscillazione
double m_dCurrTabsLen ; // lunghezza corrente lungo il percorso per tabs
bool m_bStartOutRaw ; // flag forzatura inizio fuori dal grezzo
bool m_bEndOutRaw ; // flag forzatura fine fuori dal grezzo
Vector3d m_vtStartDir ; // direzione iniziale del percorso in elaborazione
Vector3d m_vtEndDir ; // direzione finale del percorso in elaborazione
} ;
+3 -2
View File
@@ -574,7 +574,8 @@ MillingData::VerifyLeadInType( int nVal) const
{
return ( nVal == MILL_LI_NONE || nVal == MILL_LI_LINEAR ||
nVal == MILL_LI_TANGENT || nVal == MILL_LI_GLIDE ||
nVal == MILL_LI_ZIGZAG || nVal == MILL_LI_HELIX) ;
nVal == MILL_LI_ZIGZAG || nVal == MILL_LI_HELIX ||
nVal == MILL_LI_TG_PERP) ;
}
//----------------------------------------------------------------------------
@@ -583,7 +584,7 @@ MillingData::VerifyLeadOutType( int nVal) const
{
return ( nVal == MILL_LO_NONE || nVal == MILL_LO_LINEAR ||
nVal == MILL_LO_TANGENT || nVal == MILL_LO_GLIDE ||
nVal == MILL_LO_AS_LI) ;
nVal == MILL_LO_AS_LI || nVal == MILL_LO_PERP_TG) ;
}
//----------------------------------------------------------------------------
+6 -2
View File
@@ -110,6 +110,10 @@ struct MillingData : public MachiningData
//----------------------------------------------------------------------------
inline const MillingData* GetMillingData( const MachiningData* pMdata)
{ return (dynamic_cast<const MillingData*>( pMdata)) ; }
{ if ( pMdata == nullptr || pMdata->GetType() != MT_MILLING)
return nullptr ;
return ( static_cast<const MillingData*>( pMdata)) ; }
inline MillingData* GetMillingData( MachiningData* pMdata)
{ return (dynamic_cast<MillingData*>( pMdata)) ; }
{ if ( pMdata == nullptr || pMdata->GetType() != MT_MILLING)
return nullptr ;
return ( static_cast<MillingData*>( pMdata)) ; }
+213 -117
View File
@@ -524,8 +524,14 @@ Mortising::Apply( bool bRecalc, bool bPostApply)
// verifico se necessario continuare nell'aggiornamento
if ( ! bRecalc && ! bToolChanged &&
( m_nStatus == MCH_ST_OK || ( ! bPostApply && m_nStatus == MCH_ST_NO_POSTAPPL))) {
// confermo i percorsi di lavorazione
m_nMortises = nCurrMortises ;
LOG_DBG_INFO( GetEMkLogger(), "Mortising apply skipped : status already ok") ;
// eseguo aggiornamento assi macchina e collegamento con operazione precedente
if ( ! Update( bPostApply))
return false ;
LOG_DBG_INFO( GetEMkLogger(), "Update done") ;
// esco con successo
return true ;
}
m_nStatus = MCH_ST_TO_VERIFY ;
@@ -609,6 +615,8 @@ Mortising::Apply( bool bRecalc, bool bPostApply)
// dichiaro successiva da aggiornare
UpdateFollowingOperationsStatus( MCH_ST_OTH_MODIF) ;
LOG_DBG_INFO( GetEMkLogger(), "Mortising apply done") ;
return true ;
}
@@ -626,21 +634,17 @@ Mortising::Update( bool bPostApply)
return true ;
}
// elimino le entità CLIMB, RISE e HOME della lavorazione, potrebbero falsare i calcoli degli assi (in ogni casi vengono riaggiunte dopo)
RemoveClimbRiseHome() ;
// imposto eventuale asse bloccato da lavorazione
if ( ! m_Params.m_sBlockedAxis.empty()) {
string sAxis, sVal ;
Split( m_Params.m_sBlockedAxis, "=", true, sAxis, sVal) ;
double dVal = 0 ;
FromString( sVal, dVal) ;
m_pMchMgr->ClearRotAxisBlock() ;
m_pMchMgr->SetRotAxisBlock( sAxis, dVal) ;
}
SetBlockedRotAxis( m_Params.m_sBlockedAxis) ;
// calcolo gli assi macchina
string sHint = ExtractHint( m_Params.m_sUserNotes) ;
if ( ! m_Params.m_sInitAngs.empty())
sHint = m_Params.m_sInitAngs ;
if ( ! CalculateAxesValues( sHint, true)) {
if ( ! CalculateAxesValues( sHint, true, true)) {
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
if ( sInfo.empty())
m_pMchMgr->SetLastError( 2507, "Error in Mortising : axes values not calculable") ;
@@ -815,11 +819,31 @@ Mortising::UpdateToolData( bool* pbChanged)
const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ;
if ( pTdata == nullptr)
return false ;
// verifico se sono diversi (ad esclusione del nome)
m_TParams.m_sName = pTdata->m_sName ;
bool bChanged = ! SameTool( m_TParams, *pTdata) ;
// salvo posizione TC, testa e uscita originali
string sOrigTcPos = m_TParams.m_sTcPos ;
string sOrigHead = m_TParams.m_sHead ;
int nOrigExit = m_TParams.m_nExit ;
// verifico se sono diversi (ad esclusione di nome, posizione TC, testa e uscita)
bool bChanged = ( ! SameTool( m_TParams, *pTdata, false)) ;
// aggiorno comunque i parametri
m_TParams = *pTdata ;
// se definito attrezzaggio, aggiorno i parametri che ne possono derivare
string sTcPos ; string sHead ; int nExit ;
if ( m_pMchMgr->GetCurrSetupMgr().GetToolData( m_TParams.m_sName, sTcPos, sHead, nExit)) {
if ( sOrigTcPos != sTcPos ||
sOrigHead != sHead ||
nOrigExit != nExit)
bChanged = true ;
m_TParams.m_sTcPos = sTcPos ;
m_TParams.m_sHead = sHead ;
m_TParams.m_nExit = nExit ;
}
else {
if ( sOrigTcPos != pTdata->m_sTcPos ||
sOrigHead != pTdata->m_sHead ||
nOrigExit != pTdata->m_nExit)
bChanged = true ;
}
// eventuali segnalazioni
if ( ! EqualNoCase( m_Params.m_sToolName, m_TParams.m_sName)) {
string sInfo = "Warning in Mortising : tool name changed (" +
@@ -992,7 +1016,7 @@ Mortising::GetCurve( SelData Id)
else
nToolDir = TOOL_PAR_SLANT ;
int nFaceUse = ( m_Params.m_nFaceUse & 31) ;
AdjustCurveFromSurf( pCrvCompo, nToolDir, nFaceUse, m_TParams.m_dThick) ;
AdjustCurveFromSurf( pCrvCompo, nToolDir, nFaceUse, m_TParams.m_dThick, 2) ;
// la restituisco
return Release( pCrvCompo) ;
}
@@ -1186,7 +1210,7 @@ Mortising::ProcessPath( int nPathId, int nPvId, int nClId)
{
// inclinazione della direzione utensile rispetto al movimento
Vector3d vtTg ; pCompo->GetMidDir( vtTg) ;
double dSinAng = max( ( vtTg ^ vtExtr).Len(), sin( 45 * DEGTORAD)) ;
double dSinAng = max( ( vtTg ^ vtExtr).Len(), sin( 30 * DEGTORAD)) ;
double dStartAddLen = m_Params.m_dStartAddLen / dSinAng ;
double dEndAddLen = m_Params.m_dEndAddLen / dSinAng ;
// verifico che il percorso sia abbastanza lungo
@@ -1298,8 +1322,18 @@ Mortising::ProcessPath( int nPathId, int nPvId, int nClId)
if ( FromString( ExtractInfo( m_Params.m_sUserNotes, "MaxElev="), dMaxElev) && dElev > dMaxElev)
dElev = dMaxElev ;
// ingombro aggiuntivo da larghezza sega a catena quando inclinata rispetto al movimento
Vector3d vtTg ; pCompo->GetMidDir( vtTg) ;
double dSinAng = max( ( vtTg ^ vtExtr).Len(), sin( 30 * DEGTORAD)) ;
double dCosAng = min( abs( vtTg * vtExtr), cos( 30 * DEGTORAD)) ;
double dAddEnc = m_TParams.m_dDiam / 2 * dCosAng / dSinAng ;
// affondamento speciale da note utente (!!! da trasformare in parametro come gli altri !!!)
int nPlunge = 0 ;
FromString( ExtractInfo( m_Params.m_sUserNotes, "Plunge="), nPlunge) ;
// verifico che lo step dell'utensile sia sensato
double dOkStep = m_Params.m_dStep ;
double dOkStep = ( nPlunge == MORTISE_PLUNGE_STEP ? m_Params.m_dStep : 0) ;
const double MIN_ZSTEP = 1.0 ;
if ( dOkStep >= EPS_SMALL && dOkStep < MIN_ZSTEP) {
dOkStep = MIN_ZSTEP ;
@@ -1318,38 +1352,23 @@ Mortising::ProcessPath( int nPathId, int nPvId, int nClId)
}
// se lo step supera la capacità dell'utensile
if ( m_Params.m_dStep > m_TParams.m_dMaxMat + EPS_SMALL) {
if ( dOkStep > m_TParams.m_dMaxMat + EPS_SMALL) {
dOkStep = m_TParams.m_dMaxMat ;
string sInfo = "Warning in Mortising : machining step (" + ToString( m_Params.m_dStep, 1) +
") bigger than MaxMaterial (" + ToString( m_TParams.m_dMaxMat, 1) + ")" ;
m_pMchMgr->SetWarning( 2557, sInfo) ;
}
// se lavorazione singola
if ( dOkStep < EPS_SMALL || dOkStep > dElev) {
// se l'elevazione supera la capacità dell'utensile
if ( dElev > m_TParams.m_dMaxMat + EPS_SMALL) {
// segnalo, riduco e continuo
string sInfo = "Warning in Mortising : machining depth (" + ToString(dElev, 1) +
") bigger than MaxMaterial (" + ToString(m_TParams.m_dMaxMat, 1) + ")" ;
m_pMchMgr->SetWarning(2558, sInfo) ;
dDepth -= dElev - m_TParams.m_dMaxMat ;
dElev = m_TParams.m_dMaxMat ;
}
}
// altrimenti lavorazione a step
else {
// massimo affondamento dell'utensile
double dMaxDepth = m_TParams.m_dMaxMat ;
// se l'elevazione supera il massimo affondamento dell'utensile
if ( dElev > dMaxDepth + EPS_SMALL) {
// segnalo, riduco e continuo
string sInfo = "Warning in Mortising : machining depth (" + ToString( dElev, 1) +
") bigger than MaxDepth (" + ToString( dMaxDepth, 1) + ")" ;
m_pMchMgr->SetWarning( 2558, sInfo) ;
dDepth -= dElev - dMaxDepth ;
dElev = dMaxDepth ;
}
}
// massimo affondamento dell'utensile
double dMaxDepth = m_TParams.m_dMaxMat - dAddEnc ;
// se l'elevazione supera il massimo affondamento dell'utensile
if ( dElev > dMaxDepth + EPS_SMALL) {
// segnalo, riduco e continuo
string sInfo = "Warning in Mortising : machining depth (" + ToString( dElev, 1) +
") bigger than MaxDepth (" + ToString( dMaxDepth, 1) + ")" ;
m_pMchMgr->SetWarning( 2558, sInfo) ;
dDepth -= dElev - dMaxDepth ;
dElev = dMaxDepth ;
}
// se richiesta anteprima
if ( nPvId != GDB_ID_NULL) {
@@ -1386,8 +1405,8 @@ Mortising::ProcessPath( int nPathId, int nPvId, int nClId)
SetToolDir( vtTool) ;
SetAuxDir( vtAux) ;
// Calcolo la mortasatura
if ( ! GenerateMortisingCl( pCompo, vtTool, dDepth, dElev, dOkStep))
// Calcolo la mortasatura
if ( ! GenerateMortisingCl( pCompo, vtTool, dDepth, dElev, dOkStep, nPlunge))
return false ;
}
@@ -1473,103 +1492,186 @@ Mortising::GenerateMortisingPv( int nPathId, const ICurveComposite* pCompo)
//----------------------------------------------------------------------------
bool
Mortising::GenerateMortisingCl( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dElev, double dOkStep)
Mortising::GenerateMortisingCl( const ICurveComposite* pCompo, const Vector3d& vtTool,
double dDepth, double dElev, double dOkStep, int nPlunge)
{
// estremi della curva composita
// inizio e fine
Point3d ptStart ; pCompo->GetStartPoint( ptStart) ;
Point3d ptEnd ; pCompo->GetEndPoint( ptEnd) ;
// verifico se affondamento ripetuto è veramente tale
if ( ( nPlunge == MORTISE_PLUNGE_START_END || nPlunge == MORTISE_PLUNGE_START_TO_END) && Dist( ptStart, ptEnd) < 10 * EPS_SMALL)
nPlunge = MORTISE_PLUNGE_START ;
// se affondamento inizio e fine
if ( nPlunge == MORTISE_PLUNGE_START_END) {
// affondamento iniziale
if ( ! GenerateOnePlungeCl( ptStart, ptEnd, vtTool, dDepth, dElev, dOkStep, MORTISE_PLUNGE_START, true))
return false ;
// affondamento finale
if ( ! GenerateOnePlungeCl( ptStart, ptEnd, vtTool, dDepth, dElev, dOkStep, MORTISE_PLUNGE_END, false))
return false ;
}
// se alrimenti affondamenti ripetuti da inizio a fine con ritorno basso
else if ( nPlunge == MORTISE_PLUNGE_START_TO_END) {
// distanza e vettore spostamento laterale
Vector3d vtDir = ptEnd - ptStart ;
double dLen = vtDir.Len() ;
vtDir.Normalize() ;
// affondamenti iniziale e intermedi
int kMax = ( int) floor( dLen / m_TParams.m_dDiam) ;
for ( int k = 0 ; k <= kMax ; ++ k) {
Point3d ptNewStart = ptStart + vtDir * k * m_TParams.m_dDiam ;
// se non è finale
if ( k != kMax || ! AreSamePointEpsilon( ptNewStart, ptEnd, 10 * EPS_SMALL)) {
if ( ! GenerateOnePlungeCl( ptNewStart, ptEnd, vtTool, dDepth, dElev, dOkStep, MORTISE_PLUNGE_START, k == 0))
return false ;
}
}
// affondamento finale
if ( ! GenerateOnePlungeCl( ptEnd, ptStart, vtTool, dDepth, dElev, dOkStep, MORTISE_PLUNGE_STEP, false))
return false ;
}
// altrimenti affondamento singolo
else {
if ( ! GenerateOnePlungeCl( ptStart, ptEnd, vtTool, dDepth, dElev, dOkStep, nPlunge, true))
return false ;
}
// reset dati di movimento
ResetMoveData() ;
// incremento numero di mortasature
++ m_nMortises ;
return true ;
}
//----------------------------------------------------------------------------
bool
Mortising::GenerateOnePlungeCl( const Point3d& ptStart, const Point3d& ptEnd, const Vector3d& vtTool, double dDepth, double dElev,
double dOkStep, int nPlunge, bool bFirst)
{
// compensazione elevazione/affondamento
double dDelta = dElev - dDepth ;
// determino se l'inizio dell'attacco è esattamente sotto il grezzo, nel qual caso ricalcolo l'elevazione
double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() + m_pMchMgr->GetDeltaSafeZ( m_TParams.m_sHead) ;
double dStartElev = 0 ;
Point3d ptLi = ptStart + vtTool * dDelta ;
bool bUnderStart = GetPointUnderRaw( ptLi, vtTool, 0,
GetRadiusForStartEndElevation(), m_TParams.m_dLen, false, dSafeZ, dStartElev) ;
Point3d ptLi = ( nPlunge != MORTISE_PLUNGE_END ? ptStart : ptEnd) + vtTool * dDelta ;
bool bUnderStart = GetAhPointUnderRaw( ptLi, vtTool, 0,
GetRadiusForStartEndElevation(), m_TParams.m_dLen, false, dSafeZ, vtTool, dStartElev) ;
// altrimenti ridetermino elevazione su inizio percorso di lavoro
if ( ! bUnderStart)
GetElevation( m_nPhase, ptLi, vtTool, GetRadiusForStartEndElevation(), vtTool, dStartElev) ;
// 1 -> punto approccio
SetFlag( 1) ;
Point3d ptP1 = ptStart + vtTool * ( dDelta + dStartElev + dSafeZ) ;
if ( AddRapidStart( ptP1) == GDB_ID_NULL)
int nFirstFlag = ( bFirst ? 1 : 0) ;
SetFlag( nFirstFlag) ;
Point3d ptP1 = ( nPlunge != MORTISE_PLUNGE_END ? ptStart : ptEnd) + vtTool * ( dDelta + dStartElev + dSafeZ) ;
int nStart = AddRapidStartOrMove( ptP1, bFirst) ;
if ( nStart == GDB_ID_NULL)
return false ;
SetFlag( 0) ;
// 2 -> punto fuori (se diverso dal precedente)
if ( m_Params.m_dStartPos < dSafeZ) {
Point3d ptP2 = ptStart + vtTool * ( dDelta + m_Params.m_dStartPos) ;
if ( m_Params.m_dStartPos < dSafeZ - 10 * EPS_SMALL) {
Point3d ptP2 = ( nPlunge != MORTISE_PLUNGE_END ? ptStart : ptEnd) + vtTool * ( dDelta + m_Params.m_dStartPos) ;
if ( AddRapidMove( ptP2) == GDB_ID_NULL)
return false ;
}
// determino numero e affondamento degli step
if ( dOkStep < EPS_SMALL)
dOkStep = dElev ;
int nStep = max( 1, static_cast<int>( ceil( dElev / dOkStep))) ;
double dStep = dElev / nStep ;
const double RETURN_DIST = 10 ;
// eseguo ciclo a seconda del tipo di step
// eseguo ciclo a seconda del tipo di affondamento
Point3d ptLast ;
switch ( m_Params.m_nStepType) {
default : // ZIGZAG
for ( int i = 1 ; i <= nStep ; ++ i) {
// 3 -> punto in affondamento
SetFeed( GetStartFeed()) ;
SetFlag( 0) ;
Point3d ptP3 = (( i % 2 == 1) ? ptStart : ptEnd) + ( dDelta - i * dStep) * vtTool ;
if ( AddLinearMove( ptP3) == GDB_ID_NULL)
return false ;
// 4 -> punto termine
SetFeed( GetFeed()) ;
SetFlag( 0) ;
ptLast = (( i % 2 == 1) ? ptEnd : ptStart) ;
Point3d ptP4 = ptLast + ( dDelta - i * dStep) * vtTool ;
if ( AddLinearMove( ptP4) == GDB_ID_NULL)
return false ;
}
break ;
case MORTISE_ST_ONEWAY :
for ( int i = 1 ; i <= nStep ; ++ i) {
// 3 -> punto in affondamento
SetFeed( GetStartFeed()) ;
SetFlag( 0) ;
Point3d ptP3 = ptStart + ( dDelta - i * dStep) * vtTool ;
if ( AddLinearMove( ptP3) == GDB_ID_NULL)
return false ;
// 4 -> punto termine
SetFeed( GetFeed()) ;
SetFlag( 0) ;
ptLast = ptEnd ;
Point3d ptP4 = ptLast + ( dDelta - i * dStep) * vtTool ;
if ( AddLinearMove( ptP4) == GDB_ID_NULL)
return false ;
// 5 -> ritorno sull'inizio, se non ultimo punto
if ( i < nStep) {
// retrocedo
if ( nPlunge == MORTISE_PLUNGE_START) {
// 3 -> punto in affondamento
SetFeed( GetStartFeed()) ;
SetFlag( 0) ;
Point3d ptP3 = ptStart + ( dDelta - dElev) * vtTool ;
if ( AddLinearMove( ptP3) == GDB_ID_NULL)
return false ;
ptLast = ptStart ;
}
else if ( nPlunge == MORTISE_PLUNGE_END) {
// 3 -> punto in affondamento
SetFeed( GetStartFeed()) ;
SetFlag( 0) ;
Point3d ptP3 = ptEnd + ( dDelta - dElev) * vtTool ;
if ( AddLinearMove( ptP3) == GDB_ID_NULL)
return false ;
ptLast = ptEnd ;
}
else {
// determino numero e affondamento degli step
if ( dOkStep < EPS_SMALL)
dOkStep = dElev ;
int nStep = max( 1, static_cast<int>( ceil( ( dElev - 10 * EPS_SMALL) / dOkStep))) ;
double dStep = dElev / nStep ;
const double RETURN_DIST = 10 ;
// a seconda del tipo
switch ( m_Params.m_nStepType) {
default : // ZIGZAG
for ( int i = 1 ; i <= nStep ; ++ i) {
// 3 -> punto in affondamento
SetFeed( GetStartFeed()) ;
SetFlag( 0) ;
Point3d ptP3 = (( i % 2 == 1) ? ptStart : ptEnd) + ( dDelta - i * dStep) * vtTool ;
if ( AddLinearMove( ptP3) == GDB_ID_NULL)
return false ;
// 4 -> punto termine
SetFeed( GetFeed()) ;
SetFlag( 0) ;
Point3d ptP5a = ptP4 + RETURN_DIST * vtTool ;
if ( AddLinearMove( ptP5a) == GDB_ID_NULL)
return false ;
// ritorno sopra inizio
SetFeed( GetFeed()) ;
SetFlag( 0) ;
Point3d ptP5b = ptP3 + RETURN_DIST * vtTool ;
if ( AddLinearMove( ptP5b) == GDB_ID_NULL)
return false ;
ptLast = (( i % 2 == 1) ? ptEnd : ptStart) ;
Point3d ptP4 = ptLast + ( dDelta - i * dStep) * vtTool ;
if ( AddLinearMove( ptP4) == GDB_ID_NULL)
return false ;
}
break ;
case MORTISE_ST_ONEWAY :
for ( int i = 1 ; i <= nStep ; ++ i) {
// 3 -> punto in affondamento
SetFeed( GetStartFeed()) ;
SetFlag( 0) ;
Point3d ptP3 = ptStart + ( dDelta - i * dStep) * vtTool ;
if ( AddLinearMove( ptP3) == GDB_ID_NULL)
return false ;
// 4 -> punto termine
SetFeed( GetFeed()) ;
SetFlag( 0) ;
ptLast = ptEnd ;
Point3d ptP4 = ptLast + ( dDelta - i * dStep) * vtTool ;
if ( AddLinearMove( ptP4) == GDB_ID_NULL)
return false ;
// 5 -> ritorno sull'inizio, se non ultimo punto
if ( i < nStep) {
// retrocedo
SetFeed( GetFeed()) ;
SetFlag( 0) ;
Point3d ptP5a = ptP4 + RETURN_DIST * vtTool ;
if ( AddLinearMove( ptP5a) == GDB_ID_NULL)
return false ;
// ritorno sopra inizio
SetFeed( GetFeed()) ;
SetFlag( 0) ;
Point3d ptP5b = ptP3 + RETURN_DIST * vtTool ;
if ( AddLinearMove( ptP5b) == GDB_ID_NULL)
return false ;
}
}
break ;
}
break ;
}
// determino se la fine dell'uscita è esattamente sotto il grezzo, nel qual caso ricalcolo l'elevazione
double dEndElev = 0 ;
Point3d ptLo = ptLast + vtTool * dDelta ;
bool bUnderEnd = GetPointUnderRaw( ptLo, vtTool, 0,
GetRadiusForStartEndElevation(), m_TParams.m_dLen, false, dSafeZ, dEndElev) ;
bool bUnderEnd = GetAhPointUnderRaw( ptLo, vtTool, 0,
GetRadiusForStartEndElevation(), m_TParams.m_dLen, false, dSafeZ, vtTool, dEndElev) ;
// altrimenti ridetermino elevazione su fine percorso di lavoro
if ( ! bUnderEnd)
GetElevation( m_nPhase, ptLo, vtTool, GetRadiusForStartEndElevation(), vtTool, dEndElev) ;
// 6 -> ritorno all'approccio
SetFeed( GetEndFeed()) ;
SetFlag( 104) ; // risalita sopra la fine
@@ -1577,12 +1679,6 @@ Mortising::GenerateMortisingCl( const ICurveComposite* pCompo, const Vector3d& v
if ( AddLinearMove( ptP6) == GDB_ID_NULL)
return false ;
// reset dati di movimento
ResetMoveData() ;
// incremento numero di mortasature
++ m_nMortises ;
return true ;
}
+3 -1
View File
@@ -74,7 +74,9 @@ class Mortising : public Machining
bool ProcessPath( int nPathId, int nPvId, int nClId) ;
bool CalcPathElevation( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dRad, double dThick, double& dElev) const ;
bool GenerateMortisingPv( int nPathId, const ICurveComposite* pCompo) ;
bool GenerateMortisingCl( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dElev, double dOkStep) ;
bool GenerateMortisingCl( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dElev, double dOkStep, int nPlunge) ;
bool GenerateOnePlungeCl( const Point3d& ptStart, const Point3d& ptEnd, const Vector3d& vtTool, double dDepth, double dElev, double dOkStep,
int nPlunge, bool bFirst) ;
double GetRadiusForStartEndElevation( void) const ;
private :
+6 -2
View File
@@ -77,6 +77,10 @@ struct MortisingData : public MachiningData
//----------------------------------------------------------------------------
inline const MortisingData* GetMortisingData( const MachiningData* pMdata)
{ return (dynamic_cast<const MortisingData*>( pMdata)) ; }
{ if ( pMdata == nullptr || pMdata->GetType() != MT_MORTISING)
return nullptr ;
return ( static_cast<const MortisingData*>( pMdata)) ; }
inline MortisingData* GetMortisingData( MachiningData* pMdata)
{ return (dynamic_cast<MortisingData*>( pMdata)) ; }
{ if ( pMdata == nullptr || pMdata->GetType() != MT_MORTISING)
return nullptr ;
return ( static_cast<MortisingData*>( pMdata)) ; }
+1821 -496
View File
File diff suppressed because it is too large Load Diff
+94 -15
View File
@@ -14,6 +14,7 @@
#pragma once
#include "MachMgr.h"
#include "MachConst.h"
#include "MachineStruConst.h"
#include "/EgtDev/Include/EGkPoint3d.h"
@@ -21,7 +22,6 @@
#include "/EgtDev/Include/EGkSelection.h"
#include "/EgtDev/Include/EgtNumCollection.h"
class MachMgr ;
class CamData ;
class ICurve ;
class ICurveComposite ;
@@ -43,6 +43,7 @@ class Operation : public IUserObj
virtual int GetPhase( void) const
{ return m_nPhase ; }
virtual bool RemoveHome( void) ;
std::string GetName( void) const ;
public :
virtual int GetType( void) const = 0 ;
@@ -60,6 +61,21 @@ class Operation : public IUserObj
{ return true ; }
virtual bool AdjustArcCenterForAxesCalc( const CamData* pCamData, Point3d& ptCen) const
{ return true ; }
virtual bool NeedSplit( bool bSplit = true, bool bFeed = true) const
{ return ( bSplit && ( m_pMchMgr == nullptr || m_pMchMgr->GetCurrIsRobot())) ; }
virtual double GetMaxSplitLen( bool bSplit = true, bool bFeed = true) const
{ return ( bSplit && ( m_pMchMgr == nullptr || m_pMchMgr->GetCurrIsRobot()) ? ( bFeed ? 5 : 50) : 0) ; }
virtual bool GetSplitArcs( const Vector3d& vtTool) const
{ if ( m_pMchMgr == nullptr || m_pMchMgr->GetCurrIsRobot())
return true ;
int nSplitArcs = m_pMchMgr->GetCurrMachiningsMgr()->GetSplitArcs() ;
return ( nSplitArcs == SPLAR_ALWAYS ||
( nSplitArcs == SPLAR_NO_XY_PLANE && ! vtTool.IsZplus()) ||
( nSplitArcs == SPLAR_GEN_PLANE && vtTool.IsGeneric())) ; }
virtual double GetApproxLinTol( void) const
{ if ( m_pMchMgr == nullptr)
return 50 * EPS_SMALL ;
return m_pMchMgr->GetCurrMachiningsMgr()->GetApproxLinTol() ; }
protected :
Operation( void) ;
@@ -68,40 +84,75 @@ class Operation : public IUserObj
bool UpdateFollowingOperationsStatus( int nModif) ;
bool GetElevation( int nPhase, const Point3d& ptP,
const Vector3d& vtDir, double& dElev) const ;
bool GetElevation( int nPhase, const Point3d& ptP,
const Vector3d& vtDir, double& dElev, Vector3d& vtNorm) const ;
bool GetElevation( int nPhase, const Point3d& ptP,
const Vector3d& vtDir, double& dElev, INTVECTOR& vRawStmId) const ;
bool GetElevation( int nPhase, const Point3d& ptP,
const Vector3d& vtDir, double& dElev, Vector3d& vtNorm, INTVECTOR& vRawStmId) const ;
bool GetElevation( int nPhase, const Point3d& ptP1, const Point3d& ptP2,
const Vector3d& vtDir, double& dElev) const ;
bool GetElevation( int nPhase, const Point3d& ptP1, const Point3d& ptP2, const Point3d& ptP3,
const Vector3d& vtDir, double& dElev) const ;
bool GetElevation( int nPhase, const Point3d& ptP, const Vector3d& vtTool, double dRad,
const Vector3d& vtDir, double& dElev) const ;
bool GetPointUnderRaw( const Point3d& ptP, const Vector3d& vtTool, double dToolRad, double dToolRadForElev,
double dToolLen, bool bIsSaw, double dSafeZ, double& dElev) const ;
bool GetElevation( int nPhase, const Point3d& ptP, const Vector3d& vtTool, double dRad, double dLen,
const Vector3d& vtDir, double& dElev) const ;
bool GetElevation( int nPhase, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtTool, double dRad, double dLen,
const Vector3d& vtDir, double& dElev) const ;
bool GetAhPointUnderRaw( const Point3d& ptP, const Vector3d& vtTool, double dToolRad, double dToolRadForElev,
double dToolLen, bool bIsSaw, double dSafeZ, const Vector3d& vtDir, double& dElev) const ;
bool GetUhPointAboveRaw( const Point3d& ptP, const Vector3d& vtTool, double dToolRad, double dToolRadForElev,
double dToolLen, bool bIsSaw, double dSafeZ, const Vector3d& vtDir, double& dElev) const ;
bool GetDistanceFromRawSide( int nPhase, const Point3d& ptP, const Vector3d& vtDir, double& dDist) const ;
bool GetMinDistanceFromRawSide( int nPhase, const Point3d& ptP, double dExpand, double& dDist, Vector3d& vtDir) const ;
bool GetMinDistanceFromRawSide( int nPhase, const Point3d& ptP, double dExpand,
double& dDist, Vector3d& vtDir) const ;
bool GetMinDistanceFromRawSide( int nPhase, const Point3d& ptP, double dExpand,
const Vector3d& vtMainDir, double dCosMaxDelta,
double& dDist, Vector3d& vtDir) const ;
bool GetDistanceFromRawBottom( int nPhase, int nPathId, double dToler, double& dRbDist) const
{ double dDummy ;
return GetDistanceFromRawBottom( nPhase, nPathId, dToler, dRbDist, dDummy) ; }
bool GetDistanceFromRawBottom( int nPhase, int nPathId, double dToler, double& dRbDist, double& dAllRbDist) const ;
bool GetRawGlobBox( int nPhase, int nPathId, double dToler, BBox3d& b3Raw) const ;
bool GetRawGlobBox( int nPhase, const BBox3d& b3Test, double dToler, BBox3d& b3Raw) const ;
bool GetCurrRawsGlobBox( BBox3d& b3Raw) const ;
bool AdjustCurveFromSurf( ICurveComposite* pCrvCompo, int nToolDir, int nFaceUse, double dToolThick) ;
bool AdjustCurveFromSurf( ICurveComposite* pCrvCompo, int nToolDir, int nFaceUse, double dToolThick, int nGrade = 3) ;
bool ApproxWithArcsIfUseful( ICurveComposite* pCompo, bool bCareTempProp = false) const ;
bool ApproxWithLines( ICurveComposite* pCompo) const ;
bool ApproxWithLines( ICurveComposite* pCompo, bool bFeed = true) const ;
bool VerifyArcs( ICurveComposite* pCompo, double dMaxAngCen = MAX_ANG_CEN) const ;
bool CalcAndSetBBox( int nClId) ;
bool CalcAndSetAxesBBox( void) ;
bool GetInitialAxesValues( DBLVECTOR& vAxVal) const ;
bool GetClPathInitialAxesValues( int nClPathId, DBLVECTOR& vAxVal) const ;
bool CalcMirrorByDouble( int nClId, const std::string& sUserNotes) ;
bool GetInitialAxesValues( bool bSkipClimb, DBLVECTOR& vAxVal) const ;
bool GetClPathInitialAxesValues( int nClPathId, bool bSkipClimb, DBLVECTOR& vAxVal) const ;
bool GetFinalAxesValues( bool bSkipRise, DBLVECTOR& vAxVal) const ;
bool GetClPathFinalAxesValues( int nClPathId, bool bSkipRise, DBLVECTOR& vAxVal) const ;
bool GetInitialToolDir( bool bSkipClimb, Vector3d& vtTool) const ;
bool GetClPathInitialToolDir( int nClPathId, bool bSkipClimb, Vector3d& vtTool) const ;
bool GetFinalToolDir( bool bSkipRise, Vector3d& vtTool) const ;
bool GetClPathFinalToolDir( int nClPathId, bool bSkipRise, Vector3d& vtTool) const ;
const CamData* GetInitialCamData( bool bSkipClimb) const ;
const CamData* GetClPathInitialCamData( int nClPathId, bool bSkipClimb) const ;
const CamData* GetFinalCamData( bool bSkipRise) const ;
const CamData* GetClPathFinalCamData( int nClPathId, bool bSkipRise) const ;
std::string ExtractInfo( const std::string& sNotes, const std::string& sKey) const ;
std::string ExtractHint( const std::string& sNotes) const ;
bool CalculateAxesValues( const std::string& sHint, bool bSolChExact = false) ;
bool SetBlockedRotAxis( const std::string& sBlockedAxis) const ;
bool CalculateAxesValues( const std::string& sHint, bool bRotContOnNext = true, bool bSolChExact = false) ;
bool CalculateClPathCenterAxesValues( int nClPathId, int nLinAxes, int nRotAxes, double dRot1W,
bool bMaxDeltaR2OnFirst, bool bRotContOnNext, double dAngDeltaMinForHome,
const DBLVECTOR& vAxRotHome, DBLVECTOR& vAxRotPrec) ;
bool CalculateClPathAxesValues( int nClPathId, int nLinAxes, int nRotAxes, double dRot1W,
double dAngDeltaMinForHome, const DBLVECTOR& vAxRotHome, DBLVECTOR& vAxRotPrec, int& nOutStrC) ;
bool bMaxDeltaR2OnFirst, bool bRotContOnNext, double dAngDeltaMinForHome,
const DBLVECTOR& vAxRotHome, DBLVECTOR& vAxRotPrec, int& nOutStrC) ;
bool CalculateClPathRobotAxesValues( int nClPathId, int nLinAxes, int nRotAxes, double dRot1W,
bool bMaxDeltaR2OnFirst, bool bRotContOnNext, double dAngDeltaMinForHome,
const DBLVECTOR& vAxRotHome, DBLVECTOR& vAxRotPrec) ;
bool AdjustStartEndMovements( bool bVerifyPreviousLink = true) ;
bool AdjustOneStartMovement( int nClPathId, int nPrevClPathId, Operation* pPrevOp, const DBLVECTOR& vAxPrev, bool bMaxZ) ;
bool ToolChangeNeeded( const Operation& Op1, const Operation& Op2) const ;
@@ -110,17 +161,28 @@ class Operation : public IUserObj
bool AddSpecialRise( const DBLVECTOR& vAxVal, bool bOk = true, int nClPathId = GDB_ID_NULL, int nFlag = 0) ;
bool RemoveRise( int nClPathId = GDB_ID_NULL) ;
bool AddHome( void) ;
bool RemoveClimbRiseHome( void) ;
bool AddRobotClimb( int nEntId, double dDeltaZ) ;
bool CalcRobotAxesAbovePos( const Point3d& ptP, const Vector3d& vtT, const Vector3d& vtA, double dDeltaZ,
DBLVECTOR& vAx, double* pdNewDeltaZ = nullptr) const ;
bool CalcDeltaZForHeadRotation( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, double& dDeltaZ) const ;
bool GetExtraZ( double dSafeZ, double& dExtraZ, double& dMaxAngV) const ;
bool GetExtraZ( const DBLVECTOR& vAx1, const Vector3d& vtTool1,
const DBLVECTOR& vAx2, const Vector3d& vtTool2,
double dHomeZ, double& dExtraZ) const ;
bool SpecialGetMaxZ( const DBLVECTOR& vAx1, const Vector3d& vtTool1,
const DBLVECTOR& vAx2, const Vector3d& vtTool2,
double& dMaxZ) const ;
bool GetRotationAtZmax( void) const ;
bool ForcedZmax( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd) const ;
bool ForcedZmax( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, const BBox3d& b3Raws) const ;
int GetUserNotesZmax( void) const ;
bool GetZHomeDown( void) const ;
bool TestCollisionAvoid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd) const ;
bool SpecialMoveZup( DBLVECTOR& vAx, Vector3d& vtTool, int& nFlag, int& nFlag2, bool& bModif) ;
int SpecialTestCollisionAvoid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd) const ;
bool SpecialMoveZup( DBLVECTOR& vAx, Vector3d& vtTool, int& nFlag, int& nFlag2, bool& bModif) ;
bool SpecialMoveRapid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, DBLVECTOR& vAxNew, bool& bModif) ;
bool GetAggrBottomData( const std::string& sHead, AggrBottom& agbData) const ;
bool IsAggrBottom( const std::string& sHead) const ;
protected :
int m_nOwnerId ; // identificativo dell'oggetto geometrico possessore
@@ -136,6 +198,7 @@ class Operation : public IUserObj
bool SetCorrAuxDir( const Vector3d& vtDir) ;
bool SetFeed( double dFeed) ;
bool SetFlag( int nFlag) ;
bool SetFlagOnLastMove( int nFlag) ;
bool SetFlag2( int nFlag2) ;
bool SetIndex( int nIndex) ;
bool GetCurrPos( Point3d& ptCurr) const
@@ -150,12 +213,26 @@ class Operation : public IUserObj
int AddRapidStart( const Point3d& ptP, const std::string& sName) ;
int AddRapidMove( const Point3d& ptP) ;
int AddRapidMove( const Point3d& ptP, const std::string& sName) ;
int AddRapidMove( const Point3d& ptP, bool bSplit) ;
int AddRapidMove( const Point3d& ptP, bool bSplit, const std::string& sName) ;
int AddRapidStartOrMove( const Point3d& ptP, bool bFirst)
{ return ( bFirst ? AddRapidStart( ptP) : AddRapidMove( ptP)) ; }
int AddRapidStartOrMove( const Point3d& ptP, bool bFirst, const std::string& sName)
{ return ( bFirst ? AddRapidStart( ptP, sName) : AddRapidMove( ptP, sName)) ; }
int AddRapidStartOrMove( const Point3d& ptP, bool bFirst, bool bSplit)
{ return ( bFirst ? AddRapidStart( ptP) : AddRapidMove( ptP, bSplit)) ; }
int AddRapidStartOrMove( const Point3d& ptP, bool bFirst, bool bSplit, const std::string& sName)
{ return ( bFirst ? AddRapidStart( ptP, sName) : AddRapidMove( ptP, bSplit, sName)) ; }
int AddLinearMove( const Point3d& ptP) ;
int AddLinearMove( const Point3d& ptP, const std::string& sName) ;
int AddLinearMove( const Point3d& ptP, bool bSplit) ;
int AddLinearMove( const Point3d& ptP, bool bSplit, const std::string& sName) ;
int AddArcMove( const Point3d& ptP, const Point3d& ptCen, double dAngCen, const Vector3d& vtN) ;
int AddArcMove( const Point3d& ptP, const Point3d& ptCen, double dAngCen, const Vector3d& vtN, const std::string& sName) ;
int AddCurveMove( const ICurve* pCrv, bool bOnlySimple = false) ;
int AddCurveMove( const ICurve* pCrv, const std::string& sName, bool bOnlySimple = false) ;
int AddCurveMove( const ICurve* pCrv) ;
int AddCurveMove( const ICurve* pCrv, const std::string& sName) ;
int AddCurveMove( const ICurve* pCrv, bool bSplit) ;
int AddCurveMove( const ICurve* pCrv, bool bSplit, const std::string& sName) ;
bool ResetMoveData( void) ;
protected :
@@ -182,3 +259,5 @@ inline Operation* GetOperation( IUserObj* pUserObj)
enum { TOOL_PARAL = 1, TOOL_ORTHO = 2, TOOL_ORTUP = 3, TOOL_PAR_SLANT= 4} ;
// tipo di utilizzo contorno faccia
enum { FACE_DOWN = 1, FACE_TOP = 2, FACE_FRONT = 3, FACE_BACK = 4, FACE_LEFT = 5, FACE_RIGHT = 6, FACE_CONT = 7} ;
// risultato di SpecialTestCollisionAvoid
enum { SCAV_ERROR = -1, SCAV_COLLIDE = 0, SCAV_AVOID = 1, SCAV_TOTEST = 2};
+123 -6
View File
@@ -82,6 +82,18 @@ Operation::SetFlag( int nFlag)
return true ;
}
//----------------------------------------------------------------------------
bool
Operation::SetFlagOnLastMove( int nFlag)
{
int nLastEntId = m_pGeomDB->GetLastInGroup( m_nPathId) ;
CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nLastEntId)) ;
if ( pCamData == nullptr)
return false ;
pCamData->SetFlag( nFlag) ;
return true ;
}
//----------------------------------------------------------------------------
bool
Operation::SetFlag2( int nFlag2)
@@ -200,6 +212,46 @@ Operation::AddRapidMove( const Point3d& ptP, const string& sName)
return nId ;
}
//----------------------------------------------------------------------------
int
Operation::AddRapidMove( const Point3d& ptP, bool bSplit)
{
// se non richiesta spezzatura con massima lunghezza, emissione normale
if ( ! NeedSplit( bSplit))
return AddRapidMove( ptP) ;
// altrimenti opportuna spezzatura
Point3d ptS ;
if ( ! GetCurrPos( ptS))
return GDB_ID_NULL ;
double dLen = Dist( ptS, ptP) ;
double dStep = GetMaxSplitLen( true, false) ;
int nStep = int( dLen / dStep + 0.999) ;
int nFirstId = GDB_ID_NULL ;
for ( int i = 1 ; i <= nStep ; ++ i) {
int nId = AddRapidMove( Media( ptS, ptP, i * 1.0 / nStep)) ;
if ( nId == GDB_ID_NULL)
return GDB_ID_NULL ;
if ( nFirstId == GDB_ID_NULL)
nFirstId = nId ;
SetFlag( 0) ;
SetFlag2( 0) ;
}
return nFirstId ;
}
//----------------------------------------------------------------------------
int
Operation::AddRapidMove( const Point3d& ptP, bool bSplit, const string& sName)
{
int nFirstId = AddRapidMove( ptP, bSplit) ;
int nId = nFirstId ;
while ( nId != GDB_ID_NULL) {
m_pGeomDB->SetName( nId, sName) ;
nId = m_pGeomDB->GetNext( nId) ;
}
return nFirstId ;
}
//----------------------------------------------------------------------------
int
Operation::AddLinearMove( const Point3d& ptP)
@@ -258,6 +310,44 @@ Operation::AddLinearMove( const Point3d& ptP, const string& sName)
return nId ;
}
//----------------------------------------------------------------------------
int
Operation::AddLinearMove( const Point3d& ptP, bool bSplit)
{
// se non richiesta spezzatura con massima lunghezza, emissione normale
if ( ! NeedSplit( bSplit))
return AddLinearMove( ptP) ;
// altrimenti opportuna spezzatura
Point3d ptS ;
if ( ! GetCurrPos( ptS))
return GDB_ID_NULL ;
double dLen = Dist( ptS, ptP) ;
double dStep = GetMaxSplitLen( true, true) ;
int nStep = int( dLen / dStep + 0.999) ;
int nFirstId = GDB_ID_NULL ;
for ( int i = 1 ; i <= nStep ; ++ i) {
int nId = AddLinearMove( Media( ptS, ptP, i * 1.0 / nStep)) ;
if ( nId == GDB_ID_NULL)
return GDB_ID_NULL ;
if ( nFirstId == GDB_ID_NULL)
nFirstId = nId ;
}
return nFirstId ;
}
//----------------------------------------------------------------------------
int
Operation::AddLinearMove( const Point3d& ptP, bool bSplit, const string& sName)
{
int nFirstId = AddLinearMove( ptP, bSplit) ;
int nId = nFirstId ;
while ( nId != GDB_ID_NULL) {
m_pGeomDB->SetName( nId, sName) ;
nId = m_pGeomDB->GetNext( nId) ;
}
return nFirstId ;
}
//----------------------------------------------------------------------------
int
Operation::AddArcMove( const Point3d& ptP, const Point3d& ptCen, double dAngCen, const Vector3d& vtN)
@@ -334,7 +424,7 @@ Operation::AddArcMove( const Point3d& ptP, const Point3d& ptCen, double dAngCen,
//----------------------------------------------------------------------------
int
Operation::AddCurveMove( const ICurve* pCrv, bool bOnlySimple)
Operation::AddCurveMove( const ICurve* pCrv)
{
// verifico che la curva esista
if ( pCrv == nullptr)
@@ -355,8 +445,8 @@ Operation::AddCurveMove( const ICurve* pCrv, bool bOnlySimple)
pArc->GetEndPoint( ptP3) ;
return AddArcMove( ptP3, ptCen, dAngCen, vtN) ;
}
// se ammesse curve composite
else if ( ! bOnlySimple) {
// se arco o curva composita
else if ( pCrv->GetType() == CRV_ARC || pCrv->GetType() == CRV_COMPO) {
// in ogni caso, converto in archi e rette
PtrOwner<ICurveComposite> pCompo( CreateCurveComposite()) ;
if ( ! pCompo->AddCurve( *pCrv))
@@ -395,16 +485,43 @@ Operation::AddCurveMove( const ICurve* pCrv, bool bOnlySimple)
}
return nFirstId ;
}
// altrimenti
// altre curve non ammesse
else
return GDB_ID_NULL ;
}
//----------------------------------------------------------------------------
int
Operation::AddCurveMove( const ICurve* pCrv, const string& sName, bool bOnlySimple)
Operation::AddCurveMove( const ICurve* pCrv, const string& sName)
{
int nFirstId = AddCurveMove( pCrv, bOnlySimple) ;
int nFirstId = AddCurveMove( pCrv) ;
int nId = nFirstId ;
while ( nId != GDB_ID_NULL) {
m_pGeomDB->SetName( nId, sName) ;
nId = m_pGeomDB->GetNext( nId) ;
}
return nFirstId ;
}
//----------------------------------------------------------------------------
int
Operation::AddCurveMove( const ICurve* pCrv, bool bSplit)
{
// se non richiesta spezzatura, emissione normale
if ( ! bSplit)
return AddCurveMove( pCrv) ;
// altrimenti opportuna spezzatura
PtrOwner<ICurveComposite> pCompo ;
if ( ! pCompo.Set( ConvertCurveToComposite( pCrv->Clone())) || ! ApproxWithLines( pCompo))
return false ;
return AddCurveMove( pCompo) ;
}
//----------------------------------------------------------------------------
int
Operation::AddCurveMove( const ICurve* pCrv, bool bSplit, const string& sName)
{
int nFirstId = AddCurveMove( pCrv, bSplit) ;
int nId = nFirstId ;
while ( nId != GDB_ID_NULL) {
m_pGeomDB->SetName( nId, sName) ;
+251 -177
View File
@@ -20,143 +20,159 @@
static const int MAX_AXES = 7 ;
// Variabili
static const std::string GLOB_VAR = "EMT" ; // tavola variabili globali
static const std::string GVAR_VER = ".VER" ; // (string) versione della Dll
static const std::string GVAR_ERR = ".ERR" ; // (int) codice di errore (0=ok)
static const std::string GVAR_USETO1 = ".USETO1" ; // (bool) flag per utilizzo origine tavola
static const std::string GVAR_MODAL = ".MODAL" ; // (bool) flag per emissione modale dei valori
static const std::string GVAR_INCHES = ".INCHES" ; // (bool) flag unità di misura (true=inches, false=mm)
static const std::string GVAR_SPLITARCS = ".SPLITARCS" ; // (int) flag spezzatura archi (0=mai, 1=piani generici, 2=piani diversi da XY, 3=sempre)
static const std::string GVAR_NUM = ".NUM" ; // (bool) flag numerazione
static const std::string GVAR_NUMTOK = ".Nt" ; // (string) token per numerazione
static const std::string GVAR_LINENBR = ".LINENBR" ; // (int) numero progressivo di linea
static const std::string GVAR_LINEINC = ".LINEINC" ; // (int) incremento per numero di linea
static const std::string GVAR_F = ".F" ; // (num) valore della feed
static const std::string GVAR_FT = ".Ft" ; // (string) token per feed
static const std::string GVAR_S = ".S" ; // (num) valore della speed
static const std::string GVAR_ST = ".St" ; // (string) token per speed
static const std::string GVAR_MACHNAME = ".MACHNAME" ; // (string) nome macchina
static const std::string GVAR_FILE = ".FILE" ; // (string) path file di output
static const std::string GVAR_INFO = ".INFO" ; // (string) informazioni iniziali
static const std::string GVAR_SETUP = ".SETUP" ; // (bool) flag definizione setup
static const std::string GVAR_DISPID = ".DISPID" ; // (int) identificativo disposizione
static const std::string GVAR_DISPIND = ".DISPIND" ; // (int) indice disposizione
static const std::string GVAR_PHASE = ".PHASE" ; // (int) indice fase
static const std::string GVAR_EMPTY = ".EMPTY" ; // (bool) flag disposizione passiva
static const std::string GVAR_SBH = ".SBH" ; // (bool) flag disposizione con operazioni manuali
static const std::string GVAR_TABNAME = ".TABNAME" ; // (string) nome tavola
static const std::string GVAR_TABORI1 = ".TABORI1" ; // (Point3d) prima origine di tavola
static const std::string GVAR_FIXID = ".FIXID" ; // (int) identificativo bloccaggio (fixture)
static const std::string GVAR_FIXIND = ".FIXIND" ; // (int) indice bloccaggio
static const std::string GVAR_FIXNAME = ".FIXNAME" ; // (string) nome bloccaggio
static const std::string GVAR_FIXPOS = ".FIXPOS" ; // (Point3d) posizione bloccaggio
static const std::string GVAR_FIXANG = ".FIXANG" ; // (num) angolo di rotazione bloccaggio
static const std::string GVAR_FIXMOB = ".FIXMOB" ; // (num) movimento eventuale parte mobile del bloccaggio
static const std::string GVAR_RAWID = ".RAWID" ; // (int) identificativo grezzo
static const std::string GVAR_RAWIND = ".RAWIND" ; // (int) indice movimento del grezzo
static const std::string GVAR_RAWTYPE = ".RAWTYPE" ; // (int) tipo di movimento del grezzo
static const std::string GVAR_RAWPOS = ".RAWPOS" ; // (Point3d) posizione di movimento del grezzo
static const std::string GVAR_RAWFLAG = ".RAWFLAG" ; // (int) flag per movimento del grezzo
static const std::string GVAR_TOOL = ".TOOL" ; // (string) nome utensile
static const std::string GVAR_HEAD = ".HEAD" ; // (string) nome testa
static const std::string GVAR_EXIT = ".EXIT" ; // (int) indice uscita
static const std::string GVAR_TCPOS = ".TCPOS" ; // (string) eventuale posizione utensile nel TC
static const std::string GVAR_TCOMP = ".TCOMP" ; // (int) numero correttore utensile
static const std::string GVAR_TDIAM = ".TDIAM" ; // (num) diametro utensile
static const std::string GVAR_TTOTDIAM = ".TTOTDIAM" ; // (num) diametro totale utensile
static const std::string GVAR_TLEN = ".TLEN" ; // (num) lunghezza utensile
static const std::string GVAR_TTOTLEN = ".TTOTLEN" ; // (num) lunghezza totale utensile
static const std::string GVAR_TUSED = ".TUSED" ; // (bool) flag per indicare che l'utensile attrezzato è anche utilizzato
static const std::string GVAR_SMAX = ".SMAX" ; // (num) massima speed utensile
static const std::string GVAR_FIRST = ".FIRST" ; // (bool) flag per primo utensile
static const std::string GVAR_NEXTTOOL = ".NEXTTOOL" ; // (string) nome del prossimo utensile
static const std::string GVAR_NEXTHEAD = ".NEXTHEAD" ; // (string) nome testa del prossimo utensile
static const std::string GVAR_NEXTEXIT = ".NEXTEXIT" ; // (int) indice uscita su testa del prox utensile
static const std::string GVAR_NEXTTCPOS = ".NEXTTCPOS" ; // (string) eventuale posizione del prox utensile nel TC
static const std::string GVAR_MCHID = ".MCHID" ; // (int) identificativo lavorazione
static const std::string GVAR_MCHIND = ".MCHIND" ; // (int) indice lavorazione
static const std::string GVAR_MMIN = ".MMIN" ; // (Point3d) punto minimo di ingombro della lavorazione
static const std::string GVAR_MMAX = ".MMAX" ; // (Point3d) punto massimo di ingombro della lavorazione
static const std::string GVAR_VER = ".VER" ; // (string) versione della Dll
static const std::string GVAR_ERR = ".ERR" ; // (int) codice di errore (0=ok)
static const std::string GVAR_USETO1 = ".USETO1" ; // (bool) flag per utilizzo origine tavola
static const std::string GVAR_MODAL = ".MODAL" ; // (bool) flag per emissione modale dei valori
static const std::string GVAR_INCHES = ".INCHES" ; // (bool) flag unità di misura (true=inches, false=mm)
static const std::string GVAR_SPLITARCS = ".SPLITARCS" ; // (int) flag spezzatura archi (0=mai, 1=piani generici, 2=piani diversi da XY, 3=sempre)
static const std::string GVAR_NUM = ".NUM" ; // (bool) flag numerazione
static const std::string GVAR_NUMTOK = ".Nt" ; // (string) token per numerazione
static const std::string GVAR_LINENBR = ".LINENBR" ; // (int) numero progressivo di linea
static const std::string GVAR_LINEINC = ".LINEINC" ; // (int) incremento per numero di linea
static const std::string GVAR_F = ".F" ; // (num) valore della feed
static const std::string GVAR_FT = ".Ft" ; // (string) token per feed
static const std::string GVAR_S = ".S" ; // (num) valore della speed
static const std::string GVAR_ST = ".St" ; // (string) token per speed
static const std::string GVAR_MACHNAME = ".MACHNAME" ; // (string) nome macchina
static const std::string GVAR_FILE = ".FILE" ; // (string) path file di output
static const std::string GVAR_INFO = ".INFO" ; // (string) informazioni iniziali
static const std::string GVAR_SETUP = ".SETUP" ; // (bool) flag definizione setup
static const std::string GVAR_DISPID = ".DISPID" ; // (int) identificativo disposizione
static const std::string GVAR_DISPIND = ".DISPIND" ; // (int) indice disposizione
static const std::string GVAR_PHASE = ".PHASE" ; // (int) indice fase
static const std::string GVAR_EMPTY = ".EMPTY" ; // (bool) flag disposizione passiva
static const std::string GVAR_SBH = ".SBH" ; // (bool) flag disposizione con operazioni manuali
static const std::string GVAR_TABNAME = ".TABNAME" ; // (string) nome tavola
static const std::string GVAR_TABORI1 = ".TABORI1" ; // (Point3d) prima origine di tavola
static const std::string GVAR_FIXID = ".FIXID" ; // (int) identificativo bloccaggio (fixture)
static const std::string GVAR_FIXIND = ".FIXIND" ; // (int) indice bloccaggio
static const std::string GVAR_FIXNAME = ".FIXNAME" ; // (string) nome bloccaggio
static const std::string GVAR_FIXPOS = ".FIXPOS" ; // (Point3d) posizione bloccaggio
static const std::string GVAR_FIXANG = ".FIXANG" ; // (num) angolo di rotazione bloccaggio
static const std::string GVAR_FIXMOB = ".FIXMOB" ; // (num) movimento eventuale parte mobile del bloccaggio
static const std::string GVAR_RAWID = ".RAWID" ; // (int) identificativo grezzo
static const std::string GVAR_RAWIND = ".RAWIND" ; // (int) indice movimento del grezzo
static const std::string GVAR_RAWTYPE = ".RAWTYPE" ; // (int) tipo di movimento del grezzo
static const std::string GVAR_RAWPOS = ".RAWPOS" ; // (Point3d) posizione di movimento del grezzo
static const std::string GVAR_RAWFLAG = ".RAWFLAG" ; // (int) flag per movimento del grezzo
static const std::string GVAR_TOOL = ".TOOL" ; // (string) nome utensile
static const std::string GVAR_HEAD = ".HEAD" ; // (string) nome testa
static const std::string GVAR_EXIT = ".EXIT" ; // (int) indice uscita
static const std::string GVAR_TCPOS = ".TCPOS" ; // (string) eventuale posizione utensile nel TC
static const std::string GVAR_TTYPE = ".TTYPE" ; // (int) tipo utensile
static const std::string GVAR_TCOMP = ".TCOMP" ; // (int) numero correttore utensile
static const std::string GVAR_TDIAM = ".TDIAM" ; // (num) diametro utensile
static const std::string GVAR_TTOTDIAM = ".TTOTDIAM" ; // (num) diametro totale utensile
static const std::string GVAR_TLEN = ".TLEN" ; // (num) lunghezza utensile
static const std::string GVAR_TTOTLEN = ".TTOTLEN" ; // (num) lunghezza totale utensile
static const std::string GVAR_TDIST = ".TDIST" ; // (num) distanza utensile (per mortasatrice/sega a catena)
static const std::string GVAR_TUSED = ".TUSED" ; // (bool) flag per indicare che l'utensile attrezzato è anche utilizzato
static const std::string GVAR_SMAX = ".SMAX" ; // (num) massima speed utensile
static const std::string GVAR_FIRST = ".FIRST" ; // (bool) flag per primo utensile
static const std::string GVAR_NEXTTOOL = ".NEXTTOOL" ; // (string) nome del prossimo utensile
static const std::string GVAR_NEXTHEAD = ".NEXTHEAD" ; // (string) nome testa del prossimo utensile
static const std::string GVAR_NEXTEXIT = ".NEXTEXIT" ; // (int) indice uscita su testa del prox utensile
static const std::string GVAR_NEXTTCPOS = ".NEXTTCPOS" ; // (string) eventuale posizione del prox utensile nel TC
static const std::string GVAR_MCHID = ".MCHID" ; // (int) identificativo lavorazione
static const std::string GVAR_MCHIND = ".MCHIND" ; // (int) indice lavorazione
static const std::string GVAR_MMIN = ".MMIN" ; // (Point3d) punto minimo di ingombro della lavorazione
static const std::string GVAR_MMAX = ".MMAX" ; // (Point3d) punto massimo di ingombro della lavorazione
static const std::string GVAR_MAXMIN = ".MAXMIN" ; // (double/s) minimo di ingombro degli assi della lavorazione
static const std::string GVAR_MAXMAX = ".MAXMAX" ; // (double/s) massimo di ingombro degli assi della lavorazione
static const std::string GVAR_PATHID = ".PATHID" ; // (int) identificativo percorso di lavorazione
static const std::string GVAR_PATHIND = ".PATHIND" ; // (int) indice percorso di lavorazione
static const std::string GVAR_START = ".START" ; // (Point3d) punto iniziale del percorso originale
static const std::string GVAR_END = ".END" ; // (Point3d) punto finale del percorso originale
static const std::string GVAR_EXTR = ".EXTR" ; // (Vector3d)versore estrusione
static const std::string GVAR_PMIN = ".PMIN" ; // (Point3d) punto minimo di ingombro del percorso di lavorazione
static const std::string GVAR_PMAX = ".PMAX" ; // (Point3d) punto massimo di ingombro del percorso di lavorazione
static const std::string GVAR_PATHID = ".PATHID" ; // (int) identificativo percorso di lavorazione
static const std::string GVAR_PATHIND = ".PATHIND" ; // (int) indice percorso di lavorazione
static const std::string GVAR_START = ".START" ; // (Point3d) punto iniziale del percorso originale
static const std::string GVAR_END = ".END" ; // (Point3d) punto finale del percorso originale
static const std::string GVAR_EXTR = ".EXTR" ; // (Vector3d) versore estrusione
static const std::string GVAR_PMIN = ".PMIN" ; // (Point3d) punto minimo di ingombro del percorso di lavorazione
static const std::string GVAR_PMAX = ".PMAX" ; // (Point3d) punto massimo di ingombro del percorso di lavorazione
static const std::string GVAR_PAXMIN = ".PAXMIN" ; // (double/s) minimo di ingombro degli assi del percorso di lavorazione
static const std::string GVAR_PAXMAX = ".PAXMAX" ; // (double/s) massimo di ingombro degli assi del percorso di lavorazione
static const std::string GVAR_ELEV = ".ELEV" ; // (double) massima elevazione
static const std::string GVAR_AUXTOT = ".AUXTOT" ; // (int) numero totale dati ausiliari inizio/fine percorso di lavorazione
static const std::string GVAR_AUXIND = ".AUXIND" ; // (int) indice dato ausiliario inizio/fine percorso di lavorazione
static const std::string GVAR_AUX = ".AUX" ; // (string) dato ausiliario inizio/fine percorso di lavorazione
static const std::string GVAR_MOVEID = ".MOVEID" ; // (int) identificativo movimento
static const std::string GVAR_MOVEIND = ".MOVEIND" ; // (int) indice movimento
static const std::string GVAR_MOVE = ".MOVE" ; // (int) tipo di movimento (0,1,2,3)
static const std::string GVAR_L1 = ".L1" ; // (num) valore del primo asse lineare
static const std::string GVAR_L2 = ".L2" ; // (num) valore del secondo asse lineare
static const std::string GVAR_L3 = ".L3" ; // (num) valore del terzo asse lineare
static const std::string GVAR_R1 = ".R1" ; // (num) valore del primo asse rotante
static const std::string GVAR_R2 = ".R2" ; // (num) valore del secondo asse rotante
static const std::string GVAR_R3 = ".R3" ; // (num) valore del terzo asse rotante
static const std::string GVAR_R4 = ".R4" ; // (num) valore del quarto asse rotante
static const std::string GVAR_C1 = ".C1" ; // (num) valore del primo asse lineare per centro arco
static const std::string GVAR_C2 = ".C2" ; // (num) valore del secondo asse lineare per centro arco
static const std::string GVAR_C3 = ".C3" ; // (num) valore del terzo asse lineare per centro arco
static const std::string GVAR_M1 = ".M1" ; // (num) valore del primo asse lineare per punto medio arco
static const std::string GVAR_M2 = ".M2" ; // (num) valore del secondo asse lineare per punto medio arco
static const std::string GVAR_M3 = ".M3" ; // (num) valore del terzo asse lineare per punto medio arco
static const std::string GVAR_RR = ".RR" ; // (num) valore raggio per arco
static const std::string GVAR_AC = ".AC" ; // (num) valore angolo al centro per arco
static const std::string GVAR_L1P = ".L1p" ; // (num) valore precedente del primo asse lineare
static const std::string GVAR_L2P = ".L2p" ; // (num) valore precedente del secondo asse lineare
static const std::string GVAR_L3P = ".L3p" ; // (num) valore precedente del terzo asse lineare
static const std::string GVAR_R1P = ".R1p" ; // (num) valore precedente del primo asse rotante
static const std::string GVAR_R2P = ".R2p" ; // (num) valore precedente del secondo asse rotante
static const std::string GVAR_R3P = ".R3p" ; // (num) valore precedente del terzo asse rotante
static const std::string GVAR_R4P = ".R4p" ; // (num) valore precedente del quarto asse rotante
static const std::string GVAR_L1T = ".L1t" ; // (string) token del primo asse lineare
static const std::string GVAR_L2T = ".L2t" ; // (string) token del secondo asse lineare
static const std::string GVAR_L3T = ".L3t" ; // (string) token del terzo asse lineare
static const std::string GVAR_R1T = ".R1t" ; // (string) token del primo asse rotante
static const std::string GVAR_R2T = ".R2t" ; // (string) token del secondo asse rotante
static const std::string GVAR_R3T = ".R3t" ; // (string) token del terzo asse rotante
static const std::string GVAR_R4T = ".R4t" ; // (string) token del quarto asse rotante
static const std::string GVAR_C1T = ".C1t" ; // (string) token del primo asse lineare per centro arco
static const std::string GVAR_C2T = ".C2t" ; // (string) token del secondo asse lineare per centro arco
static const std::string GVAR_C3T = ".C3t" ; // (string) token del terzo asse lineare per centro arco
static const std::string GVAR_M1T = ".M1t" ; // (string) token del primo asse lineare per punto medio arco
static const std::string GVAR_M2T = ".M2t" ; // (string) token del secondo asse lineare per punto medio arco
static const std::string GVAR_M3T = ".M3t" ; // (string) token del terzo asse lineare per punto medio arco
static const std::string GVAR_RRT = ".RRt" ; // (string) token del raggio per arco
static const std::string GVAR_L1N = ".L1n" ; // (string) nome del primo asse lineare
static const std::string GVAR_L2N = ".L2n" ; // (string) nome del secondo asse lineare
static const std::string GVAR_L3N = ".L3n" ; // (string) nome del terzo asse lineare
static const std::string GVAR_R1N = ".R1n" ; // (string) nome del primo asse rotante
static const std::string GVAR_R2N = ".R2n" ; // (string) nome del secondo asse rotante
static const std::string GVAR_R3N = ".R3n" ; // (string) nome del terzo asse rotante
static const std::string GVAR_R4N = ".R4n" ; // (string) nome del quarto asse rotante
static const std::string GVAR_MASK = ".MASK" ; // (int) mask associato ai movimenti in rapido
static const std::string GVAR_FLAG = ".FLAG" ; // (int) flag associato ad ogni movimento
static const std::string GVAR_FLAG2 = ".FLAG2" ; // (int) secondo flag associato ad ogni movimento
static const std::string GVAR_INDEX = ".IDX" ; // (int) indice associato ad ogni movimento
static const std::string GVAR_TDIR = ".TDIR" ; // (Vector3d)versore utensile nel riferimento pezzo
static const std::string GVAR_CDIR = ".CDIR" ; // (Vector3d)versore correzione nel riferimento pezzo
static const std::string GVAR_ADIR = ".ADIR" ; // (Vector3d)versore ausiliario nel riferimento pezzo
static const std::string GVAR_ENABAXES = ".EnabAxes" ; // (bool) flag abilitazione assi attivi per simulazione
static const std::string GVAR_SHOWAXES = ".ShowAxes" ; // (bool) flag visualizzazione assi attivi per simulazione
static const std::string GVAR_AUXAXES = ".AuxAxes" ; // (int) numero assi ausiliari per simulazione
static const std::string GVAR_AN = ".AN" ; // (num) valore del N-esimo asse ausiliario per simulazione
static const std::string GVAR_ANN = ".ANn" ; // (string) nome del N-esimo asse ausiliario per simulazione
static const std::string GVAR_VMILL = ".VMILL" ; // (int/s) identificativi Zmap attivi per Virtual Milling
static const std::string GVAR_CODET = ".CODET" ; // (int/s) identificativi Zmap attivi per Collision Detection
static const std::string GVAR_SIM1ST = ".SIM1ST" ; // (bool) flag inizio simulazione
static const std::string GVAR_SIMSTEP = ".SIMSTEP" ; // (num) step di movimento durante la simulazione
static const std::string GVAR_SIMUISTAT = ".SIMUISTAT" ; // (num) stato simulazione imposto da utente
static const std::string GVAR_SAFEDIST = ".SAFEDIST" ; // (num) distanza di sicurezza per verifica di collisione
static const std::string GVAR_SIMVMID = ".SIMVMID" ; // (int) identificativo grezzo Vmill in collisione
static const std::string GVAR_SIMCOBIND = ".SIMCOBIND" ; // (int) indice oggetto in collisione
static const std::string GVAR_ELEV = ".ELEV" ; // (double) massima elevazione
static const std::string GVAR_AUXTOT = ".AUXTOT" ; // (int) numero totale dati ausiliari inizio/fine percorso di lavorazione
static const std::string GVAR_AUXIND = ".AUXIND" ; // (int) indice dato ausiliario inizio/fine percorso di lavorazione
static const std::string GVAR_AUX = ".AUX" ; // (string) dato ausiliario inizio/fine percorso di lavorazione
static const std::string GVAR_MOVEID = ".MOVEID" ; // (int) identificativo movimento
static const std::string GVAR_MOVEIND = ".MOVEIND" ; // (int) indice movimento
static const std::string GVAR_MOVE = ".MOVE" ; // (int) tipo di movimento (0,1,2,3)
static const std::string GVAR_L1 = ".L1" ; // (num) valore del primo asse lineare
static const std::string GVAR_L2 = ".L2" ; // (num) valore del secondo asse lineare
static const std::string GVAR_L3 = ".L3" ; // (num) valore del terzo asse lineare
static const std::string GVAR_R1 = ".R1" ; // (num) valore del primo asse rotante
static const std::string GVAR_R2 = ".R2" ; // (num) valore del secondo asse rotante
static const std::string GVAR_R3 = ".R3" ; // (num) valore del terzo asse rotante
static const std::string GVAR_R4 = ".R4" ; // (num) valore del quarto asse rotante
static const std::string GVAR_R5 = ".R5" ; // (num) valore del quinto asse rotante
static const std::string GVAR_R6 = ".R6" ; // (num) valore del sesto asse rotante
static const std::string GVAR_R7 = ".R7" ; // (num) valore del settimo asse rotante
static const std::string GVAR_C1 = ".C1" ; // (num) valore del primo asse lineare per centro arco
static const std::string GVAR_C2 = ".C2" ; // (num) valore del secondo asse lineare per centro arco
static const std::string GVAR_C3 = ".C3" ; // (num) valore del terzo asse lineare per centro arco
static const std::string GVAR_M1 = ".M1" ; // (num) valore del primo asse lineare per punto medio arco
static const std::string GVAR_M2 = ".M2" ; // (num) valore del secondo asse lineare per punto medio arco
static const std::string GVAR_M3 = ".M3" ; // (num) valore del terzo asse lineare per punto medio arco
static const std::string GVAR_RR = ".RR" ; // (num) valore raggio per arco
static const std::string GVAR_AC = ".AC" ; // (num) valore angolo al centro per arco
static const std::string GVAR_L1P = ".L1p" ; // (num) valore precedente del primo asse lineare
static const std::string GVAR_L2P = ".L2p" ; // (num) valore precedente del secondo asse lineare
static const std::string GVAR_L3P = ".L3p" ; // (num) valore precedente del terzo asse lineare
static const std::string GVAR_R1P = ".R1p" ; // (num) valore precedente del primo asse rotante
static const std::string GVAR_R2P = ".R2p" ; // (num) valore precedente del secondo asse rotante
static const std::string GVAR_R3P = ".R3p" ; // (num) valore precedente del terzo asse rotante
static const std::string GVAR_R4P = ".R4p" ; // (num) valore precedente del quarto asse rotante
static const std::string GVAR_R5P = ".R5p" ; // (num) valore precedente del quinto asse rotante
static const std::string GVAR_R6P = ".R6p" ; // (num) valore precedente del sesto asse rotante
static const std::string GVAR_R7P = ".R7p" ; // (num) valore precedente del settimo asse rotante
static const std::string GVAR_L1T = ".L1t" ; // (string) token del primo asse lineare
static const std::string GVAR_L2T = ".L2t" ; // (string) token del secondo asse lineare
static const std::string GVAR_L3T = ".L3t" ; // (string) token del terzo asse lineare
static const std::string GVAR_R1T = ".R1t" ; // (string) token del primo asse rotante
static const std::string GVAR_R2T = ".R2t" ; // (string) token del secondo asse rotante
static const std::string GVAR_R3T = ".R3t" ; // (string) token del terzo asse rotante
static const std::string GVAR_R4T = ".R4t" ; // (string) token del quarto asse rotante
static const std::string GVAR_R5T = ".R5t" ; // (string) token del quinto asse rotante
static const std::string GVAR_R6T = ".R6t" ; // (string) token del sesto asse rotante
static const std::string GVAR_R7T = ".R7t" ; // (string) token del settimo asse rotante
static const std::string GVAR_C1T = ".C1t" ; // (string) token del primo asse lineare per centro arco
static const std::string GVAR_C2T = ".C2t" ; // (string) token del secondo asse lineare per centro arco
static const std::string GVAR_C3T = ".C3t" ; // (string) token del terzo asse lineare per centro arco
static const std::string GVAR_M1T = ".M1t" ; // (string) token del primo asse lineare per punto medio arco
static const std::string GVAR_M2T = ".M2t" ; // (string) token del secondo asse lineare per punto medio arco
static const std::string GVAR_M3T = ".M3t" ; // (string) token del terzo asse lineare per punto medio arco
static const std::string GVAR_RRT = ".RRt" ; // (string) token del raggio per arco
static const std::string GVAR_L1N = ".L1n" ; // (string) nome del primo asse lineare
static const std::string GVAR_L2N = ".L2n" ; // (string) nome del secondo asse lineare
static const std::string GVAR_L3N = ".L3n" ; // (string) nome del terzo asse lineare
static const std::string GVAR_R1N = ".R1n" ; // (string) nome del primo asse rotante
static const std::string GVAR_R2N = ".R2n" ; // (string) nome del secondo asse rotante
static const std::string GVAR_R3N = ".R3n" ; // (string) nome del terzo asse rotante
static const std::string GVAR_R4N = ".R4n" ; // (string) nome del quarto asse rotante
static const std::string GVAR_R5N = ".R5n" ; // (string) nome del quinto asse rotante
static const std::string GVAR_R6N = ".R6n" ; // (string) nome del sesto asse rotante
static const std::string GVAR_R7N = ".R7n" ; // (string) nome del settimo asse rotante
static const std::string GVAR_MASK = ".MASK" ; // (int) mask associato ai movimenti in rapido
static const std::string GVAR_FLAG = ".FLAG" ; // (int) flag associato ad ogni movimento
static const std::string GVAR_FLAG2 = ".FLAG2" ; // (int) secondo flag associato ad ogni movimento
static const std::string GVAR_INDEX = ".IDX" ; // (int) indice associato ad ogni movimento
static const std::string GVAR_TDIR = ".TDIR" ; // (Vector3d) versore utensile nel riferimento pezzo
static const std::string GVAR_CDIR = ".CDIR" ; // (Vector3d) versore correzione nel riferimento pezzo
static const std::string GVAR_ADIR = ".ADIR" ; // (Vector3d) versore ausiliario nel riferimento pezzo
static const std::string GVAR_TDIRP = ".TDIRp" ; // (Vector3d) precedente versore utensile nel riferimento pezzo
static const std::string GVAR_ENABAXES = ".EnabAxes" ; // (bool) flag abilitazione assi attivi per simulazione
static const std::string GVAR_SHOWAXES = ".ShowAxes" ; // (bool) flag visualizzazione assi attivi per simulazione
static const std::string GVAR_AUXAXES = ".AuxAxes" ; // (int) numero assi ausiliari per simulazione
static const std::string GVAR_AN = ".AN" ; // (num) valore del N-esimo asse ausiliario per simulazione
static const std::string GVAR_ANN = ".ANn" ; // (string) nome del N-esimo asse ausiliario per simulazione
static const std::string GVAR_ANM = ".ANm" ; // (string) asse master del N-esimo asse ausiliario per simulazione
static const std::string GVAR_VMILL = ".VMILL" ; // (int/s) identificativi Zmap attivi per Virtual Milling
static const std::string GVAR_CODET = ".CODET" ; // (int/s) identificativi Zmap attivi per Collision Detection
static const std::string GVAR_SIM1ST = ".SIM1ST" ; // (bool) flag inizio simulazione
static const std::string GVAR_SIMSTEP = ".SIMSTEP" ; // (num) step di movimento durante la simulazione
static const std::string GVAR_SIMUISTAT = ".SIMUISTAT" ; // (num) stato simulazione imposto da utente
static const std::string GVAR_SAFEDIST = ".SAFEDIST" ; // (num) distanza di sicurezza per verifica di collisione
static const std::string GVAR_SIMVMID = ".SIMVMID" ; // (int) identificativo grezzo Vmill in collisione
static const std::string GVAR_SIMCOBIND = ".SIMCOBIND" ; // (int) indice oggetto in collisione
// Funzioni generazione
static const std::string ON_START = "OnStart" ;
static const std::string ON_END = "OnEnd" ;
@@ -202,6 +218,8 @@ static const std::string ON_ESTIM_RAPID = "OnEstimRapid" ;
static const std::string ON_ESTIM_LINEAR = "OnEstimLinear" ;
static const std::string ON_ESTIM_ARC = "OnEstimArc" ;
// Funzioni simulazione
static const std::string ON_SIMUL_INIT = "OnSimulInit" ;
static const std::string ON_SIMUL_EXIT = "OnSimulExit" ;
static const std::string ON_SIMUL_START = "OnSimulStart" ;
static const std::string ON_SIMUL_END = "OnSimulEnd" ;
static const std::string ON_SIMUL_DISPOSITION_STARTING = "OnSimulDispositionStarting" ;
@@ -223,64 +241,120 @@ static const std::string ON_RESET_MACHINE = "OnResetMachine" ;
//----------------------------------------------------------------------------
inline std::string
GetGlobVarAxisValue( int nAx, const std::string& sVar = GLOB_VAR)
GetGlobVarAxisValue( int nAx, const std::string& sVar = GLOB_VAR, bool bIsRobot = false)
{
switch ( nAx) {
case 1 : return ( sVar + GVAR_L1) ;
case 2 : return ( sVar + GVAR_L2) ;
case 3 : return ( sVar + GVAR_L3) ;
case 4 : return ( sVar + GVAR_R1) ;
case 5 : return ( sVar + GVAR_R2) ;
case 6 : return ( sVar + GVAR_R3) ;
case 7 : return ( sVar + GVAR_R4) ;
default : return "" ;
}
if ( ! bIsRobot) {
switch ( nAx) {
case 1 : return ( sVar + GVAR_L1) ;
case 2 : return ( sVar + GVAR_L2) ;
case 3 : return ( sVar + GVAR_L3) ;
case 4 : return ( sVar + GVAR_R1) ;
case 5 : return ( sVar + GVAR_R2) ;
case 6 : return ( sVar + GVAR_R3) ;
case 7 : return ( sVar + GVAR_R4) ;
default : return "" ;
}
}
else {
switch ( nAx) {
case 1 : return ( sVar + GVAR_R1) ;
case 2 : return ( sVar + GVAR_R2) ;
case 3 : return ( sVar + GVAR_R3) ;
case 4 : return ( sVar + GVAR_R4) ;
case 5 : return ( sVar + GVAR_R5) ;
case 6 : return ( sVar + GVAR_R6) ;
case 7 : return ( sVar + GVAR_R7) ;
default : return "" ;
}
}
}
//----------------------------------------------------------------------------
inline std::string
GetGlobVarAxisPrev( int nAx, const std::string& sVar = GLOB_VAR)
GetGlobVarAxisPrev( int nAx, const std::string& sVar = GLOB_VAR, bool bIsRobot = false)
{
switch ( nAx) {
case 1 : return ( sVar + GVAR_L1P) ;
case 2 : return ( sVar + GVAR_L2P) ;
case 3 : return ( sVar + GVAR_L3P) ;
case 4 : return ( sVar + GVAR_R1P) ;
case 5 : return ( sVar + GVAR_R2P) ;
case 6 : return ( sVar + GVAR_R3P) ;
case 7 : return ( sVar + GVAR_R4P) ;
default : return "" ;
}
if ( ! bIsRobot) {
switch ( nAx) {
case 1 : return ( sVar + GVAR_L1P) ;
case 2 : return ( sVar + GVAR_L2P) ;
case 3 : return ( sVar + GVAR_L3P) ;
case 4 : return ( sVar + GVAR_R1P) ;
case 5 : return ( sVar + GVAR_R2P) ;
case 6 : return ( sVar + GVAR_R3P) ;
case 7 : return ( sVar + GVAR_R4P) ;
default : return "" ;
}
}
else {
switch ( nAx) {
case 1 : return ( sVar + GVAR_R1P) ;
case 2 : return ( sVar + GVAR_R2P) ;
case 3 : return ( sVar + GVAR_R3P) ;
case 4 : return ( sVar + GVAR_R4P) ;
case 5 : return ( sVar + GVAR_R5P) ;
case 6 : return ( sVar + GVAR_R6P) ;
case 7 : return ( sVar + GVAR_R7P) ;
default : return "" ;
}
}
}
//----------------------------------------------------------------------------
inline std::string
GetGlobVarAxisToken( int nAx)
GetGlobVarAxisToken( int nAx, bool bIsRobot = false)
{
switch ( nAx) {
case 1 : return ( GLOB_VAR + GVAR_L1T) ;
case 2 : return ( GLOB_VAR + GVAR_L2T) ;
case 3 : return ( GLOB_VAR + GVAR_L3T) ;
case 4 : return ( GLOB_VAR + GVAR_R1T) ;
case 5 : return ( GLOB_VAR + GVAR_R2T) ;
case 6 : return ( GLOB_VAR + GVAR_R3T) ;
case 7 : return ( GLOB_VAR + GVAR_R4T) ;
default : return "" ;
}
if ( ! bIsRobot) {
switch ( nAx) {
case 1 : return ( GLOB_VAR + GVAR_L1T) ;
case 2 : return ( GLOB_VAR + GVAR_L2T) ;
case 3 : return ( GLOB_VAR + GVAR_L3T) ;
case 4 : return ( GLOB_VAR + GVAR_R1T) ;
case 5 : return ( GLOB_VAR + GVAR_R2T) ;
case 6 : return ( GLOB_VAR + GVAR_R3T) ;
case 7 : return ( GLOB_VAR + GVAR_R4T) ;
default : return "" ;
}
}
else {
switch ( nAx) {
case 1 : return ( GLOB_VAR + GVAR_R1T) ;
case 2 : return ( GLOB_VAR + GVAR_R2T) ;
case 3 : return ( GLOB_VAR + GVAR_R3T) ;
case 4 : return ( GLOB_VAR + GVAR_R4T) ;
case 5 : return ( GLOB_VAR + GVAR_R5T) ;
case 6 : return ( GLOB_VAR + GVAR_R6T) ;
case 7 : return ( GLOB_VAR + GVAR_R7T) ;
default : return "" ;
}
}
}
//----------------------------------------------------------------------------
inline std::string
GetGlobVarAxisName( int nAx)
GetGlobVarAxisName( int nAx, bool bIsRobot = false)
{
switch ( nAx) {
case 1 : return ( GLOB_VAR + GVAR_L1N) ;
case 2 : return ( GLOB_VAR + GVAR_L2N) ;
case 3 : return ( GLOB_VAR + GVAR_L3N) ;
case 4 : return ( GLOB_VAR + GVAR_R1N) ;
case 5 : return ( GLOB_VAR + GVAR_R2N) ;
case 6 : return ( GLOB_VAR + GVAR_R3N) ;
case 7 : return ( GLOB_VAR + GVAR_R4N) ;
default : return "" ;
}
if ( ! bIsRobot) {
switch ( nAx) {
case 1 : return ( GLOB_VAR + GVAR_L1N) ;
case 2 : return ( GLOB_VAR + GVAR_L2N) ;
case 3 : return ( GLOB_VAR + GVAR_L3N) ;
case 4 : return ( GLOB_VAR + GVAR_R1N) ;
case 5 : return ( GLOB_VAR + GVAR_R2N) ;
case 6 : return ( GLOB_VAR + GVAR_R3N) ;
case 7 : return ( GLOB_VAR + GVAR_R4N) ;
default : return "" ;
}
}
else {
switch ( nAx) {
case 1 : return ( GLOB_VAR + GVAR_R1N) ;
case 2 : return ( GLOB_VAR + GVAR_R2N) ;
case 3 : return ( GLOB_VAR + GVAR_R3N) ;
case 4 : return ( GLOB_VAR + GVAR_R4N) ;
case 5 : return ( GLOB_VAR + GVAR_R5N) ;
case 6 : return ( GLOB_VAR + GVAR_R6N) ;
case 7 : return ( GLOB_VAR + GVAR_R7N) ;
default : return "" ;
}
}
}
+2141 -441
View File
File diff suppressed because it is too large Load Diff
+52 -15
View File
@@ -17,6 +17,7 @@
#include "PocketingData.h"
#include "ToolData.h"
#include "/EgtDev/Include/EGkCurveComposite.h"
#include "/EgtDev/Include/EGkCurveLine.h"
#include "/EgtDev/Include/EgtNumUtils.h"
//----------------------------------------------------------------------------
@@ -67,49 +68,80 @@ class Pocketing : public Machining
private :
bool VerifyGeometry( SelData Id, int& nSubs, int& nType) ;
bool GetCurves( SelData Id, ICURVEPLIST& lstPC) ;
bool SetCurveAllTempProp( int nCrvId, ICurve* pCurve) ;
bool SetCurveAllTempProp( int nCrvId, bool bForcedClose, ICurve* pCurve, bool* pbSomeOpen = nullptr) ;
bool ResetCurveAllTempProp( ICurve* pCurve) ;
bool Chain( int nGrpDestId) ;
bool ProcessPath( int nPathId, int nPvId, int nClId) ;
bool CalcRegionElevation( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dRad, double& dElev) const ;
bool CalcRegionElevation( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dRad, double dLen, double& dElev) const ;
bool VerifyPathFromBottom( const ICurveComposite* pCompo, const Vector3d& vtTool) ;
bool GeneratePocketingPv( int nPathId, const ICurveComposite* pCompo) ;
bool AddZigZag( const ICurveComposite* pCompo, const Vector3d& vtTool, const Vector3d& vtExtr,
double dDepth, double dElev, double dOkStep, bool bSplitArcs) ;
double dDepth, double dElev, double dOkStep, bool bSplitArcs, int nPathId) ;
bool CalcZigZag( const ICurveComposite* pOffs, ICRVCOMPOPOVECTOR& vpCrvs) ;
bool OptimizedZigZag( int nPathId, const Vector3d& vtTool, double dDepth, double dSafeZ,
Frame3d& frPocket, bool& bOptimizedZigZag, ICRVCOMPOPOVECTOR& vpCrvs, double& dOffs) ;
bool ZigZagOptimizedNoClosedEdges( ICurveComposite* pCrvPocket, bool& bOptimizedZigZag, Vector3d& vtDir, double& dOffs) ;
bool ZigZagOptimizedOneClosedEdge( ICurveComposite* pCrvPocket, int nClosedId, bool& bOptimizedZigZag, Vector3d& vtDir, double& dOffs) ;
bool ZigZagOptimizedTwoClosedEdges( ICurveComposite* pCrvPocket, const INTVECTOR& vnClosedIds, bool& bOptimizedZigZag,
bool& bOpposite, Vector3d& vtDir, double& dOffs) ;
bool ZigZagOptimizedThreeClosedEdges( ICurveComposite* pCrvPocket, const INTVECTOR& vnClosedIds, bool& bOptimizedZigZag,
bool& bOpposite, Vector3d& vtDir, double& dOffs) ;
bool ZigZagOptimizedComputeOffset( ICurveComposite* pCrvPocket, const Vector3d& vtMainDir, int nOffsettedEdgesOnY,
const INTVECTOR& vnClosedIds, double& dOffs) ;
bool CutCurveWithLine( ICurveComposite* pCrvA, const ICurveLine* pCrvB) ;
bool AddOneWay( const ICurveComposite* pCompo, const Vector3d& vtTool, const Vector3d& vtExtr,
double dDepth, double dElev, double dOkStep, bool bSplitArcs) ;
bool AddSpiralIn( const ICurveComposite* pCompo, const Vector3d& vtTool, const Vector3d& vtExtr,
double dDepth, double dElev, double dOkStep, bool bSplitArcs, bool bMidOpen,
const Point3d& ptMidOpen, const Vector3d& vtMidOut) ;
const Point3d& ptMidOpen, const Vector3d& vtMidOut, int nPathId) ;
bool AddSpiralOut( const ICurveComposite* pCompo, const Vector3d& vtTool, const Vector3d& vtExtr,
double dDepth, double dElev, double dOkStep, bool bSplitArcs) ;
bool CalcSpiral( const ICurveComposite* pCompo, int nReg, bool bSplitArcs,
ICurveComposite* pMCrv, ICurveComposite* pRCrv) ;
double dDepth, double dElev, double dOkStep, bool bSplitArcs, int nPathId) ;
bool CalcSpiral( const ICurveComposite* pCompo, int nReg, bool bSplitArcs,
ICurveComposite* pMCrv, ICurveComposite* pRCrv, int nPathId, bool& bOptimizedTrap) ;
bool CalcBoundedLink( const Point3d& ptStart, const Point3d& ptEnd, const ICurve* pCrvBound,
ICurveComposite* pCrvLink) ;
bool CalcBoundedLinkWithBiArcs( const Point3d& ptStart, const Vector3d& vtStart, const Point3d& ptEnd, const Vector3d& vtEnd,
const ICurve* pCrvBound, ICurveComposite* pCrvLink) ;
bool CalcCircleSpiral( const Point3d& ptCen, const Vector3d& vtN, double dOutRad, double dIntRad,
bool bSplitArcs, ICurveComposite* pMCrv, ICurveComposite* pRCrv) ;
bool CalcTrapezoidSpiral( ICurveComposite* pCrvPocket, const Vector3d& vtDir, double dPocketSize,
ICurveComposite* pMCrv, ICurveComposite* pRCrv, bool& bOptimizedTrap) ;
bool CalcTrapezoidSpiralLocalFrame( ICurveComposite * pCrvPocket, const Vector3d& vtDir, Frame3d& frLoc) ;
bool CalcTrapezoidSpiralXCoord( const ICurveComposite * pCrvPocket, bool bStart, double dYCoord, double& dXCoord, double dPocketSize) ;
bool AdjustTrapezoidSpiralForAngles( ICurveComposite * pMCrv, const ICurveComposite * pCrvPocket, bool bStart) ;
bool SpecialAdjustTrapezoidSpiralForAngles( ICurveComposite* pMCrv, const ICurveComposite* pCrvPocket) ;
bool AdjustTrapezoidSpiralForLeadInLeadOut( ICurveComposite * pCompo, ICurveComposite * pRCrv, const Vector3d& vtTool,
double dDepth, int& nOutsideRaw) ;
bool ComputeTrapezoidSpiralLeadInLeadOut( ICurveComposite * pCompo, const Vector3d& vtMainDir, bool bLeadIn, const Vector3d& vtTool, double dDepth, bool& bIsOutsideRaw) ;
bool ComputePolishingPath( ICurveComposite* pMCrv, ICurveComposite* pRCrv, bool bSplitArcs) ;
bool AddEpicycles( ICurveComposite * pCompo, ICurveComposite * pCrv, ICurveComposite * pCrvBound = nullptr) ;
bool AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
double dElev, double dAppr, bool bOutStart) ;
double dElev, double dAppr, bool bSplitArcs, bool bOutStart) ;
bool AddLinkApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
double dElev, double dAppr) ;
double dElev, double dAppr, bool bSplitArcs, bool bOutStart = false) ;
bool AddLinkRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
double dElev, double dAppr) ;
double dElev, double dAppr, bool bSplitArcs) ;
bool AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
double dElev, double dAppr) ;
double dElev, double dAppr, bool bSplitArcs) ;
bool CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtN,
const ICurveComposite* pRCrv, Point3d& ptP1) const ;
bool AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtN,
const ICurveComposite* pCompo, const ICurveComposite* pRCrv, bool bAtLeft, bool bSplitArcs, bool bNoneForced = false) ;
const ICurveComposite* pCompo, const ICurveComposite* pRCrv, bool bAtLeft, bool bSplitArcs,
bool bNoneForced = false, bool bSkipControl = false) ;
bool AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d& vtN,
const ICurveComposite* pRCrv, bool bSplitArcs, Point3d& ptP1, double& dElev, bool bNoneForced = false) ;
const ICurveComposite* pRCrv, bool bSplitArcs, bool bNoneForced,
Point3d& ptP1, double& dElev) ;
bool AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d& vtN,
const ICurveComposite* pRCrv, bool bSplitArcs, bool bNoneForced,
Point3d& ptP1, double& dElev, bool& bOppositeHome) ;
double GetRadiusForStartEndElevation( void) const ;
bool GetForcedClosed( void) ;
bool GetMidOfLongestOpenSide( const ICurveComposite* pCompo, Point3d& ptMid, Vector3d& vtMidOut) ;
bool AdjustContourWithOpenEdges( ICurveComposite* pCompo) ;
bool AdjustContourStart( ICurveComposite* pCompo) ;
bool VerifyLeadInHelix( const ICurveComposite* pCompo, const Point3d& ptCen, double dRad) const ;
bool VerifyLeadInZigZag( const ICurveComposite* pCompo, const Point3d& ptPa, const Point3d& ptPb) const ;
bool CalcDistanceFromRawSurface( int nPhase, const Point3d& ptP, const Vector3d& vtDir, double& dDist, Vector3d& vtNorm) ;
private :
double GetSpeed( void) const
@@ -134,10 +166,11 @@ class Pocketing : public Machining
if ( m_Params.m_nLeadInType != POCKET_LI_GLIDE && m_Params.m_dLiElev < 10 * EPS_SMALL)
return POCKET_LI_NONE ;
return m_Params.m_nLeadInType ; }
int LeadInIsOk( void) const
bool LeadInRawIsOk( void) const
{ if ( m_TParams.m_nType != TT_MILL_NOTIP)
return true ;
return ( GetLeadInType() == POCKET_LI_HELIX && m_Params.m_dLiTang >= 0.49 * m_TParams.m_dDiam && m_Params.m_dLiElev <= 2) ; }
return (( GetLeadInType() == POCKET_LI_ZIGZAG || GetLeadInType() == POCKET_LI_HELIX) &&
m_Params.m_dLiTang >= 0.9 * m_TParams.m_dDiam && m_Params.m_dLiElev <= 2) ; }
int GetLeadOutType( void) const
{ if ( m_Params.m_dLoTang < std::min( 0.1 * m_TParams.m_dDiam, 1.0))
return POCKET_LO_NONE ;
@@ -147,14 +180,18 @@ class Pocketing : public Machining
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
} ;
+14 -1
View File
@@ -29,6 +29,8 @@ enum nPocketingKey {
KEY_AB = 0,
KEY_AI,
KEY_DH,
KEY_EPCD,
KEY_EPCR,
KEY_F,
KEY_FE,
KEY_FS,
@@ -61,6 +63,8 @@ static const array<string,KEY_ZZZ> sPocketingKey = {
"AB",
"AI",
"DH",
"EPCD",
"EPCR",
"F",
"FE",
"FS",
@@ -241,6 +245,12 @@ PocketingData::FromString( const string& sString, int& nKey)
if ( m_sDepth.empty())
m_sDepth = "0" ;
break ;
case KEY_EPCD :
bOk = ::FromString( sVal, m_dEpicyclesDist) ;
break ;
case KEY_EPCR :
bOk = ::FromString( sVal, m_dEpicyclesRad) ;
break ;
case KEY_F :
bOk = ::FromString( sVal, m_dFeed) ;
break ;
@@ -335,6 +345,8 @@ PocketingData::ToString( int nInd) const
case KEY_AB : return ( sPocketingKey[KEY_AB] + "=" + m_sBlockedAxis) ;
case KEY_AI : return ( sPocketingKey[KEY_AI] + "=" + m_sInitAngs) ;
case KEY_DH : return ( sPocketingKey[KEY_DH] + "=" + m_sDepth) ;
case KEY_EPCD : return ( m_dEpicyclesRad < EPS_SMALL ? "" : sPocketingKey[KEY_EPCD] + "=" + ::ToString( m_dEpicyclesDist)) ;
case KEY_EPCR : return ( m_dEpicyclesRad < EPS_SMALL ? "" : sPocketingKey[KEY_EPCR] + "=" + ::ToString( m_dEpicyclesRad)) ;
case KEY_F : return ( sPocketingKey[KEY_F] + "=" + ::ToString( m_dFeed)) ;
case KEY_FE : return ( sPocketingKey[KEY_FE] + "=" + ::ToString( m_dEndFeed)) ;
case KEY_FS : return ( sPocketingKey[KEY_FS] + "=" + ::ToString( m_dStartFeed)) ;
@@ -369,7 +381,8 @@ PocketingData::ToString( int nInd) const
bool
PocketingData::IsOptional( int nKey) const
{
return ( nKey == KEY_AB || nKey == KEY_AI || nKey == KEY_LIEL || nKey == KEY_TI) ;
return ( nKey == KEY_AB || nKey == KEY_AI || nKey == KEY_EPCD || nKey == KEY_EPCR ||
nKey == KEY_LIEL || nKey == KEY_TI) ;
}
//----------------------------------------------------------------------------
+9 -3
View File
@@ -43,6 +43,8 @@ struct PocketingData : public MachiningData
double m_dLiElev ; // elevazione di uno step di attacco
int m_nLeadOutType ; // tipo di uscita (come attacco, nessuno, lineare, tangente, inseguimento)
double m_dLoTang ; // distanza tangente verso fine uscita
double m_dEpicyclesRad ; // raggio epicicli lucidatura
double m_dEpicyclesDist ; // distanza epicicli lucidatura
std::string m_sSysNotes ; // note interne
std::string m_sUserNotes ; // note dell'utente
@@ -51,7 +53,7 @@ struct PocketingData : public MachiningData
m_dOffsR( UNKNOWN_PAR), m_dOffsL( UNKNOWN_PAR), m_bToolInvert( false), m_bInvert( false),
m_dStartPos( 0), m_dStep( 0), m_dSideStep( 0), m_nSubType( 0), m_dSideAngle( 0),
m_nLeadInType( 0), m_dLiTang( 0), m_dLiElev( 0),
m_nLeadOutType( 0), m_dLoTang( 0) {}
m_nLeadOutType( 0), m_dLoTang( 0), m_dEpicyclesRad( 0), m_dEpicyclesDist( 0) {}
PocketingData* Clone( void) const override ;
bool CopyFrom( const MachiningData* pMdata) override ;
bool SameAs(const MachiningData* pMdata) const override ;
@@ -81,6 +83,10 @@ struct PocketingData : public MachiningData
//----------------------------------------------------------------------------
inline const PocketingData* GetPocketingData( const MachiningData* pMdata)
{ return (dynamic_cast<const PocketingData*>( pMdata)) ; }
{ if ( pMdata == nullptr || pMdata->GetType() != MT_POCKETING)
return nullptr ;
return ( static_cast<const PocketingData*>( pMdata)) ; }
inline PocketingData* GetPocketingData( MachiningData* pMdata)
{ return (dynamic_cast<PocketingData*>( pMdata)) ; }
{ if ( pMdata == nullptr || pMdata->GetType() != MT_POCKETING)
return nullptr ;
return ( static_cast<PocketingData*>( pMdata)) ; }
+56 -25
View File
@@ -84,6 +84,9 @@ Processor::Run( const string& sOutFile, const string& sInfo)
if ( ! VerifySetup())
return false ;
// imposto la fase iniziale come corrente
m_pMchMgr->SetCurrPhase( 1) ;
// evento inizio esecuzione
bool bOk = true ;
if ( ! OnStart()) {
@@ -145,6 +148,9 @@ Processor::Run( const string& sOutFile, const string& sInfo)
LOG_ERROR( GetEMkLogger(), "OnEnd error") ;
}
// imposto la fase iniziale come corrente
m_pMchMgr->SetCurrPhase( 1) ;
return bOk ;
}
@@ -184,8 +190,8 @@ Processor::ProcessDisposition( int nOpId, int nOpInd)
bool bEmpty = pDisp->IsEmpty() ;
bool bSomeByHand = pDisp->GetSomeByHand() ;
// Se disposizione con movimenti macchina
if ( ! pDisp->IsEmpty()) {
// Se disposizione con movimenti autonomi e utensile associato
if ( ! pDisp->IsEmpty() && pDisp->IsWithTool()) {
// Recupero l'utensile della disposizione corrente
string sTool ; string sHead ; int nExit ; string sTcPos ;
if ( ! pDisp->GetToolData( sTool, sHead, nExit, sTcPos))
@@ -447,13 +453,13 @@ Processor::ProcessClEnt( int nEntId, int nEntInd, int nClPathId, int nClPathInd,
int nMove = pCamData->GetMoveType() ;
switch ( nMove) {
case 0 : // rapido
if ( ! OnRapid( nMove, AxesEnd, pCamData->GetAxesMask(),
if ( ! OnRapid( nEntId, nEntInd, nMove, AxesEnd, pCamData->GetAxesMask(),
pCamData->GetToolDir(), pCamData->GetCorrDir(), pCamData->GetBackAuxDir(),
pCamData->GetFlag(), pCamData->GetFlag2(), pCamData->GetIndex()))
return false ;
break ;
case 1 : // linea
if ( ! OnLinear( nMove, AxesEnd,
if ( ! OnLinear( nEntId, nEntInd, nMove, AxesEnd,
pCamData->GetToolDir(), pCamData->GetCorrDir(), pCamData->GetBackAuxDir(),
pCamData->GetFeed(), pCamData->GetFlag(), pCamData->GetFlag2(), pCamData->GetIndex()))
return false ;
@@ -462,7 +468,8 @@ Processor::ProcessClEnt( int nEntId, int nEntInd, int nClPathId, int nClPathInd,
case 3 : // arco CCW
Point3d ptMid( AxesEnd[0], AxesEnd[1], AxesEnd[2]) ;
ptMid.Rotate( pCamData->GetAxesCen(), pCamData->GetAxesNormDir(), - pCamData->GetAxesAngCen() / 2) ;
if ( ! OnArc( nMove, AxesEnd, pCamData->GetAxesCen(), ptMid, pCamData->GetAxesRad(), pCamData->GetAxesAngCen(),
if ( ! OnArc( nEntId, nEntInd, nMove, AxesEnd,
pCamData->GetAxesCen(), ptMid, pCamData->GetAxesRad(), pCamData->GetAxesAngCen(),
pCamData->GetToolDir(), pCamData->GetCorrDir(), pCamData->GetBackAuxDir(),
pCamData->GetFeed(), pCamData->GetFlag(), pCamData->GetFlag2(), pCamData->GetIndex()))
return false ;
@@ -514,8 +521,8 @@ bool
Processor::UpdateAxes( void)
{
// Carico i nomi degli assi macchina attivi
return m_pMachine->GetAllCurrAxesName( m_AxesName) &&
m_pMachine->GetAllCurrAxesToken( m_AxesToken) ;
return m_pMachine->GetAllCurrAxesNames( m_AxesName) &&
m_pMachine->GetAllCurrAxesTokens( m_AxesToken) ;
}
//----------------------------------------------------------------------------
@@ -602,14 +609,16 @@ Processor::ProcessToolData( void)
string sHead ;
int nExit ;
string sTcPos ;
int nType ;
int nComp ;
double dDiam ;
double dTDiam ;
double dLen ;
double dTLen ;
double dDist ;
double dMaxSpeed ;
MyToolData( void)
: sName(), sHead(), nExit( 0), sTcPos(), nComp(0), dDiam( 0), dLen( 0), dMaxSpeed( 0) {}
: sName(), sHead(), nExit( 0), sTcPos(), nType(0), nComp(0), dDiam( 0), dLen( 0), dDist( 0), dMaxSpeed( 0) {}
} ;
typedef vector<MyToolData> TDATAVECTOR ;
TDATAVECTOR vTdata ;
@@ -634,11 +643,13 @@ Processor::ProcessToolData( void)
m_pMchMgr->TdbGetCurrToolParam( TPA_HEAD, Tdata.sHead) ;
m_pMchMgr->TdbGetCurrToolParam( TPA_EXIT, Tdata.nExit) ;
m_pMchMgr->TdbGetCurrToolParam( TPA_TCPOS, Tdata.sTcPos) ;
m_pMchMgr->TdbGetCurrToolParam( TPA_TYPE, Tdata.nType) ;
m_pMchMgr->TdbGetCurrToolParam( TPA_CORR, Tdata.nComp) ;
m_pMchMgr->TdbGetCurrToolParam( TPA_DIAM, Tdata.dDiam) ;
m_pMchMgr->TdbGetCurrToolParam( TPA_TOTDIAM, Tdata.dTDiam) ;
m_pMchMgr->TdbGetCurrToolParam( TPA_LEN, Tdata.dLen) ;
m_pMchMgr->TdbGetCurrToolParam( TPA_TOTLEN, Tdata.dTLen) ;
m_pMchMgr->TdbGetCurrToolParam( TPA_DIST, Tdata.dDist) ;
m_pMchMgr->TdbGetCurrToolParam( TPA_MAXSPEED, Tdata.dMaxSpeed) ;
vTdata.push_back( Tdata) ;
}
@@ -671,18 +682,22 @@ Processor::ProcessToolData( void)
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_EXIT, nExit) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TCPOS, sTcPos) ;
if ( m_pMchMgr->TdbSetCurrTool( sTool)) {
int nComp ; double dDiam ; double dTDiam ; double dLen ; double dTLen ; double dMaxSpeed ;
int nType ; int nComp ; double dDiam ; double dTDiam ; double dLen ; double dTLen ; double dDist ; double dMaxSpeed ;
m_pMchMgr->TdbGetCurrToolParam( TPA_TYPE, nType) ;
m_pMchMgr->TdbGetCurrToolParam( TPA_CORR, nComp) ;
m_pMchMgr->TdbGetCurrToolParam( TPA_DIAM, dDiam) ;
m_pMchMgr->TdbGetCurrToolParam( TPA_TOTDIAM, dTDiam) ;
m_pMchMgr->TdbGetCurrToolParam( TPA_LEN, dLen) ;
m_pMchMgr->TdbGetCurrToolParam( TPA_TOTLEN, dTLen) ;
m_pMchMgr->TdbGetCurrToolParam( TPA_DIST, dDist) ;
m_pMchMgr->TdbGetCurrToolParam( TPA_MAXSPEED, dMaxSpeed) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TTYPE, nType) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TCOMP, nComp) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TDIAM, dDiam) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TTOTDIAM, dTDiam) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TLEN, dLen) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TTOTLEN, dTLen) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TDIST, dDist) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_SMAX, dMaxSpeed) ;
}
bool bUsed = false ;
@@ -716,11 +731,13 @@ Processor::ProcessToolData( void)
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_HEAD, vTdata[i].sHead) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_EXIT, vTdata[i].nExit) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TCPOS, vTdata[i].sTcPos) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TTYPE, vTdata[i].nType) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TCOMP, vTdata[i].nComp) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TDIAM, vTdata[i].dDiam) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TTOTDIAM, vTdata[i].dTDiam) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TLEN, vTdata[i].dLen) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TTOTLEN, vTdata[i].dTLen) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TDIST, vTdata[i].dDist) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_SMAX, vTdata[i].dMaxSpeed) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TUSED, true) ;
// se esiste, chiamo la funzione di emissione dati utensile
@@ -826,15 +843,16 @@ Processor::OnToolSelect( const string& sTool, const string& sHead, int nExit, co
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_EXIT, nExit) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TCPOS, sTcPos) ;
// assegno il token e il nome degli assi
bool bIsRobot = m_pMchMgr->GetCurrIsRobot() ;
int nNumAxes = int( m_AxesName.size()) ;
for ( int i = 1 ; i <= MAX_AXES ; ++ i) {
if ( i <= nNumAxes) {
bOk = bOk && m_pMachine->LuaSetGlobVar( GetGlobVarAxisToken(i), m_AxesToken[i-1]) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GetGlobVarAxisName(i), m_AxesName[i-1]) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GetGlobVarAxisToken( i, bIsRobot), m_AxesToken[i-1]) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GetGlobVarAxisName( i, bIsRobot), m_AxesName[i-1]) ;
}
else {
bOk = bOk && m_pMachine->LuaResetGlobVar( GetGlobVarAxisToken(i)) ;
bOk = bOk && m_pMachine->LuaResetGlobVar( GetGlobVarAxisName(i)) ;
bOk = bOk && m_pMachine->LuaResetGlobVar( GetGlobVarAxisToken( i, bIsRobot)) ;
bOk = bOk && m_pMachine->LuaResetGlobVar( GetGlobVarAxisName( i, bIsRobot)) ;
}
}
// chiamo la funzione di selezione utensile
@@ -954,21 +972,25 @@ Processor::OnPathEndAux( int nInd, const string& sAE)
//----------------------------------------------------------------------------
bool
Processor::OnRapid( int nMove, const DBLVECTOR& AxesEnd, int nAxesMask,
Processor::OnRapid( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd, int nAxesMask,
const Vector3d& vtTool, const Vector3d& vtCorr, const Vector3d& vtAux,
int nFlag, int nFlag2, int nIndex)
{
// cancello variabili estranee
ResetArcData() ;
// assegno Id e indice entità di movimento
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVEID, nEntId) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVEIND, nEntInd) ;
// assegno il tipo di movimento
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVE, nMove) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVE, nMove) ;
// assegno il valore degli assi
bool bIsRobot = m_pMchMgr->GetCurrIsRobot() ;
int nNumAxes = int( AxesEnd.size()) ;
for ( int i = 1 ; i <= MAX_AXES ; ++ i) {
if ( i <= nNumAxes)
bOk = bOk && m_pMachine->LuaSetGlobVar( GetGlobVarAxisValue(i), AxesEnd[i-1]) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GetGlobVarAxisValue( i, GLOB_VAR, bIsRobot), AxesEnd[i-1]) ;
else
bOk = bOk && m_pMachine->LuaResetGlobVar( GetGlobVarAxisValue(i)) ;
bOk = bOk && m_pMachine->LuaResetGlobVar( GetGlobVarAxisValue( i, GLOB_VAR, bIsRobot)) ;
}
// assegno la mascheratura degli assi
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MASK, nAxesMask) ;
@@ -991,21 +1013,25 @@ Processor::OnRapid( int nMove, const DBLVECTOR& AxesEnd, int nAxesMask,
//----------------------------------------------------------------------------
bool
Processor::OnLinear( int nMove, const DBLVECTOR& AxesEnd,
Processor::OnLinear( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd,
const Vector3d& vtTool, const Vector3d& vtCorr, const Vector3d& vtAux,
double dFeed, int nFlag, int nFlag2, int nIndex)
{
// cancello variabili estranee
ResetArcData() ;
// assegno Id e indice entità di movimento
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVEID, nEntId) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVEIND, nEntInd) ;
// assegno il tipo di movimento
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVE, nMove) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVE, nMove) ;
// assegno il valore degli assi
bool bIsRobot = m_pMchMgr->GetCurrIsRobot() ;
int nNumAxes = int( AxesEnd.size()) ;
for ( int i = 1 ; i <= MAX_AXES ; ++ i) {
if ( i <= nNumAxes)
bOk = bOk && m_pMachine->LuaSetGlobVar( GetGlobVarAxisValue(i), AxesEnd[i-1]) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GetGlobVarAxisValue( i, GLOB_VAR, bIsRobot), AxesEnd[i-1]) ;
else
bOk = bOk && m_pMachine->LuaResetGlobVar( GetGlobVarAxisValue(i)) ;
bOk = bOk && m_pMachine->LuaResetGlobVar( GetGlobVarAxisValue( i, GLOB_VAR, bIsRobot)) ;
}
// assegno il valore del versore utensile
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TDIR, vtTool) ;
@@ -1028,19 +1054,24 @@ Processor::OnLinear( int nMove, const DBLVECTOR& AxesEnd,
//----------------------------------------------------------------------------
bool
Processor::OnArc( int nMove, const DBLVECTOR& AxesEnd, const Point3d& ptCen, const Point3d& ptMid, double dRad, double dAngCen,
Processor::OnArc( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd,
const Point3d& ptCen, const Point3d& ptMid, double dRad, double dAngCen,
const Vector3d& vtTool, const Vector3d& vtCorr, const Vector3d& vtAux,
double dFeed, int nFlag, int nFlag2, int nIndex)
{
// assegno Id e indice entità di movimento
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVEID, nEntId) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVEIND, nEntInd) ;
// assegno il tipo di movimento
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVE, nMove) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVE, nMove) ;
// assegno il valore degli assi
bool bIsRobot = m_pMchMgr->GetCurrIsRobot() ;
int nNumAxes = int( AxesEnd.size()) ;
for ( int i = 1 ; i <= MAX_AXES ; ++ i) {
if ( i <= nNumAxes)
bOk = bOk && m_pMachine->LuaSetGlobVar( GetGlobVarAxisValue(i), AxesEnd[i-1]) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GetGlobVarAxisValue( i, GLOB_VAR, bIsRobot), AxesEnd[i-1]) ;
else
bOk = bOk && m_pMachine->LuaResetGlobVar( GetGlobVarAxisValue(i)) ;
bOk = bOk && m_pMachine->LuaResetGlobVar( GetGlobVarAxisValue( i, GLOB_VAR, bIsRobot)) ;
}
// assegno le coordinate del centro
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_C1, ptCen.x) ;
+5 -3
View File
@@ -59,12 +59,14 @@ class Processor
bool OnPathEnd( int nAE) ;
bool OnPathStartAux( int nInd, const std::string& sAS) ;
bool OnPathEndAux( int nInd, const std::string& sAE) ;
bool OnRapid( int nMove, const DBLVECTOR& AxesEnd, int nAxesMask,
bool OnRapid( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd, int nAxesMask,
const Vector3d& vtTool, const Vector3d& vtCorr, const Vector3d& vtAux,
int nFlag, int nFlag2, int nIndex) ;
bool OnLinear( int nMove, const DBLVECTOR& AxesEnd, const Vector3d& vtTool, const Vector3d& vtCorr, const Vector3d& vtAux,
bool OnLinear( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd,
const Vector3d& vtTool, const Vector3d& vtCorr, const Vector3d& vtAux,
double dFeed, int nFlag, int nFlag2, int nIndex) ;
bool OnArc( int nMove, const DBLVECTOR& AxesEnd, const Point3d& ptCen, const Point3d& ptMid, double dRad, double dAngCen,
bool OnArc( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd,
const Point3d& ptCen, const Point3d& ptMid, double dRad, double dAngCen,
const Vector3d& vtTool, const Vector3d& vtCorr, const Vector3d& vtAux,
double dFeed, int nFlag, int nFlag2, int nIndex) ;
bool ResetArcData( void) ;
+45 -21
View File
@@ -23,8 +23,8 @@
#include "/EgtDev/Include/EGkCurveLine.h"
#include "/EgtDev/Include/EGkCurveArc.h"
#include "/EgtDev/Include/EGkCurveComposite.h"
#include "/EgtDev/Include/EgkOffsetCurve.h"
#include "/EgtDev/Include/EgkOffsetCurveOnX.h"
#include "/EgtDev/Include/EGkOffsetCurve.h"
#include "/EgtDev/Include/EGkOffsetCurveOnX.h"
#include "/EgtDev/Include/EGkSfrCreate.h"
#include "/EgtDev/Include/EGkIntervals.h"
#include "/EgtDev/Include/EGkUserObjFactory.h"
@@ -499,8 +499,14 @@ SawFinishing::Apply( bool bRecalc, bool bPostApply)
// verifico se necessario continuare nell'aggiornamento
if ( ! bRecalc && ! bToolChanged &&
( m_nStatus == MCH_ST_OK || ( ! bPostApply && m_nStatus == MCH_ST_NO_POSTAPPL))) {
// confermo i percorsi di lavorazione
m_nCuts = nCurrCuts ;
LOG_DBG_INFO( GetEMkLogger(), "SawFinishing apply skipped : status already ok") ;
// eseguo aggiornamento assi macchina e collegamento con operazione precedente
if ( ! Update( bPostApply))
return false ;
LOG_DBG_INFO( GetEMkLogger(), "Update done") ;
// esco con successo
return true ;
}
m_nStatus = MCH_ST_TO_VERIFY ;
@@ -582,6 +588,8 @@ SawFinishing::Apply( bool bRecalc, bool bPostApply)
// dichiaro successiva da aggiornare
UpdateFollowingOperationsStatus( MCH_ST_OTH_MODIF) ;
LOG_DBG_INFO( GetEMkLogger(), "SawFinishing apply done") ;
return true ;
}
@@ -599,15 +607,11 @@ SawFinishing::Update( bool bPostApply)
return true ;
}
// elimino le entità CLIMB, RISE e HOME della lavorazione, potrebbero falsare i calcoli degli assi (in ogni casi vengono riaggiunte dopo)
RemoveClimbRiseHome() ;
// imposto eventuale asse bloccato da lavorazione
if ( ! m_Params.m_sBlockedAxis.empty()) {
string sAxis, sVal ;
Split( m_Params.m_sBlockedAxis, "=", true, sAxis, sVal) ;
double dVal = 0 ;
FromString( sVal, dVal) ;
m_pMchMgr->ClearRotAxisBlock() ;
m_pMchMgr->SetRotAxisBlock( sAxis, dVal) ;
}
SetBlockedRotAxis( m_Params.m_sBlockedAxis) ;
// calcolo gli assi macchina
string sHint = ExtractHint( m_Params.m_sUserNotes) ;
@@ -794,11 +798,31 @@ SawFinishing::UpdateToolData( bool* pbChanged)
const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ;
if ( pTdata == nullptr)
return false ;
// verifico se sono diversi (ad esclusione del nome)
m_TParams.m_sName = pTdata->m_sName ;
bool bChanged = ! SameTool( m_TParams, *pTdata) ;
// salvo posizione TC, testa e uscita originali
string sOrigTcPos = m_TParams.m_sTcPos ;
string sOrigHead = m_TParams.m_sHead ;
int nOrigExit = m_TParams.m_nExit ;
// verifico se sono diversi (ad esclusione di nome, posizione TC, testa e uscita)
bool bChanged = ( ! SameTool( m_TParams, *pTdata, false)) ;
// aggiorno comunque i parametri
m_TParams = *pTdata ;
// se definito attrezzaggio, aggiorno i parametri che ne possono derivare
string sTcPos ; string sHead ; int nExit ;
if ( m_pMchMgr->GetCurrSetupMgr().GetToolData( m_TParams.m_sName, sTcPos, sHead, nExit)) {
if ( sOrigTcPos != sTcPos ||
sOrigHead != sHead ||
nOrigExit != nExit)
bChanged = true ;
m_TParams.m_sTcPos = sTcPos ;
m_TParams.m_sHead = sHead ;
m_TParams.m_nExit = nExit ;
}
else {
if ( sOrigTcPos != pTdata->m_sTcPos ||
sOrigHead != pTdata->m_sHead ||
nOrigExit != pTdata->m_nExit)
bChanged = true ;
}
// eventuali segnalazioni
if ( ! EqualNoCase( m_Params.m_sToolName, m_TParams.m_sName)) {
string sInfo = "Warning in SawFinishing : tool name changed (" +
@@ -958,15 +982,15 @@ SawFinishing::AdjustGeometry( int nAuxId)
if ( ! pGuide->IsFlat( plPlane, false, 10 * EPS_SMALL) || ! AreSameOrOppositeVectorApprox( plPlane.GetVersN(), Z_AX))
return false ;
// verifiche sulla curva (che trasformo in composita)
PtrOwner<ICurveComposite> pCompo( CreateCurveComposite()) ;
if ( IsNull( pCompo) || ! pCompo->AddCurve( Release( pGuide)))
PtrOwner<ICurveComposite> pCompo ;
if ( ! pCompo.Set( ConvertCurveToComposite( Release( pGuide))))
return false ;
// converto in archi e rette
pCompo->ArcsBezierCurvesToArcsPerpExtr( LIN_TOL_MID, ANG_TOL_STD_DEG) ;
// verifiche sull'ampiezza dell'angolo al centro degli eventuali archi
VerifyArcs( pCompo) ;
// reinserisco nella curva originale
pGuide.Set( Release( pCompo)) ;
pGuide.Set( pCompo) ;
}
// deve iniziare in comune con la prima sezione ed essere ivi perpendicolare
Vector3d vtGdDir ;
@@ -1774,7 +1798,7 @@ SawFinishing::TrimSection( ICurve* pCrv)
// calcolo la classificazione della curva rispetto alla regione
CRVCVECTOR ccClass ;
if ( ! pSfr->GetCurveClassification( *pCrv, ccClass))
if ( ! pSfr->GetCurveClassification( *pCrv, EPS_SMALL, ccClass))
return false ;
// determino l'intervallo di curva da conservare
@@ -2379,8 +2403,8 @@ SawFinishing::CalcCurvedAlongVerticalCuts( ICurve* pSect, int nUmin, int nUmax,
Vector3d vtMove = ( dY - m_TParams.m_dThick / 2) * Z_AX ;
OffsetCurve OffsCrv ;
OffsCrv.Make( pGuide, dOffs, ICurve::OFF_FILLET) ;
PtrOwner<ICurveComposite> pCut( CreateCurveComposite()) ;
if ( IsNull( pCut) || ! pCut->AddCurve( OffsCrv.GetLongerCurve()))
PtrOwner<ICurveComposite> pCut ;
if ( ! pCut.Set( ConvertCurveToComposite( OffsCrv.GetLongerCurve())))
return false ;
VerifyArcs( pCut) ;
pCut->SimpleOffset( SAWRF_OFFS, ICurve::OFF_FORCE_OPEN) ;
@@ -2454,8 +2478,8 @@ SawFinishing::CalcCurvedAlongStdCuts( ICurve* pSect, double dUmin, double dUmax,
Vector3d vtMove = ( ptP.y - m_TParams.m_dThick / 2) * Z_AX ;
OffsetCurve OffsCrv ;
OffsCrv.Make( pGuide, dOffs, ICurve::OFF_FILLET) ;
PtrOwner<ICurveComposite> pCut( CreateCurveComposite()) ;
if ( IsNull( pCut) || ! pCut->AddCurve( OffsCrv.GetLongerCurve()))
PtrOwner<ICurveComposite> pCut ;
if ( ! pCut.Set( ConvertCurveToComposite( OffsCrv.GetLongerCurve())))
return false ;
VerifyArcs( pCut) ;
pCut->SimpleOffset( SAWRF_OFFS, ICurve::OFF_FORCE_OPEN) ;
+6 -2
View File
@@ -81,6 +81,10 @@ struct SawFinishingData : public MachiningData
//----------------------------------------------------------------------------
inline const SawFinishingData* GetSawFinishingData( const MachiningData* pMdata)
{ return (dynamic_cast<const SawFinishingData*>( pMdata)) ; }
{ if ( pMdata == nullptr || pMdata->GetType() != MT_SAWFINISHING)
return nullptr ;
return ( static_cast<const SawFinishingData*>( pMdata)) ; }
inline SawFinishingData* GetSawFinishingData( MachiningData* pMdata)
{ return (dynamic_cast<SawFinishingData*>( pMdata)) ; }
{ if ( pMdata == nullptr || pMdata->GetType() != MT_SAWFINISHING)
return nullptr ;
return ( static_cast<SawFinishingData*>( pMdata)) ; }
+43 -19
View File
@@ -23,8 +23,8 @@
#include "/EgtDev/Include/EGkCurveLine.h"
#include "/EgtDev/Include/EGkCurveArc.h"
#include "/EgtDev/Include/EGkCurveComposite.h"
#include "/EgtDev/Include/EgkOffsetCurve.h"
#include "/EgtDev/Include/EgkOffsetCurveOnX.h"
#include "/EgtDev/Include/EGkOffsetCurve.h"
#include "/EgtDev/Include/EGkOffsetCurveOnX.h"
#include "/EgtDev/Include/EGkSfrCreate.h"
#include "/EgtDev/Include/EGkIntervals.h"
#include "/EgtDev/Include/EGkUserObjFactory.h"
@@ -482,8 +482,14 @@ SawRoughing::Apply( bool bRecalc, bool bPostApply)
// verifico se necessario continuare nell'aggiornamento
if ( ! bRecalc && ! bToolChanged &&
( m_nStatus == MCH_ST_OK || ( ! bPostApply && m_nStatus == MCH_ST_NO_POSTAPPL))) {
// confermo i percorsi di lavorazione
m_nCuts = nCurrCuts ;
LOG_DBG_INFO( GetEMkLogger(), "SawRoughing apply skipped : status already ok") ;
// eseguo aggiornamento assi macchina e collegamento con operazione precedente
if ( ! Update( bPostApply))
return false ;
LOG_DBG_INFO( GetEMkLogger(), "Update done") ;
// esco con successo
return true ;
}
m_nStatus = MCH_ST_TO_VERIFY ;
@@ -546,6 +552,8 @@ SawRoughing::Apply( bool bRecalc, bool bPostApply)
// dichiaro successiva da aggiornare
UpdateFollowingOperationsStatus( MCH_ST_OTH_MODIF) ;
LOG_DBG_INFO( GetEMkLogger(), "SawRoughing apply done") ;
return true ;
}
@@ -563,15 +571,11 @@ SawRoughing::Update( bool bPostApply)
return true ;
}
// elimino le entità CLIMB, RISE e HOME della lavorazione, potrebbero falsare i calcoli degli assi (in ogni casi vengono riaggiunte dopo)
RemoveClimbRiseHome() ;
// imposto eventuale asse bloccato da lavorazione
if ( ! m_Params.m_sBlockedAxis.empty()) {
string sAxis, sVal ;
Split( m_Params.m_sBlockedAxis, "=", true, sAxis, sVal) ;
double dVal = 0 ;
FromString( sVal, dVal) ;
m_pMchMgr->ClearRotAxisBlock() ;
m_pMchMgr->SetRotAxisBlock( sAxis, dVal) ;
}
SetBlockedRotAxis( m_Params.m_sBlockedAxis) ;
// calcolo gli assi macchina
string sHint = ExtractHint( m_Params.m_sUserNotes) ;
@@ -752,11 +756,31 @@ SawRoughing::UpdateToolData( bool* pbChanged)
const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ;
if ( pTdata == nullptr)
return false ;
// verifico se sono diversi (ad esclusione del nome)
m_TParams.m_sName = pTdata->m_sName ;
bool bChanged = ! SameTool( m_TParams, *pTdata) ;
// salvo posizione TC, testa e uscita originali
string sOrigTcPos = m_TParams.m_sTcPos ;
string sOrigHead = m_TParams.m_sHead ;
int nOrigExit = m_TParams.m_nExit ;
// verifico se sono diversi (ad esclusione di nome, posizione TC, testa e uscita)
bool bChanged = ( ! SameTool( m_TParams, *pTdata, false)) ;
// aggiorno comunque i parametri
m_TParams = *pTdata ;
// se definito attrezzaggio, aggiorno i parametri che ne possono derivare
string sTcPos ; string sHead ; int nExit ;
if ( m_pMchMgr->GetCurrSetupMgr().GetToolData( m_TParams.m_sName, sTcPos, sHead, nExit)) {
if ( sOrigTcPos != sTcPos ||
sOrigHead != sHead ||
nOrigExit != nExit)
bChanged = true ;
m_TParams.m_sTcPos = sTcPos ;
m_TParams.m_sHead = sHead ;
m_TParams.m_nExit = nExit ;
}
else {
if ( sOrigTcPos != pTdata->m_sTcPos ||
sOrigHead != pTdata->m_sHead ||
nOrigExit != pTdata->m_nExit)
bChanged = true ;
}
// eventuali segnalazioni
if ( ! EqualNoCase( m_Params.m_sToolName, m_TParams.m_sName)) {
string sInfo = "Warning in SawRoughing : tool name changed (" +
@@ -916,15 +940,15 @@ SawRoughing::AdjustGeometry( int nAuxId)
if ( ! pGuide->IsFlat( plPlane, false, 10 * EPS_SMALL) || ! AreSameOrOppositeVectorApprox( plPlane.GetVersN(), Z_AX))
return false ;
// verifiche sulla curva (che trasformo in composita)
PtrOwner<ICurveComposite> pCompo( CreateCurveComposite()) ;
if ( IsNull( pCompo) || ! pCompo->AddCurve( Release( pGuide)))
PtrOwner<ICurveComposite> pCompo ;
if ( ! pCompo.Set( ConvertCurveToComposite( Release( pGuide))))
return false ;
// converto in archi e rette
pCompo->ArcsBezierCurvesToArcsPerpExtr( LIN_TOL_MID, ANG_TOL_STD_DEG) ;
// verifiche sull'ampiezza dell'angolo al centro degli eventuali archi
VerifyArcs( pCompo) ;
// reinserisco nella curva originale
pGuide.Set( Release( pCompo)) ;
pGuide.Set( pCompo) ;
}
// deve iniziare in comune con la prima sezione ed essere ivi perpendicolare
Vector3d vtGdDir ;
@@ -1306,8 +1330,8 @@ SawRoughing::CalculateCurvedToolPath( int nAuxId, int nClId)
// creo la curva di taglio
OffsetCurve OffsCrv ;
OffsCrv.Make( pGuide, dX, ICurve::OFF_FILLET) ;
PtrOwner<ICurveComposite> pCut( CreateCurveComposite()) ;
if ( IsNull( pCut) || ! pCut->AddCurve( OffsCrv.GetLongerCurve()))
PtrOwner<ICurveComposite> pCut ;
if ( ! pCut.Set( ConvertCurveToComposite( OffsCrv.GetLongerCurve())))
return false ;
VerifyArcs( pCut) ;
Vector3d vtMove = ( dY - m_TParams.m_dThick / 2) * Z_AX ;
@@ -1459,7 +1483,7 @@ SawRoughing::TrimSection( ICurve* pCrv)
// calcolo la classificazione della curva rispetto alla regione
CRVCVECTOR ccClass ;
if ( ! pSfr->GetCurveClassification( *pCrv, ccClass))
if ( ! pSfr->GetCurveClassification( *pCrv, EPS_SMALL, ccClass))
return false ;
// determino l'intervallo di curva da conservare
+6 -2
View File
@@ -78,6 +78,10 @@ struct SawRoughingData : public MachiningData
//----------------------------------------------------------------------------
inline const SawRoughingData* GetSawRoughingData( const MachiningData* pMdata)
{ return (dynamic_cast<const SawRoughingData*>( pMdata)) ; }
{ if ( pMdata == nullptr || pMdata->GetType() != MT_SAWROUGHING)
return nullptr ;
return ( static_cast<const SawRoughingData*>( pMdata)) ; }
inline SawRoughingData* GetSawRoughingData( MachiningData* pMdata)
{ return (dynamic_cast<SawRoughingData*>( pMdata)) ; }
{ if ( pMdata == nullptr || pMdata->GetType() != MT_SAWROUGHING)
return nullptr ;
return ( static_cast<SawRoughingData*>( pMdata)) ; }
+174 -81
View File
@@ -4,7 +4,7 @@
// File : Sawing.cpp Data : 24.10.15 Versione : 1.6j3
// Contenuto : Implementazione gestione tagli con lama.
//
// Note : Questa lavorazione è sempre espressa nel riferimento globale.
// Note : Questa lavorazione è sempre espressa nel riferimento globale.
//
// Modifiche : 07.06.15 DS Creazione modulo.
//
@@ -532,15 +532,15 @@ Sawing::SetParam( int nType, const string& sVal)
bool
Sawing::SetGeometry( const SELVECTOR& vIds)
{
// verifico validità gestore DB geometrico
// verifico validità gestore DB geometrico
if ( m_pGeomDB == nullptr)
return false ;
// reset della geometria corrente
m_vId.clear() ;
// verifico che gli identificativi rappresentino delle entità ammissibili
// verifico che gli identificativi rappresentino delle entità ammissibili
int nType = GEO_NONE ;
for ( const auto& Id : vIds) {
// test sull'entità
// test sull'entità
int nSubs ;
if ( ! VerifyGeometry( Id, nSubs, nType)) {
string sInfo = "Warning in Sawing : Skipped entity " + ToString( Id) ;
@@ -563,14 +563,14 @@ Sawing::Preview( bool bRecalc)
// reset numero tagli nella lavorazione
m_nCuts = 0 ;
// verifico validità gestore DB geometrico e Id del gruppo
// verifico validità gestore DB geometrico e Id del gruppo
if ( m_pGeomDB == nullptr || ! m_pGeomDB->ExistsObj( m_nOwnerId))
return false ;
// recupero gruppo per geometria ausiliaria
int nAuxId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_AUX) ;
bool bChain = false ;
// se non c'è, lo aggiungo
// se non c'è, lo aggiungo
if ( nAuxId == GDB_ID_NULL) {
nAuxId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
if ( nAuxId == GDB_ID_NULL)
@@ -603,7 +603,7 @@ Sawing::Preview( bool bRecalc)
// recupero gruppo per anteprima di lavorazione (PreView)
int nPvId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_PV) ;
// se non c'è, lo aggiungo
// se non c'è, lo aggiungo
if ( nPvId == GDB_ID_NULL) {
nPvId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
if ( nPvId == GDB_ID_NULL)
@@ -633,7 +633,7 @@ Sawing::Apply( bool bRecalc, bool bPostApply)
int nCurrCuts = m_nCuts ;
m_nCuts = 0 ;
// verifico validità gestore DB geometrico e Id del gruppo
// verifico validità gestore DB geometrico e Id del gruppo
if ( m_pGeomDB == nullptr || ! m_pGeomDB->ExistsObj( m_nOwnerId))
return false ;
@@ -647,8 +647,14 @@ Sawing::Apply( bool bRecalc, bool bPostApply)
// verifico se necessario continuare nell'aggiornamento
if ( ! bRecalc && ! bToolChanged &&
( m_nStatus == MCH_ST_OK || ( ! bPostApply && m_nStatus == MCH_ST_NO_POSTAPPL))) {
// confermo i percorsi di lavorazione
m_nCuts = nCurrCuts ;
LOG_DBG_INFO( GetEMkLogger(), "Sawing apply skipped : status already ok") ;
// eseguo aggiornamento assi macchina e collegamento con operazione precedente
if ( ! Update( bPostApply))
return false ;
LOG_DBG_INFO( GetEMkLogger(), "Update done") ;
// esco con successo
return true ;
}
m_nStatus = MCH_ST_TO_VERIFY ;
@@ -656,7 +662,7 @@ Sawing::Apply( bool bRecalc, bool bPostApply)
// recupero gruppo per geometria ausiliaria
int nAuxId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_AUX) ;
bool bChain = false ;
// se non c'è, lo aggiungo
// se non c'è, lo aggiungo
if ( nAuxId == GDB_ID_NULL) {
nAuxId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
if ( nAuxId == GDB_ID_NULL)
@@ -683,7 +689,7 @@ Sawing::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)
@@ -717,6 +723,8 @@ Sawing::Apply( bool bRecalc, bool bPostApply)
// dichiaro successiva da aggiornare
UpdateFollowingOperationsStatus( MCH_ST_OTH_MODIF) ;
LOG_DBG_INFO( GetEMkLogger(), "Sawing apply done") ;
return true ;
}
@@ -724,7 +732,7 @@ Sawing::Apply( bool bRecalc, bool bPostApply)
bool
Sawing::Update( bool bPostApply)
{
// verifico validità gestore DB geometrico e Id del gruppo
// verifico validità gestore DB geometrico e Id del gruppo
if ( m_pGeomDB == nullptr || ! m_pGeomDB->ExistsObj( m_nOwnerId))
return false ;
@@ -734,15 +742,11 @@ Sawing::Update( bool bPostApply)
return true ;
}
// elimino le entità CLIMB, RISE e HOME della lavorazione, potrebbero falsare i calcoli degli assi (in ogni casi vengono riaggiunte dopo)
RemoveClimbRiseHome() ;
// imposto eventuale asse bloccato da lavorazione
if ( ! m_Params.m_sBlockedAxis.empty()) {
string sAxis, sVal ;
Split( m_Params.m_sBlockedAxis, "=", true, sAxis, sVal) ;
double dVal = 0 ;
FromString( sVal, dVal) ;
m_pMchMgr->ClearRotAxisBlock() ;
m_pMchMgr->SetRotAxisBlock( sAxis, dVal) ;
}
SetBlockedRotAxis( m_Params.m_sBlockedAxis) ;
// calcolo gli assi macchina
string sHint = ExtractHint( m_Params.m_sUserNotes) ;
@@ -790,7 +794,7 @@ Sawing::Update( bool bPostApply)
bool
Sawing::AdjustFeeds( void)
{
// controlli su GeomDB e simili non ripetuti perchè già fatti
// controlli su GeomDB e simili non ripetuti perchè già fatti
// recupero gruppo della geometria di lavorazione (Cutter Location)
int nClId = m_pGeomDB->GetFirstNameInGroup( GetOwner(), MCH_CL) ;
@@ -800,11 +804,11 @@ Sawing::AdjustFeeds( void)
// ciclo sui gruppi CL
int nClPathId = m_pGeomDB->GetFirstGroupInGroup( nClId) ;
while ( nClPathId != GDB_ID_NULL) {
// ciclo su tutte le entità del percorso CL
// ciclo su tutte le entità del percorso CL
for ( int nEntId = m_pGeomDB->GetFirstInGroup( nClPathId) ;
nEntId != GDB_ID_NULL ;
nEntId = m_pGeomDB->GetNext( nEntId)) {
// recupero i dati Cam dell'entità
// recupero i dati Cam dell'entità
CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nEntId)) ;
if ( pCamData == nullptr)
continue ;
@@ -1024,11 +1028,31 @@ Sawing::UpdateToolData( bool* pbChanged)
const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ;
if ( pTdata == nullptr)
return false ;
// verifico se sono diversi (ad esclusione del nome)
m_TParams.m_sName = pTdata->m_sName ;
bool bChanged = ! SameTool( m_TParams, *pTdata) ;
// salvo posizione TC, testa e uscita originali
string sOrigTcPos = m_TParams.m_sTcPos ;
string sOrigHead = m_TParams.m_sHead ;
int nOrigExit = m_TParams.m_nExit ;
// verifico se sono diversi (ad esclusione di nome, posizione TC, testa e uscita)
bool bChanged = ( ! SameTool( m_TParams, *pTdata, false)) ;
// aggiorno comunque i parametri
m_TParams = *pTdata ;
// se definito attrezzaggio, aggiorno i parametri che ne possono derivare
string sTcPos ; string sHead ; int nExit ;
if ( m_pMchMgr->GetCurrSetupMgr().GetToolData( m_TParams.m_sName, sTcPos, sHead, nExit)) {
if ( sOrigTcPos != sTcPos ||
sOrigHead != sHead ||
nOrigExit != nExit)
bChanged = true ;
m_TParams.m_sTcPos = sTcPos ;
m_TParams.m_sHead = sHead ;
m_TParams.m_nExit = nExit ;
}
else {
if ( sOrigTcPos != pTdata->m_sTcPos ||
sOrigHead != pTdata->m_sHead ||
nOrigExit != pTdata->m_nExit)
bChanged = true ;
}
// eventuali segnalazioni
if ( ! EqualNoCase( m_Params.m_sToolName, m_TParams.m_sName)) {
string sInfo = "Warning in Sawing : tool name changed (" +
@@ -1051,7 +1075,7 @@ Sawing::UpdateToolData( bool* pbChanged)
bool
Sawing::GetGeometry( SELVECTOR& vIds) const
{
// restituisco l'elenco delle entità
// restituisco l'elenco delle entità
vIds = m_vId ;
return true ;
}
@@ -1074,7 +1098,7 @@ Sawing::VerifyGeometry( SelData Id, int& nSubs, int& nType)
const IGeoObj* pGObj = m_pGeomDB->GetGeoObj( Id.nId) ;
if ( pGObj == nullptr)
return false ;
// se ammesse curve ed è tale
// se ammesse curve ed è tale
if ( ( nType == GEO_NONE || nType == GEO_CURVE) && ( pGObj->GetType() & GEO_CURVE) != 0) {
nType = GEO_CURVE ;
const ICurve* pCurve = nullptr ;
@@ -1098,7 +1122,7 @@ Sawing::VerifyGeometry( SelData Id, int& nSubs, int& nType)
}
return ( pCurve != nullptr) ;
}
// se altrimenti ammesse superfici trimesh ed è tale
// se altrimenti ammesse superfici trimesh ed è tale
else if ( ( nType == GEO_NONE || nType == GEO_SURF) && pGObj->GetType() == SRF_TRIMESH) {
nType = GEO_SURF ;
const ISurfTriMesh* pSurf = ::GetSurfTriMesh( pGObj) ;
@@ -1118,7 +1142,7 @@ Sawing::VerifyGeometry( SelData Id, int& nSubs, int& nType)
}
return true ;
}
// se altrimenti ammesse regioni ed è tale
// se altrimenti ammesse regioni ed è tale
else if ( ( nType == GEO_NONE || nType == GEO_SURF) && pGObj->GetType() == SRF_FLATRGN) {
nType = GEO_SURF ;
const ISurfFlatRegion* pReg = ::GetSurfFlatRegion( pGObj) ;
@@ -1221,7 +1245,7 @@ Sawing::GetCurve( SelData Id)
pCrvCompo->ToGlob( frGlob) ;
vtN.ToGlob( frGlob) ;
// sistemazioni varie
AdjustCurveFromSurf( pCrvCompo, TOOL_ORTUP, FACE_DOWN, 0) ;
AdjustCurveFromSurf( pCrvCompo, TOOL_ORTUP, FACE_DOWN, 0, 1) ;
// aggiusto lato lavoro e inverti, angolo di fianco e lato mandrino
if ( m_Params.m_nWorkSide == SAW_WS_CENTER)
m_Params.m_nWorkSide = SAW_WS_RIGHT ;
@@ -1255,8 +1279,8 @@ Sawing::GetCurve( SelData Id)
// recupero l'indice del chunk
int nChunk = ( ( Id.nSub == SEL_SUB_ALL) ? 0 : Id.nSub) ;
// recupero il contorno esterno del chunk
PtrOwner<ICurveComposite> pCrvCompo( CreateCurveComposite()) ;
if ( IsNull( pCrvCompo) || ! pCrvCompo->AddCurve( pReg->GetLoop( nChunk, 0)))
PtrOwner<ICurveComposite> pCrvCompo ;
if ( ! pCrvCompo.Set( ConvertCurveToComposite( pReg->GetLoop( nChunk, 0))))
return nullptr ;
// recupero la normale della regione
Vector3d vtN = pReg->GetNormVersor() ;
@@ -1270,7 +1294,7 @@ Sawing::GetCurve( SelData Id)
pCrvCompo->ToGlob( frGlob) ;
vtN.ToGlob( frGlob) ;
// sistemazioni varie
AdjustCurveFromSurf( pCrvCompo, TOOL_ORTUP, FACE_DOWN, 0) ;
AdjustCurveFromSurf( pCrvCompo, TOOL_ORTUP, FACE_DOWN, 0, 1) ;
// aggiusto lato lavoro e inverti, angolo di fianco e lato mandrino
if ( m_Params.m_nWorkSide == SAW_WS_CENTER)
m_Params.m_nWorkSide = SAW_WS_RIGHT ;
@@ -1311,7 +1335,7 @@ Sawing::Chain( int nGrpDestId)
for ( const auto& Id : m_vId) {
// prendo curva
vpCrvs.emplace_back( GetCurve( Id)) ;
// ne verifico la validità
// ne verifico la validità
if ( IsNull( vpCrvs.back())) {
string sInfo = "Warning in Sawing : Skipped entity " + ToString( Id) ;
m_pMchMgr->SetWarning( 2251, sInfo) ;
@@ -1453,7 +1477,7 @@ Sawing::ProcessPath( int nPathId, int nPvId, int nClId)
// recupero gruppo per geometria temporanea
const string GRP_TEMP = "Temp" ;
int nTempId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, GRP_TEMP) ;
// se non c'è, lo aggiungo
// se non c'è, lo aggiungo
if ( nTempId == GDB_ID_NULL) {
nTempId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
if ( nTempId == GDB_ID_NULL)
@@ -1477,7 +1501,7 @@ Sawing::ProcessPath( int nPathId, int nPvId, int nClId)
ICurveComposite* pCompo = GetCurveComposite( m_pGeomDB->GetGeoObj( nCopyId)) ;
// unisco le parti allineate
if ( ! pCompo->MergeCurves( 10 * EPS_SMALL, 10 * EPS_ANG_SMALL))
if ( ! pCompo->MergeCurves( 100 * EPS_SMALL, 100 * EPS_ANG_SMALL))
return false ;
// eventuale inversione percorso
@@ -1518,7 +1542,7 @@ Sawing::ProcessPath( int nPathId, int nPvId, int nClId)
// elaboro la curva composita e la esplodo nelle curve componenti
if ( m_Params.m_nCurveUse == SAW_CRV_APPROX ||
m_Params.m_nCurveUse == SAW_CRV_CONVEX) {
// calcolo l'approssimazione lineare con eventuale convessità
// calcolo l'approssimazione lineare con eventuale convessità
PolyLine PL ;
int nType = ICurve::APL_STD ;
if ( m_Params.m_nWorkSide == SAW_WS_LEFT)
@@ -1607,7 +1631,7 @@ Sawing::ProcessPath( int nPathId, int nPvId, int nClId)
// flag di curva chiusa
bool bClosed = pCompo->IsClosed() ;
// calcolo gli eventuali punti di perdita di tangenza e di cambio di concavità
// calcolo gli eventuali punti di perdita di tangenza e di cambio di concavità
DBLVECTOR vU ;
const double ANG_PERD_TG = 1.0 ;
const ICurveArc* pArc = ( bClosed ? GetCurveArc( pCompo->GetLastCurve()) : nullptr) ;
@@ -1623,7 +1647,7 @@ Sawing::ProcessPath( int nPathId, int nPvId, int nClId)
nCurrConv = 0 ;
continue ;
}
// verifico cambio di concavità e/o lavorazione interna
// verifico cambio di concavità e/o lavorazione interna
const ICurve* pCrv = pCompo->GetCurve( i) ;
if ( pCrv->GetType() == CRV_ARC) {
if ( GetCurveArc( pCrv)->GetAngCenter() > 0) {
@@ -1705,7 +1729,7 @@ Sawing::ProcessEntity( const ICurve* pCrvP, const ICurve* pCrvC, const ICurve* p
// altrimenti
else {
if ( m_Params.m_nCurveUse == SAW_CRV_KEEP) {
// determino la convessità
// determino la convessità
int nConv = 0 ;
for ( int i = 0 ; i < pCompo->GetCurveCount() ; ++ i) {
const ICurveArc* pArc = GetCurveArc( pCompo->GetCurve( i)) ;
@@ -1767,10 +1791,11 @@ Sawing::ProcessLine( const ICurve* pCrvP, const ICurveLine* pLineC, const ICurve
// aggiungo affondamento
pLine->Translate( - vtCorr * dDepth) ;
// calcolo elevazione (sui due bordi della striscia, leggermente allargata)
const double DELTA_ELEV_THICK = 2.0 ;
double dElev, dElev2 ;
Vector3d vtToolH( vtTool.x, vtTool.y, 0) ;
Vector3d vtSafe = vtToolH * ( 10 * EPS_SMALL) ;
Vector3d vtThick = vtToolH * ( m_TParams.m_dThick / vtToolH.SqLen() + 10 * EPS_SMALL) ;
Vector3d vtSafe = vtToolH * DELTA_ELEV_THICK ;
Vector3d vtThick = vtToolH * ( m_TParams.m_dThick / vtToolH.SqLen() + DELTA_ELEV_THICK) ;
if ( ! GetElevation( m_nPhase, pLine->GetStart() - vtSafe, pLine->GetEnd() - vtSafe, vtCorr, dElev) ||
! GetElevation( m_nPhase, pLine->GetStart() + vtThick, pLine->GetEnd() + vtThick, vtCorr, dElev2) ) {
m_pMchMgr->SetLastError( 2210, "Error in Sawing : Entity GetElevation") ;
@@ -1805,7 +1830,7 @@ Sawing::ProcessLine( const ICurve* pCrvP, const ICurveLine* pLineC, const ICurve
( m_Params.m_nWorkSide == SAW_WS_RIGHT && dAngCN < - EPS_ANG_SMALL))
bExtAngCN = false ;
}
// verifico eventuale attacco speciale a step (se parametri validi e su entità linea singola)
// verifico eventuale attacco speciale a step (se parametri validi e su entità linea singola)
double dLiStep = 0 ;
double dLiElev = 0 ;
if ( m_Params.m_dLiTang > 10 * EPS_SMALL && m_Params.m_dLiElev > 10 * EPS_SMALL &&
@@ -1826,13 +1851,13 @@ Sawing::ProcessLine( const ICurve* pCrvP, const ICurveLine* pLineC, const ICurve
return true ;
}
// Eventuale variazioni di velocità all'inizio e alla fine del percorso
// Eventuale variazioni di velocità all'inizio e alla fine del percorso
FseVar FvVar ;
if ( pCrvP == nullptr) {
string sFsta = ExtractInfo( m_Params.m_sUserNotes, "Fsta:") ;
string sFsta = ExtractInfo( m_Params.m_sUserNotes, "Fsta=") ;
if ( ! sFsta.empty()) {
string sLen, sPu ;
SplitFirst( sFsta, "=", sLen, sPu) ;
SplitFirst( sFsta, ",", sLen, sPu) ;
FromString( sLen, FvVar.dLenStart) ;
FvVar.dLenStart = max( FvVar.dLenStart, 0.) ;
FromString( sPu, FvVar.dPuStart) ;
@@ -1840,10 +1865,10 @@ Sawing::ProcessLine( const ICurve* pCrvP, const ICurveLine* pLineC, const ICurve
}
}
if ( pCrvN == nullptr) {
string sFend = ExtractInfo( m_Params.m_sUserNotes, "Fend:") ;
string sFend = ExtractInfo( m_Params.m_sUserNotes, "Fend=") ;
if ( ! sFend.empty()) {
string sLen, sPu ;
SplitFirst( sFend, "=", sLen, sPu) ;
SplitFirst( sFend, ",", sLen, sPu) ;
FromString( sLen, FvVar.dLenEnd) ;
FvVar.dLenEnd = max( FvVar.dLenEnd, 0.) ;
FromString( sPu, FvVar.dPuEnd) ;
@@ -1974,14 +1999,17 @@ Sawing::GenerateLinePv( const ICurveLine* pLine, const Vector3d& vtTool, const V
ptREnd + vtDir * ( dDtEnd + dExtraL) , RTY_LOC) ;
m_pGeomDB->SetName( nReId, MCH_PV_RLOCUT) ;
m_pGeomDB->SetMaterial( nReId, INVISIBLE) ;
// eventuali ripetizioni in basso per tagli inclinati
if ( abs( m_Params.m_dSideAngle) > EPS_ANG_SMALL) {
// lunghezza movimento
double dMove = ( dElev - dExtraCut) ;
// se sottosquadra (controllo il lato opposto della lama, quindi ...)
if ( m_Params.m_dSideAngle < 0)
dMove -= m_TParams.m_dThick * tan( abs( m_Params.m_dSideAngle) * DEGTORAD) ;
dMove = dElev - dExtraCut - m_TParams.m_dThick * tan( abs( m_Params.m_dSideAngle) * DEGTORAD) ;
// altrimenti tengo conto di dove si trova il sopra del lato esterno
else
dMove = dElev - max( dExtraCut, m_TParams.m_dThick * tan( abs( m_Params.m_dSideAngle) * DEGTORAD)) ;
// vettore movimento
Vector3d vtMove = - dMove * vtCorr ; vtMove.z = 0 ;
// rettangolo per parte di taglio completo
@@ -2012,6 +2040,38 @@ Sawing::GenerateLinePv( const ICurveLine* pLine, const Vector3d& vtTool, const V
int nDwnReId = m_pGeomDB->Copy( nReId, GDB_ID_NULL, nPxId) ;
m_pGeomDB->Translate( nDwnReId, vtMove) ;
m_pGeomDB->SetName( nDwnReId, MCH_PV_DOWN_RLOCUT) ;
// riduzione larghezza regioni per tagli da sopra
if ( m_Params.m_dSideAngle > 0) {
double dRefH = max( m_TParams.m_dThick * sin( m_Params.m_dSideAngle * DEGTORAD) - dExtraCut * cos( m_Params.m_dSideAngle * DEGTORAD), 0.) ;
if ( dRefH > EPS_SMALL) {
double dLargh = vtToolH.LenXY() ;
double dRedLargh = dLargh - dRefH * tan( m_Params.m_dSideAngle * DEGTORAD) - EPS_SMALL ;
double dCoeff = dRedLargh / dLargh ;
Frame3d frScale ;
frScale.Set( ptRCross + vtMove, Z_AX, vtDir) ;
m_pGeomDB->Scale( nDwnRId, frScale, 1, dCoeff, 1) ;
m_pGeomDB->Scale( nDwnRrId, frScale, 1, dCoeff, 1) ;
m_pGeomDB->Scale( nDwnRsId, frScale, 1, dCoeff, 1) ;
m_pGeomDB->Scale( nDwnReId, frScale, 1, dCoeff, 1) ;
}
}
}
// creo regioni di lavorazione che interessano le superfici superiore e inferiore del grezzo considerando anche gli
// allungamenti dei baffi
int nSurfUpId = ExeCreateSurfFrRectangle3P( nPxId, ptIni - vtDir * ( dStartWhiskExt + 5 * EPS_SMALL),
ptCross + vtDir * ( dEndWhiskExt + 5 * EPS_SMALL),
ptEnd + vtDir * ( dEndWhiskExt + 5 * EPS_SMALL), RTY_LOC) ;
m_pGeomDB->SetName( nSurfUpId, MCH_PV_UP_RAWCUT) ;
m_pGeomDB->SetMaterial( nSurfUpId, INVISIBLE) ;
// solo se la lavorazione interessa il fondo del grezzo creo la superficie down
if ( dRbHeight < EPS_SMALL) {
int nSurfDownId = m_pGeomDB->CopyGlob( nSurfUpId, GDB_ID_NULL, nPxId) ;
double dMove = dElev + dRbHeight / cos( m_Params.m_dSideAngle * DEGTORAD) ;
Vector3d vtMove = - dMove * vtCorr ; vtMove.z = 0 ;
ExeMove( {nSurfDownId}, vtMove, RTY_LOC) ;
m_pGeomDB->SetName( nSurfDownId, MCH_PV_DOWN_RAWCUT) ;
m_pGeomDB->SetMaterial( nSurfDownId, INVISIBLE) ;
}
// salvo in info gruppo : larghezza XY del taglio, distanza XY tra centro e bordo taglio, extra taglio e quota minima della lama
@@ -2236,7 +2296,7 @@ Sawing::GenerateLineCl( const ICurveLine* pLine, const Vector3d& vtTool, const V
Point3d ptP3 = pLine->GetEnd() + vtCorr * dDelta ;
if ( AddLinearMove( ptP3) == GDB_ID_NULL)
return false ;
// se non è ultimo passo
// se non è ultimo passo
if ( i != 0) {
// movimento di risalita sopra il punto finale
SetFeed( GetEndFeed()) ;
@@ -2432,7 +2492,7 @@ Sawing::GenerateExtCurvePv( const ICurveComposite* pCrv, double dOffs,
if ( abs( m_Params.m_dSideAngle) > EPS_ANG_SMALL)
colCut = FUCHSIA ;
// dimensione da aggiungere alle regioni nelle parti in cui la lama è inclinata
// dimensione da aggiungere alle regioni nelle parti in cui la lama è inclinata
double dExtraL = m_pMchMgr->GetCurrMachiningsMgr()->GetExtraLOnCutRegion() ;
// lunghezza taglio parziale
@@ -2580,6 +2640,17 @@ Sawing::GenerateExtCurvePv( const ICurveComposite* pCrv, double dOffs,
return false ;
if ( ! ExeSurfFrAdd( nRId, nRsId) || ! ExeSurfFrAdd( nRId, nReId))
return false ;
// creo regioni di lavorazione che interessano le superfici superiore e inferiore del grezzo
int nSurfUpId = m_pGeomDB->CopyGlob( nRrId, GDB_ID_NULL, nPxId) ;
m_pGeomDB->SetName( nSurfUpId, MCH_PV_UP_RAWCUT) ;
m_pGeomDB->SetMaterial( nSurfUpId, INVISIBLE) ;
// solo se lavorazione interessa il fondo del grezzo creo la superficie down
if ( dRbHeight < EPS_SMALL) {
int nSurfDownId = m_pGeomDB->CopyGlob( nSurfUpId, GDB_ID_NULL, nPxId) ;
m_pGeomDB->SetName( nSurfDownId, MCH_PV_DOWN_RAWCUT) ;
m_pGeomDB->SetMaterial( nSurfDownId, INVISIBLE) ;
}
}
// altrimenti errore
@@ -2825,7 +2896,7 @@ Sawing::GenerateExtCurveCl( const ICurveComposite* pCrv,
CalculateToolAndCorrVersors( vtCurrDir, m_Params.m_nHeadSide, m_Params.m_nWorkSide, m_Params.m_dSideAngle, vtCurrTool, vtCurrCorr) ;
SetToolDir( vtCurrTool) ;
SetCorrAuxDir( vtCurrCorr) ;
if ( AddCurveMove( pSmpCrv, true) == GDB_ID_NULL)
if ( AddCurveMove( pSmpCrv) == GDB_ID_NULL)
return false ;
}
// 4 -> retrazione
@@ -2903,7 +2974,7 @@ Sawing::GenerateExtCurveCl( const ICurveComposite* pCrv,
pCopy->SimpleOffset( dOffs) ;
}
// emissione
if ( AddCurveMove( pCopy, true) == GDB_ID_NULL)
if ( AddCurveMove( pCopy) == GDB_ID_NULL)
return false ;
}
}
@@ -2936,7 +3007,7 @@ Sawing::GenerateExtCurveCl( const ICurveComposite* pCrv,
// inversione
pCopy->Invert() ;
// emissione
if ( AddCurveMove( pCopy, true) == GDB_ID_NULL)
if ( AddCurveMove( pCopy) == GDB_ID_NULL)
return false ;
}
}
@@ -3003,10 +3074,10 @@ Sawing::GenerateExtCurveCl( const ICurveComposite* pCrv,
pCopy->SimpleOffset( dOffs) ;
}
// emissione
if ( AddCurveMove( pCopy, true) == GDB_ID_NULL)
if ( AddCurveMove( pCopy) == GDB_ID_NULL)
return false ;
}
// se non è ultimo passo
// se non è ultimo passo
if ( i != 0) {
// ricavo punto di risalita e punto iniziale
Point3d ptP4 ;
@@ -3150,7 +3221,7 @@ Sawing::ProcessIntArc( const ICurve* pCrvP, const ICurveArc* pArcC, const ICurve
m_pMchMgr->SetWarning( 2257, "Warning in Sawing : skipped Entity too small") ;
return true ;
}
// ricalcolo i versori fresa alle estremità (potrebbero essere cambiate)
// ricalcolo i versori fresa alle estremità (potrebbero essere cambiate)
pArc->GetStartDir( vtStaDirC) ;
pArc->GetMidDir( vtMidDirC) ;
pArc->GetEndDir( vtEndDirC) ;
@@ -3242,7 +3313,7 @@ Sawing::GenerateIntArcPv( const ICurveArc* pArc,
m_pGeomDB->SetName( nId3, MCH_PV_POST_CUT) ;
m_pGeomDB->SetMaterial( nId3, BLUE) ;
// dimensione da aggiungere alle regioni nelle parti in cui la lama è inclinata
// dimensione da aggiungere alle regioni nelle parti in cui la lama è inclinata
double dExtraL = m_pMchMgr->GetCurrMachiningsMgr()->GetExtraLOnCutRegion() ;
// regione ridotta di taglio per nesting (escluse parti iniziali e finali)
@@ -3296,6 +3367,17 @@ Sawing::GenerateIntArcPv( const ICurveArc* pArc,
if ( ! ExeSurfFrAdd( nRId, nRsId) || ! ExeSurfFrAdd( nRId, nReId))
return false ;
// creo regioni di lavorazione che interessano le superfici superiore e inferiore del grezzo
int nSurfUpId = m_pGeomDB->CopyGlob( nRrId, GDB_ID_NULL, nPxId) ;
m_pGeomDB->SetName( nSurfUpId, MCH_PV_UP_RAWCUT) ;
m_pGeomDB->SetMaterial( nSurfUpId, INVISIBLE) ;
// solo se lavorazione interessa il fondo del grezzo creo la superficie down
if ( dRbHeight < EPS_SMALL) {
int nSurfDownId = m_pGeomDB->CopyGlob( nSurfUpId, GDB_ID_NULL, nPxId) ;
m_pGeomDB->SetName( nSurfDownId, MCH_PV_DOWN_RAWCUT) ;
m_pGeomDB->SetMaterial( nSurfDownId, INVISIBLE) ;
}
// salvo in info gruppo : larghezza XY del taglio, distanza XY tra centro e bordo taglio, extra taglio e quota minima della lama
m_pGeomDB->SetInfo( nPxId, MCH_PV_KEY_WT, dDeltaInt + dDeltaExt) ;
m_pGeomDB->SetInfo( nPxId, MCH_PV_KEY_DT, dDeltaT * dLenCoeff) ;
@@ -3528,12 +3610,12 @@ Sawing::GenerateIntArcCl( const ICurveArc* pArc,
else {
Point3d ptMid ;
pArc->GetMidPoint( ptMid) ;
// prima metà arco
// prima metà arco
SetToolDir( vtMidTool) ;
SetCorrAuxDir( vtMidCorr) ;
if ( AddArcMove( ptMid, ptCen, dAngCen / 2, vtN) == GDB_ID_NULL)
return false ;
// seconda metà arco
// seconda metà arco
SetToolDir( vtEndTool) ;
SetCorrAuxDir( vtEndCorr) ;
if ( AddArcMove( ptP3, ptCen, dAngCen / 2, vtN) == GDB_ID_NULL)
@@ -3614,12 +3696,12 @@ Sawing::GenerateIntArcCl( const ICurveArc* pArc,
pArc->GetMidPoint( ptMid) ;
ptMid += Z_AX * dDelta ;
double dCurrAngCen = dAngCen / 2 * ((( i % 2) == 0) ? -1 : 1) ;
// prima metà arco
// prima metà arco
SetToolDir( vtMidTool) ;
SetCorrAuxDir( vtMidCorr) ;
if ( AddArcMove( ptMid, ptCen, dCurrAngCen, vtN) == GDB_ID_NULL)
return false ;
// seconda metà arco
// seconda metà arco
SetToolDir( ( ( i % 2) == 0) ? vtStaTool : vtEndTool) ;
SetCorrAuxDir( ( ( i % 2) == 0) ? vtStaCorr : vtEndCorr) ;
if ( AddArcMove( ptP3, ptCen, dCurrAngCen, vtN) == GDB_ID_NULL)
@@ -3703,18 +3785,18 @@ Sawing::GenerateIntArcCl( const ICurveArc* pArc,
Point3d ptMid ;
pArc->GetMidPoint( ptMid) ;
ptMid += Z_AX * dDelta ;
// prima metà arco
// prima metà arco
SetToolDir( vtMidTool) ;
SetCorrAuxDir( vtMidCorr) ;
if ( AddArcMove( ptMid, ptCen, dAngCen / 2, vtN) == GDB_ID_NULL)
return false ;
// seconda metà arco
// seconda metà arco
SetToolDir( vtEndTool) ;
SetCorrAuxDir( vtEndCorr) ;
if ( AddArcMove( ptP3, ptCen, dAngCen / 2, vtN) == GDB_ID_NULL)
return false ;
}
// se non è ultimo passo
// se non è ultimo passo
if ( i != 0) {
// movimento di risalita sopra il punto finale
SetFeed( GetEndFeed()) ;
@@ -3792,29 +3874,40 @@ bool
Sawing::CalculateToolAndCorrVersors( const Vector3d& vtTang, int nHeadSide, int nWorkSide, double dSideAng,
Vector3d& vtTool, Vector3d& vtCorr)
{
// Versore fresa : annullo la componente in Z e normalizzo
vtTool = vtTang ;
vtTool.z = 0 ;
if ( ! vtTool.Normalize())
// Direzione tangente nel piano XY
Vector3d vtXYTg = vtTang ;
vtXYTg.z = 0 ;
double dLenXYTg = vtXYTg.Len() ;
if ( dLenXYTg < EPS_SMALL)
return false ;
// ruoto attorno a Zglob+ a seconda del lato mandrino
vtXYTg /= dLenXYTg ;
// se direzione tangente inclinata in Z e SideAng non nullo devo calcolare la vera tangente nel piano XY
if ( abs( vtTang.z) > EPS_SMALL && abs( dSideAng) > EPS_ANG_SMALL) {
double dSinDelta = vtTang.z * tan( dSideAng * DEGTORAD) / dLenXYTg ;
double dCosDelta = sqrt( 1 - dSinDelta * dSinDelta) ;
if ( nHeadSide == SAW_HS_LEFT)
vtXYTg.Rotate( Z_AX, dCosDelta, dSinDelta) ;
else
vtXYTg.Rotate( Z_AX, dCosDelta, -dSinDelta) ;
}
// Versore fresa : ruoto direzione nel piano XY attorno a Zglob+ a seconda del lato mandrino
vtTool = vtXYTg ;
if ( nHeadSide == SAW_HS_LEFT)
vtTool.Rotate( Z_AX, 0, 1) ;
else
vtTool.Rotate( Z_AX, 0, -1) ;
// Versore correzione
// Versore correzione : se lama sbandata devo aggiustare
vtCorr = Z_AX ;
// Se lama sbandata
if ( abs( dSideAng) > EPS_ANG_SMALL) {
if ( nWorkSide == SAW_WS_RIGHT) {
vtTool.Rotate( vtTang, - dSideAng) ;
vtCorr.Rotate( vtTang, - dSideAng) ;
vtTool.Rotate( vtXYTg, - dSideAng) ;
vtCorr.Rotate( vtXYTg, - dSideAng) ;
}
else {
vtTool.Rotate( vtTang, dSideAng) ;
vtCorr.Rotate( vtTang, dSideAng) ;
vtTool.Rotate( vtXYTg, dSideAng) ;
vtCorr.Rotate( vtXYTg, dSideAng) ;
}
}
@@ -3825,7 +3918,7 @@ Sawing::CalculateToolAndCorrVersors( const Vector3d& vtTang, int nHeadSide, int
bool
Sawing::AdjustForSide( ICurve* pCurve)
{
// se lato lavoro e lato mandrino coincidono, non devo fare alcunché
// se lato lavoro e lato mandrino coincidono, non devo fare alcunché
if ( ( m_Params.m_nWorkSide == SAW_WS_LEFT && m_Params.m_nHeadSide == SAW_HS_LEFT) ||
( m_Params.m_nWorkSide == SAW_WS_RIGHT && m_Params.m_nHeadSide == SAW_HS_RIGHT))
return true ;
@@ -3994,7 +4087,7 @@ Sawing::AdjustLineForEdges( ICurveLine* pLine, double dElev, const Vector3d& vtC
dDeltaLoExt = dDeltaF ;
}
}
// controllo se lunghezza entità accettabile
// controllo se lunghezza entità accettabile
const double MIN_LEN = 1 ;
double dLenXY = DistXY( pLine->GetStart(), pLine->GetEnd()) ;
if ( dDeltaI + dLenXY + dDeltaF < MIN_LEN) {
@@ -4065,7 +4158,7 @@ Sawing::AdjustCurveForEdges( ICurve* pCrv, double dElev, double dLenCoeff,
dDeltaF = dDeltaT ;
}
dDeltaF *= dLenCoeff ;
// controllo se lunghezza entità accettabile
// controllo se lunghezza entità accettabile
const double MIN_LEN = 1 ;
double dLenXY ;
pCrv->GetLength( dLenXY) ;
+6 -2
View File
@@ -99,6 +99,10 @@ struct SawingData : public MachiningData
//----------------------------------------------------------------------------
inline const SawingData* GetSawingData( const MachiningData* pMdata)
{ return (dynamic_cast<const SawingData*>( pMdata)) ; }
{ if ( pMdata == nullptr || pMdata->GetType() != MT_SAWING)
return nullptr ;
return ( static_cast<const SawingData*>( pMdata)) ; }
inline SawingData* GetSawingData( MachiningData* pMdata)
{ return (dynamic_cast<SawingData*>( pMdata)) ; }
{ if ( pMdata == nullptr || pMdata->GetType() != MT_SAWING)
return nullptr ;
return ( static_cast<SawingData*>( pMdata)) ; }
+21 -11
View File
@@ -181,16 +181,12 @@ SetupMgr::Import( const string& sFileName)
m_pMchMgr->GetCurrMachGroup() == GDB_ID_NULL)
return false ;
// recupero il gruppo di setup
int nSetupId = m_pMchMgr->GetCurrSetupGroupId() ;
// inizializzo lo scanner
Scanner TheScanner ;
if ( ! TheScanner.Init( sFileName, ";"))
return false ;
// eseguo la lettura dei campi di attrezzaggio
int nPos = 1 ;
string sLine ;
while ( TheScanner.GetLine( sLine)) {
// salto dichiarazione sezione
@@ -228,8 +224,6 @@ SetupMgr::Import( const string& sFileName)
stuData.m_nExit = 0 ;
m_vStuData.emplace_back( stuData) ;
}
// passo alla successiva posizione
++ nPos ;
}
return true ;
@@ -277,14 +271,20 @@ SetupMgr::GetPosData( int nPos, string& sTcPos, string& sHead, int& nExit, strin
bool
SetupMgr::GetToolData( const string& sName, string& sTcPos, string& sHead, int& nExit, int* pnPos) const
{
// reset valori di ritorno
sTcPos.clear() ;
sHead.clear() ;
nExit = 0 ;
if ( pnPos != nullptr)
*pnPos = 0 ;
// verifico validità utensile
if ( IsEmptyOrSpaces( sName))
return false ;
// cerco l'utensile
int nI = - 1 ;
for ( size_t i = 0 ; i < m_vStuData.size() ; ++ i) {
for ( int i = 0 ; i < int( m_vStuData.size()) ; ++ i) {
if ( m_vStuData[i].m_nExit > 0 && EqualNoCase( sName, m_vStuData[i].m_sName)) {
nI = int( i) ;
nI = i ;
break ;
}
}
@@ -318,11 +318,21 @@ SetupMgr::GetToolName( const string& sHead, int nExit, string& sName) const
bool
SetupMgr::GetToolsInSetupPos( const string& sTcPos, STRVECTOR& vsTools) const
{
// default vettore vuoto
vsTools.clear() ;
// eseguo ricerca
// verifico macchina
if ( m_pMachine == nullptr)
return false ;
// eseguo ricerca (con inserimento nel vettore secondo indice dell'uscita)
for ( int i = 0 ; i < int( m_vStuData.size()) ; ++ i) {
if ( EqualNoCase( sTcPos, m_vStuData[i].m_sTcPos)) {
vsTools.emplace_back( m_vStuData[i].m_sName) ;
if ( ! IsEmptyOrSpaces( m_vStuData[i].m_sHead) && EqualNoCase( sTcPos, m_vStuData[i].m_sTcPos)) {
if ( vsTools.empty()) {
int nExitCnt = m_pMachine->GetHeadExitCount( m_vStuData[i].m_sHead) ;
vsTools.resize( nExitCnt) ;
}
int nExit = m_vStuData[i].m_nExit ;
if ( nExit > 0 && nExit <= int( vsTools.size()))
vsTools[nExit - 1] = m_vStuData[i].m_sName ;
}
}
return true ;
+663 -187
View File
File diff suppressed because it is too large Load Diff
+58 -15
View File
@@ -1,7 +1,7 @@
//----------------------------------------------------------------------------
// EgalTech 2015-2015
// EgalTech 2015-2023
//----------------------------------------------------------------------------
// File : Simulator.h Data : 19.10.15 Versione : 1.6j2
// File : Simulator.h Data : 16.01.23 Versione : 2.5a2
// Contenuto : Dichiarazione della classe Simulator.
//
//
@@ -21,6 +21,22 @@ class IGeomDB ;
class Machine ;
class PerformanceCounter ;
//------------------------ Struttura per movimento esterno assi --------------
struct SimAxMv
{
std::string sName ;
double dEndPos ;
double dStep ;
SimAxMv( void) : dEndPos( 0), dStep( 0) { }
SimAxMv( std::string sN, double dE, double dS) : sName( sN), dEndPos( dE), dStep( dS) {}
} ;
typedef std::vector<SimAxMv> SAMVECTOR ;
//------------------------ Risultato movimento esterno assi -------------------
enum SimAxMvRes { SIM_AXMV_RES_STOP = -1,
SIM_AXMV_RES_ERR = 0,
SIM_AXMV_RES_OK = 1} ;
//----------------------------------------------------------------------------
class Simulator
{
@@ -37,9 +53,11 @@ class Simulator
bool GetToolInfo( std::string& sName, double& dSpeed) const ;
bool GetOperationInfo( std::string& sName, int& nType) const ;
bool GetMoveInfo( int& nGmove, double& dFeed) const ;
bool AddCollisionObj( int nInd, int nFrameId, int nType, const Vector3d& vtMove, double dPar1, double dPar2, double dPar3) ;
bool AddCollisionObj( int nInd, bool bToolOn, int nFrameId, int nType, const Vector3d& vtMove, double dPar1, double dPar2, double dPar3) ;
bool ExecCollisionCheck( int& nCdInd, int& nObjInd, int nMoveType) ;
bool OnCollision( int nCdInd, int nObjInd, int& nErr) ;
bool SetToolForVmill( const std::string& sTool, const std::string& sHead, int nExit, const INTVECTOR& vVmill, bool bFirst) ;
int MoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt) ;
private :
bool UpdateTool( bool bFirst, int& nErr) ;
@@ -60,15 +78,18 @@ class Simulator
bool ManageMove( int& nStatus) ;
bool ManageSingleMove( int& nStatus, double& dMove) ;
int CalcStatusOnError( int nErr) ;
bool GetHeadCurrPosDirAux( Point3d& ptH, Vector3d& vtH, Vector3d& vtA) ;
bool ExecLineVmill( int nVmId, const Point3d& ptHi, const Vector3d& vtHi, const Vector3d& vtAi, const Frame3d& frVzmI,
const Point3d& ptHf, const Vector3d& vtHf, const Vector3d& vtAf, const Frame3d& frVzmF) ;
bool GetHeadCurrPosDirAux( const std::string& sHead, int nExit, Point3d& ptH, Vector3d& vtH, Vector3d& vtA) ;
bool ExecLineVmill( int nVmId, int nCurrTool, double dVmTdOffs, double dVmAdOffs,
const Point3d& ptHi, const Vector3d& vtHi, const Vector3d& vtAi, const Frame3d& frVzmI,
const Point3d& ptHf, const Vector3d& vtHf, const Vector3d& vtAf, const Frame3d& frVzmF) ;
bool NeedCollisionCheck( void) const
{ return ( ! m_CollObj.empty() && ! m_CdId.empty()) ; }
bool Stopped( void)
{ return ( m_nUiStatus == MCH_UISIM_STOP) ; }
bool OnStart( bool bFirst) ;
bool OnEnd( void) ;
bool OnInit( void) ;
bool OnExit( void) ;
bool OnProgramStart( bool bFirst) ;
bool OnProgramEnd( void) ;
bool OnDispositionStarting( int nOpId, int nOpInd, int nPhase,
const std::string& sTable, const Point3d& ptOri1, bool bEmpty, bool bSomeByHand) ;
bool OnDispositionStart( int nOpId, int nOpInd, int nPhase,
@@ -92,23 +113,41 @@ class Simulator
private :
struct CollObj {
int nInd ;
bool bToolOn ;
int nFrameId ;
int nType ;
Vector3d vtMove ;
double dPar1 ;
double dPar2 ;
double dPar3 ;
CollObj( void) : nInd( 0), nFrameId( -1), nType( 0), vtMove(), dPar1( 0), dPar2( 0), dPar3( 0) {}
CollObj( int nI, int nF, int nT, const Vector3d& vtM, double dP1, double dP2, double dP3)
: nInd( nI), nFrameId( nF), nType( nT), vtMove( vtM), dPar1( dP1), dPar2( dP2), dPar3( dP3) {}
CollObj( void) : nInd( 0), bToolOn( false), nFrameId( -1), nType( 0), vtMove(), dPar1( 0), dPar2( 0), dPar3( 0) {}
CollObj( int nI, bool bTOn, int nF, int nT, const Vector3d& vtM, double dP1, double dP2, double dP3)
: nInd( nI), bToolOn( bTOn), nFrameId( nF), nType( nT), vtMove( vtM), dPar1( dP1), dPar2( dP2), dPar3( dP3) {}
} ;
typedef std::vector< CollObj> COBVECTOR ;
typedef std::vector<CollObj> COBVECTOR ;
struct VmTool
{
std::string sName ;
std::string sHead ;
int nExit ;
double dTdOffs ;
double dAdOffs ;
VmTool( void) : nExit( 0), dTdOffs( 0), dAdOffs( 0) {}
VmTool( std::string sN, std::string sH, int nE, double dT, double dA)
: sName( sN), sHead( sH), nExit( nE), dTdOffs( dT), dAdOffs( dA) {}
} ;
typedef std::vector<VmTool> VMTVECTOR ;
enum { SIS_CREATED = 0,
SIS_INITIALIZED = 1,
SIS_READYTOSTART = 2,
SIS_READYTORUN = 3} ;
private :
MachMgr* m_pMchMgr ; // puntatore al gestore di tutte le lavorazioni
IGeomDB* m_pGeomDB ; // puntatore al DB geometrico
Machine* m_pMachine ; // puntatore alla macchina
PerformanceCounter* m_pPerfCnt ; // timer per calcolo FPS
int m_nStatus ; // stato interno del simulatore (creato, inizializzato, pronto al movimento)
double m_dStep ; // lunghezza di riferimento per la velocità di simulazione
int m_nUiStatus ; // stato simulazione a livello utente
int m_nOpId ; // identificativo della operazione (lavoraz.) corrente
@@ -126,23 +165,27 @@ class Simulator
std::string m_sHead ; // nome della testa corrente
int m_nExit ; // indice dell'uscita corrente
double m_dTDiam ; // diametro dell'utensile corrente
bool m_bCutOnTip ; // flag capacità di lavorare di testa dell'utensile corrente
INTVECTOR m_VmId ; // vettore identificativi Zmap per Virtual Milling
INTVECTOR m_CdId ; // vettore identificativi Zmap per Collision Detection
double m_dVmTdOffs ; // offset utensile in direzione principale per VM
double m_dVmAdOffs ; // offset utensile in direzione ausiliaria per VM
VMTVECTOR m_VmTool ; // vettore utensili attivi per virtual milling
COBVECTOR m_CollObj ; // vettore oggetti da testare per collisione con grezzo
double m_dSafeDist ; // distanza di sicurezza per verifica collisioni
int m_nAxesMask ; // maschera a bit di abilitazione movimento assi (solo se rapido)
bool m_bEnabAxes ; // flag abilitazione movimento assi attivi
bool m_bShowAxes ; // flag visualizzazione assi attivi
STRVECTOR m_AxesName ; // nomi degli assi macchina attivi
STRVECTOR m_AxesToken ; // token degli assi macchina attivi
BOOLVECTOR m_AxesInvert ; // flag di asse con verso invertito
BOOLVECTOR m_AxesInvert ; // flag di asse con verso invertito degli assi macchina attivi
DBLVECTOR m_AxesOffset ; // valore di offset delgli assi macchina ttivi
BOOLVECTOR m_AxesLinear ; // flag di lineare degli assi macchina attivi
DBLVECTOR m_AxesVal ; // valori degli assi macchina all'inizio del movimento corrente
STRVECTOR m_AuxAxesName ; // nomi degli assi macchina ausiliari abilitati
STRVECTOR m_AuxAxesToken ; // token degli assi macchina ausiliari abilitati
BOOLVECTOR m_AuxAxesInvert ; // flag di asse con verso invertito degli assi macchina ausiliari abilitati
DBLVECTOR m_AuxAxesOffset ; // valore di offset degli assi macchina ausiliari abilitati
BOOLVECTOR m_AuxAxesLinear ; // flag di lineare degli assi macchina ausiliari abilitati
DBLVECTOR m_AuxAxesVal ; // valori degli assi macchina ausiliari all'inizio del movimento corrente
DBLVECTOR m_AuxAxesEnd ; // valori degli assi macchina ausiliari alla fine del movimento corrente
INTVECTOR m_AuxAxesLink ; // indice + 1 asse principale di aggancio (negativo valore opposto, 0 nessuno)
} ;
+102 -40
View File
@@ -24,8 +24,8 @@
#include "/EgtDev/Include/EGkCurveArc.h"
#include "/EgtDev/Include/EGkCurveComposite.h"
#include "/EgtDev/Include/EGkChainCurves.h"
#include "/EgtDev/Include/EgkOffsetCurve.h"
#include "/EgtDev/Include/EgkOffsetCurveOnX.h"
#include "/EgtDev/Include/EGkOffsetCurve.h"
#include "/EgtDev/Include/EGkOffsetCurveOnX.h"
#include "/EgtDev/Include/EGkSfrCreate.h"
#include "/EgtDev/Include/EGkSurfLocal.h"
#include "/EgtDev/Include/EGkCAvToolSurfTm.h"
@@ -88,6 +88,9 @@ SurfFinishing::Clone( void) const
pSrF->m_nPhase = m_nPhase ;
pSrF->m_Params = m_Params ;
pSrF->m_TParams = m_TParams ;
pSrF->m_dTHoldBase = m_dTHoldBase ;
pSrF->m_dTHoldLen = m_dTHoldLen ;
pSrF->m_dTHoldDiam = m_dTHoldDiam ;
pSrF->m_nStatus = m_nStatus ;
pSrF->m_nPaths = m_nPaths ;
}
@@ -201,6 +204,7 @@ SurfFinishing::SurfFinishing( void)
m_Params.m_sToolName = "*" ;
m_TParams.m_sName = "*" ;
m_TParams.m_sHead = "*" ;
m_dTHoldBase = 0 ;
m_dTHoldLen = 0 ;
m_dTHoldDiam = 0 ;
m_nStatus = MCH_ST_TO_VERIFY ;
@@ -497,8 +501,14 @@ SurfFinishing::Apply( bool bRecalc, bool bPostApply)
// verifico se necessario continuare nell'aggiornamento
if ( ! bRecalc && ! bToolChanged &&
( m_nStatus == MCH_ST_OK || ( ! bPostApply && m_nStatus == MCH_ST_NO_POSTAPPL))) {
// confermo i percorsi di lavorazione
m_nPaths = nCurrPaths ;
LOG_DBG_INFO( GetEMkLogger(), "SurfFinishing apply skipped : status already ok") ;
// eseguo aggiornamento assi macchina e collegamento con operazione precedente
if ( ! Update( bPostApply))
return false ;
LOG_DBG_INFO( GetEMkLogger(), "Update done") ;
// esco con successo
return true ;
}
m_nStatus = MCH_ST_TO_VERIFY ;
@@ -528,6 +538,8 @@ SurfFinishing::Apply( bool bRecalc, bool bPostApply)
}
// recupero i dati del portautensile
int nToolId = m_pMchMgr->GetCalcTool() ;
m_dTHoldBase = 0 ;
m_pGeomDB->GetInfo( nToolId, TTH_BASE, m_dTHoldBase) ;
m_dTHoldLen = 0 ;
m_pGeomDB->GetInfo( nToolId, TTH_LEN, m_dTHoldLen) ;
m_dTHoldDiam = 0 ;
@@ -575,6 +587,8 @@ SurfFinishing::Apply( bool bRecalc, bool bPostApply)
// dichiaro successiva da aggiornare
UpdateFollowingOperationsStatus( MCH_ST_OTH_MODIF) ;
LOG_DBG_INFO( GetEMkLogger(), "SurfFinishing apply done") ;
return true ;
}
@@ -592,15 +606,11 @@ SurfFinishing::Update( bool bPostApply)
return true ;
}
// elimino le entità CLIMB, RISE e HOME della lavorazione, potrebbero falsare i calcoli degli assi (in ogni casi vengono riaggiunte dopo)
RemoveClimbRiseHome() ;
// imposto eventuale asse bloccato da lavorazione
if ( ! m_Params.m_sBlockedAxis.empty()) {
string sAxis, sVal ;
Split( m_Params.m_sBlockedAxis, "=", true, sAxis, sVal) ;
double dVal = 0 ;
FromString( sVal, dVal) ;
m_pMchMgr->ClearRotAxisBlock() ;
m_pMchMgr->SetRotAxisBlock( sAxis, dVal) ;
}
SetBlockedRotAxis( m_Params.m_sBlockedAxis) ;
// calcolo gli assi macchina
string sHint = ExtractHint( m_Params.m_sUserNotes) ;
@@ -793,11 +803,31 @@ SurfFinishing::UpdateToolData( bool* pbChanged)
const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ;
if ( pTdata == nullptr)
return false ;
// verifico se sono diversi (ad esclusione del nome)
m_TParams.m_sName = pTdata->m_sName ;
bool bChanged = ! SameTool( m_TParams, *pTdata) ;
// salvo posizione TC, testa e uscita originali
string sOrigTcPos = m_TParams.m_sTcPos ;
string sOrigHead = m_TParams.m_sHead ;
int nOrigExit = m_TParams.m_nExit ;
// verifico se sono diversi (ad esclusione di nome, posizione TC, testa e uscita)
bool bChanged = ( ! SameTool( m_TParams, *pTdata, false)) ;
// aggiorno comunque i parametri
m_TParams = *pTdata ;
// se definito attrezzaggio, aggiorno i parametri che ne possono derivare
string sTcPos ; string sHead ; int nExit ;
if ( m_pMchMgr->GetCurrSetupMgr().GetToolData( m_TParams.m_sName, sTcPos, sHead, nExit)) {
if ( sOrigTcPos != sTcPos ||
sOrigHead != sHead ||
nOrigExit != nExit)
bChanged = true ;
m_TParams.m_sTcPos = sTcPos ;
m_TParams.m_sHead = sHead ;
m_TParams.m_nExit = nExit ;
}
else {
if ( sOrigTcPos != pTdata->m_sTcPos ||
sOrigHead != pTdata->m_sHead ||
nOrigExit != pTdata->m_nExit)
bChanged = true ;
}
// eventuali segnalazioni
if ( ! EqualNoCase( m_Params.m_sToolName, m_TParams.m_sName)) {
string sInfo = "Warning in SurfFinishing : tool name changed (" +
@@ -840,28 +870,39 @@ bool
SurfFinishing::VerifyGeometry( SelData Id, int& nSubs)
{
// ammessi : curve o superfici
// per ora accetto solo curve
const ICurve* pCurve = nullptr ;
const IGeoObj* pGObj = m_pGeomDB->GetGeoObj( Id.nId) ;
// se direttamente la curva
if ( Id.nSub == SEL_SUB_ALL) {
pCurve = ::GetCurve( pGObj) ;
if ( pCurve != nullptr) {
if ( pCurve->GetType() == CRV_COMPO)
nSubs = ::GetCurveComposite( pCurve)->GetCurveCount() ;
else
nSubs = 0 ;
if ( pGObj == nullptr)
return false ;
// se curva
if ( ( pGObj->GetType() & GEO_CURVE) != 0) {
const ICurve* pCurve = nullptr ;
// se direttamente la curva
if ( Id.nSub == SEL_SUB_ALL) {
pCurve = ::GetCurve( pGObj) ;
if ( pCurve != nullptr) {
if ( pCurve->GetType() == CRV_COMPO)
nSubs = ::GetCurveComposite( pCurve)->GetCurveCount() ;
else
nSubs = 0 ;
}
}
// altrimenti sottocurva di composita
else {
const ICurveComposite* pCompo = GetCurveComposite( pGObj) ;
if ( pCompo != nullptr)
pCurve = pCompo->GetCurve( Id.nSub) ;
nSubs = 0 ;
}
return ( pCurve != nullptr) ;
}
// altrimenti sottocurva di composita
else {
const ICurveComposite* pCompo = GetCurveComposite( pGObj) ;
if ( pCompo != nullptr)
pCurve = pCompo->GetCurve( Id.nSub) ;
nSubs = 0 ;
// se altrimenti è superficie trimesh
else if ( pGObj->GetType() == SRF_TRIMESH) {
const ISurfTriMesh* pSurf = ::GetSurfTriMesh( pGObj) ;
return ( pSurf != nullptr && pSurf->GetFacetCount() >= 1) ;
}
return ( pCurve != nullptr) ;
// altrimenti errore
else
return false ;
}
//----------------------------------------------------------------------------
@@ -921,6 +962,10 @@ SurfFinishing::GetCurves( SelData Id, ICURVEPLIST& lstPC)
lstPC.emplace_back( Release( pCurve)) ;
return true ;
}
// se altrimenti superficie
else if ( pGObj->GetType() == SRF_TRIMESH)
return true ;
// altrimenti errore
else
return false ;
}
@@ -1222,7 +1267,16 @@ SurfFinishing::GetActiveSurfaces( INTVECTOR& vSurfId) const
// verifiche
if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr)
return false ;
// ciclo sui grezzi attivi nella fase
// cerco tra gli oggetti selezionati
for ( const auto& Id : m_vId) {
int nEntId = Id.nId ;
if ( m_pGeomDB->GetGeoType( nEntId) == SRF_TRIMESH)
vSurfId.emplace_back( nEntId) ;
}
// se trovate superfici, considero solo queste ed esco
if ( ! vSurfId.empty())
return true ;
// altrimenti considero tutte le superfici dei pezzi nei grezzi attivi della fase
int nRawId = m_pMchMgr->GetFirstRawPart() ;
while ( nRawId != GDB_ID_NULL) {
if ( m_pMchMgr->VerifyRawPartPhase(nRawId, m_nPhase)) {
@@ -1277,8 +1331,8 @@ SurfFinishing::AddZigZag( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf,
bool bStart = true ;
while ( OffsCrv.GetCurveCount() > 0) {
// recupero la prima curva di offset
PtrOwner<ICurveComposite> pOffs( CreateCurveComposite()) ;
if ( IsNull( pOffs) || ! pOffs->AddCurve( OffsCrv.GetLongerCurve())) {
PtrOwner<ICurveComposite> pOffs ;
if ( ! pOffs.Set( ConvertCurveToComposite( OffsCrv.GetLongerCurve()))) {
m_pMchMgr->SetLastError( 3110, "Error in SurfFinishing : Toolpath not computable") ;
return false ;
}
@@ -1328,7 +1382,7 @@ SurfFinishing::AddZigZag( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf,
if ( IsNull( pCompo) || ! pCompo->FromPolyLine( PL))
return false ;
// sostituisco la vecchia curva con la nuova
vpCrvs[k].Set( Release( pCompo )) ;
vpCrvs[k].Set( pCompo) ;
}
// ciclo sulle curve elementari
int nMaxInd = vpCrvs[k]->GetCurveCount() - 1 ;
@@ -1475,7 +1529,7 @@ SurfFinishing::CalcZigZag( const ICurveComposite* pOffs,
// calcolo la classificazione della curva rispetto al contorno esterno offsettato
IntersCurveCurve intCC( *pLine, *pOffs) ;
CRVCVECTOR ccClass ;
if ( ! intCC.GetCurveClassification( 0, ccClass)) {
if ( ! intCC.GetCurveClassification( 0, EPS_SMALL, ccClass)) {
m_pMchMgr->SetLastError( 3110, "Error in SurfFinishing : Toolpath not computable") ;
return false ;
}
@@ -1618,6 +1672,13 @@ SurfFinishing::CalcZigZag( const ICurveComposite* pOffs,
nJ = -1 ;
}
}
// se richiesta percorrenza invertita
if ( m_Params.m_bInvert) {
for ( auto& pCompo : vpCrvs)
pCompo->Invert() ;
}
return true ;
}
@@ -1689,7 +1750,7 @@ SurfFinishing::AddSpiral( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf,
if ( IsNull( pCompo) || ! pCompo->FromPolyLine( PL))
return false ;
// sostituisco la vecchia curva con la nuova
pMCrv.Set( Release( pCompo )) ;
pMCrv.Set( pCompo) ;
}
// ciclo sulle curve elementari
int nMaxInd = pMCrv->GetCurveCount() - 1 ;
@@ -1852,7 +1913,7 @@ SurfFinishing::CalcSpiral( const ICurveComposite* pCompo, bool bSplitArcs,
if ( bNextOk) {
// sistemo per prossimo step
dCurrRad = dRad ;
pOffs.Set( Release( pNextOffs)) ;
pOffs.Set( pNextOffs) ;
pCurr = Get( pOffs) ;
// nuovo valore pari allo step
dOffs = GetSideStep() ;
@@ -2052,6 +2113,7 @@ SurfFinishing::GetRightFeed( const Vector3d& vtMove, const Vector3d& vtTool) con
double
SurfFinishing::GetRadiusForStartEndElevation( void) const
{
const double DELTA_ELEV_RAD = 20.0 ;
return ( 0.5 * m_TParams.m_dTDiam + DELTA_ELEV_RAD) ;
const double DELTA_ELEV_RAD = 4.0 ;
double dDeltaRad = min( DELTA_ELEV_RAD, 0.5 * m_TParams.m_dTDiam) ;
return ( 0.5 * m_TParams.m_dTDiam + dDeltaRad) ;
}
+1
View File
@@ -113,6 +113,7 @@ class SurfFinishing : public Machining
SELVECTOR m_vId ; // identificativi entità geometriche da lavorare
SurfFinishingData m_Params ; // parametri lavorazione
ToolData m_TParams ; // parametri utensile
double m_dTHoldBase ; // posizione base del porta-utensile
double m_dTHoldLen ; // lunghezza del porta-utensile
double m_dTHoldDiam ; // diametro del porta-utensile
int m_nStatus ; // stato di aggiornamento della lavorazione
+6 -2
View File
@@ -83,6 +83,10 @@ struct SurfFinishingData : public MachiningData
//----------------------------------------------------------------------------
inline const SurfFinishingData* GetSurfFinishingData( const MachiningData* pMdata)
{ return (dynamic_cast<const SurfFinishingData*>( pMdata)) ; }
{ if ( pMdata == nullptr || pMdata->GetType() != MT_SURFFINISHING)
return nullptr ;
return ( static_cast<const SurfFinishingData*>( pMdata)) ; }
inline SurfFinishingData* GetSurfFinishingData( MachiningData* pMdata)
{ return (dynamic_cast<SurfFinishingData*>( pMdata)) ; }
{ if ( pMdata == nullptr || pMdata->GetType() != MT_SURFFINISHING)
return nullptr ;
return ( static_cast<SurfFinishingData*>( pMdata)) ; }
+9 -4
View File
@@ -1,7 +1,7 @@
//----------------------------------------------------------------------------
// EgalTech 2015-2015
// EgalTech 2015-2024
//----------------------------------------------------------------------------
// File : Table.cpp Data : 25.05.15 Versione : 1.6e7
// File : Table.cpp Data : 19.03.24 Versione : 2.6c2
// Contenuto : Oggetto tavola per gruppo tavola di macchina.
//
//
@@ -45,6 +45,7 @@ Table::Clone( void) const
pTab->m_sName = m_sName ;
pTab->m_nType = m_nType ;
pTab->m_ptRef1 = m_ptRef1 ;
pTab->m_vsColl = m_vsColl ;
}
catch( ...) {
delete pTab ;
@@ -63,7 +64,10 @@ Table::Dump( string& sOut, bool bMM, const char* szNewLine) const
sOut += "Id=" + ToString( m_nOwnerId) + szNewLine ;
sOut += "Name=" + m_sName + szNewLine ;
sOut += "Type=" + ToString( m_nType) + szNewLine ;
sOut += "Ref1=(" + ToString( GetInUiUnits(m_ptRef1, bMM), 4) + ")" + szNewLine ;
sOut += "Ref1=(" + ToString( GetInUiUnits( m_ptRef1, bMM), 4) + ")" + szNewLine ;
sOut += "Area1=(" + ToString( GetInUiUnits( m_b3Area1.GetMin(), bMM), 4) + ";" +
ToString( GetInUiUnits( m_b3Area1.GetMax(), bMM), 4) + szNewLine ;
sOut += "Coll=" + ToString( m_vsColl) + szNewLine ;
return true ;
}
@@ -99,11 +103,12 @@ Table::Table( void)
//----------------------------------------------------------------------------
bool
Table::Set( const string& sName, int nType, const Point3d& ptRef1, const BBox3d& b3Area1)
Table::Set( const string& sName, int nType, const Point3d& ptRef1, const BBox3d& b3Area1, const STRVECTOR& vsColl)
{
m_sName = sName ;
m_nType = nType ;
m_ptRef1 = ptRef1 ;
m_b3Area1 = b3Area1 ;
m_vsColl = vsColl ;
return true ;
}
+4 -1
View File
@@ -30,7 +30,7 @@ class Table : public IUserObj
public :
Table( void) ;
bool Set( const std::string& sName, int nType, const Point3d& ptRef1, const BBox3d& b3Area1) ;
bool Set( const std::string& sName, int nType, const Point3d& ptRef1, const BBox3d& b3Area1, const STRVECTOR& vsColl) ;
const std::string& GetName( void)
{ return m_sName ; }
int GetType( void)
@@ -39,6 +39,8 @@ class Table : public IUserObj
{ return m_ptRef1 ; }
const BBox3d& GetArea1( void)
{ return m_b3Area1 ; }
const STRVECTOR& GetCollGroups( void) const
{ return m_vsColl ; }
private :
int m_nOwnerId ;
@@ -47,4 +49,5 @@ class Table : public IUserObj
int m_nType ;
Point3d m_ptRef1 ;
BBox3d m_b3Area1 ;
STRVECTOR m_vsColl ;
} ;
+12 -2
View File
@@ -354,17 +354,23 @@ ToolData::SetParam( int nType, double dVal)
m_dMinFeed = dVal ;
return true ;
case TPA_DIST :
if ( abs( dVal) > 0)
if ( abs( dVal) > EPS_SMALL)
SetValInNotes( TSI_DIST, dVal, m_sSysNotes) ;
else
RemoveValInNotes( TSI_DIST, m_sSysNotes) ;
return true ;
case TPA_STEMDIAM :
if ( abs( dVal) > 0)
if ( abs( dVal) > EPS_SMALL)
SetValInNotes( TSI_STEM_DIAM, dVal, m_sSysNotes) ;
else
RemoveValInNotes( TSI_STEM_DIAM, m_sSysNotes) ;
return true ;
case TPA_CORE :
if ( abs( dVal) > EPS_SMALL)
SetValInNotes( TSI_CORE, dVal, m_sSysNotes) ;
else
RemoveValInNotes( TSI_CORE, m_sSysNotes) ;
return true ;
}
return false ;
}
@@ -500,6 +506,10 @@ ToolData::GetParam( int nType, double& dVal) const
dVal = 0 ;
GetValInNotes( m_sSysNotes, TSI_STEM_DIAM, dVal) ;
return true ;
case TPA_CORE :
dVal = 0 ;
GetValInNotes( m_sSysNotes, TSI_CORE, dVal) ;
return true ;
}
dVal = 0 ;
return false ;
+5 -5
View File
@@ -72,7 +72,7 @@ struct ToolData
//----------------------------------------------------------------------------
inline bool
SameTool( const ToolData& Td1, const ToolData& Td2)
SameTool( const ToolData& Td1, const ToolData& Td2, bool bAlsoNameTcPosHeadExit = true)
{
const double EPS_TOOL_LEN = 10 * EPS_SMALL ;
const double EPS_TOOL_ANG = 10 * EPS_ANG_SMALL ;
@@ -80,11 +80,11 @@ SameTool( const ToolData& Td1, const ToolData& Td2)
const double EPS_FEED = 0.5 ;
const double EPS_ABSORP = 0.5 ;
return ( Td1.m_Uuid == Td2.m_Uuid &&
Td1.m_sName == Td2.m_sName &&
( Td1.m_sName == Td2.m_sName || ! bAlsoNameTcPosHeadExit) &&
Td1.m_sDraw == Td2.m_sDraw &&
Td1.m_sTcPos == Td2.m_sTcPos &&
Td1.m_sHead == Td2.m_sHead &&
Td1.m_nExit == Td2.m_nExit &&
( Td1.m_sTcPos == Td2.m_sTcPos || ! bAlsoNameTcPosHeadExit) &&
( Td1.m_sHead == Td2.m_sHead || ! bAlsoNameTcPosHeadExit) &&
( Td1.m_nExit == Td2.m_nExit || ! bAlsoNameTcPosHeadExit) &&
Td1.m_nCorr == Td2.m_nCorr &&
Td1.m_nType == Td2.m_nType &&
abs( Td1.m_dMaxSpeed - Td2.m_dMaxSpeed) < EPS_SPEED &&
+116 -85
View File
@@ -112,7 +112,19 @@ ToolsMgr::Reload( void)
// ciclo di lettura degli utensili
do {
if ( ! LoadOneTool( TheScanner, nToolSize, bEnd)) {
ToolData tData ;
if ( LoadOneTool( TheScanner, nToolSize, tData, bEnd)) {
if ( ! tData.m_sName.empty()) {
// salvo i dati dell'utensile
if ( ! m_utData.emplace( tData.m_Uuid, tData).second ||
! m_suData.emplace( tData.m_sName, tData.m_Uuid).second) {
bOk = false ;
string sOut = "ReloadTools : Error adding tool " + tData.m_sName ;
LOG_ERROR( GetEMkLogger(), sOut.c_str())
}
}
}
else {
bOk = false ;
string sOut = "ReloadTools : Error on line " + ToString( TheScanner.GetCurrLineNbr()) ;
LOG_ERROR( GetEMkLogger(), sOut.c_str())
@@ -133,7 +145,7 @@ ToolsMgr::Reload( void)
//----------------------------------------------------------------------------
bool
ToolsMgr::LoadHeader( Scanner& TheScanner, int& nVersion, int& nToolSize, int& nTotal, bool& bEnd)
ToolsMgr::LoadHeader( Scanner& TheScanner, int& nVersion, int& nToolSize, int& nTotal, bool& bEnd) const
{
// leggo la prossima linea
string sLine ;
@@ -176,12 +188,12 @@ ToolsMgr::LoadHeader( Scanner& TheScanner, int& nVersion, int& nToolSize, int& n
//----------------------------------------------------------------------------
bool
ToolsMgr::LoadOneTool( Scanner& TheScanner, int nToolSize, bool& bEnd)
ToolsMgr::LoadOneTool( Scanner& TheScanner, int nToolSize, ToolData& tData, bool& bEnd) const
{
ToolData tData ;
// leggo la prossima linea
string sLine ;
if ( ! TheScanner.GetLine( sLine)) {
tData.m_sName = "" ;
// fine file
bEnd = true ;
return true ;
@@ -213,9 +225,6 @@ ToolsMgr::LoadOneTool( Scanner& TheScanner, int nToolSize, bool& bEnd)
}
// verifico di aver letto tutti i campi
bOk = bOk && ( Flag.count() == nToolSize) ;
// salvo i dati dell'utensile
bOk = bOk && m_utData.emplace( tData.m_Uuid, tData).second ;
bOk = bOk && m_suData.emplace( tData.m_sName, tData.m_Uuid).second ;
return bOk ;
}
@@ -542,8 +551,6 @@ ToolsMgr::SaveCurrTool( void)
m_suData.emplace( m_tdCurrTool.m_sName, m_tdCurrTool.m_Uuid) ;
}
}
// aggiorno dati portautensile
UpdateCurrToolHolderData() ;
// eseguo salvataggio
m_bModified = true ;
if ( find( m_utModified.begin(), m_utModified.end(), m_tdCurrTool.m_Uuid) == m_utModified.end())
@@ -554,19 +561,13 @@ ToolsMgr::SaveCurrTool( void)
//----------------------------------------------------------------------------
bool
ToolsMgr::UpdateCurrToolHolderData( void)
ToolsMgr::UpdateCurrToolHolderData( double dTHoldBase, double dTHoldLen, double dTHoldDiam)
{
// Leggo i dati del portautensile dal disegno dell'utensile
PtrOwner<IGeomDB> pGeomDB( CreateGeomDB()) ;
pGeomDB->Init() ;
string sDrawPath = m_sToolsDir + "\\" + m_tdCurrTool.m_sDraw ;
pGeomDB->Load( sDrawPath) ;
int nToolId = pGeomDB->GetFirstGroupInGroup( GDB_ID_ROOT) ;
double dTHoldLen = 0 ;
pGeomDB->GetInfo( nToolId, TTH_LEN, dTHoldLen) ;
double dTHoldDiam = 0 ;
pGeomDB->GetInfo( nToolId, TTH_DIAM, dTHoldDiam) ;
// verifico validità utensile corrente
if ( ! m_bCurrTool)
return false ;
// Aggiorno i dati nelle note di sistema
SetValInNotes( TSI_THBASE, dTHoldBase, m_tdCurrTool.m_sSysNotes) ;
SetValInNotes( TSI_THLEN, dTHoldLen, m_tdCurrTool.m_sSysNotes) ;
SetValInNotes( TSI_THDIAM, dTHoldDiam, m_tdCurrTool.m_sSysNotes) ;
return true ;
@@ -679,17 +680,30 @@ ToolsMgr::GetCurrToolMaxDepth( double dSafe, double& dMaxDepth) const
// se fresa
else if ( ( m_tdCurrTool.m_nType & TF_MILL) != 0) {
// recupero le dimensioni del porta utensili
double dTHoldBase = 0 ;
double dTHoldLen = 0 ;
double dTHoldDiam = 0 ;
if ( ! GetValInNotes( m_tdCurrTool.m_sSysNotes, TSI_THLEN, dTHoldLen) ||
! GetValInNotes( m_tdCurrTool.m_sSysNotes, TSI_THDIAM, dTHoldDiam)) {
bool bBaseOk = GetValInNotes( m_tdCurrTool.m_sSysNotes, TSI_THBASE, dTHoldBase) ;
bool bLenOk = GetValInNotes( m_tdCurrTool.m_sSysNotes, TSI_THLEN, dTHoldLen) ;
bool bDiamOk = GetValInNotes( m_tdCurrTool.m_sSysNotes, TSI_THDIAM, dTHoldDiam) ;
if ( ! bBaseOk || ! bLenOk || ! bDiamOk) {
(const_cast<ToolsMgr*>(this))->UpdateCurrToolHolderData( dTHoldBase, dTHoldLen, dTHoldDiam) ;
(const_cast<ToolsMgr*>(this))->SaveCurrTool() ;
Save() ;
GetValInNotes( m_tdCurrTool.m_sSysNotes, TSI_THBASE, dTHoldBase) ;
GetValInNotes( m_tdCurrTool.m_sSysNotes, TSI_THLEN, dTHoldLen) ;
GetValInNotes( m_tdCurrTool.m_sSysNotes, TSI_THDIAM, dTHoldDiam) ;
}
// calcolo il massimo affondamento
dMaxDepth = m_tdCurrTool.m_dLen - ( m_tdCurrTool.m_dDiam > dTHoldDiam ? 0 : dTHoldLen) - dSafe ;
// calcolo il massimo affondamento per le limitazioni dal portautensili
dMaxDepth = m_tdCurrTool.m_dLen - dSafe ;
if ( dTHoldDiam > m_tdCurrTool.m_dDiam + EPS_SMALL)
dMaxDepth -= dTHoldLen ;
else
dMaxDepth -= dTHoldBase ;
// recupero l'eventuale diametro gambo utensile (definito se non nullo)
double dStemDiam ; m_tdCurrTool.GetParam( TPA_STEMDIAM, dStemDiam) ;
if ( dStemDiam > m_tdCurrTool.m_dDiam + EPS_SMALL)
dMaxDepth = min( dMaxDepth, m_tdCurrTool.m_dMaxMat) ;
return true ;
}
// se mortasatrice o sega a catena
@@ -724,27 +738,32 @@ ToolsMgr::GetCurrToolThDiam( double& dThDiam) const
if ( ! m_bCurrTool)
return false ;
// se punta a forare, lama, fresa o scalpello
// se punta a forare, lama, fresa, mortasatrice/sega a catena o scalpello
if ( ( m_tdCurrTool.m_nType & TF_DRILLBIT) != 0 ||
( m_tdCurrTool.m_nType & TF_SAWBLADE) != 0 ||
( m_tdCurrTool.m_nType & TF_MILL) != 0 ||
( m_tdCurrTool.m_nType & TF_MORTISE) != 0 ||
( m_tdCurrTool.m_nType & TF_CHISEL) != 0) {
// recupero le dimensioni del porta utensili
double dTHoldBase = 0 ;
double dTHoldLen = 0 ;
double dTHoldDiam = 0 ;
if ( ! GetValInNotes( m_tdCurrTool.m_sSysNotes, TSI_THLEN, dTHoldLen) ||
! GetValInNotes( m_tdCurrTool.m_sSysNotes, TSI_THDIAM, dTHoldDiam)) {
bool bBaseOk = GetValInNotes( m_tdCurrTool.m_sSysNotes, TSI_THBASE, dTHoldBase) ;
bool bLenOk = GetValInNotes( m_tdCurrTool.m_sSysNotes, TSI_THLEN, dTHoldLen) ;
bool bDiamOk = GetValInNotes( m_tdCurrTool.m_sSysNotes, TSI_THDIAM, dTHoldDiam) ;
if ( ! bBaseOk || ! bLenOk || ! bDiamOk) {
(const_cast<ToolsMgr*>(this))->UpdateCurrToolHolderData( dTHoldBase, dTHoldLen, dTHoldDiam) ;
(const_cast<ToolsMgr*>(this))->SaveCurrTool() ;
Save() ;
GetValInNotes( m_tdCurrTool.m_sSysNotes, TSI_THBASE, dTHoldBase) ;
GetValInNotes( m_tdCurrTool.m_sSysNotes, TSI_THLEN, dTHoldLen) ;
GetValInNotes( m_tdCurrTool.m_sSysNotes, TSI_THDIAM, dTHoldDiam) ;
}
dThDiam = dTHoldDiam ;
return true ;
}
// se mortasatrice/sega a catena o waterjet
else if ( ( m_tdCurrTool.m_nType & TF_MORTISE) != 0 ||
( m_tdCurrTool.m_nType & TF_WATERJET) != 0) {
// se waterjet
else if ( ( m_tdCurrTool.m_nType & TF_WATERJET) != 0) {
dThDiam = 0 ;
return true ;
}
@@ -760,27 +779,32 @@ ToolsMgr::GetCurrToolThLength( double& dThLen) const
if ( ! m_bCurrTool)
return false ;
// se punta a forare, lama, fresa o scalpello
// se punta a forare, lama, fresa, mortasatrice/sega a catena o scalpello
if ( ( m_tdCurrTool.m_nType & TF_DRILLBIT) != 0 ||
( m_tdCurrTool.m_nType & TF_SAWBLADE) != 0 ||
( m_tdCurrTool.m_nType & TF_MILL) != 0 ||
( m_tdCurrTool.m_nType & TF_MORTISE) != 0 ||
( m_tdCurrTool.m_nType & TF_CHISEL) != 0) {
// recupero le dimensioni del porta utensili
double dTHoldBase = 0 ;
double dTHoldLen = 0 ;
double dTHoldDiam = 0 ;
if ( ! GetValInNotes( m_tdCurrTool.m_sSysNotes, TSI_THLEN, dTHoldLen) ||
! GetValInNotes( m_tdCurrTool.m_sSysNotes, TSI_THDIAM, dTHoldDiam)) {
bool bBaseOk = GetValInNotes( m_tdCurrTool.m_sSysNotes, TSI_THBASE, dTHoldBase) ;
bool bLenOk = GetValInNotes( m_tdCurrTool.m_sSysNotes, TSI_THLEN, dTHoldLen) ;
bool bDiamOk = GetValInNotes( m_tdCurrTool.m_sSysNotes, TSI_THDIAM, dTHoldDiam) ;
if ( ! bBaseOk || ! bLenOk || ! bDiamOk) {
(const_cast<ToolsMgr*>(this))->UpdateCurrToolHolderData( dTHoldBase, dTHoldLen, dTHoldDiam) ;
(const_cast<ToolsMgr*>(this))->SaveCurrTool() ;
Save() ;
GetValInNotes( m_tdCurrTool.m_sSysNotes, TSI_THBASE, dTHoldBase) ;
GetValInNotes( m_tdCurrTool.m_sSysNotes, TSI_THLEN, dTHoldLen) ;
GetValInNotes( m_tdCurrTool.m_sSysNotes, TSI_THDIAM, dTHoldDiam) ;
}
dThLen = dTHoldLen ;
return true ;
}
// se mortasatrice/sega a catena o waterjet
else if ( ( m_tdCurrTool.m_nType & TF_MORTISE) != 0 ||
( m_tdCurrTool.m_nType & TF_WATERJET) != 0) {
// se waterjet
else if ( ( m_tdCurrTool.m_nType & TF_WATERJET) != 0) {
dThLen = 0 ;
return true ;
}
@@ -790,7 +814,7 @@ ToolsMgr::GetCurrToolThLength( double& dThLen) const
//----------------------------------------------------------------------------
bool
ToolsMgr::Export( const STRVECTOR& vsToolsNames, const string& sOutFile, bool bCompressed)
ToolsMgr::Export( const STRVECTOR& vsToolsNames, const string& sOutFile, bool bCompressed) const
{
LOG_INFO( GetEMkLogger(), ( "Export Tools " + sOutFile).c_str()) ;
@@ -854,10 +878,10 @@ ToolsMgr::Export( const STRVECTOR& vsToolsNames, const string& sOutFile, bool bC
//----------------------------------------------------------------------------
bool
ToolsMgr::ExportOneTool( const string& sToolName, Writer& TheWriter, const int& nCounter, const string& sOutDir)
ToolsMgr::ExportOneTool( const string& sToolName, Writer& TheWriter, int nCounter, const string& sOutDir) const
{
// se il tool non esiste nel DB lo ignoro
if ( m_suData.find( sToolName) == m_suData.end()){
if ( m_suData.find( sToolName) == m_suData.end()) {
string sOut = "Warning Export Tool : " + sToolName + " not found. Tool is ignored" ;
LOG_ERROR( GetEMkLogger(), sOut.c_str()) ;
return true ;
@@ -865,7 +889,7 @@ ToolsMgr::ExportOneTool( const string& sToolName, Writer& TheWriter, const int&
const ToolData * tData = GetTool( sToolName) ;
string sOut ;
if ( tData == nullptr){
if ( tData == nullptr) {
sOut = "Export Tools : Error exporting " + sToolName ;
LOG_ERROR( GetEMkLogger(), sOut.c_str()) ;
return false ;
@@ -885,7 +909,7 @@ ToolsMgr::ExportOneTool( const string& sToolName, Writer& TheWriter, const int&
bOk = ! sOut.empty() && TheWriter.OutText( sOut) ;
}
if ( ! bOk){
if ( ! bOk) {
sOut = "Export Tools : Error exporting " + sToolName ;
LOG_ERROR( GetEMkLogger(), sOut.c_str()) ;
// visto che non ho salvato correttamente il tool elimino il suo disegno
@@ -898,7 +922,7 @@ ToolsMgr::ExportOneTool( const string& sToolName, Writer& TheWriter, const int&
//----------------------------------------------------------------------------
bool
ToolsMgr::ToBeImported( const string& sFile, STRVECTOR& vsToolsNames, INTVECTOR& vToolsTypes)
ToolsMgr::ToBeImported( const string& sFile, STRVECTOR& vsToolsNames, INTVECTOR& vToolsTypes) const
{
Scanner TheScanner ;
if ( ! TheScanner.Init( sFile, ";")) {
@@ -911,7 +935,7 @@ ToolsMgr::ToBeImported( const string& sFile, STRVECTOR& vsToolsNames, INTVECTOR&
int nToolSize = 0 ;
int nTotal = 0 ;
bool bEnd = false ;
if ( ! LoadHeader( TheScanner, nVersion, nToolSize, nTotal, bEnd)){
if ( ! LoadHeader( TheScanner, nVersion, nToolSize, nTotal, bEnd)) {
LOG_ERROR( GetEMkLogger(), "Tools ToBeImported : Error on Header") ;
}
@@ -960,7 +984,7 @@ ToolsMgr::ToBeImported( const string& sFile, STRVECTOR& vsToolsNames, INTVECTOR&
}
// aggiungo ultimo tool se ok
if ( bAdd && bToolType && bToolName) {
if ( bAdd && bToolType && bToolName) {
vsToolsNames.push_back( sName) ;
vToolsTypes.push_back( stoi( sType)) ;
}
@@ -986,14 +1010,14 @@ ToolsMgr::Import( const string& sFile, const STRVECTOR& vsToolsToImport, const S
return false ;
}
}
// Verfico che il nome non sia ripetuto nella lista dei vsToolsNames
// Verifico che il nome non sia ripetuto nella lista dei vsToolsNames
if ( i != vsToolsNames.size() - 1 && find( vsToolsNames.begin() + i + 1, vsToolsNames.end(), vsToolsNames[i]) != vsToolsNames.end()) {
LOG_ERROR( GetEMkLogger(), ( " Error : name \"" + vsToolsNames[i] + "\" is already used").c_str()) ;
return false ;
}
}
// sFile directory
// File directory
size_t pos = sFile.rfind( "\\") ;
if ( pos == string::npos)
return false ;
@@ -1018,7 +1042,7 @@ ToolsMgr::Import( const string& sFile, const STRVECTOR& vsToolsToImport, const S
// leggo i tool
string sLine ;
if( ! TheScanner.GetLine( sLine))
if ( ! TheScanner.GetLine( sLine))
return false ;
if ( sLine.front() != '[' || sLine.back() != ']')
return false ;
@@ -1032,7 +1056,7 @@ ToolsMgr::Import( const string& sFile, const STRVECTOR& vsToolsToImport, const S
vector<string>::const_iterator it = find( vsToolsToImport.begin(), vsToolsToImport.end(), tData.m_sName) ;
// Se il tool non deve essere importato proseguo con il successivo
if ( it == vsToolsToImport.end())
if ( it == vsToolsToImport.end())
continue ;
// Se errore nel leggere il tool, proseguo con il successivo
@@ -1085,7 +1109,7 @@ ToolsMgr::Import( const string& sFile, const STRVECTOR& vsToolsToImport, const S
//--------------------------------------------------------------------------
bool
ToolsMgr::ReadTool( Scanner& TheScanner, ToolData& tData, const int& nToolSize) const
ToolsMgr::ReadTool( Scanner& TheScanner, ToolData& tData, int nToolSize) const
{
string sLine ;
TheScanner.GetLine( sLine) ;
@@ -1122,49 +1146,56 @@ ToolsMgr::ReadTool( Scanner& TheScanner, ToolData& tData, const int& nToolSize)
//----------------------------------------------------------------------------
bool
ToolsMgr::CopyToolDraw( const string& sDraw, const string& sOutDraw, const string& sToolName)
ToolsMgr::CopyToolDraw( const string& sDraw, const string& sOutDraw, const string& sToolName) const
{
// se il file del disegno esiste lo copio nella nuova cartella
if ( ExistsFile( sDraw)){
if ( ExistsFile( sDraw)) {
if ( ! CopyFileEgt( sDraw, sOutDraw)) {
string sOut = " Error in copying " + sToolName + " draw" ;
LOG_ERROR( GetEMkLogger(), sOut.c_str()) ;
return false ;
}
}
else {
// se il file non esiste e non è standard restituisco errore
if ( ! IsUUID( GetFileTitleEgt( sDraw))) {
string sOut = " Error : " + sToolName + " draw not found" ;
LOG_ERROR( GetEMkLogger(), sOut.c_str()) ;
return false ;
}
// se il file non esiste ma è standard lo ricreo
else {
int nGenCtx = ExeGetCurrentContext() ;
int nToolCtx = ExeInitContext() ;
bool bOk = SetCurrTool( sToolName) ; // setto il tool corrente per farne il disegno
if ( ! bOk){
string sOut = " Error in " + sToolName + " draw" ;
LOG_ERROR( GetEMkLogger(), sOut.c_str()) ;
return false ;
}
if ( ExeTdbCurrToolDraw( nGenCtx, nToolCtx)) {
string sOut = " Error : " + sToolName + " CurrToolDraw" ;
LOG_ERROR( GetEMkLogger(), sOut.c_str()) ;
return false ;
}
if ( ! ExeSaveFile( sOutDraw, GDB_SV_CMPTXT)) {
string sOut = " Error : saving " + sToolName + " tool draw" ;
LOG_ERROR( GetEMkLogger(), sOut.c_str()) ;
return false ;
}
ExeSetCurrentContext( nGenCtx) ;
ExeDeleteContext( nToolCtx) ;
}
return true ;
}
return true ;
// se il file non esiste e non è standard restituisco errore
if ( ! IsUUID( GetFileTitleEgt( sDraw))) {
string sOut = " Error : " + sToolName + " draw not found" ;
LOG_ERROR( GetEMkLogger(), sOut.c_str()) ;
return false ;
}
// altrimenti il file non esiste ma è standard lo ricreo
// recupero indice contesto corrente e creo nuovo contesto per disegno utensile
int nGenCtx = ExeGetCurrentContext() ;
int nToolCtx = ExeInitContext() ;
// salvo dati utensile corrente
bool bCurrToolOld = m_bCurrTool ;
ToolData tdCurrToolOld = m_tdCurrTool ;
// imposto utensile da esportare come corrente
bool bOk = true ;
if ( bOk && ! const_cast<ToolsMgr*>(this)->SetCurrTool( sToolName)) {
string sOut = " Error in " + sToolName + " draw" ;
LOG_ERROR( GetEMkLogger(), sOut.c_str()) ;
bOk = false ;
}
if ( bOk && ExeTdbCurrToolDraw( nGenCtx, nToolCtx) != 0) {
string sOut = " Error : " + sToolName + " CurrToolDraw" ;
LOG_ERROR( GetEMkLogger(), sOut.c_str()) ;
bOk = false ;
}
if ( bOk && ! ExeSaveFile( sOutDraw, GDB_SV_CMPTXT)) {
string sOut = " Error : saving " + sToolName + " tool draw" ;
LOG_ERROR( GetEMkLogger(), sOut.c_str()) ;
bOk = false ;
}
// ripristino utensile corrente
const_cast<ToolsMgr*>(this)->m_bCurrTool = bCurrToolOld ;
const_cast<ToolsMgr*>(this)->m_tdCurrTool = tdCurrToolOld ;
// ripristino contesto corrente e cancello quello creato ad hoc
ExeSetCurrentContext( nGenCtx) ;
ExeDeleteContext( nToolCtx) ;
return bOk ;
}
+8 -8
View File
@@ -56,26 +56,26 @@ class ToolsMgr
bool GetCurrToolParam( int nType, double& dVal) const ;
bool GetCurrToolParam( int nType, std::string& sVal) const ;
template <class T> bool GetCurrToolValInNotes( int nType, const std::string& sKey, T& Val) const ;
bool UpdateCurrToolHolderData( double dTHoldBase, double dTHoldLen, double dTHoldDiam) ;
bool GetCurrToolMaxDepth( double dSafe, double& dMaxDepth) const ;
bool GetCurrToolThDiam( double& dThDiam) const ;
bool GetCurrToolThLength( double& dThLen) const ;
const ToolData* GetCurrTool(void) const
{ return (m_bCurrTool ? &m_tdCurrTool : nullptr) ; }
bool Export( const STRVECTOR& vsToolsNames, const std::string& sOutFile, bool bCompressed = true) ;
bool ToBeImported( const std::string& sFile, STRVECTOR& vsToolsNames, INTVECTOR& vToolsTypes) ;
bool Export( const STRVECTOR& vsToolsNames, const std::string& sOutFile, bool bCompressed = true) const ;
bool ToBeImported( const std::string& sFile, STRVECTOR& vsToolsNames, INTVECTOR& vToolsTypes) const ;
bool Import( const std::string& sFile, const STRVECTOR& vsToolsToImport, const STRVECTOR& vsToolsNames, STRVECTOR& vsImported) ;
private :
bool Clear( void) ;
bool LoadHeader( Scanner& TheScanner, int& nVersion, int& nToolSize, int& nTotal, bool& bEnd) ;
bool LoadOneTool( Scanner& TheScanner, int nToolSize, bool& bEnd) ;
bool LoadHeader( Scanner& TheScanner, int& nVersion, int& nToolSize, int& nTotal, bool& bEnd) const ;
bool LoadOneTool( Scanner& TheScanner, int nToolSize, ToolData& tData, bool& bEnd) const ;
bool SaveHeader( Writer& TheWriter) const ;
bool SaveOneTool( const EgtUUID& Uuid, int& nCounter, Writer& TheWriter) const ;
bool VerifyTool( int nFamily, std::string& sName, int& nType) const ;
bool UpdateCurrToolHolderData( void) ;
bool ExportOneTool( const std::string& sToolName, Writer& TheWriter, const int& nCounter, const std::string& sOutDir) ;
bool ReadTool( Scanner& TheScanner, ToolData& tData, const int& nToolSize) const ;
bool CopyToolDraw( const std::string& sDraw, const std::string& sOutDraw, const std::string& sToolName) ;
bool ExportOneTool( const std::string& sToolName, Writer& TheWriter, int nCounter, const std::string& sOutDir) const ;
bool ReadTool( Scanner& TheScanner, ToolData& tData, int nToolSize) const ;
bool CopyToolDraw( const std::string& sDraw, const std::string& sOutDraw, const std::string& sToolName) const ;
private :
typedef std::unordered_map< EgtUUID, ToolData> UUIDTDATA_UMAP ;
+341 -167
View File
@@ -28,7 +28,9 @@
#include "/EgtDev/Include/EGkSfrCreate.h"
#include "/EgtDev/Include/EGkSurfTriMesh.h"
#include "/EgtDev/Include/EGkExtText.h"
#include "/EgtDev/Include/EGkDistPointCurve.h"
#include "/EgtDev/Include/EGkUserObjFactory.h"
#include "/EgtDev/Include/EGkStringUtils3d.h"
#include "/EgtDev/Include/EGnStringKeyVal.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
@@ -89,6 +91,7 @@ WaterJetting::Clone( void) const
pWJ->m_nPhase = m_nPhase ;
pWJ->m_Params = m_Params ;
pWJ->m_TParams = m_TParams ;
pWJ->m_dTHoldBase = m_dTHoldBase ;
pWJ->m_dTHoldLen = m_dTHoldLen ;
pWJ->m_dTHoldDiam = m_dTHoldDiam ;
pWJ->m_dElev = m_dElev ;
@@ -207,6 +210,7 @@ WaterJetting::WaterJetting( void)
m_Params.m_sToolName = "*" ;
m_TParams.m_sName = "*" ;
m_TParams.m_sHead = "*" ;
m_dTHoldBase = 0 ;
m_dTHoldLen = 0 ;
m_dTHoldDiam = 0 ;
m_dElev = 0 ;
@@ -563,6 +567,8 @@ WaterJetting::Preview( bool bRecalc)
}
// recupero i dati del portautensile
int nToolId = m_pMchMgr->GetCalcTool() ;
m_dTHoldBase = 0 ;
m_pGeomDB->GetInfo( nToolId, TTH_BASE, m_dTHoldBase) ;
m_dTHoldLen = 0 ;
m_pGeomDB->GetInfo( nToolId, TTH_LEN, m_dTHoldLen) ;
m_dTHoldDiam = 0 ;
@@ -625,8 +631,14 @@ WaterJetting::Apply( bool bRecalc, bool bPostApply)
// verifico se necessario continuare nell'aggiornamento
if ( ! bRecalc && ! bToolChanged &&
( m_nStatus == MCH_ST_OK || ( ! bPostApply && m_nStatus == MCH_ST_NO_POSTAPPL))) {
// confermo i percorsi di lavorazione
m_nMills = nCurrMills ;
LOG_DBG_INFO( GetEMkLogger(), "Milling apply skipped : status already ok") ;
// eseguo aggiornamento assi macchina e collegamento con operazione precedente
if ( ! Update( bPostApply))
return false ;
LOG_DBG_INFO( GetEMkLogger(), "Update done") ;
// esco con successo
return true ;
}
m_nStatus = MCH_ST_TO_VERIFY ;
@@ -656,6 +668,8 @@ WaterJetting::Apply( bool bRecalc, bool bPostApply)
}
// recupero i dati del portautensile
int nToolId = m_pMchMgr->GetCalcTool() ;
m_dTHoldBase = 0 ;
m_pGeomDB->GetInfo( nToolId, TTH_BASE, m_dTHoldBase) ;
m_dTHoldLen = 0 ;
m_pGeomDB->GetInfo( nToolId, TTH_LEN, m_dTHoldLen) ;
m_dTHoldDiam = 0 ;
@@ -707,6 +721,8 @@ WaterJetting::Apply( bool bRecalc, bool bPostApply)
// dichiaro successiva da aggiornare
UpdateFollowingOperationsStatus( MCH_ST_OTH_MODIF) ;
LOG_DBG_INFO( GetEMkLogger(), "WaterJetting apply done") ;
return true ;
}
@@ -724,15 +740,11 @@ WaterJetting::Update( bool bPostApply)
return true ;
}
// elimino le entità CLIMB, RISE e HOME della lavorazione, potrebbero falsare i calcoli degli assi (in ogni casi vengono riaggiunte dopo)
RemoveClimbRiseHome() ;
// imposto eventuale asse bloccato da lavorazione
if ( ! m_Params.m_sBlockedAxis.empty()) {
string sAxis, sVal ;
Split( m_Params.m_sBlockedAxis, "=", true, sAxis, sVal) ;
double dVal = 0 ;
FromString( sVal, dVal) ;
m_pMchMgr->ClearRotAxisBlock() ;
m_pMchMgr->SetRotAxisBlock( sAxis, dVal) ;
}
SetBlockedRotAxis( m_Params.m_sBlockedAxis) ;
// calcolo gli assi macchina
string sHint = ExtractHint( m_Params.m_sUserNotes) ;
@@ -955,11 +967,31 @@ WaterJetting::UpdateToolData( bool* pbChanged)
const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ;
if ( pTdata == nullptr)
return false ;
// verifico se sono diversi (ad esclusione del nome)
m_TParams.m_sName = pTdata->m_sName ;
bool bChanged = ! SameTool( m_TParams, *pTdata) ;
// salvo posizione TC, testa e uscita originali
string sOrigTcPos = m_TParams.m_sTcPos ;
string sOrigHead = m_TParams.m_sHead ;
int nOrigExit = m_TParams.m_nExit ;
// verifico se sono diversi (ad esclusione di nome, posizione TC, testa e uscita)
bool bChanged = ( ! SameTool( m_TParams, *pTdata, false)) ;
// aggiorno comunque i parametri
m_TParams = *pTdata ;
// se definito attrezzaggio, aggiorno i parametri che ne possono derivare
string sTcPos ; string sHead ; int nExit ;
if ( m_pMchMgr->GetCurrSetupMgr().GetToolData( m_TParams.m_sName, sTcPos, sHead, nExit)) {
if ( sOrigTcPos != sTcPos ||
sOrigHead != sHead ||
nOrigExit != nExit)
bChanged = true ;
m_TParams.m_sTcPos = sTcPos ;
m_TParams.m_sHead = sHead ;
m_TParams.m_nExit = nExit ;
}
else {
if ( sOrigTcPos != pTdata->m_sTcPos ||
sOrigHead != pTdata->m_sHead ||
nOrigExit != pTdata->m_nExit)
bChanged = true ;
}
// eventuali segnalazioni
if ( ! EqualNoCase( m_Params.m_sToolName, m_TParams.m_sName)) {
string sInfo = "Warning in WaterJetting : tool name changed (" +
@@ -1176,6 +1208,11 @@ WaterJetting::Chain( int nGrpDestId)
vInds.emplace_back( Id) ;
}
}
// verifico se sono necessarie sistemazioni per collegamenti (bridges)
if ( abs( m_Params.m_dSideAngle) < EPS_ANG_SMALL &&
m_pGeomDB->GetFirstNameInGroup( m_pMchMgr->GetCurrMachGroup(), MACH_BRIDGES_GROUP) != GDB_ID_NULL) {
AdjustCurvesForBridges( vpCrvs, vInds) ;
}
// preparo i dati per il concatenamento
bool bFirst = true ;
Point3d ptNear = ORIG ;
@@ -1262,6 +1299,108 @@ WaterJetting::Chain( int nGrpDestId)
return true ;
}
//----------------------------------------------------------------------------
bool
WaterJetting::AdjustCurvesForBridges( ICURVEPOVECTOR& vpCrvs, SELVECTOR& vInds)
{
// Gruppo dei collegamenti
struct Bridge {
int nId ;
int nEnt1 ;
int nEnt2 ;
double dWidth ;
Point3d ptP1 ;
Point3d ptP2 ;
Bridge( int nI, int nE1, int nE2, double dW, const Point3d& ptQ1, const Point3d& ptQ2)
: nId( nI), nEnt1( nE1), nEnt2( nE2), dWidth( dW), ptP1( ptQ1), ptP2( ptQ2) {}
} ;
vector<Bridge> vBridges ;
int nBridGrpId = m_pGeomDB->GetFirstNameInGroup( m_pMchMgr->GetCurrMachGroup(), MACH_BRIDGES_GROUP) ;
int nBridgeId = m_pGeomDB->GetFirstInGroup( nBridGrpId) ;
while ( nBridgeId != GDB_ID_NULL) {
int nEnt1, nEnt2 ;
double dWidth ;
Point3d ptP1, ptP2 ;
if ( m_pGeomDB->GetInfo( nBridgeId, "EntStart", nEnt1) &&
m_pGeomDB->GetInfo( nBridgeId, "EntEnd", nEnt2) &&
m_pGeomDB->GetInfo( nBridgeId, "BridgeW", dWidth) &&
ExeStartPoint( nBridgeId, GDB_ID_ROOT, ptP1) &&
ExeEndPoint( nBridgeId, GDB_ID_ROOT, ptP2)) {
vBridges.emplace_back( nBridgeId, nEnt1, nEnt2, dWidth, ptP1, ptP2) ;
}
nBridgeId = m_pGeomDB->GetNext( nBridgeId) ;
}
// Verifico i collegamenti che interessano le geometrie della lavorazione
for ( int i = 0 ; i < int( vBridges.size()) ; ++ i) {
// cerco le due curve interessate dal collegamento
int nI1 = -1 ;
for ( int j = 0 ; j < int( vInds.size()) ; ++ j) {
if ( vInds[j].nId == vBridges[i].nEnt1) {
nI1 = j ;
break ;
}
}
int nI2 = -1 ;
for ( int j = 0 ; j < int( vInds.size()) ; ++ j) {
if ( vInds[j].nId == vBridges[i].nEnt2) {
nI2 = j ;
break ;
}
}
if ( nI1 == -1 || nI2 == -1)
continue ;
// calcolo e verifico la posizione dei punti di collegamento sulle due curve
double const DIST_MAX = 5 ;
double dDist1, dU1, dLenP1, dLen1 ; int nF1 ;
DistPointCurve distPC1( vBridges[i].ptP1, *vpCrvs[nI1]) ;
if ( ! distPC1.GetDist( dDist1) || dDist1 > DIST_MAX ||
! distPC1.GetParamAtMinDistPoint( 0, dU1, nF1) ||
! vpCrvs[nI1]->GetLengthAtParam( dU1, dLenP1) ||
! vpCrvs[nI1]->GetLength( dLen1) ||
dLenP1 < vBridges[i].dWidth + m_TParams.m_dDiam ||
( dLen1 - dLenP1) < vBridges[i].dWidth + m_TParams.m_dDiam)
continue ;
double dDist2, dU2, dLenP2, dLen2 ; int nF2 ;
DistPointCurve distPC2( vBridges[i].ptP2, *vpCrvs[nI2]) ;
if ( ! distPC2.GetDist( dDist2) || dDist2 > DIST_MAX ||
! distPC2.GetParamAtMinDistPoint( 0, dU2, nF2) ||
! vpCrvs[nI2]->GetLengthAtParam( dU2, dLenP2) ||
! vpCrvs[nI2]->GetLength( dLen2) ||
dLenP2 < vBridges[i].dWidth + m_TParams.m_dDiam ||
( dLen2 - dLenP2) < vBridges[i].dWidth + m_TParams.m_dDiam)
continue ;
// spezzo le curve nei punti del collegamento e creo i segmenti di collegamento
PtrOwner<ICurve> pCopy1( vpCrvs[nI1]->Clone()) ;
PtrOwner<ICurve> pCopy2( vpCrvs[nI2]->Clone()) ;
PtrOwner<ICurveLine> pLinkA( CreateCurveLine()) ;
PtrOwner<ICurveLine> pLinkB( CreateCurveLine()) ;
if ( IsNull( pCopy1) || IsNull( pCopy2) || IsNull( pLinkA) || IsNull( pLinkB))
continue ;
vpCrvs[nI1]->TrimEndAtLen( dLenP1 - vBridges[i].dWidth / 2) ;
pCopy1->TrimStartAtLen( dLenP1 + vBridges[i].dWidth / 2) ;
vpCrvs[nI2]->TrimEndAtLen( dLenP2 - vBridges[i].dWidth / 2) ;
pCopy2->TrimStartAtLen( dLenP2 + vBridges[i].dWidth / 2) ;
Point3d ptAs ; vpCrvs[nI1]->GetEndPoint( ptAs) ;
Point3d ptAe ; pCopy2->GetStartPoint( ptAe) ;
pLinkA->Set( ptAs, ptAe) ;
Point3d ptBs ; vpCrvs[nI2]->GetEndPoint( ptBs) ;
Point3d ptBe ; pCopy1->GetStartPoint( ptBe) ;
pLinkB->Set( ptBs, ptBe) ;
// inserisco le nuove curve nel vettore delle curve e aggiorno il vettore degli indici
vpCrvs.emplace_back( Release( pCopy1)) ;
vInds.emplace_back( vInds[nI1]) ;
vpCrvs.emplace_back( Release( pCopy2)) ;
vInds.emplace_back( vInds[nI2]) ;
vpCrvs.emplace_back( Release( pLinkA)) ;
vInds.emplace_back( 0, 0) ;
vpCrvs.emplace_back( Release( pLinkB)) ;
vInds.emplace_back( 0, 0) ;
}
return true ;
}
//----------------------------------------------------------------------------
bool
WaterJetting::VerifySideAngle( void)
@@ -1366,8 +1505,10 @@ WaterJetting::ProcessPath( int nPathId, int nPvId, int nClId)
nStart = 2 ;
else if ( sMyNotes.find( "START=YM") != string::npos)
nStart = -2 ;
else if ( sMyNotes.find( "START=") != string::npos)
nStart = 11 ;
// se richiesta sistemazione punto di inizio
if ( nStart != 0) {
if ( nStart != 0 && nStart != 11) {
const double COS_ANG_PERD_TG = cos( 5 * DEGTORAD) ;
const double DIST_SIC_WJ_LIO = 2 ;
double dMinLen = m_Params.m_dOverlap + 2 * DIST_SIC_WJ_LIO ;
@@ -1426,6 +1567,18 @@ WaterJetting::ProcessPath( int nPathId, int nPvId, int nClId)
if ( dMin >= 0)
pCompo->ChangeStartPoint( dMin) ;
}
// se altrimenti suggerito punto di inizio
else if ( nStart == 11) {
ReplaceString( sMyNotes, "(", "") ;
ReplaceString( sMyNotes, ")", "") ;
Point3d ptStart ;
double dPar ;
int nFlag ;
if ( GetValInNotes( sMyNotes, "START", ptStart) &&
DistPointCurve( ptStart, *pCompo).GetParamAtMinDistPoint( 0, dPar, nFlag)) {
pCompo->ChangeStartPoint( dPar) ;
}
}
}
// eventuali allungamenti/accorciamenti per percorso aperto o chiuso senza sovrapposizione
@@ -1523,18 +1676,12 @@ WaterJetting::ProcessPath( int nPathId, int nPvId, int nClId)
m_pGeomDB->GetName( nPathId, sPathName) ;
// eventuale approssimazione con segmenti di retta
int nSplitArcs = m_pMchMgr->GetCurrMachiningsMgr()->GetSplitArcs() ;
bool bSplitArcs = ( nSplitArcs == SPLAR_ALWAYS ||
( nSplitArcs == SPLAR_NO_XY_PLANE && ! vtTool.IsZplus()) ||
( nSplitArcs == SPLAR_GEN_PLANE && vtTool.IsGeneric())) ;
if ( bSplitArcs && ! ApproxWithLines( pCompo)) {
m_pMchMgr->SetLastError( 3211, "Error in WaterJetting : Linear Approx not computable") ;
return false ;
bool bSplitArcs = GetSplitArcs( vtTool) ;
if ( ! bSplitArcs) {
// verifiche sull'ampiezza dell'angolo al centro degli eventuali archi
VerifyArcs( pCompo) ;
}
// verifiche sull'ampiezza dell'angolo al centro degli eventuali archi
VerifyArcs( pCompo) ;
// se abilitato probing, verifico lunghezza entità ed eventualmente le divido
if ( m_Params.m_bProbing)
VerifyMaxLenCurves( pCompo, m_Params.m_dProbingMaxDist) ;
@@ -1627,8 +1774,8 @@ WaterJetting::GeneratePreView( int nPathId, const ICurveComposite* pCompo, doubl
// calcolo la regione
PtrOwner<ISurfFlatRegion> pSfr ;
double dSideCoeff = ( abs( m_Params.m_dSideAngle) > EPS_ANG_SMALL ? 1. / cos( m_Params.m_dSideAngle * DEGTORAD) : 1) ;
double Rad = 0.5 * m_TParams.m_dDiam * dSideCoeff ;
pSfr.Set( GetSurfFlatRegionFromFatCurve( Release( pCrv), Rad, false, false)) ;
double dRad = 0.5 * m_TParams.m_dDiam * dSideCoeff ;
pSfr.Set( GetSurfFlatRegionFromFatCurve( Release( pCrv), dRad, false, false)) ;
if ( IsNull( pSfr))
return false ;
// aggiungo eventuale attacco
@@ -1640,32 +1787,18 @@ WaterJetting::GeneratePreView( int nPathId, const ICurveComposite* pCompo, doubl
// aggiungo eventuali anelli su angoli esterni
if ( ! AddLoopsPreview( pCompo, pSfr))
return false ;
// ne recupero il contorno
PtrOwner< ICurve> pCrv2 ;
pCrv2.Set( pSfr->GetLoop( 0, 0)) ;
if ( IsNull( pCrv2))
return false ;
// inserisco la curva nel DB
int nC2Id = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nPathId, Release( pCrv2)) ;
if ( nC2Id == GDB_ID_NULL)
return false ;
// assegno nome e colore
m_pGeomDB->SetName( nC2Id, MCH_PV_CUT) ;
m_pGeomDB->SetMaterial( nC2Id, colCut) ;
// eventuali altri contorni ( interni di contornatura chiusa)
const int MAX_INT_LOOP = 1000 ;
for ( int i = 1 ; i <= MAX_INT_LOOP ; ++i) {
PtrOwner< ICurve> pCrv3 ;
pCrv3.Set( pSfr->GetLoop( 0, i)) ;
if ( IsNull( pCrv3))
break ;
// ne recupero i contorni
for ( int i = 0 ; i < pSfr->GetLoopCount( 0) ; ++i) {
PtrOwner<ICurve> pCrv2( pSfr->GetLoop( 0, i)) ;
if ( IsNull( pCrv2))
return false ;
// inserisco la curva nel DB
int nC3Id = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nPathId, Release( pCrv3)) ;
if ( nC3Id == GDB_ID_NULL)
int nC2Id = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nPathId, Release( pCrv2)) ;
if ( nC2Id == GDB_ID_NULL)
return false ;
// assegno nome e colore
m_pGeomDB->SetName( nC3Id, MCH_PV_CUT) ;
m_pGeomDB->SetMaterial( nC3Id, colCut) ;
m_pGeomDB->SetName( nC2Id, MCH_PV_CUT) ;
m_pGeomDB->SetMaterial( nC2Id, colCut) ;
}
// inserisco la regione nel DB
int nRId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nPathId, Release( pSfr)) ;
@@ -1679,10 +1812,11 @@ WaterJetting::GeneratePreView( int nPathId, const ICurveComposite* pCompo, doubl
return false ;
m_pGeomDB->SetName( nRrId, MCH_PV_RRCUT) ;
m_pGeomDB->SetMaterial( nRrId, INVISIBLE) ;
// eventuali ripetizioni in basso per tagli inclinati
if ( abs( m_Params.m_dSideAngle) > EPS_ANG_SMALL) {
// creo copia della curva composita
PtrOwner< ICurve> pCrv( pCompo->Clone()) ;
PtrOwner<ICurveComposite> pCrv( pCompo->Clone()) ;
if ( IsNull( pCrv))
return false ;
// rimuovo eventuale overlap
@@ -1691,98 +1825,114 @@ WaterJetting::GeneratePreView( int nPathId, const ICurveComposite* pCompo, doubl
pCrv->TrimStartAtLen( dAddedOverlap) ;
pCrv->Invert() ;
}
ICURVEPOVECTOR vpCrvs ;
if ( m_Params.m_dSideAngle < 0) {
// se inclinazione negativa devo considerare separatamente ogni sottocurva della composita
vpCrvs.reserve( pCrv->GetCurveCount()) ;
for ( int i = 0 ; i < pCrv->GetCurveCount() ; i++)
vpCrvs.emplace_back( pCrv->GetCurve( i)->Clone()) ;
}
else {
// se inclinazione positiva posso considerare la curva completa
vpCrvs.emplace_back( pCrv->Clone()) ;
}
// offset per raggio utensile
double dRad = 0.5 * m_TParams.m_dDiam / cos( m_Params.m_dSideAngle * DEGTORAD) ;
double dSignOffs1 = dRad ;
double dSignOffs1 = dRad ;
if ( ( m_Params.m_nWorkSide == WJET_WS_RIGHT && m_Params.m_dSideAngle > 0) ||
( m_Params.m_nWorkSide == WJET_WS_LEFT && m_Params.m_dSideAngle < 0))
dSignOffs1 = - dSignOffs1 ;
OffsetCurve OffsCrv1 ;
OffsCrv1.Make( pCrv, dSignOffs1, ICurve::OFF_FILLET) ;
PtrOwner< ICurve> pOffs1( OffsCrv1.GetLongerCurve()) ;
if ( IsNull( pOffs1))
return false ;
// offset per inclinazione
double dSignOffs2 = dRad + m_dElev * abs( sin( m_Params.m_dSideAngle * DEGTORAD)) ;
if ( ( m_Params.m_nWorkSide == WJET_WS_RIGHT && m_Params.m_dSideAngle < 0) ||
( m_Params.m_nWorkSide == WJET_WS_LEFT && m_Params.m_dSideAngle > 0))
dSignOffs2 = - dSignOffs2 ;
OffsetCurve OffsCrv2 ;
OffsCrv2.Make( pCrv, dSignOffs2, ICurve::OFF_EXTEND) ;
PtrOwner< ICurve> pOffs2( OffsCrv2.GetLongerCurve()) ;
if ( IsNull( pOffs2))
return false ;
// calcolo la regione
PtrOwner<ISurfFlatRegion> pSfr ;
// se i due offset sono aperti
if ( ! pOffs1->IsClosed() && ! pOffs2->IsClosed()) {
// li unisco
PtrOwner<ICurveComposite> pBound( CreateCurveComposite()) ;
if ( IsNull( pBound))
return false ;
pBound->AddCurve( Release( pOffs1)) ;
pOffs2->Invert() ;
Point3d ptStart ; pOffs2->GetStartPoint( ptStart) ;
pBound->AddLine( ptStart) ;
pBound->AddCurve( Release( pOffs2)) ;
pBound->Close() ;
// creo la regione
SurfFlatRegionByContours SfrCntr( false, false) ;
SfrCntr.AddCurve( Release( pBound)) ;
pSfr.Set( SfrCntr.GetSurf()) ;
}
// altrimenti sono chiusi
else {
// creo la regione
SurfFlatRegionByContours SfrCntr( false, false) ;
SfrCntr.AddCurve( Release( pOffs1)) ;
SfrCntr.AddCurve( Release( pOffs2)) ;
pSfr.Set( SfrCntr.GetSurf()) ;
}
PtrOwner<ISurfFlatRegion> pSfr( CreateSurfFlatRegion()) ;
if ( IsNull( pSfr))
return false ;
for ( int i = 0 ; i < int( vpCrvs.size()) ; i++) {
OffsetCurve OffsCrv1 ;
OffsCrv1.Make( vpCrvs[i], dSignOffs1, ICurve::OFF_FILLET) ;
PtrOwner< ICurve> pOffs1( OffsCrv1.GetLongerCurve()) ;
if ( IsNull( pOffs1))
return false ;
OffsetCurve OffsCrv2 ;
OffsCrv2.Make( vpCrvs[i], dSignOffs2, ICurve::OFF_EXTEND) ;
PtrOwner< ICurve> pOffs2( OffsCrv2.GetLongerCurve()) ;
if ( IsNull( pOffs2))
return false ;
// calcolo la regione corrente
PtrOwner<ISurfFlatRegion> pSfrCurr ;
// se i due offset sono aperti
if ( ! pOffs1->IsClosed() && ! pOffs2->IsClosed()) {
// li unisco
PtrOwner<ICurveComposite> pBound( CreateCurveComposite()) ;
if ( IsNull( pBound))
return false ;
pBound->AddCurve( Release( pOffs1)) ;
pOffs2->Invert() ;
Point3d ptStart ; pOffs2->GetStartPoint( ptStart) ;
pBound->AddLine( ptStart) ;
pBound->AddCurve( Release( pOffs2)) ;
pBound->Close() ;
// creo la regione
SurfFlatRegionByContours SfrCntr( false, false) ;
SfrCntr.AddCurve( Release( pBound)) ;
pSfrCurr.Set( SfrCntr.GetSurf()) ;
}
// altrimenti sono chiusi
else {
// creo la regione
SurfFlatRegionByContours SfrCntr( false, false) ;
SfrCntr.AddCurve( Release( pOffs1)) ;
SfrCntr.AddCurve( Release( pOffs2)) ;
pSfrCurr.Set( SfrCntr.GetSurf()) ;
}
if ( IsNull( pSfrCurr))
return false ;
// aggiungo alla superficie complessiva
if ( pSfr->IsValid())
pSfr->Add( *pSfrCurr) ;
else
pSfr.Set( Release( pSfrCurr)) ;
}
// la regione deve essere rivolta verso Z+
if ( pSfr->GetNormVersor().z < 0)
pSfr->Invert() ;
// ne recupero il contorno
PtrOwner< ICurve> pCrv2 ;
pCrv2.Set( pSfr->GetLoop( 0, 0)) ;
if ( IsNull( pCrv2))
return false ;
// inserisco la curva nel DB
int nC2Id = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nPathId, Release( pCrv2)) ;
if ( nC2Id == GDB_ID_NULL)
return false ;
// assegno nome e colore
m_pGeomDB->SetName( nC2Id, MCH_PV_DOWN_CUT) ;
m_pGeomDB->SetMaterial( nC2Id, colCut) ;
// eventuali altri contorni ( interni di contornatura chiusa)
const int MAX_INT_LOOP = 1000 ;
for ( int i = 1 ; i <= MAX_INT_LOOP ; ++i) {
PtrOwner< ICurve> pCrv3 ;
pCrv3.Set( pSfr->GetLoop( 0, i)) ;
if ( IsNull( pCrv3))
break ;
// inserisco la curva nel DB
int nC3Id = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nPathId, Release( pCrv3)) ;
if ( nC3Id == GDB_ID_NULL)
// aggiungo eventuali loops
AddLoopsPreview( pCrv, pSfr) ;
// ne recupero i contorni
for ( int i = 0 ; i < pSfr->GetLoopCount( 0) ; ++i) {
PtrOwner<ICurve> pCrv2( pSfr->GetLoop( 0, i)) ;
if ( IsNull( pCrv2))
return false ;
// assegno nome e colore
m_pGeomDB->SetName( nC3Id, MCH_PV_DOWN_CUT) ;
m_pGeomDB->SetMaterial( nC3Id, colCut) ;
// inserisco la curva nel DB
int nC2Id = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nPathId, Release( pCrv2)) ;
if ( nC2Id == GDB_ID_NULL)
return false ;
// assegno nome e colore
m_pGeomDB->SetName( nC2Id, MCH_PV_DOWN_CUT) ;
m_pGeomDB->SetMaterial( nC2Id, colCut) ;
}
// inserisco la regione nel DB
// inserisco la regione nel DB
int nRId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nPathId, Release( pSfr)) ;
if ( nRId == GDB_ID_NULL)
return false ;
m_pGeomDB->SetName( nRId, MCH_PV_DOWN_RCUT) ;
m_pGeomDB->SetMaterial( nRId, INVISIBLE) ;
// la copio anche come regione ridotta
// la copio anche come regione ridotta
int nRrId = m_pGeomDB->Copy( nRId, GDB_ID_NULL, nPathId) ;
if ( nRrId == GDB_ID_NULL)
return false ;
m_pGeomDB->SetName( nRrId, MCH_PV_DOWN_RRCUT) ;
m_pGeomDB->SetMaterial( nRrId, INVISIBLE) ;
m_pGeomDB->SetMaterial( nRrId, INVISIBLE) ;
}
return true ;
}
@@ -1811,7 +1961,7 @@ WaterJetting::AddLeadInPreview( const ICurveComposite* pCompo, ISurfFlatRegion*
{ PtrOwner<ICurveLine> pLine( CreateCurveLine()) ;
if ( IsNull( pLine) || ! pLine->Set( ptP1, ptStart))
return false ;
pCrv.Set( Release( pLine)) ;
pCrv.Set( pLine) ;
} break ;
case WJET_LI_TANGENT :
pCrv.Set( GetArc2PVN( ptStart, ptP1, - vtStart, vtN)) ;
@@ -1880,7 +2030,7 @@ WaterJetting::AddLeadOutPreview( const ICurveComposite* pCompo, ISurfFlatRegion*
Point3d ptP1 = ptEnd + vtEnd * dTang + vtPerp * dPerp ;
if ( IsNull( pLine) || ! pLine->Set( ptEnd, ptP1))
return false ;
pCrv.Set( Release( pLine)) ;
pCrv.Set( pLine) ;
} break ;
case WJET_LO_TANGENT :
{ // calcolo punto finale dell'uscita
@@ -1930,6 +2080,11 @@ WaterJetting::AddLoopsPreview( const ICurveComposite* pCompo, ISurfFlatRegion* p
return false ;
// lunghezza tratti lineari e loro punti estremi
double dTgLen = 0.5 * m_TParams.m_dDiam * tan( 0.5 * 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) ;
dTgLen += dExtraLen ;
}
Point3d ptP ; pCrvC->GetStartPoint( ptP) ;
Point3d ptPe = ptP + vtEnd * dTgLen ;
Point3d ptPs = ptP - vtStart * dTgLen ;
@@ -1962,7 +2117,6 @@ WaterJetting::AddLoopsPreview( const ICurveComposite* pCompo, ISurfFlatRegion* p
if ( IsNull( pSfr) || ! pSPV->Add( *pSfr))
return false ;
}
}
return true ;
}
@@ -2094,7 +2248,7 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
// imposto versore correzione e ausiliario sul punto di partenza
CalcAndSetToolCorrAuxDir( pCompo, i) ;
// aggiungo approccio al punto iniziale
if ( ! AddApproach( ptP1, vtTool, dSafeZ)) {
if ( ! AddApproach( ptP1, vtTool, dSafeZ, bSplitArcs)) {
m_pMchMgr->SetLastError( 3207, "Error in WaterJetting : Approach not computable") ;
return false ;
}
@@ -2120,27 +2274,57 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
vtEnd.GetAngleXY( vtStart, dAng) ;
// Se angolo esterno e richiesto anello esterno
if ( IsExternalAngle( dAng) && m_Params.m_nExtCornerType == WJET_EC_LOOP) {
// lunghezza tratti lineari e loro punti estremi
// lunghezza tratti lineari
double dTgLen = 0.5 * m_TParams.m_dDiam * tan( 0.5 * 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) ;
dTgLen += dExtraLen ;
}
// calcolo punti estremi
Point3d ptP ; pCrvC->GetStartPoint( ptP) ;
Point3d ptPe = ptP + vtEnd * dTgLen ;
Point3d ptPs = ptP - vtStart * dTgLen ;
// tratto prima dell'anello
SetFeed( GetActualFeed()) ;
if ( AddLinearMove( ptPe) == GDB_ID_NULL)
if ( AddLinearMove( ptPe, bSplitArcs) == GDB_ID_NULL)
return false ;
// anello
PtrOwner<ICurve> pCrvA( GetArc2PVN( ptPe, ptPs, vtEnd, vtN)) ;
if ( ! IsNull( pCrvA) && pCrvA->GetType() == CRV_ARC) {
if ( AddCurveMove( pCrvA) == GDB_ID_NULL)
// 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)
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 {
if ( AddLinearMove( ptPs) == GDB_ID_NULL)
CalcAndSetToolCorrAuxDir( pCompo, i + 0.5) ;
if ( AddLinearMove( ptPs, bSplitArcs) == GDB_ID_NULL)
return false ;
}
// tratto dopo l'anello
if ( AddLinearMove( ptP) == GDB_ID_NULL)
if ( AddLinearMove( ptP, bSplitArcs) == GDB_ID_NULL)
return false ;
}
// se angolo esterno e richiesto rallentamento esterno, eseguo accelerazione
@@ -2160,7 +2344,7 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
return false ;
CalcAndSetToolCorrAuxDir( pCompo, i + dU) ;
SetFeed( ( 1 - dCoeff) * dMinFeed + dCoeff * GetActualFeed()) ;
if ( AddCurveMove( pCrvT) == GDB_ID_NULL)
if ( AddCurveMove( pCrvT, bSplitArcs) == GDB_ID_NULL)
return false ;
dUprev = dU ;
}
@@ -2202,7 +2386,7 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
Vector3d vtCorr = CalcCorrDir( pCompo, i + dU) ;
SetToolCorrAuxDir( vtTool, vtCorr) ;
SetFeed( ( 1 - dCoeff) * dMinFeed + dCoeff * GetActualFeed()) ;
if ( AddCurveMove( pCrvT) == GDB_ID_NULL)
if ( AddCurveMove( pCrvT, bSplitArcs) == GDB_ID_NULL)
return false ;
dUprev = dU ;
}
@@ -2239,7 +2423,7 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
return false ;
CalcAndSetToolCorrAuxDir( pCompo, i + dU) ;
SetFeed( ( 1 - dCoeff) * GetActualFeed() + dCoeff * dMinFeed) ;
if ( AddCurveMove( pCrvT) == GDB_ID_NULL)
if ( AddCurveMove( pCrvT, bSplitArcs) == GDB_ID_NULL)
return false ;
dUprev = dU ;
}
@@ -2282,15 +2466,22 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
Vector3d vtCorr = CalcCorrDir( pCompo, i + dU) ;
SetToolCorrAuxDir( vtTool, vtCorr) ;
SetFeed( ( 1 - dCoeff) * GetActualFeed() + dCoeff * dMinFeed) ;
if ( AddCurveMove( pCrvT) == GDB_ID_NULL)
if ( AddCurveMove( pCrvT, bSplitArcs) == GDB_ID_NULL)
return false ;
dUprev = dU ;
}
dNextFeed = dMinFeed ;
}
// se successivo non è angolo esterno ad anello imposto versore correzione e ausiliario del punto di arrivo
if ( ! IsExternalAngle( dAng) || m_Params.m_nExtCornerType != WJET_EC_LOOP)
CalcAndSetToolCorrAuxDir( pCompo, i + 1) ;
}
// imposto versore correzione e ausiliario del punto di arrivo
CalcAndSetToolCorrAuxDir( pCompo, i + 1) ;
else {
// se ultima entità imposto versore correzione e ausiliario del punto finale
CalcAndSetToolCorrAuxDir( pCompo, i + 1) ;
}
// elaborazioni sulla curva corrente
if ( pCurve->GetType() == CRV_LINE) {
ICurveLine* pLine = GetCurveLine( pCurve) ;
@@ -2303,25 +2494,20 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
}
else
++ nIdxSkip ;
if ( AddLinearMove( ptP3) == GDB_ID_NULL)
if ( AddLinearMove( ptP3, bSplitArcs) == GDB_ID_NULL)
return false ;
}
else if ( pCurve->GetType() == CRV_ARC) {
ICurveArc* pArc = GetCurveArc( pCurve) ;
Point3d ptCen = pArc->GetCenter() ;
double dAngCen = pArc->GetAngCenter() ;
Point3d ptP3 ; pArc->GetEndPoint( ptP3) ;
Point3d ptCurr ; GetCurrPos( ptCurr) ;
double dDeltaAng ; pArc->CalcPointAngle( ptCurr, dDeltaAng) ;
SetFeed( dNextFeed) ;
// controlli per indice del punto di arrivo
Point3d ptP3 ; pCurve->GetEndPoint( ptP3) ;
if ( SqDistXY( ptP3, m_ptLastProbe) >= m_Params.m_dProbingMinDist * m_Params.m_dProbingMinDist) {
SetIndex( i + 1 - nIdxSkip) ;
m_ptLastProbe = ptP3 ;
}
else
++ nIdxSkip ;
if ( AddArcMove( ptP3, ptCen, dAngCen - dDeltaAng, vtN) == GDB_ID_NULL)
if ( AddCurveMove( pCurve, bSplitArcs) == GDB_ID_NULL)
return false ;
}
// se ultima entità, uscita e retrazione
@@ -2338,7 +2524,7 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
}
// aggiungo retrazione
SetFlag( 203) ;
if ( ! AddRetract( ptP1, vtTool, dSafeZ)) {
if ( ! AddRetract( ptP1, vtTool, dSafeZ, bSplitArcs)) {
m_pMchMgr->SetLastError( 3210, "Error in WaterJetting : Retract not computable") ;
return false ;
}
@@ -2372,7 +2558,7 @@ class LeadIOStatus
//----------------------------------------------------------------------------
bool
WaterJetting::AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ)
WaterJetting::AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, bool bSplit)
{
SetFlag( 1) ;
// 1 -> punto sopra inizio
@@ -2381,18 +2567,18 @@ WaterJetting::AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dS
return false ;
// affondo al punto iniziale
SetFlag( ( m_Params.m_bLiHole ? 201 : 202)) ;
if ( AddRapidMove( ptP) == GDB_ID_NULL)
if ( AddRapidMove( ptP, bSplit) == GDB_ID_NULL)
return false ;
return true ;
}
//----------------------------------------------------------------------------
bool
WaterJetting::AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ)
WaterJetting::AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, bool bSplit)
{
// Risalgo in rapido alla quota di sicurezza
Point3d ptP4 = ptP + vtTool * dSafeZ ;
if ( AddRapidMove( ptP4) == GDB_ID_NULL)
if ( AddRapidMove( ptP4, bSplit) == GDB_ID_NULL)
return false ;
return true ;
}
@@ -2442,29 +2628,19 @@ WaterJetting::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vect
{
// Assegno il tipo
int nType = GetLeadInType() ;
double dTang = m_Params.m_dLiTang ;
// Eseguo a seconda del tipo
switch ( nType) {
case WJET_LI_NONE :
return true ;
case WJET_LI_LINEAR :
return ( AddLinearMove( ptStart, MCH_CL_LEADIN) != GDB_ID_NULL) ;
return ( AddLinearMove( ptStart, bSplitArcs, MCH_CL_LEADIN) != GDB_ID_NULL) ;
case WJET_LI_TANGENT :
{
PtrOwner<ICurve> pCrv( GetArc2PVN( ptStart, ptP1, - vtStart, vtN)) ;
if ( IsNull( pCrv))
return false ;
pCrv->Invert() ;
// eventuale spezzatura
if ( bSplitArcs) {
PtrOwner<ICurveComposite> pCompo( CreateCurveComposite()) ;
if ( IsNull( pCompo) || ! pCompo->AddCurve( Release( pCrv)) || ! ApproxWithLines( pCompo))
return false ;
return ( AddCurveMove( pCompo, MCH_CL_LEADIN) != GDB_ID_NULL) ;
}
else {
return ( AddCurveMove( pCrv, MCH_CL_LEADIN) != GDB_ID_NULL) ;
}
return ( AddCurveMove( pCrv, bSplitArcs, MCH_CL_LEADIN) != GDB_ID_NULL) ;
}
default :
return false ;
@@ -2514,7 +2690,7 @@ WaterJetting::AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vec
Vector3d vtPerp = vtEnd ;
vtPerp.Rotate( vtN, 0, ( bCcwRot ? 1 : - 1)) ;
ptP1 = ptEnd + vtEnd * dTang + vtPerp * dPerp ;
return ( AddLinearMove( ptP1, MCH_CL_LEADOUT) != GDB_ID_NULL) ;
return ( AddLinearMove( ptP1, bSplitArcs, MCH_CL_LEADOUT) != GDB_ID_NULL) ;
}
case WJET_LO_TANGENT :
{
@@ -2526,16 +2702,7 @@ WaterJetting::AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vec
PtrOwner<ICurve> pCrv( GetArc2PVN( ptEnd, ptP1, vtEnd, vtN)) ;
if ( IsNull( pCrv))
return false ;
// eventuale spezzatura
if ( bSplitArcs) {
PtrOwner<ICurveComposite> pCompo( CreateCurveComposite()) ;
if ( IsNull( pCompo) || ! pCompo->AddCurve( Release( pCrv)) || ! ApproxWithLines( pCompo))
return false ;
return ( AddCurveMove( pCompo, MCH_CL_LEADOUT) != GDB_ID_NULL) ;
}
else {
return ( AddCurveMove( pCrv, MCH_CL_LEADOUT) != GDB_ID_NULL) ;
}
return ( AddCurveMove( pCrv, bSplitArcs, MCH_CL_LEADOUT) != GDB_ID_NULL) ;
}
default :
return false ;
@@ -2769,8 +2936,15 @@ WaterJetting::CalcCorrDir( const ICurveComposite* pCompo, double dU)
bool
WaterJetting::CalcOffset( ICurveComposite* pCompo, double dSignOffs)
{
// determino opzioni di offset
int nFlag = ICurve::OFF_EXTEND ;
if ( pCompo->IsClosed()) {
Vector3d vtStart ; pCompo->GetStartDir( vtStart) ;
Vector3d vtEnd ; pCompo->GetEndDir( vtEnd) ;
if ( ! AreSameVectorEpsilon( vtStart, vtEnd, sin( 5 * DEGTORAD)))
nFlag |= ICurve::OFF_FORCE_OPEN ;
}
// eseguo offset semplice
int nFlag = ICurve::OFF_EXTEND | ICurve::OFF_FORCE_OPEN ;
if ( pCompo->SimpleOffset( dSignOffs, nFlag))
return true ;
// se curva piatta, provo con offset avanzato
@@ -2792,7 +2966,7 @@ WaterJetting::CalcOffset( ICurveComposite* pCompo, double dSignOffs)
//----------------------------------------------------------------------------
// Valore limite angolo per corner
const double ANG_CORNER = 10 ;
const double ANG_CORNER = 10 ;
//----------------------------------------------------------------------------
bool
+4 -2
View File
@@ -72,6 +72,7 @@ class WaterJetting : public Machining
bool VerifyGeometry( SelData Id, int& nSubs, int& nType) ;
bool GetCurves( SelData Id, ICURVEPLIST& lstPC) ;
bool Chain( int nGrpDestId) ;
bool AdjustCurvesForBridges( ICURVEPOVECTOR& vpCrvs, SELVECTOR& vInds) ;
bool VerifySideAngle( void) ;
bool ProcessPath( int nPathId, int nPvId, int nClId) ;
bool AdjustPathForInternalAngles( ICurveComposite* pCompo) ;
@@ -80,8 +81,8 @@ class WaterJetting : public Machining
bool AddLeadOutPreview( const ICurveComposite* pCompo, ISurfFlatRegion* pSPV) ;
bool AddLoopsPreview( const ICurveComposite* pCompo, ISurfFlatRegion* pSPV) ;
bool AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTool, bool bSplitArcs) ;
bool AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ) ;
bool AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ) ;
bool AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, bool bSplit) ;
bool AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, bool bSplit) ;
bool CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtN,
const ICurveComposite* pCompo, Point3d& ptP1) const ;
bool AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d& vtStart,
@@ -121,6 +122,7 @@ class WaterJetting : public Machining
SELVECTOR m_vId ; // identificativi entità geometriche da lavorare
WaterJettingData m_Params ; // parametri lavorazione
ToolData m_TParams ; // parametri utensile
double m_dTHoldBase ; // posizione base del porta-utensile
double m_dTHoldLen ; // lunghezza del porta-utensile
double m_dTHoldDiam ; // diametro del porta-utensile
double m_dElev ; // elevazione del percorso tenendo conto dell'angolo di fianco
+6 -2
View File
@@ -102,6 +102,10 @@ struct WaterJettingData : public MachiningData
//----------------------------------------------------------------------------
inline const WaterJettingData* GetWaterJettingData( const MachiningData* pMdata)
{ return (dynamic_cast<const WaterJettingData*>( pMdata)) ; }
{ if ( pMdata == nullptr || pMdata->GetType() != MT_WATERJETTING)
return nullptr ;
return ( static_cast<const WaterJettingData*>( pMdata)) ; }
inline WaterJettingData* GetWaterJettingData( MachiningData* pMdata)
{ return (dynamic_cast<WaterJettingData*>( pMdata)) ; }
{ if ( pMdata == nullptr || pMdata->GetType() != MT_WATERJETTING)
return nullptr ;
return ( static_cast<WaterJettingData*>( pMdata)) ; }
+1 -1
View File
@@ -33,4 +33,4 @@
#pragma comment(lib, EGTLIBDIR "EgtGeomKernel" EGTLIBVER ".lib")
#pragma comment(lib, EGTLIBDIR "EgtExecutor" EGTLIBVER ".lib")
#pragma comment(lib, EGTLIBDIR "SEgtLock" EGTLIBVER ".lib")
#pragma comment(lib, EGTEXTDIR "Lua/Lib/Lua53" EGTLIBVER ".lib")
#pragma comment(lib, EGTEXTDIR "Lua/Lib/Lua54" EGTLIBVER ".lib")