132 Commits

Author SHA1 Message Date
DarioS d86f1cf47f EgtMachKernel 2.5a3 :
- pulizia codice.
2023-01-23 16:52:25 +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
60 changed files with 9353 additions and 2717 deletions
+5 -3
View File
@@ -46,6 +46,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 +110,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 ;
+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 ;
+9 -8
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 ;
}
@@ -588,14 +596,7 @@ Chiseling::Update( bool bPostApply)
}
// 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) ;
+11 -2
View File
@@ -306,7 +306,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)
{
}
@@ -1294,6 +1294,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 +1305,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 ;
@@ -1367,6 +1368,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 +1379,7 @@ Disposition::SpecialApply( bool bRecalc)
// aggiorno stato
m_nStatus = MCH_ST_OK ;
LOG_DBG_INFO( GetEMkLogger(), "Disposition special apply ok") ;
return true ;
}
@@ -1409,6 +1415,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 ;
}
+1
View File
@@ -21,3 +21,4 @@
std::string GetEMkVer( void) ;
ILogger* GetEMkLogger( void) ;
const std::string& GetEMkKey( void) ;
bool GetEMkNetHwKey( void) ;
+16 -12
View File
@@ -544,8 +544,14 @@ Drilling::Apply( bool bRecalc, bool bPostApply)
// verifico se necessario continuare nell'aggiornamento
if ( ! bRecalc && ! bToolChanged &&
( m_nStatus == MCH_ST_OK || ( ! bPostApply && m_nStatus == MCH_ST_NO_POSTAPPL))) {
// confermo i percorsi di lavorazione
m_nDrillings = nCurrDrillings ;
LOG_DBG_INFO( GetEMkLogger(), "Drilling apply skipped : status already ok") ;
// eseguo aggiornamento assi macchina e collegamento con operazione precedente
if ( ! Update( bPostApply))
return false ;
LOG_DBG_INFO( GetEMkLogger(), "Update done") ;
// esco con successo
return true ;
}
m_nStatus = MCH_ST_TO_VERIFY ;
@@ -589,6 +595,8 @@ Drilling::Apply( bool bRecalc, bool bPostApply)
// dichiaro successiva da aggiornare
UpdateFollowingOperationsStatus( MCH_ST_OTH_MODIF) ;
LOG_DBG_INFO( GetEMkLogger(), "Drilling apply done") ;
return true ;
}
@@ -607,14 +615,7 @@ Drilling::Update( bool bPostApply)
}
// 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) ;
@@ -1026,8 +1027,11 @@ Drilling::GenerateHoleCl( int nInd, const SelData& nCircId, const string& sPName
// imposto elevazione da lunghezza foro con possibilità di sovrascrittura da info
double dElev = hole.dLen ;
double dMaxElev ;
if ( FromString( ExtractInfo( m_Params.m_sUserNotes, "MaxElev="), dMaxElev) && dElev > dMaxElev)
if ( FromString( ExtractInfo( m_Params.m_sUserNotes, "MaxElev="), dMaxElev) && dElev > dMaxElev) {
dElev = dMaxElev ;
hole.ptIni += hole.vtDir * ( dElev - hole.dLen) ;
hole.dLen = dElev ;
}
// limito lunghezza foro a massima lavorazione della punta
double dAddLen = ( hole.bBlind ? 0 : m_Params.m_dThroughAddLen) ;
if ( ( dElev + dAddLen) > m_TParams.m_dMaxMat + EPS_SMALL) {
@@ -1439,7 +1443,7 @@ Drilling::VerifyHoleFromBottom( const Hole& hole, SelData Id)
// calcolo la distanza minima del punto dal contorno del grezzo
double dDist ;
Vector3d vtDir ;
if ( ! GetMinDistanceFromRawSide( m_nPhase, hole.ptIni, 0, dDist, vtDir) || dDist > m_AggrBottom.dDMax) {
if ( ! GetMinDistanceFromRawSide( m_nPhase, hole.ptIni, 0, m_AggrBottom.vtMDir, MCH_AGB_DELTAMAX_MDIR, dDist, vtDir) || dDist > m_AggrBottom.dDMax) {
string sOut = "Error in Drilling : Entity " + ToString( Id) + " skipped because too far from part sides" ;
m_pMchMgr->SetLastError( 2107, sOut) ;
return false ;
@@ -1472,7 +1476,7 @@ Drilling::DoStandardDrilling( const Hole& hole, SelData Id, int nPathId)
bool bEndSlow = ( dEndSlowLen > EPS_SMALL) ;
// determino l'elevazione
double dElev = 0 ;
GetElevation( m_nPhase, hole.ptIni, hole.vtDir, dElev) ;
GetElevation( m_nPhase, hole.ptIni, hole.vtDir, m_TParams.m_dDiam / 2, hole.vtDir, dElev) ;
// determino alcune caratteristiche dell'utensile
double dTExtrLen = max( 0.0, m_TParams.m_dTLen - m_TParams.m_dLen) ;
// imposto dati comuni
@@ -1601,7 +1605,7 @@ Drilling::DoPeckDrilling( const Hole& hole, SelData Id, int nPathId)
bool bEndSlow = ( dEndSlowLen > EPS_SMALL) ;
// determino l'elevazione
double dElev = 0 ;
GetElevation( m_nPhase, hole.ptIni, hole.vtDir, dElev) ;
GetElevation( m_nPhase, hole.ptIni, hole.vtDir, m_TParams.m_dDiam / 2, hole.vtDir, dElev) ;
// determino alcune caratteristiche dell'utensile
double dTExtrLen = max( 0.0, m_TParams.m_dTLen - m_TParams.m_dLen) ;
// imposto dati comuni
+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.
+4 -2
View File
@@ -27,7 +27,7 @@
<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>
@@ -132,6 +132,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>
@@ -200,6 +201,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>
+10 -9
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"
@@ -527,8 +527,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 ;
@@ -611,6 +617,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 ;
}
@@ -629,14 +637,7 @@ GenMachining::Update( bool bPostApply)
}
// 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) ;
+12 -5
View File
@@ -47,11 +47,18 @@ bool
Generator::Run( const string& sCncFile, const string& sInfo)
{
// verifico sia abilitato dalla 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) {
bool bEnabled = false ;
if ( GetEMkNetHwKey()) {
bEnabled = true ;
}
else {
unsigned int nOpt1, nOpt2 ;
int nOptExpDays ;
int nRet = GetKeyOptions( GetEMkKey(), KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV,
nOpt1, nOpt2, nOptExpDays) ;
bEnabled = ( nRet == KEY_OK && ( nOpt1 & KEYOPT_EMK_NC_OFF) == 0) ;
}
if ( bEnabled) {
// emetto info di log
{ string sOut = "Generator Run : " + sCncFile ;
+16 -4
View File
@@ -1,7 +1,7 @@
//----------------------------------------------------------------------------
// EgalTech 2015-2017
// EgalTech 2015-2021
//----------------------------------------------------------------------------
// File : Head.cpp Data : 11.01.17 Versione : 1.6x6
// File : Head.cpp Data : 14.10.21 Versione : 2.3j5
// Contenuto : Oggetto testa per gruppo testa di macchina.
//
//
@@ -49,6 +49,7 @@ Head::Clone( void) const
pHead->m_vsHSet = m_vsHSet ;
pHead->m_vtADir = m_vtADir ;
pHead->m_dRot1W = m_dRot1W ;
pHead->m_bMaxDeltaR2On1 = m_bMaxDeltaR2On1 ;
pHead->m_Rot2Stroke = m_Rot2Stroke ;
pHead->m_nSolCh = m_nSolCh ;
}
@@ -102,7 +103,7 @@ Head::GetGeomDB( void) const
//----------------------------------------------------------------------------
Head::Head( void)
: m_nOwnerId( GDB_ID_NULL), m_pGeomDB( nullptr), m_nType( MCH_HT_NONE), m_nExitCount( 0),
m_dRot1W( 1), m_nSolCh( MCH_SCC_NONE)
m_dRot1W( 1), m_bMaxDeltaR2On1( true), m_nSolCh( MCH_SCC_NONE)
{
m_Rot2Stroke.Min = - INFINITO ;
m_Rot2Stroke.Max = INFINITO ;
@@ -111,7 +112,7 @@ 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)
double dRot1W, bool bMaxDeltaR2On1, const STROKE& Rot2Stroke, int nSolCh, const STRVECTOR& vsOthColl)
{
m_sName = sName ;
m_nType = nType ;
@@ -122,7 +123,9 @@ Head::Set( const string& sName, int nType, int nExitCount, const string& sHSet,
m_vsHSet.clear() ;
m_vsHSet.push_back( sHSet) ;
m_vtADir = vtADir ;
m_vtADir.Normalize() ;
m_dRot1W = dRot1W ;
m_bMaxDeltaR2On1 = bMaxDeltaR2On1 ;
m_Rot2Stroke = Rot2Stroke ;
if ( IsValidHeadScc( nSolCh))
m_nSolCh = nSolCh ;
@@ -142,3 +145,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 ;
}
+7 -3
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.
//
//
@@ -31,9 +31,10 @@ 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,
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
@@ -46,6 +47,8 @@ class Head : public IUserObj
{ 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
@@ -62,6 +65,7 @@ class Head : public IUserObj
STRVECTOR m_vsHSet ;
Vector3d m_vtADir ;
double m_dRot1W ;
bool m_bMaxDeltaR2On1 ;
STROKE m_Rot2Stroke ;
int m_nSolCh ;
STRVECTOR m_vsOtherColl ;
+2
View File
@@ -31,6 +31,8 @@ const std::string MACH_FIXT_GROUP = "Fixt" ;
const std::string MACH_SETUP_GROUP = "Setup" ;
// Gruppo dei grezzi in una macchinata
const std::string MACH_RAW_GROUP = "Raws" ;
// Gruppo dei collegamenti per waterjet in una macchinata
const std::string MACH_BRIDGES_GROUP = "Bridges" ;
// Gruppo delle operazioni in una macchinata
const std::string MACH_OPER_GROUP = "Opers" ;
// Chiave per info fase di appartenenza di una fixture
+22 -9
View File
@@ -1,7 +1,7 @@
//----------------------------------------------------------------------------
// EgalTech 2015-2021
// EgalTech 2015-2022
//----------------------------------------------------------------------------
// File : MachMgr.h Data : 24.05.21 Versione : 2.3e3
// File : MachMgr.h Data : 21.09.22 Versione : 2.4i4
// Contenuto : Dichiarazione della classe MachMgr.
//
//
@@ -10,6 +10,7 @@
// 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.
//
//----------------------------------------------------------------------------
@@ -51,14 +52,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 +82,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 ;
@@ -144,6 +147,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 ;
@@ -230,6 +234,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 ;
@@ -346,6 +354,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 ;
@@ -424,6 +433,7 @@ class MachMgr : public IMachMgr
bool GetAllCurrAxesName( STRVECTOR& vAxName) const ;
bool GetAllCurrAxesHomePos( DBLVECTOR& vAxHomeVal) const ;
bool GetCurrAxisHomePos( int nInd, double& dHome) const ;
const Frame3d& GetCurrLinAxesFrame( void) const ;
bool ApplyRotAxisBlock( void) ;
void ClearRotAxisBlock( void)
{ m_vAxisBlock.clear() ; }
@@ -432,6 +442,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 +452,11 @@ class MachMgr : public IMachMgr
bool GetOperationNewName( std::string& sName) const ;
const ToolData* GetMachiningToolData( void) const ;
// Simulation
bool SimAddCollisionObj( int nInd, int nFrameId, int nType, const Vector3d& vtMove, double dPar1, double dPar2, double dPar3) ;
bool SimAddCollisionObj( int nInd, bool bToolOn, int nFrameId, int nType, const Vector3d& vtMove, double dPar1, double dPar2, double dPar3) ;
bool SimExecCollisionCheck( int& nCdInd, int& nObjInd, int nMoveType) ;
bool SimOnCollision( int nCdInd, int nObjInd, int& nErr) ;
bool SimSetToolForVmill( const std::string& sTool, const std::string& sHead, int nExit, const INTVECTOR& vVmill, bool bFirst) ;
int SimMoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt) ;
// Machine
bool GetHeadAbove( const std::string& sHead) const ;
double GetDeltaSafeZ( const std::string& sHead) const ;
@@ -483,11 +496,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 +513,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()) ;
}
//----------------------------------------------------------------------------
+59 -3
View File
@@ -15,6 +15,7 @@
#include "stdafx.h"
#include "DllMain.h"
#include "MachMgr.h"
#include "/EgtDev/Include/EGnFileUtils.h"
using namespace std ;
@@ -410,9 +411,64 @@ MachMgr::MdbSave( void) const
bool
MachMgr::MdbGetMachiningDir( string& sMchDir) const
{
string sMachineName ;
if ( ! GetCurrMachineName( sMachineName))
string sMachineDir, sMachineName ;
if ( ! GetCurrMachineDir( sMachineDir) || ! GetCurrMachineName( sMachineName))
return false ;
sMchDir = m_sMachinesDir + "\\" + sMachineName + "\\" + MACHININGS_DIR ;
sMchDir = sMachineDir + "\\" + MACHININGS_DIR ;
return true ;
}
//----------------------------------------------------------------------------
bool
MachMgr::MdbExport( const STRVECTOR& vsMachiningsNames, const string& sOutFile) const
{
if ( vsMachiningsNames.empty())
return true ;
// recupero il gestore di lavorazioni della macchina corrente
MachiningsMgr* pMsMgr = GetCurrMachiningsMgr() ;
if ( pMsMgr == nullptr)
return false ;
return pMsMgr->Export( vsMachiningsNames, sOutFile) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::MdbToBeImported( const string& sFile, STRVECTOR& vsMachiningsNames, INTVECTOR& vMachiningsTypes) const
{
if ( ! ExistsFile( sFile)) {
LOG_ERROR( GetEMkLogger(), "MdbToBeImported Error : File does not exist") ;
return false ;
}
// recupero il gestore di lavorazioni della macchina corrente
MachiningsMgr* pMsMgr = GetCurrMachiningsMgr() ;
if ( pMsMgr == nullptr)
return false ;
return pMsMgr->ToBeImported( sFile, vsMachiningsNames, vMachiningsTypes) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::MdbImport( const string& sFile, const STRVECTOR& vsMachiningsToImport, const STRVECTOR& vsMachiningsNames, STRVECTOR& vsImported)
{
if ( vsMachiningsToImport.empty())
return true ;
if ( ! ExistsFile( sFile)) {
LOG_ERROR( GetEMkLogger(), "MdbImport Error : File does not exist") ;
return false ;
}
if ( vsMachiningsToImport.size() != vsMachiningsNames.size())
return false ;
// recupero il gestore di lavorazioni della macchina corrente
MachiningsMgr* pMsMgr = GetCurrMachiningsMgr() ;
if ( pMsMgr == nullptr)
return false ;
return pMsMgr->Import( sFile, vsMachiningsToImport, vsMachiningsNames, vsImported) ;
}
+42 -22
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) ;
@@ -625,10 +639,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 +664,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 +680,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) ;
@@ -724,9 +747,6 @@ 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 ;
// Imposto contesto per il disegno utensile
if ( ! ExeSetCurrentContext( nToolCtx))
return TD_INT_ERR ;
@@ -774,7 +794,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 +841,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 +860,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 +895,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 +904,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 ;
+91 -39
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,6 +342,15 @@ 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)
@@ -536,7 +587,15 @@ double
MachMgr::GetCalcRot1W( void) const
{
Machine* pMch = GetCurrMachine() ;
return ( ( pMch != nullptr) ? pMch->GetCurrRot1W() : false) ;
return ( ( pMch != nullptr) ? pMch->GetCurrRot1W() : 1) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::GetCalcMaxDeltaR2OnFirst( void) const
{
Machine* pMch = GetCurrMachine() ;
return ( ( pMch != nullptr) ? pMch->GetCurrMaxDeltaR2OnFirst() : true) ;
}
//----------------------------------------------------------------------------
@@ -545,12 +604,9 @@ MachMgr::GetAllTablesNames( STRVECTOR& vNames) const
{
// pulisco il vettore
vNames.clear() ;
// recupero la macchina corrente
// richiedo elenco tavole alla macchina corrente
Machine* pMch = GetCurrMachine() ;
if ( pMch == nullptr)
return false ;
// richiedo elenco tavole alla macchina
return pMch->GetAllTablesNames( vNames) ;
return ( ( pMch != nullptr) ? pMch->GetAllTablesNames( vNames) : false) ;
}
//----------------------------------------------------------------------------
@@ -559,12 +615,9 @@ MachMgr::GetAllHeadsNames( STRVECTOR& vNames) const
{
// pulisco il vettore
vNames.clear() ;
// recupero la macchina corrente
// richiedo elenco teste alla macchina corrente
Machine* pMch = GetCurrMachine() ;
if ( pMch == nullptr)
return false ;
// richiedo elenco teste alla macchina
return pMch->GetAllHeadsNames( vNames) ;
return ( ( pMch != nullptr) ? pMch->GetAllHeadsNames( vNames) : false) ;
}
//----------------------------------------------------------------------------
@@ -573,12 +626,9 @@ MachMgr::GetAllTcPosNames( STRVECTOR& vNames) const
{
// pulisco il vettore
vNames.clear() ;
// recupero la macchina corrente
// richiedo elenco posizioni cambio utensile alla macchina corrente
Machine* pMch = GetCurrMachine() ;
if ( pMch == nullptr)
return false ;
// richiedo elenco posizioni cambio utensile alla macchina
return pMch->GetAllTcPosNames( vNames) ;
return ( ( pMch != nullptr) ? pMch->GetAllTcPosNames( vNames) : false) ;
}
//----------------------------------------------------------------------------
@@ -621,6 +671,18 @@ 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::GetCalcAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
@@ -682,9 +744,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 +752,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 +760,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 +816,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 +832,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
+2 -2
View File
@@ -24,7 +24,7 @@
#include "/EgtDev/Include/EGkGeoPoint3d.h"
#include "/EgtDev/Include/EGkCurveAux.h"
#include "/EgtDev/Include/EGkOffsetCurve.h"
#include "/EgtDev/Include/EgkDistPointCurve.h"
#include "/EgtDev/Include/EGkDistPointCurve.h"
#include "/EgtDev/Include/EGkSfrCreate.h"
#include "/EgtDev/Include/EGkStmStandard.h"
#include "/EgtDev/Include/EGkStmFromCurves.h"
@@ -414,7 +414,7 @@ MachMgr::AddRawPart( int nSurfId, Color cCol)
// ne calcolo la silhouette secondo Z+
POLYLINEVECTOR vPL ;
bool bSilh = false ;
if ( pStm->GetSilhouette( Z_AX, vPL) && vPL.size() > 0) {
if ( pStm->GetSilhouette( Z_AX, 10.0, vPL) && vPL.size() > 0) {
// cerco il contorno esterno
int nInd = - 1 ;
double dMaxArea = 0 ;
+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 false ;
// lancio movimento assi
return m_pSimul->MoveAxes( nMoveType, vAxNaEpSt) ;
}
+42 -12
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,18 @@ 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_nMachineLook = MCH_LOOK_NONE ;
}
@@ -86,7 +93,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 +103,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
@@ -280,7 +287,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 +328,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))
@@ -493,7 +500,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 +528,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, vtADir, dRot1W, bMaxDeltaR2On1, Rot2Stroke, nSolCh, vsOthColl) ;
m_pGeomDB->SetUserObj( nLay, pHead) ;
// aggiorno la testa capostipite
if ( ! AddHeadToSet( sHSet, sName))
@@ -542,7 +549,7 @@ 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,
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 +577,7 @@ 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, vtADir, dRot1W, bMaxDeltaR2On1, Rot2Stroke, nSolCh, vsOthColl) ;
m_pGeomDB->SetUserObj( nLay, pHead) ;
// aggiorno la testa capostipite
if ( ! AddHeadToSet( sHSet, sName))
@@ -589,7 +596,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 +624,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, vtADir, dRot1W, bMaxDeltaR2On1, Rot2Stroke, nSolCh, vsOthColl) ;
m_pGeomDB->SetUserObj( nLay, pHead) ;
// aggiorno la testa capostipite
if ( ! AddHeadToSet( sHSet, sName))
@@ -801,6 +808,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)
@@ -1081,6 +1104,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)
+34 -11
View File
@@ -1,7 +1,7 @@
//----------------------------------------------------------------------------
// EgalTech 2015-2015
// EgalTech 2015-2023
//----------------------------------------------------------------------------
// File : Machine.h Data : 06.05.15 Versione : 1.6e3
// File : Machine.h Data : 16.01.23 Versione : 2.5a2
// Contenuto : Dichiarazione della classe Machine.
//
//
@@ -34,7 +34,7 @@ class Machine
public :
Machine( void) ;
~Machine( void) ;
bool Init( const std::string& sMachinesDir, const std::string& sMachineName, MachMgr* pMchMgr) ;
bool Init( const std::string& sMachineName, const std::string& sMachineDir, MachMgr* pMchMgr) ;
const std::string& GetMachineName( void) const
{ return m_sName ; }
const std::string& GetMachineDir( void) const
@@ -53,6 +53,10 @@ class Machine
int GetHeadId( const std::string& sHead) const
{ int nId = GetGroup( sHead) ;
return ( IsHeadGroup( nId) ? nId : GDB_ID_NULL) ; }
int GetExitId( const std::string& sHead, int nExit) const
{ int nHeadId = GetHeadId( sHead) ;
int nId = ( m_pGeomDB != nullptr ? m_pGeomDB->GetFirstNameInGroup( nHeadId, MCH_EXIT + ToString( nExit)) : GDB_ID_NULL) ;
return ( IsExitGroup( nId) ? nId : GDB_ID_NULL) ; }
int GetTcPosId( const std::string& sTcPos) const
{ int nId = GetGroup( sTcPos) ;
return ( IsTcPosGroup( nId) ? nId : GDB_ID_NULL) ; }
@@ -75,6 +79,7 @@ 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 GetAxisPos( const std::string& sAxis, double& dVal) const ;
@@ -100,7 +105,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) ;
@@ -119,14 +127,14 @@ class Machine
bool GetCurrAxisMax( int nInd, double& dMax) const ;
bool GetCurrAxisHomePos( int nInd, double& dHome) const ;
bool GetAllCurrAxesHomePos( DBLVECTOR& vAxHomeVal) const ;
const Frame3d& GetCurrLinAxesFrame( void) const
{ return m_frLinAx ; }
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 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 +159,7 @@ class Machine
{ return m_nMachineLook ; }
bool LinkRawPartToGroup( int nRawPartId, const std::string& sGroupName) ;
bool IsLinkedRawPart( int nRawId) const ;
const INTVECTOR& GetAllLinkedRawParts( void) const ;
bool UnlinkRawPartFromGroup( int nRawPartId) ;
bool UnlinkAllRawPartsFromGroups( void) ;
bool LinkFixtureToGroup( int nFxtId, const std::string& sGroupName) ;
@@ -183,8 +192,8 @@ class Machine
const Point3d& ptRef1, double dCoeffX, double dCoeffY, double dCoeffZ,
const std::string& sGeo, const STRVECTOR& vsAux) ;
bool AdjustTable( int nLay, const Point3d& ptRef1) ;
bool LoadMachineAxis( const std::string& sName, const std::string& sParent, const std::string& sToken,
bool bInvert, int nType, const Point3d& ptPos, const Vector3d& vtDir, const STROKE& Stroke,
bool LoadMachineAxis( const std::string& sName, const std::string& sParent, const std::string& sToken, bool bInvert,
double dOffset, int nType, const Point3d& ptPos, const Vector3d& vtDir, const STROKE& Stroke,
double dHome, bool bAdjustAux, const std::string& sGeo, const STRVECTOR& vsAux) ;
bool AdjustAxis( int nLay, const std::string& sPart, const std::string& sName,
int nType, const Point3d& ptPos, const Vector3d& vtDir, bool bAdjustAux) ;
@@ -194,15 +203,15 @@ 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,
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,
@@ -230,6 +239,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 +287,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 +297,14 @@ 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
mutable OutStroke m_OutstrokeInfo ; // informazioni su ultima extra corsa
// stato di visualizzazione
int m_nMachineLook ; // stato di visualizzazione della macchina
@@ -310,6 +327,7 @@ class Machine
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 +337,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 +354,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) ;
} ;
//----------------------------------------------------------------------------
+16
View File
@@ -54,6 +54,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
+196 -95
View File
@@ -174,6 +174,12 @@ Machine::GetCurrTableIsTilting( bool& bTilting) const
// verifico esistenza tavola
if ( m_nCalcTabId == GDB_ID_NULL)
return false ;
// verifico se presente flag che lo forza come tale
bool bTiltingLike ;
if ( m_pGeomDB->GetInfo( m_nCalcTabId, MCH_TILTINGLIKE, bTiltingLike) && bTiltingLike) {
bTilting = true ;
return true ;
}
// recupero gli eventuali assi rotanti della tavola
int nTParId = m_pGeomDB->GetParentId( m_nCalcTabId) ;
if ( nTParId == GDB_ID_NULL)
@@ -209,7 +215,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 ;
}
@@ -273,6 +281,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() ;
@@ -427,14 +436,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,6 +444,11 @@ 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() ;
// recupero gli assi di tavola
@@ -451,6 +457,8 @@ Machine::CalculateKinematicChain( void)
int nTParId = m_pGeomDB->GetParentId( m_nCalcTabId) ;
if ( nTParId == GDB_ID_NULL)
return false ;
m_nTabLinAxes = 0 ;
m_nTabRotAxes = 0 ;
while ( IsAxisGroup( nTParId)) {
if ( ! AddKinematicAxis( false, nTParId))
return false ;
@@ -462,40 +470,63 @@ Machine::CalculateKinematicChain( void)
int nHParId = m_pGeomDB->GetParentId( m_nCalcHeadId) ;
if ( nHParId == GDB_ID_NULL)
return false ;
m_nHeadLinAxes = 0 ;
m_nHeadRotAxes = 0 ;
while ( IsAxisGroup( nHParId)) {
if ( ! AddKinematicAxis( true, nHParId))
return false ;
nHParId = m_pGeomDB->GetParentId( nHParId) ;
}
// 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)
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 :
bool bOk = false ;
// 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 ;
bOk = 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 +538,10 @@ Machine::CalculateKinematicChain( void)
m_vCalcRotAx[1].stroke.Max = min( m_vCalcRotAx[1].stroke.Max, pHead->GetRot2Stroke().Max) ;
}
}
return true ;
bOk = 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,10 +561,48 @@ Machine::CalculateKinematicChain( void)
m_vCalcRotAx[n2ndHeadRotAx].stroke.Max = min( m_vCalcRotAx[n2ndHeadRotAx].stroke.Max, pHead->GetRot2Stroke().Max) ;
}
}
return true ;
bOk = true ;
}
if ( ! bOk)
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 ;
}
}
}
return true ;
// altrimenti non ancora gestito, quindi errore
// altrimenti non ancora gestito, quindi errore
LOG_ERROR( GetEMkLogger(), "Rotary Axes not manageable")
return false ;
}
@@ -553,11 +622,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() ;
@@ -1025,26 +1103,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 +1142,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
@@ -1166,17 +1215,25 @@ Machine::GetNoseFromPositions( double dX, double dY, double dZ, const DBLVECTOR&
// 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]) ;
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 ( size_t i = 1 ; i <= m_vCalcLinAx.size() ; ++ i) {
if ( m_vCalcLinAx[i-1].bHead)
ptNose += m_vCalcLinAx[i-1].vtDir * vMov[i-1] ;
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]) ;
}
return true ;
}
@@ -1188,11 +1245,26 @@ 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))
return false ;
ptTip.Set( dX - dRecX, dY - dRecY, dZ - dRecZ) ;
// 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 richiesto ingombro totale o punto sotto del tip utensile
if ( bOverall || bBottom) {
@@ -1236,7 +1308,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 +1324,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 +1421,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 +1458,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) ;
+2
View File
@@ -171,6 +171,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))
+166 -17
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,6 +41,7 @@ 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_POS = "Pos" ;
@@ -52,6 +53,7 @@ static const string FLD_HSET = "HSet" ;
static const string FLD_TDIR = "TDir" ;
static const string FLD_ADIR = "ADir" ;
static const string FLD_ROT1W = "Rot1W" ;
static const string FLD_MAXDELTAR2ON1 = "MaxDeltaR2OnFirst" ;
static const string FLD_ROT2STROKE = "Rot2Stroke" ;
static const string FLD_SOLCH = "SolCh" ;
static const string FLD_OTHCOLL = "OthColl" ;
@@ -93,8 +95,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 +132,12 @@ Machine::LuaInit( const string& sMachineName)
m_LuaMgr.RegisterFunction( "EmtExecCollisionCheck", Machine::LuaEmtExecCollisionCheck) ;
// registro la funzione di gestione della collisione in simulazione
m_LuaMgr.RegisterFunction( "EmtOnCollision", Machine::LuaEmtOnCollision) ;
// registro la funzione di impostazione del primo utensile per virtual milling in simulazione
m_LuaMgr.RegisterFunction( "EmtSetToolForVmill", Machine::LuaEmtSetToolForVmill) ;
// registro la funzione di impostazione di utensile aggiuntivo per virtual milling in simulazione
m_LuaMgr.RegisterFunction( "EmtAddToolForVmill", Machine::LuaEmtAddToolForVmill) ;
// registro la funzione di movimento assi in simulazione
m_LuaMgr.RegisterFunction( "EmtMoveAxes", Machine::LuaEmtMoveAxes) ;
return true ;
}
@@ -488,6 +498,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 +536,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 +601,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 +631,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
@@ -666,8 +682,11 @@ Machine::LuaEmtMultiHead( 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 ;
@@ -693,7 +712,7 @@ Machine::LuaEmtMultiHead( lua_State* L)
// carico i dati della testa multipla
if ( ! m_pMchLua->LoadMachineMultiHead( sName, sParent, sHSet, vMuExit, 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
@@ -733,8 +752,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 +782,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
@@ -903,6 +925,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 +1005,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 +1208,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 +1233,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 +1262,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 +1272,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 +1287,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 +1304,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 +1334,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 +1342,92 @@ 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, ..., 16 parametri : nMoveType, sAx1, dPos1, dStep1 [, sAx2, dPos2, dStep2] [, sAx3, dPos3, dStep3] [, sAx4, dPos4, dStep4] [, sAx5, dPos5, dStep5]
int nMoveType ;
LuaCheckParam( L, 1, nMoveType)
string sAx1 ;
LuaCheckParam( L, 2, sAx1) ;
double dEnd1 ;
LuaCheckParam( L, 3, dEnd1) ;
double dStep1 ;
LuaCheckParam( L, 4, dStep1) ;
SAMVECTOR vAxNaEpSt ;
vAxNaEpSt.emplace_back( sAx1, dEnd1, dStep1) ;
for ( int i = 0 ; i < 4 ; ++ i) {
int nInd = 5 + 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 ;
}
+13 -6
View File
@@ -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 ;
@@ -112,17 +113,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 +138,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) ;
+314 -20
View File
@@ -1,7 +1,7 @@
//----------------------------------------------------------------------------
// EgalTech 2015-2020
// EgalTech 2015-2022
//----------------------------------------------------------------------------
// File : MachiningsMgr.cpp Data : 09.11.20 Versione : 2.2k2
// File : MachiningsMgr.cpp Data : 04.02.22 Versione : 2.4b1
// Contenuto : Implementazione gestore database lavorazioni.
//
//
@@ -15,6 +15,7 @@
// 03.06.20 DS Agg. per nuovi parametri Tab in fresatura (MF_CURR_VER = 1009).
// 22.06.20 DS Agg. per nuovi parametri attacco tagli di lama (MF_CURR_VER = 1010).
// 09.11.20 DS Agg. per nuovi parametri tagli di lama (MF_CURR_VER = 1011).
// 04.02.22 DS Agg. per nuovi parametri svuotature con epicicli (MF_CURR_VER = 1012).
//
//----------------------------------------------------------------------------
@@ -31,7 +32,6 @@
#include "/EgtDev/Include/EGnFileUtils.h"
#include "/EgtDev/Include/EGnScanner.h"
#include "/EgtDev/Include/EGnWriter.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
#include <cassert>
#include <bitset>
@@ -42,7 +42,7 @@ const string MF_HEADER = "[HEADER]" ;
const string MF_VERSION = "VERSION" ;
const string MF_TOTAL = "TOTAL" ;
const string MF_SIZE = "SIZE" ;
const int MF_CURR_VER = 1011 ;
const int MF_CURR_VER = 1012 ;
const string MF_GENERAL = "[GENERAL]" ;
const string MF_3AXCOMP = "3AXCOMP" ;
const bool MF_CURR_3AXCOMP = false ;
@@ -189,11 +189,25 @@ MachiningsMgr::Reload( void)
// Ciclo di lettura delle lavorazioni
do {
if ( ! LoadOneMachining( TheScanner, bEnd)) {
PtrOwner<MachiningData> pMch ;
if ( LoadOneMachining( TheScanner, pMch, bEnd)) {
// salvo i dati della lavorazione
if ( ! IsNull( pMch)) {
if ( ! m_umData.emplace( pMch->m_Uuid, Get( pMch)).second ||
! m_suData.emplace( pMch->m_sName, pMch->m_Uuid).second) {
bOk = false ;
string sOut = "ReloadMachinings : Error adding machining " + pMch->m_sName ;
LOG_ERROR( GetEMkLogger(), sOut.c_str())
}
Release( pMch) ;
}
}
else {
bOk = false ;
string sOut = "ReloadMachinings : Error on line " + ToString( TheScanner.GetCurrLineNbr()) ;
LOG_ERROR( GetEMkLogger(), sOut.c_str())
}
} while ( bOk && ! bEnd) ;
// Termino lo scanner
@@ -207,7 +221,7 @@ MachiningsMgr::Reload( void)
//----------------------------------------------------------------------------
bool
MachiningsMgr::LoadHeader( Scanner& TheScanner, int& nVersion, int& nTotal, bool& bEnd)
MachiningsMgr::LoadHeader( Scanner& TheScanner, int& nVersion, int& nTotal, bool& bEnd) const
{
// leggo la prossima linea
string sLine ;
@@ -311,11 +325,12 @@ MachiningsMgr::LoadGeneral( Scanner& TheScanner, bool& bEnd)
//----------------------------------------------------------------------------
bool
MachiningsMgr::LoadOneMachining( Scanner& TheScanner, bool& bEnd)
MachiningsMgr::LoadOneMachining( Scanner& TheScanner, PtrOwner<MachiningData>& pMch, bool& bEnd) const
{
// leggo la prossima linea
string sLine ;
if ( ! TheScanner.GetLine( sLine)) {
pMch.Reset() ;
// fine file
bEnd = true ;
return true ;
@@ -324,12 +339,12 @@ MachiningsMgr::LoadOneMachining( Scanner& TheScanner, bool& bEnd)
if ( sLine.front() != '[' || sLine.back() != ']')
return false ;
Trim( sLine, "[]") ;
// separo tipo da contatore
// separo tipo da contatore
string sType, sCount ;
SplitFirst( sLine, "_", sType, sCount) ;
ToUpper( sType) ;
// alloco la lavorazione del tipo corrispondente
PtrOwner<MachiningData> pMch( MCHDATA_CREATE( MCHDATA_NAMETOTYPE( sType))) ;
pMch.Set( MCHDATA_CREATE( MCHDATA_NAMETOTYPE( sType))) ;
if ( IsNull( pMch))
return false ;
bool bOk = true ;
@@ -366,10 +381,6 @@ MachiningsMgr::LoadOneMachining( Scanner& TheScanner, bool& bEnd)
}
// verifico di aver letto tutti i campi
bOk = bOk && ( Flag.count() == nSize) ;
// salvo i dati della lavorazione
bOk = bOk && m_umData.emplace( pMch->m_Uuid, Get( pMch)).second ;
bOk = bOk && m_suData.emplace( pMch->m_sName, pMch->m_Uuid).second ;
Release( pMch) ;
return bOk ;
}
@@ -438,7 +449,7 @@ MachiningsMgr::Save( bool bCompressed) const
//----------------------------------------------------------------------------
bool
MachiningsMgr::SaveHeader( Writer& TheWriter) const
MachiningsMgr::SaveHeader( Writer& TheWriter, int nTotal) const
{
// scrivo l'intestazione
bool bOk = true ;
@@ -447,7 +458,10 @@ MachiningsMgr::SaveHeader( Writer& TheWriter) const
bOk = bOk && TheWriter.OutText( sOut) ;
sOut = MF_VERSION + "=" + ToString( m_nDbVer) ;
bOk = bOk && TheWriter.OutText( sOut) ;
sOut = MF_TOTAL + "=" + ToString( int( m_umData.size())) ;
if ( nTotal == -1)
sOut = MF_TOTAL + "=" + ToString( int( m_umData.size())) ;
else
sOut = MF_TOTAL + "=" + ToString( nTotal) ;
bOk = bOk && TheWriter.OutText( sOut) ;
return bOk ;
}
@@ -498,14 +512,20 @@ MachiningsMgr::SaveOneMachining( const EgtUUID& Uuid, int& nCounter, Writer& The
if ( iIter == m_umData.end())
return false ;
const MachiningData* pmData = iIter->second ;
// preparo la lista dei dati (quelli vuoti sono opzionali con default)
STRVECTOR vsOut ;
for ( int i = 0 ; i < pmData->GetSize() ; ++ i) {
string sOut = pmData->ToString( i) ;
if ( ! sOut.empty())
vsOut.emplace_back( sOut) ;
}
// scrivo i dati della lavorazione
string sOut = "[" + pmData->GetTitle() + "_" + ToString( ++ nCounter, 3) + "]" ;
bool bOk = TheWriter.OutText( sOut) ;
sOut = MF_SIZE + "=" + ToString( pmData->GetSize()) ;
sOut = MF_SIZE + "=" + ToString( int( vsOut.size())) ;
bOk = bOk && TheWriter.OutText( sOut) ;
for ( int i = 0 ; i < pmData->GetSize() ; ++ i) {
string sOut = pmData->ToString( i) ;
bOk = bOk && ! sOut.empty() && TheWriter.OutText( sOut) ;
for ( const auto& sOut : vsOut) {
bOk = bOk && TheWriter.OutText( sOut) ;
}
return bOk ;
}
@@ -514,7 +534,7 @@ MachiningsMgr::SaveOneMachining( const EgtUUID& Uuid, int& nCounter, Writer& The
bool
MachiningsMgr::GetMachiningNewName( string& sName) const
{
// il parametro nome deve essere valido
// il parametro nome deve essere valido
if ( &sName == nullptr)
return false ;
// se nome vuoto, assegno radice standard
@@ -1168,3 +1188,277 @@ MachiningsMgr::SetMaxDepthSafe( double dSafe)
}
return true ;
}
//----------------------------------------------------------------------------
bool
MachiningsMgr::Export( const STRVECTOR& vsMachiningsNames, const string& sOutFile, bool bCompressed) const
{
LOG_INFO( GetEMkLogger(), ( "Export Machinings " + sOutFile).c_str()) ;
// conto le lavorazioni da esportare
int nMachinings = 0 ;
for ( size_t i = 0 ; i < vsMachiningsNames.size() ; i ++) {
if ( m_suData.find( vsMachiningsNames[i]) != m_suData.end())
nMachinings ++ ;
}
// inizializzo il writer
Writer TheWriter ;
if ( ! TheWriter.Init( sOutFile, bCompressed)) {
LOG_ERROR( GetEMkLogger(), " Error Exporting Machinings on Init") ;
return false ;
}
// scrivo linea di inizio file
string sOut = "; --- " + sOutFile + " " + CurrDateTime() + " ---" ;
if ( ! TheWriter.OutText( sOut)) {
LOG_ERROR( GetEMkLogger(), " Error Exporting Machinings on Start") ;
return false ;
}
// scrivo l'intestazione
if ( ! SaveHeader( TheWriter, nMachinings)) {
LOG_ERROR( GetEMkLogger(), " Error Exporting Machinings on Header") ;
return false ;
}
// scrivo i dati generali
if ( m_nDbVer >= 1002 && ! SaveGeneral( TheWriter)) {
LOG_ERROR( GetEMkLogger(), " Error Exporting Machinings on General") ;
return false ;
}
// ciclo su tutti i nomi delle lavorazioni da esportare
int nCounter = 0 ;
for ( size_t i = 0 ; i < vsMachiningsNames.size() ; i ++) {
auto it = m_suData.find( vsMachiningsNames[i]) ;
// se la lavorazione non esiste passo alla sucessiva
if ( it == m_suData.end()) {
string sOut = " Warning Exporting Machinings : " + vsMachiningsNames[i] + " not found. Machining is ignored." ;
LOG_ERROR( GetEMkLogger(), sOut.c_str()) ;
continue ;
}
// esporto la singola lavorazione
if ( ! SaveOneMachining( it->second, nCounter, TheWriter)) {
string sOut = " Error Exporting Machining " + it->first ;
LOG_ERROR( GetEMkLogger(), sOut.c_str()) ;
return false ;
}
}
// scrivo linea di fine file
if ( ! TheWriter.OutText( "; --- End ---")) {
LOG_ERROR( GetEMkLogger(), " Error Exporting Machinings on End") ;
return false ;
}
// chiudo la scrittura
TheWriter.Close() ;
return true ;
}
//----------------------------------------------------------------------------
bool
MachiningsMgr::ToBeImported( const string& sFile, STRVECTOR& vsMachiningsNames, INTVECTOR& vMachiningsTypes) const
{
// inizializzo lo scanner
Scanner TheScanner ;
if ( ! TheScanner.Init( sFile, ";")) {
LOG_ERROR( GetEMkLogger(), "Machinings ToBeImported : Error on Init") ;
return false ;
}
// leggo l'intestazione
int nVersion = 0 ;
int nTotal = 0 ;
bool bEnd = false ;
if ( ! LoadHeader( TheScanner, nVersion, nTotal, bEnd)) {
LOG_ERROR( GetEMkLogger(), "Machinings ToBeImported : Error on Header") ;
return false ;
}
string sLine ;
if ( ! TheScanner.GetLine( sLine))
return true ; // il file è finito, esco
// parte generale
if ( sLine == MF_GENERAL) {
// scorro le linee fino ad arrivare alla sezione successiva
while ( TheScanner.GetLine( sLine)) {
if ( sLine.front() == '[' && sLine.back() == ']')
break ;
}
// se non c'è una sezione successiva esco
if ( sLine.empty())
return true ;
}
else if ( nVersion >= 1002) {
LOG_ERROR( GetEMkLogger(), "Machinings ToBeImported : General section missing") ;
return false ;
}
bool bMachiningName = false ;
bool bAdd = true ;
string sName ;
int nType = 0 ;
TheScanner.UngetLine( sLine) ;
while ( TheScanner.GetLine( sLine)) {
if ( sLine.front() == '[' && sLine.back() == ']') { // se è intestazione
// aggiungo lavorazione precedente se ok
if ( bAdd && bMachiningName && nType != 0) {
vsMachiningsNames.push_back( sName) ;
vMachiningsTypes.push_back( nType) ;
}
bMachiningName = false ;
bAdd = true ;
// salvo il tipo di lavorazione
Trim( sLine, "[]") ;
string sType, sCount ;
SplitFirst( sLine, "_", sType, sCount) ;
ToUpper( sType) ;
nType = MCHDATA_NAMETOTYPE( sType) ;
}
else {
string sKey, sVal ;
SplitFirst( sLine, "=", sKey, sVal) ;
if ( ToUpper( sKey) == "NAME") {
if ( ! bMachiningName) {
bMachiningName = true ;
sName = sVal ;
}
else // se lavorazione ha più nomi è errore, non deve essere importata
bAdd = false ;
}
}
}
// aggiungo ultima lavorazione se ok
if ( bAdd && bMachiningName && nType != 0) {
vsMachiningsNames.push_back( sName) ;
vMachiningsTypes.push_back( nType) ;
}
if ( vsMachiningsNames.size() != vMachiningsTypes.size())
return false ;
return true ;
}
//----------------------------------------------------------------------------
bool
MachiningsMgr::Import( const string& sFile, const STRVECTOR& vsMachiningsToImport, const STRVECTOR& vsMachiningsNames, STRVECTOR& vsImported)
{
LOG_INFO( GetEMkLogger(), ( "Import Machinings : " + sFile).c_str()) ;
for ( size_t i = 0 ; i < vsMachiningsNames.size() ; i ++) {
// se esiste già nel DB una lavorazione con lo stesso nome la rimuovo
if ( m_suData.find( vsMachiningsNames[i]) != m_suData.end()) {
bool bOk = RemoveMachining( vsMachiningsNames[i]) ;
if ( ! bOk) {
LOG_ERROR( GetEMkLogger(), ( " Error Importing Machinings : removing " + vsMachiningsNames[i] + " failed" ).c_str()) ;
return false ;
}
}
// verfico che il nome non sia ripetuto nella lista dei vsMachiningsNames
if ( i != vsMachiningsNames.size() - 1 &&
find( vsMachiningsNames.begin() + i + 1, vsMachiningsNames.end(), vsMachiningsNames[i]) != vsMachiningsNames.end()) {
LOG_ERROR( GetEMkLogger(), ( " Error Importing Machinings : name \"" + vsMachiningsNames[i] + "\" is already used").c_str()) ;
return false ;
}
}
// inizializzo lo scanner
Scanner TheScanner ;
if ( ! TheScanner.Init( sFile, ";")) {
LOG_ERROR( GetEMkLogger(), " Error Importing Machinings on Init") ;
return false ;
}
// leggo l'intestazione
int nVersion = 0 ;
int nTotal = 0 ;
bool bEnd ;
if ( ! LoadHeader( TheScanner, nVersion, nTotal, bEnd)) {
LOG_ERROR( GetEMkLogger(), " Error Importing Machinings on Header") ;
return false ;
}
// leggo i dati generali (da versione 1002) e li ignoro
if ( nVersion >= 1002 && ! SkipGeneral( TheScanner, bEnd)) {
LOG_ERROR( GetEMkLogger(), " Error Importing Machinings on General") ;
return false ;
}
// ciclo di lettura delle lavorazioni
while ( ! bEnd) {
PtrOwner<MachiningData> pMch ;
if ( ! LoadOneMachining( TheScanner, pMch, bEnd)) {
LOG_ERROR( GetEMkLogger(), ( " Error Importing Machinings : reading at line" + ToString( TheScanner.GetCurrLineNbr())).c_str()) ;
continue ;
}
// se non c'è lavorazione (si è alla fine), si prosegue
if ( IsNull( pMch))
continue ;
// se la lavorazione non deve essere importata proseguo con la successiva
auto it = find( vsMachiningsToImport.begin(), vsMachiningsToImport.end(), pMch->m_sName) ;
if ( it == vsMachiningsToImport.end())
continue ;
// assegno il nuovo nome
pMch->m_sName = vsMachiningsNames[ it - vsMachiningsToImport.begin()] ;
// se il suo UUID esiste già nel DB lo modifico
if ( m_umData.find( pMch->m_Uuid) != m_umData.end()) {
LOG_ERROR( GetEMkLogger(), ( " Warning Importing Machinings: " + pMch->m_sName + " UUID changed").c_str()) ;
CreateEgtUUID( pMch->m_Uuid) ;
}
// aggiungo la lavorazione
if ( ! m_umData.emplace( pMch->m_Uuid, pMch).second ||
! m_suData.emplace( pMch->m_sName, pMch->m_Uuid).second) {
LOG_ERROR( GetEMkLogger(), ( " Error Importing Machinings : failed adding " + pMch->m_sName).c_str()) ;
continue ;
}
vsImported.push_back( pMch->m_sName) ;
Release( pMch) ;
}
if ( ! vsImported.empty())
m_bModified = true ;
return true ;
}
//----------------------------------------------------------------------------
bool
MachiningsMgr::SkipGeneral( Scanner& TheScanner, bool& bEnd) const
{
// leggo la prossima linea
string sLine ;
if ( ! TheScanner.GetLine( sLine)) {
// fine file
bEnd = true ;
return true ;
}
// deve essere dati generali
if ( sLine != MF_GENERAL)
return false ;
bool bOk = true ;
// leggo le linee successive
bEnd = true ;
while ( bOk && TheScanner.GetLine( sLine)) {
// se sezione successiva
if ( sLine.front() == '[' && sLine.back() == ']') {
TheScanner.UngetLine( sLine) ;
bEnd = false ;
break ;
}
}
return bOk ;
}
+8 -3
View File
@@ -14,6 +14,7 @@
#pragma once
#include "MachiningData.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
#include <unordered_map>
#include <map>
@@ -81,13 +82,17 @@ class MachiningsMgr
bool SetMaxDepthSafe( double dSafe) ;
double GetMaxDepthSafe( void) const
{ return m_dMaxDepthSafe ; }
bool Export( const STRVECTOR& vsMachiningsNames, const std::string& sOutFile, bool bCompressed = true) const ;
bool ToBeImported( const std::string& sFile, STRVECTOR& vsMachiningsNames, INTVECTOR& vMachiningsTypes) const ;
bool Import( const std::string& sFile, const STRVECTOR& vsMachiningsToImport, const STRVECTOR& vsMachiningsNames, STRVECTOR& vsImported) ;
private :
bool Clear( bool bReset) ;
bool LoadHeader( Scanner& TheScanner, int& nVersion, int& nTotal, bool& bEnd) ;
bool LoadHeader( Scanner& TheScanner, int& nVersion, int& nTotal, bool& bEnd) const ;
bool LoadGeneral( Scanner& TheScanner, bool& bEnd) ;
bool LoadOneMachining( Scanner& TheScanner, bool& bEnd) ;
bool SaveHeader( Writer& TheWriter) const ;
bool SkipGeneral( Scanner& TheScanner, bool& bEnd) const ;
bool LoadOneMachining( Scanner& TheScanner, PtrOwner<MachiningData>& pMch, bool& bEnd) const ;
bool SaveHeader( Writer& TheWriter, int nTotal = -1) const ;
bool SaveGeneral( Writer& TheWriter) const ;
bool SaveOneMachining( const EgtUUID& Uuid, int& nCounter, Writer& TheWriter) const ;
bool VerifyCurrMachining( int nType, std::string& sName) const ;
+664 -250
View File
File diff suppressed because it is too large Load Diff
+13 -10
View File
@@ -88,26 +88,28 @@ class Milling : public Machining
bool GenerateMillingPv( int nPathId, const ICurveComposite* pCompo) ;
bool AddStandardMilling( const ICurveComposite* pCompo, const Vector3d& vtTool,
double dDepth, double dElev, bool bSplitArcs, bool bPathTabsEnable, bool bPathOscEnable) ;
bool AddZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool,
double dDepth, double dElev, double dOkStep, bool bSplitArcs, bool bPathTabsEnable, bool bPathOscEnable) ;
bool AddOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtTool,
double dDepth, double dElev, double dOkStep, bool bSplitArcs, bool bPathTabsEnable, bool bPathOscEnable) ;
bool AddZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dElev,
double dOkStep, bool bStepUp, bool bSplitArcs, bool bPathTabsEnable, bool bPathOscEnable) ;
bool AddOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dElev,
double dOkStep, bool bStepUp, bool bSplitArcs, bool bPathTabsEnable, bool bPathOscEnable) ;
bool AddSpiralMilling( const ICurveComposite* pCompo, const Vector3d& vtTool,
double dDepth, double dElev, double dOkStep, bool bSplitArcs, bool bPathTabsEnable, bool bPathOscEnable) ;
bool AddSawZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool,
double dDepth, double dElev, double dOkStep, bool bSplitArcs) ;
bool AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
double dElev, double dAppr, bool bOutStart, bool bAboveStart) ;
bool AddSawBladeSideApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dStElev, double dAppr) ;
bool AddSawBladeSideApproach( const Point3d& ptP, const Vector3d& vtAppr, double dSafeZ, double dStElev, double dAppr) ;
bool AddDirectApproach( const Point3d& ptP) ;
bool AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
double dElev, double dAppr, bool bAboveEnd) ;
bool AddSawBladeSideRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dEndElev, double dAppr) ;
bool CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtN,
bool AddSawBladeSideRetract( const Point3d& ptP, const Vector3d& vtRetr, double dSafeZ, double dEndElev, double dAppr) ;
bool CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtTool,
double dStElev, bool bInvert, const ICurveComposite* pCompo, Point3d& ptP1) 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,
const Vector3d& vtTool, 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) ;
bool AdjustOscillParams( const ICurve* pCrv, bool& bPathOscEnable, double& dRampLen, double& dFlatLen) ;
bool AddOscillLine( const ICurveLine* pLine, const Vector3d& vtTool, double dRampLen, double dFlatLen) ;
@@ -117,7 +119,7 @@ class Milling : public Machining
bool AddTabsLine( const ICurveLine* pLine, const Vector3d& vtTool, const DBLVECTOR& vdTabs, const TabData& tdTabs) ;
bool AddTabsArc( const ICurveArc* pArc, const Vector3d& vtTool, const DBLVECTOR& vdTabs, const TabData& tdTabs) ;
double GetRadiusForStartEndElevation( bool bExtra = true) const ;
bool GetPointOutOfRaw( const Point3d& ptP, const Vector3d& vtTool, double dElev, double dSafeZ) const ;
bool GetPointOutOfRaw( const Point3d& ptP, const Vector3d& vtTool, const Vector3d& vtCorr, double dElev, double dSafeZ) const ;
bool GetPointAboveRaw( const Point3d& ptP, const Vector3d& vtTool) const ;
bool CalcAndSetCorrAuxDir( const ICurveComposite* pCompo, double dU) ;
Vector3d CalcCorrDir( const ICurveComposite* pCompo, double dU) ;
@@ -149,6 +151,7 @@ class Milling : public Machining
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
+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) ;
}
//----------------------------------------------------------------------------
+184 -111
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 ;
}
@@ -627,14 +635,7 @@ Mortising::Update( bool bPostApply)
}
// 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) ;
@@ -992,7 +993,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 +1187,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 +1299,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 +1329,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 +1382,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 +1469,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 ;
Point3d ptLi = ( nPlunge != MORTISE_PLUNGE_END ? ptStart : ptEnd) + vtTool * dDelta ;
bool bUnderStart = GetPointUnderRaw( ptLi, vtTool, 0,
GetRadiusForStartEndElevation(), m_TParams.m_dLen, false, dSafeZ, dStartElev) ;
GetRadiusForStartEndElevation(), m_TParams.m_dLen, false, dSafeZ, vtTool, dStartElev) ;
// altrimenti ridetermino elevazione su inizio percorso di lavoro
if ( ! bUnderStart)
GetElevation( m_nPhase, ptLi, vtTool, GetRadiusForStartEndElevation(), vtTool, dStartElev) ;
// 1 -> punto approccio
SetFlag( 1) ;
Point3d ptP1 = ptStart + vtTool * ( dDelta + dStartElev + dSafeZ) ;
if ( AddRapidStart( ptP1) == GDB_ID_NULL)
int nFirstFlag = ( bFirst ? 1 : 0) ;
SetFlag( nFirstFlag) ;
Point3d ptP1 = ( nPlunge != MORTISE_PLUNGE_END ? ptStart : ptEnd) + vtTool * ( dDelta + dStartElev + dSafeZ) ;
int nStart = ( bFirst ? AddRapidStart( ptP1) : AddRapidMove( ptP1)) ;
if ( nStart == GDB_ID_NULL)
return false ;
SetFlag( 0) ;
// 2 -> punto fuori (se diverso dal precedente)
if ( m_Params.m_dStartPos < dSafeZ) {
Point3d ptP2 = ptStart + vtTool * ( dDelta + m_Params.m_dStartPos) ;
if ( m_Params.m_dStartPos < dSafeZ - 10 * EPS_SMALL) {
Point3d ptP2 = ( nPlunge != MORTISE_PLUNGE_END ? ptStart : ptEnd) + vtTool * ( dDelta + m_Params.m_dStartPos) ;
if ( AddRapidMove( ptP2) == GDB_ID_NULL)
return false ;
}
// determino numero e affondamento degli step
if ( dOkStep < EPS_SMALL)
dOkStep = dElev ;
int nStep = max( 1, static_cast<int>( ceil( dElev / dOkStep))) ;
double dStep = dElev / nStep ;
const double RETURN_DIST = 10 ;
// eseguo ciclo a seconda del tipo di step
// eseguo ciclo a seconda del tipo di affondamento
Point3d ptLast ;
switch ( m_Params.m_nStepType) {
default : // ZIGZAG
for ( int i = 1 ; i <= nStep ; ++ i) {
// 3 -> punto in affondamento
SetFeed( GetStartFeed()) ;
SetFlag( 0) ;
Point3d ptP3 = (( i % 2 == 1) ? ptStart : ptEnd) + ( dDelta - i * dStep) * vtTool ;
if ( AddLinearMove( ptP3) == GDB_ID_NULL)
return false ;
// 4 -> punto termine
SetFeed( GetFeed()) ;
SetFlag( 0) ;
ptLast = (( i % 2 == 1) ? ptEnd : ptStart) ;
Point3d ptP4 = ptLast + ( dDelta - i * dStep) * vtTool ;
if ( AddLinearMove( ptP4) == GDB_ID_NULL)
return false ;
}
break ;
case MORTISE_ST_ONEWAY :
for ( int i = 1 ; i <= nStep ; ++ i) {
// 3 -> punto in affondamento
SetFeed( GetStartFeed()) ;
SetFlag( 0) ;
Point3d ptP3 = ptStart + ( dDelta - i * dStep) * vtTool ;
if ( AddLinearMove( ptP3) == GDB_ID_NULL)
return false ;
// 4 -> punto termine
SetFeed( GetFeed()) ;
SetFlag( 0) ;
ptLast = ptEnd ;
Point3d ptP4 = ptLast + ( dDelta - i * dStep) * vtTool ;
if ( AddLinearMove( ptP4) == GDB_ID_NULL)
return false ;
// 5 -> ritorno sull'inizio, se non ultimo punto
if ( i < nStep) {
// retrocedo
if ( nPlunge == MORTISE_PLUNGE_START) {
// 3 -> punto in affondamento
SetFeed( GetStartFeed()) ;
SetFlag( 0) ;
Point3d ptP3 = ptStart + ( dDelta - dElev) * vtTool ;
if ( AddLinearMove( ptP3) == GDB_ID_NULL)
return false ;
ptLast = ptStart ;
}
else if ( nPlunge == MORTISE_PLUNGE_END) {
// 3 -> punto in affondamento
SetFeed( GetStartFeed()) ;
SetFlag( 0) ;
Point3d ptP3 = ptEnd + ( dDelta - dElev) * vtTool ;
if ( AddLinearMove( ptP3) == GDB_ID_NULL)
return false ;
ptLast = ptEnd ;
}
else {
// determino numero e affondamento degli step
if ( dOkStep < EPS_SMALL)
dOkStep = dElev ;
int nStep = max( 1, static_cast<int>( ceil( ( dElev - 10 * EPS_SMALL) / dOkStep))) ;
double dStep = dElev / nStep ;
const double RETURN_DIST = 10 ;
// a seconda del tipo
switch ( m_Params.m_nStepType) {
default : // ZIGZAG
for ( int i = 1 ; i <= nStep ; ++ i) {
// 3 -> punto in affondamento
SetFeed( GetStartFeed()) ;
SetFlag( 0) ;
Point3d ptP3 = (( i % 2 == 1) ? ptStart : ptEnd) + ( dDelta - i * dStep) * vtTool ;
if ( AddLinearMove( ptP3) == GDB_ID_NULL)
return false ;
// 4 -> punto termine
SetFeed( GetFeed()) ;
SetFlag( 0) ;
Point3d ptP5a = ptP4 + RETURN_DIST * vtTool ;
if ( AddLinearMove( ptP5a) == GDB_ID_NULL)
return false ;
// ritorno sopra inizio
SetFeed( GetFeed()) ;
SetFlag( 0) ;
Point3d ptP5b = ptP3 + RETURN_DIST * vtTool ;
if ( AddLinearMove( ptP5b) == GDB_ID_NULL)
return false ;
ptLast = (( i % 2 == 1) ? ptEnd : ptStart) ;
Point3d ptP4 = ptLast + ( dDelta - i * dStep) * vtTool ;
if ( AddLinearMove( ptP4) == GDB_ID_NULL)
return false ;
}
break ;
case MORTISE_ST_ONEWAY :
for ( int i = 1 ; i <= nStep ; ++ i) {
// 3 -> punto in affondamento
SetFeed( GetStartFeed()) ;
SetFlag( 0) ;
Point3d ptP3 = ptStart + ( dDelta - i * dStep) * vtTool ;
if ( AddLinearMove( ptP3) == GDB_ID_NULL)
return false ;
// 4 -> punto termine
SetFeed( GetFeed()) ;
SetFlag( 0) ;
ptLast = ptEnd ;
Point3d ptP4 = ptLast + ( dDelta - i * dStep) * vtTool ;
if ( AddLinearMove( ptP4) == GDB_ID_NULL)
return false ;
// 5 -> ritorno sull'inizio, se non ultimo punto
if ( i < nStep) {
// retrocedo
SetFeed( GetFeed()) ;
SetFlag( 0) ;
Point3d ptP5a = ptP4 + RETURN_DIST * vtTool ;
if ( AddLinearMove( ptP5a) == GDB_ID_NULL)
return false ;
// ritorno sopra inizio
SetFeed( GetFeed()) ;
SetFlag( 0) ;
Point3d ptP5b = ptP3 + RETURN_DIST * vtTool ;
if ( AddLinearMove( ptP5b) == GDB_ID_NULL)
return false ;
}
}
break ;
}
break ;
}
// determino se la fine dell'uscita è esattamente sotto il grezzo, nel qual caso ricalcolo l'elevazione
double dEndElev = 0 ;
Point3d ptLo = ptLast + vtTool * dDelta ;
bool bUnderEnd = GetPointUnderRaw( ptLo, vtTool, 0,
GetRadiusForStartEndElevation(), m_TParams.m_dLen, false, dSafeZ, dEndElev) ;
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 +1656,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 :
+669 -212
View File
File diff suppressed because it is too large Load Diff
+29 -7
View File
@@ -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 ;
@@ -68,6 +69,8 @@ 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& ptP1, const Point3d& ptP2,
const Vector3d& vtDir, double& dElev) const ;
bool GetElevation( int nPhase, const Point3d& ptP1, const Point3d& ptP2, const Point3d& ptP3,
@@ -75,17 +78,22 @@ class Operation : public IUserObj
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 ;
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 GetDistanceFromRawBottom( int nPhase, BBox3d& b3Test, double dToler, double& dRbDist, double& dAllRbDist) const;
bool GetRawGlobBox( int nPhase, int nPathId, double dToler, BBox3d& b3Raw) const ;
bool GetRawGlobBox( int nPhase, const BBox3d& b3Test, double dToler, BBox3d& b3Raw) const ;
bool 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 VerifyArcs( ICurveComposite* pCompo, double dMaxAngCen = MAX_ANG_CEN) const ;
@@ -93,14 +101,23 @@ class Operation : public IUserObj
bool CalcAndSetBBox( int nClId) ;
bool CalcAndSetAxesBBox( void) ;
bool GetInitialAxesValues( DBLVECTOR& vAxVal) const ;
bool GetClPathInitialAxesValues( int nClPathId, DBLVECTOR& vAxVal) const ;
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 SetBlockedRotAxis( const std::string& sBlockedAxis) const ;
bool CalculateAxesValues( const std::string& sHint, bool bSolChExact = false) ;
bool CalculateClPathAxesValues( int nClPathId, int nLinAxes, int nRotAxes, double dRot1W,
bool CalculateClPathAxesValues( int nClPathId, int nLinAxes, int nRotAxes, double dRot1W, bool bMaxDeltaR2OnFirst,
double dAngDeltaMinForHome, const DBLVECTOR& vAxRotHome, DBLVECTOR& vAxRotPrec, int& nOutStrC) ;
bool AdjustStartEndMovements( bool bVerifyPreviousLink = true) ;
bool AdjustOneStartMovement( int nClPathId, int nPrevClPathId, Operation* pPrevOp, const DBLVECTOR& vAxPrev, bool bMaxZ) ;
@@ -111,7 +128,12 @@ class Operation : public IUserObj
bool RemoveRise( int nClPathId = GDB_ID_NULL) ;
bool AddHome( void) ;
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 dSafeZ, 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 ;
int GetUserNotesZmax( void) const ;
+136 -133
View File
@@ -20,143 +20,146 @@
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_TCOMP = ".TCOMP" ; // (int) numero correttore utensile
static const std::string GVAR_TDIAM = ".TDIAM" ; // (num) diametro utensile
static const std::string GVAR_TTOTDIAM = ".TTOTDIAM" ; // (num) diametro totale utensile
static const std::string GVAR_TLEN = ".TLEN" ; // (num) lunghezza utensile
static const std::string GVAR_TTOTLEN = ".TTOTLEN" ; // (num) lunghezza totale utensile
static const std::string GVAR_TDIST = ".TDIST" ; // (num) distanza utensile (per mortasatrice/sega a catena)
static const std::string GVAR_TUSED = ".TUSED" ; // (bool) flag per indicare che l'utensile attrezzato è anche utilizzato
static const std::string GVAR_SMAX = ".SMAX" ; // (num) massima speed utensile
static const std::string GVAR_FIRST = ".FIRST" ; // (bool) flag per primo utensile
static const std::string GVAR_NEXTTOOL = ".NEXTTOOL" ; // (string) nome del prossimo utensile
static const std::string GVAR_NEXTHEAD = ".NEXTHEAD" ; // (string) nome testa del prossimo utensile
static const std::string GVAR_NEXTEXIT = ".NEXTEXIT" ; // (int) indice uscita su testa del prox utensile
static const std::string GVAR_NEXTTCPOS = ".NEXTTCPOS" ; // (string) eventuale posizione del prox utensile nel TC
static const std::string GVAR_MCHID = ".MCHID" ; // (int) identificativo lavorazione
static const std::string GVAR_MCHIND = ".MCHIND" ; // (int) indice lavorazione
static const std::string GVAR_MMIN = ".MMIN" ; // (Point3d) punto minimo di ingombro della lavorazione
static const std::string GVAR_MMAX = ".MMAX" ; // (Point3d) punto massimo di ingombro della lavorazione
static const std::string GVAR_MAXMIN = ".MAXMIN" ; // (double/s) minimo di ingombro degli assi della lavorazione
static const std::string GVAR_MAXMAX = ".MAXMAX" ; // (double/s) massimo di ingombro degli assi della lavorazione
static const std::string GVAR_PATHID = ".PATHID" ; // (int) identificativo percorso di lavorazione
static const std::string GVAR_PATHIND = ".PATHIND" ; // (int) indice percorso di lavorazione
static const std::string GVAR_START = ".START" ; // (Point3d) punto iniziale del percorso originale
static const std::string GVAR_END = ".END" ; // (Point3d) punto finale del percorso originale
static const std::string GVAR_EXTR = ".EXTR" ; // (Vector3d)versore estrusione
static const std::string GVAR_PMIN = ".PMIN" ; // (Point3d) punto minimo di ingombro del percorso di lavorazione
static const std::string GVAR_PMAX = ".PMAX" ; // (Point3d) punto massimo di ingombro del percorso di lavorazione
static const std::string GVAR_PATHID = ".PATHID" ; // (int) identificativo percorso di lavorazione
static const std::string GVAR_PATHIND = ".PATHIND" ; // (int) indice percorso di lavorazione
static const std::string GVAR_START = ".START" ; // (Point3d) punto iniziale del percorso originale
static const std::string GVAR_END = ".END" ; // (Point3d) punto finale del percorso originale
static const std::string GVAR_EXTR = ".EXTR" ; // (Vector3d) versore estrusione
static const std::string GVAR_PMIN = ".PMIN" ; // (Point3d) punto minimo di ingombro del percorso di lavorazione
static const std::string GVAR_PMAX = ".PMAX" ; // (Point3d) punto massimo di ingombro del percorso di lavorazione
static const std::string GVAR_PAXMIN = ".PAXMIN" ; // (double/s) minimo di ingombro degli assi del percorso di lavorazione
static const std::string GVAR_PAXMAX = ".PAXMAX" ; // (double/s) massimo di ingombro degli assi del percorso di lavorazione
static const std::string GVAR_ELEV = ".ELEV" ; // (double) massima elevazione
static const std::string GVAR_AUXTOT = ".AUXTOT" ; // (int) numero totale dati ausiliari inizio/fine percorso di lavorazione
static const std::string GVAR_AUXIND = ".AUXIND" ; // (int) indice dato ausiliario inizio/fine percorso di lavorazione
static const std::string GVAR_AUX = ".AUX" ; // (string) dato ausiliario inizio/fine percorso di lavorazione
static const std::string GVAR_MOVEID = ".MOVEID" ; // (int) identificativo movimento
static const std::string GVAR_MOVEIND = ".MOVEIND" ; // (int) indice movimento
static const std::string GVAR_MOVE = ".MOVE" ; // (int) tipo di movimento (0,1,2,3)
static const std::string GVAR_L1 = ".L1" ; // (num) valore del primo asse lineare
static const std::string GVAR_L2 = ".L2" ; // (num) valore del secondo asse lineare
static const std::string GVAR_L3 = ".L3" ; // (num) valore del terzo asse lineare
static const std::string GVAR_R1 = ".R1" ; // (num) valore del primo asse rotante
static const std::string GVAR_R2 = ".R2" ; // (num) valore del secondo asse rotante
static const std::string GVAR_R3 = ".R3" ; // (num) valore del terzo asse rotante
static const std::string GVAR_R4 = ".R4" ; // (num) valore del quarto asse rotante
static const std::string GVAR_C1 = ".C1" ; // (num) valore del primo asse lineare per centro arco
static const std::string GVAR_C2 = ".C2" ; // (num) valore del secondo asse lineare per centro arco
static const std::string GVAR_C3 = ".C3" ; // (num) valore del terzo asse lineare per centro arco
static const std::string GVAR_M1 = ".M1" ; // (num) valore del primo asse lineare per punto medio arco
static const std::string GVAR_M2 = ".M2" ; // (num) valore del secondo asse lineare per punto medio arco
static const std::string GVAR_M3 = ".M3" ; // (num) valore del terzo asse lineare per punto medio arco
static const std::string GVAR_RR = ".RR" ; // (num) valore raggio per arco
static const std::string GVAR_AC = ".AC" ; // (num) valore angolo al centro per arco
static const std::string GVAR_L1P = ".L1p" ; // (num) valore precedente del primo asse lineare
static const std::string GVAR_L2P = ".L2p" ; // (num) valore precedente del secondo asse lineare
static const std::string GVAR_L3P = ".L3p" ; // (num) valore precedente del terzo asse lineare
static const std::string GVAR_R1P = ".R1p" ; // (num) valore precedente del primo asse rotante
static const std::string GVAR_R2P = ".R2p" ; // (num) valore precedente del secondo asse rotante
static const std::string GVAR_R3P = ".R3p" ; // (num) valore precedente del terzo asse rotante
static const std::string GVAR_R4P = ".R4p" ; // (num) valore precedente del quarto asse rotante
static const std::string GVAR_L1T = ".L1t" ; // (string) token del primo asse lineare
static const std::string GVAR_L2T = ".L2t" ; // (string) token del secondo asse lineare
static const std::string GVAR_L3T = ".L3t" ; // (string) token del terzo asse lineare
static const std::string GVAR_R1T = ".R1t" ; // (string) token del primo asse rotante
static const std::string GVAR_R2T = ".R2t" ; // (string) token del secondo asse rotante
static const std::string GVAR_R3T = ".R3t" ; // (string) token del terzo asse rotante
static const std::string GVAR_R4T = ".R4t" ; // (string) token del quarto asse rotante
static const std::string GVAR_C1T = ".C1t" ; // (string) token del primo asse lineare per centro arco
static const std::string GVAR_C2T = ".C2t" ; // (string) token del secondo asse lineare per centro arco
static const std::string GVAR_C3T = ".C3t" ; // (string) token del terzo asse lineare per centro arco
static const std::string GVAR_M1T = ".M1t" ; // (string) token del primo asse lineare per punto medio arco
static const std::string GVAR_M2T = ".M2t" ; // (string) token del secondo asse lineare per punto medio arco
static const std::string GVAR_M3T = ".M3t" ; // (string) token del terzo asse lineare per punto medio arco
static const std::string GVAR_RRT = ".RRt" ; // (string) token del raggio per arco
static const std::string GVAR_L1N = ".L1n" ; // (string) nome del primo asse lineare
static const std::string GVAR_L2N = ".L2n" ; // (string) nome del secondo asse lineare
static const std::string GVAR_L3N = ".L3n" ; // (string) nome del terzo asse lineare
static const std::string GVAR_R1N = ".R1n" ; // (string) nome del primo asse rotante
static const std::string GVAR_R2N = ".R2n" ; // (string) nome del secondo asse rotante
static const std::string GVAR_R3N = ".R3n" ; // (string) nome del terzo asse rotante
static const std::string GVAR_R4N = ".R4n" ; // (string) nome del quarto asse rotante
static const std::string GVAR_MASK = ".MASK" ; // (int) mask associato ai movimenti in rapido
static const std::string GVAR_FLAG = ".FLAG" ; // (int) flag associato ad ogni movimento
static const std::string GVAR_FLAG2 = ".FLAG2" ; // (int) secondo flag associato ad ogni movimento
static const std::string GVAR_INDEX = ".IDX" ; // (int) indice associato ad ogni movimento
static const std::string GVAR_TDIR = ".TDIR" ; // (Vector3d)versore utensile nel riferimento pezzo
static const std::string GVAR_CDIR = ".CDIR" ; // (Vector3d)versore correzione nel riferimento pezzo
static const std::string GVAR_ADIR = ".ADIR" ; // (Vector3d)versore ausiliario nel riferimento pezzo
static const std::string GVAR_ENABAXES = ".EnabAxes" ; // (bool) flag abilitazione assi attivi per simulazione
static const std::string GVAR_SHOWAXES = ".ShowAxes" ; // (bool) flag visualizzazione assi attivi per simulazione
static const std::string GVAR_AUXAXES = ".AuxAxes" ; // (int) numero assi ausiliari per simulazione
static const std::string GVAR_AN = ".AN" ; // (num) valore del N-esimo asse ausiliario per simulazione
static const std::string GVAR_ANN = ".ANn" ; // (string) nome del N-esimo asse ausiliario per simulazione
static const std::string GVAR_VMILL = ".VMILL" ; // (int/s) identificativi Zmap attivi per Virtual Milling
static const std::string GVAR_CODET = ".CODET" ; // (int/s) identificativi Zmap attivi per Collision Detection
static const std::string GVAR_SIM1ST = ".SIM1ST" ; // (bool) flag inizio simulazione
static const std::string GVAR_SIMSTEP = ".SIMSTEP" ; // (num) step di movimento durante la simulazione
static const std::string GVAR_SIMUISTAT = ".SIMUISTAT" ; // (num) stato simulazione imposto da utente
static const std::string GVAR_SAFEDIST = ".SAFEDIST" ; // (num) distanza di sicurezza per verifica di collisione
static const std::string GVAR_SIMVMID = ".SIMVMID" ; // (int) identificativo grezzo Vmill in collisione
static const std::string GVAR_SIMCOBIND = ".SIMCOBIND" ; // (int) indice oggetto in collisione
static const std::string GVAR_ELEV = ".ELEV" ; // (double) massima elevazione
static const std::string GVAR_AUXTOT = ".AUXTOT" ; // (int) numero totale dati ausiliari inizio/fine percorso di lavorazione
static const std::string GVAR_AUXIND = ".AUXIND" ; // (int) indice dato ausiliario inizio/fine percorso di lavorazione
static const std::string GVAR_AUX = ".AUX" ; // (string) dato ausiliario inizio/fine percorso di lavorazione
static const std::string GVAR_MOVEID = ".MOVEID" ; // (int) identificativo movimento
static const std::string GVAR_MOVEIND = ".MOVEIND" ; // (int) indice movimento
static const std::string GVAR_MOVE = ".MOVE" ; // (int) tipo di movimento (0,1,2,3)
static const std::string GVAR_L1 = ".L1" ; // (num) valore del primo asse lineare
static const std::string GVAR_L2 = ".L2" ; // (num) valore del secondo asse lineare
static const std::string GVAR_L3 = ".L3" ; // (num) valore del terzo asse lineare
static const std::string GVAR_R1 = ".R1" ; // (num) valore del primo asse rotante
static const std::string GVAR_R2 = ".R2" ; // (num) valore del secondo asse rotante
static const std::string GVAR_R3 = ".R3" ; // (num) valore del terzo asse rotante
static const std::string GVAR_R4 = ".R4" ; // (num) valore del quarto asse rotante
static const std::string GVAR_C1 = ".C1" ; // (num) valore del primo asse lineare per centro arco
static const std::string GVAR_C2 = ".C2" ; // (num) valore del secondo asse lineare per centro arco
static const std::string GVAR_C3 = ".C3" ; // (num) valore del terzo asse lineare per centro arco
static const std::string GVAR_M1 = ".M1" ; // (num) valore del primo asse lineare per punto medio arco
static const std::string GVAR_M2 = ".M2" ; // (num) valore del secondo asse lineare per punto medio arco
static const std::string GVAR_M3 = ".M3" ; // (num) valore del terzo asse lineare per punto medio arco
static const std::string GVAR_RR = ".RR" ; // (num) valore raggio per arco
static const std::string GVAR_AC = ".AC" ; // (num) valore angolo al centro per arco
static const std::string GVAR_L1P = ".L1p" ; // (num) valore precedente del primo asse lineare
static const std::string GVAR_L2P = ".L2p" ; // (num) valore precedente del secondo asse lineare
static const std::string GVAR_L3P = ".L3p" ; // (num) valore precedente del terzo asse lineare
static const std::string GVAR_R1P = ".R1p" ; // (num) valore precedente del primo asse rotante
static const std::string GVAR_R2P = ".R2p" ; // (num) valore precedente del secondo asse rotante
static const std::string GVAR_R3P = ".R3p" ; // (num) valore precedente del terzo asse rotante
static const std::string GVAR_R4P = ".R4p" ; // (num) valore precedente del quarto asse rotante
static const std::string GVAR_L1T = ".L1t" ; // (string) token del primo asse lineare
static const std::string GVAR_L2T = ".L2t" ; // (string) token del secondo asse lineare
static const std::string GVAR_L3T = ".L3t" ; // (string) token del terzo asse lineare
static const std::string GVAR_R1T = ".R1t" ; // (string) token del primo asse rotante
static const std::string GVAR_R2T = ".R2t" ; // (string) token del secondo asse rotante
static const std::string GVAR_R3T = ".R3t" ; // (string) token del terzo asse rotante
static const std::string GVAR_R4T = ".R4t" ; // (string) token del quarto asse rotante
static const std::string GVAR_C1T = ".C1t" ; // (string) token del primo asse lineare per centro arco
static const std::string GVAR_C2T = ".C2t" ; // (string) token del secondo asse lineare per centro arco
static const std::string GVAR_C3T = ".C3t" ; // (string) token del terzo asse lineare per centro arco
static const std::string GVAR_M1T = ".M1t" ; // (string) token del primo asse lineare per punto medio arco
static const std::string GVAR_M2T = ".M2t" ; // (string) token del secondo asse lineare per punto medio arco
static const std::string GVAR_M3T = ".M3t" ; // (string) token del terzo asse lineare per punto medio arco
static const std::string GVAR_RRT = ".RRt" ; // (string) token del raggio per arco
static const std::string GVAR_L1N = ".L1n" ; // (string) nome del primo asse lineare
static const std::string GVAR_L2N = ".L2n" ; // (string) nome del secondo asse lineare
static const std::string GVAR_L3N = ".L3n" ; // (string) nome del terzo asse lineare
static const std::string GVAR_R1N = ".R1n" ; // (string) nome del primo asse rotante
static const std::string GVAR_R2N = ".R2n" ; // (string) nome del secondo asse rotante
static const std::string GVAR_R3N = ".R3n" ; // (string) nome del terzo asse rotante
static const std::string GVAR_R4N = ".R4n" ; // (string) nome del quarto asse rotante
static const std::string GVAR_MASK = ".MASK" ; // (int) mask associato ai movimenti in rapido
static const std::string GVAR_FLAG = ".FLAG" ; // (int) flag associato ad ogni movimento
static const std::string GVAR_FLAG2 = ".FLAG2" ; // (int) secondo flag associato ad ogni movimento
static const std::string GVAR_INDEX = ".IDX" ; // (int) indice associato ad ogni movimento
static const std::string GVAR_TDIR = ".TDIR" ; // (Vector3d) versore utensile nel riferimento pezzo
static const std::string GVAR_CDIR = ".CDIR" ; // (Vector3d) versore correzione nel riferimento pezzo
static const std::string GVAR_ADIR = ".ADIR" ; // (Vector3d) versore ausiliario nel riferimento pezzo
static const std::string GVAR_TDIRP = ".TDIRp" ; // (Vector3d) precedente versore utensile nel riferimento pezzo
static const std::string GVAR_ENABAXES = ".EnabAxes" ; // (bool) flag abilitazione assi attivi per simulazione
static const std::string GVAR_SHOWAXES = ".ShowAxes" ; // (bool) flag visualizzazione assi attivi per simulazione
static const std::string GVAR_AUXAXES = ".AuxAxes" ; // (int) numero assi ausiliari per simulazione
static const std::string GVAR_AN = ".AN" ; // (num) valore del N-esimo asse ausiliario per simulazione
static const std::string GVAR_ANN = ".ANn" ; // (string) nome del N-esimo asse ausiliario per simulazione
static const std::string GVAR_ANM = ".ANm" ; // (string) asse master del N-esimo asse ausiliario per simulazione
static const std::string GVAR_VMILL = ".VMILL" ; // (int/s) identificativi Zmap attivi per Virtual Milling
static const std::string GVAR_CODET = ".CODET" ; // (int/s) identificativi Zmap attivi per Collision Detection
static const std::string GVAR_SIM1ST = ".SIM1ST" ; // (bool) flag inizio simulazione
static const std::string GVAR_SIMSTEP = ".SIMSTEP" ; // (num) step di movimento durante la simulazione
static const std::string GVAR_SIMUISTAT = ".SIMUISTAT" ; // (num) stato simulazione imposto da utente
static const std::string GVAR_SAFEDIST = ".SAFEDIST" ; // (num) distanza di sicurezza per verifica di collisione
static const std::string GVAR_SIMVMID = ".SIMVMID" ; // (int) identificativo grezzo Vmill in collisione
static const std::string GVAR_SIMCOBIND = ".SIMCOBIND" ; // (int) indice oggetto in collisione
// Funzioni generazione
static const std::string ON_START = "OnStart" ;
static const std::string ON_END = "OnEnd" ;
+5442 -1341
View File
File diff suppressed because it is too large Load Diff
+83 -22
View File
@@ -17,7 +17,9 @@
#include "PocketingData.h"
#include "ToolData.h"
#include "/EgtDev/Include/EGkCurveComposite.h"
#include "/EgtDev/Include/EGkCurveLine.h"
#include "/EgtDev/Include/EgtNumUtils.h"
#include "/EgtDev/Include/EGkSurfFlatRegion.h"
//----------------------------------------------------------------------------
class Pocketing : public Machining
@@ -72,44 +74,99 @@ class Pocketing : public Machining
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 VerifyPathFromBottom( const ICurveComposite* pCompo, const Vector3d& vtTool) ;
bool GeneratePocketingPv( int nPathId, const ICurveComposite* pCompo) ;
bool AddZigZag( const ICurveComposite* pCompo, const Vector3d& vtTool, const Vector3d& vtExtr,
double dDepth, double dElev, double dOkStep, bool bSplitArcs) ;
bool CalcZigZag( const ICurveComposite* pOffs, ICRVCOMPOPOVECTOR& vpCrvs) ;
bool AddOneWay( const ICurveComposite* pCompo, const Vector3d& vtTool, const Vector3d& vtExtr,
double dDepth, double dElev, double dOkStep, bool bSplitArcs) ;
bool AddSpiralIn( const ICurveComposite* pCompo, const Vector3d& vtTool, const Vector3d& vtExtr,
double dDepth, double dElev, double dOkStep, bool bSplitArcs, bool bMidOpen,
const Point3d& ptMidOpen, const Vector3d& vtMidOut) ;
bool AddSpiralOut( const ICurveComposite* pCompo, const Vector3d& vtTool, const Vector3d& vtExtr,
double dDepth, double dElev, double dOkStep, bool bSplitArcs) ;
bool CalcSpiral( const ICurveComposite* pCompo, int nReg, bool bSplitArcs,
ICurveComposite* pMCrv, ICurveComposite* pRCrv) ;
bool CalcBoundedLink( const Point3d& ptStart, const Point3d& ptEnd, const ICurve* pCrvBound,
ICurveComposite* pCrvLink) ;
bool VerifyPathFromBottom( const ISurfFlatRegion* pSrf, const Vector3d& vtTool) ;
bool GeneratePocketingPv( int nPathId, const ISurfFlatRegion* pSrfPock) ;
bool ModifyCurveToSmooted( ICurveComposite* pCrvOffset, double dRightPer, double dleftPer) ;
// ===== ZigZag =====
bool AddZigZag( const ISurfFlatRegion* pSrfPock, const Vector3d& vtTool, const Vector3d& vtExtr, double dDepth, double dElev, double dOkStep,
bool bSplitArcs, int nPathId) ;
bool CalcZigZag( const ISurfFlatRegion* pSrfZigZag, ICRVCOMPOPOVECTOR& vpCrvs) ;
bool CalcBoundedZigZagLink( ICurveLine* pCrv1, ICurveLine* pCrv2, ICRVCOMPOPOVECTOR& vOffIslands, ICurveComposite* pCrvLink, int nIndexCut = 3) ;
bool OptimizedZigZag( ISurfFlatRegion* pSrf, const Vector3d & vtTool, double dDepth, double dSafeZ, Frame3d & frPocket, bool & bOptimizedZigZag,
ICRVCOMPOPOVECTOR & vpCrvs) ;
bool ZigZagOptimizedNoClosedEdges( ICurveComposite* pCrvPocket, bool& bOptimizedZigZag, Vector3d& vtDir) ;
bool ZigZagOptimizedOneClosedEdge( ICurveComposite* pCrvPocket, int nClosedId, bool& bOptimizedZigZag, Vector3d& vtDir) ;
bool ZigZagOptimizedTwoClosedEdges( ICurveComposite* pCrvPocket, const INTVECTOR& vnClosedIds, bool& bOptimizedZigZag,
bool& bOpposite, Vector3d& vtDir) ;
bool ZigZagOptimizedThreeClosedEdges( ICurveComposite* pCrvPocket, const INTVECTOR& vnClosedIds, bool& bOptimizedZigZag,
bool& bOpposite, Vector3d& vtDir) ;
bool ZigZagOptimizedComputeOffset( ICurveComposite* pCrvPocket, const Vector3d& vtMainDir, int nOffsettedEdgesOnY,
const INTVECTOR& vnClosedIds) ;
bool CutCurveWithLine( ICurveComposite* pCrvA, const ICurveLine* pCrvB) ;
bool GetUnclearedRegion( ICRVCOMPOPOVECTOR& vFirstOffs, ICRVCOMPOPOVECTOR& vCrvs, ICURVEPOVECTOR& vLinks, ISurfFlatRegion* pSrfToCut) ;
// ==================
// ==== OneWay ======
bool AddOneWay( const ISurfFlatRegion* pSrfPock, const Vector3d& vtTool, const Vector3d& vtExtr, double dDepth, double dElev, double dOkStep, bool bSplitArcs) ;
// ==================
// ==== SpiralIn/Out ====
bool AddSpiralIn( const ISurfFlatRegion* pSrfPock, const PNTVECTOR vPtStart, const Vector3d& vtTool, const Vector3d& vtExtr, double dDepth,
double dElev, double dOkStep, bool bSplitArcs, BOOLVECTOR vbMidOpen, PNTVECTOR vPtMidOpen, VCT3DVECTOR vVtMidOut, int nPathId) ;
bool AddSpiralOut( const ISurfFlatRegion* pSrfpock, const PNTVECTOR vPtStart, const Vector3d& vtTool, const Vector3d& vtExtr, double dDepth, double dElev,
double dOkStep, bool bSplitArcs, int nPathId) ;
bool CalcSpiral( const ISurfFlatRegion* pSrfChunk, int nReg, Point3d ptStart, bool bSplitArcs, ICurveComposite* pMCrv, ICurveComposite* pRCrv, int nPathId,
bool& bOptimizedTrap) ;
bool RemoveExtraParts( ISurfFlatRegion* pSrfToCut, ICRVCOMPOPOVECTOR& vOffs, ICRVCOMPOPOVECTOR& vOffsClosedCurves, ICRVCOMPOPOVECTOR& vOffsFirstCurve,
ICURVEPOVECTOR& vLinks) ;
bool RemoveExtraPartByMedialAxis( ISurfFlatRegion* pChunkToCut, ICRVCOMPOPOVECTOR& vOffsFirstCurve, int& nOptFlag, Point3d& ptCentroid,
ICurveComposite* pCrvPath) ;
bool CalcBoundedLink( const Point3d& ptStart, const Point3d& ptEnd, ICRVCOMPOPOVECTOR& vOffIslands, ICurveComposite* pCrvLink) ;
bool CalcBoundedSmootedLink( const Point3d& ptStart, const Vector3d& vtStart, const Point3d& ptEnd, const Vector3d& vtEnd, double dParMeet,
ICRVCOMPOPOVECTOR& vOffIslands, ICurveComposite* pCrvLink) ;
bool ModifyBiArc( ICurve* pCrvBiArc, double dCutToll, ICurveComposite* pNewCrv) ;
bool CutCurveByOffsets( ICurveComposite* pCurve, ICRVCOMPOPOVECTOR& vOffs) ;
bool GetCurveWeightInfo( ICurveComposite* pCrvCompo, double dMaxLen, double& dToTRot, int& nSmallArcs, int& nSmallLines) ;
bool ChoosePath( ICurveComposite* pCrv1, ICurveComposite* pCrv2, int nP, double dPerP, double dMaxLen, int& nC) ;
bool CutCurveToConnect( ICurveComposite* pCrvS, ICurveComposite* pCrvE, ICRVCOMPOPOVECTOR& vOffs, ICRVCOMPOPOVECTOR& vOffIslands,
ICurveComposite* pCrvLink, double dLenPercS = 0.01, double dLenPercE = 0.01, int nMaxIter = 2) ;
bool GetNewCurvetWithCentroid( ICurveComposite* pCrvH1, ICurveComposite* pCrvH2, Point3d& ptC, bool bCir, ICRVCOMPOPOVECTOR& VFirstOff,
ICurveComposite* pCrvNewCurve) ;
bool GetNewCurvetWithPath( ICurveComposite* pCrvH1, ICurveComposite* pCrvH2, ICurveComposite* pCrvPath, ICRVCOMPOPOVECTOR& VFirstOff, ICRVCOMPOPOVECTOR& VoffsCl,
ICurveComposite* pCrvNewCurve) ;
bool ManageSmoothAndAutoInters( ICurveComposite* pCrv, ICurveComposite* pCrvPath, ICurveComposite* pPath1, ICurveComposite* pPath2, ICRVCOMPOPOVECTOR& vOffsCL) ;
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) ;
bool AddLinkApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
double dElev, double dAppr) ;
double dElev, double dAppr, bool bOutStart = false) ;
bool AddLinkRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
double dElev, double dAppr) ;
bool AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
double dElev, double dAppr) ;
bool CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtN,
const ICurveComposite* pRCrv, Point3d& ptP1) const ;
bool AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtN,
const ICurveComposite* pCompo, const ICurveComposite* pRCrv, bool bAtLeft, bool bSplitArcs, bool bNoneForced = false) ;
bool AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtN,
ISurfFlatRegion* pSrfChunk, const ICurveComposite* pRCrv, bool bAtLeft, bool bSplitArcs,
bool bNoneForced = false, bool bSkipControl = false) ;
bool AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d& vtN,
const ICurveComposite* pRCrv, bool bSplitArcs, Point3d& ptP1, double& dElev, bool bNoneForced = false) ;
double GetRadiusForStartEndElevation( void) const ;
bool GetMidOfLongestOpenSide( const ICurveComposite* pCompo, Point3d& ptMid, Vector3d& vtMidOut) ;
bool AdjustContourWithOpenEdges( ICurveComposite* pCompo) ;
bool AdjustContourStart( ICurveComposite* pCompo) ;
bool VerifyLeadInHelix( const ICurveComposite* pCompo, const Point3d& ptCen, double dRad) const ;
bool VerifyLeadInZigZag( const ICurveComposite* pCompo, const Point3d& ptPa, const Point3d& ptPb) const ;
bool VerifyLeadInHelix( ISurfFlatRegion* pSrfChunk, const Point3d& ptCen, double dRad) const ;
bool VerifyLeadInZigZag( ISurfFlatRegion* pSrfChunk, 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
@@ -137,7 +194,8 @@ class Pocketing : public Machining
int LeadInIsOk( 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,6 +205,7 @@ 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
@@ -157,4 +216,6 @@ class Pocketing : public Machining
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
POLYLINEVECTOR m_VplIsland ; // vettore che contiene le curve che descrivono le isole
} ;
+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) ;
}
//----------------------------------------------------------------------------
+3 -1
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 ;
+27 -11
View File
@@ -447,13 +447,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 +462,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 ;
@@ -607,9 +608,10 @@ Processor::ProcessToolData( void)
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(), nComp(0), dDiam( 0), dLen( 0), dDist( 0), dMaxSpeed( 0) {}
} ;
typedef vector<MyToolData> TDATAVECTOR ;
TDATAVECTOR vTdata ;
@@ -639,6 +641,7 @@ Processor::ProcessToolData( void)
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 +674,20 @@ 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 nComp ; double dDiam ; double dTDiam ; double dLen ; double dTLen ; double dDist ; double dMaxSpeed ;
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_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 ;
@@ -721,6 +726,7 @@ Processor::ProcessToolData( void)
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TTOTDIAM, vTdata[i].dTDiam) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TLEN, vTdata[i].dLen) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TTOTLEN, vTdata[i].dTLen) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TDIST, vTdata[i].dDist) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_SMAX, vTdata[i].dMaxSpeed) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TUSED, true) ;
// se esiste, chiamo la funzione di emissione dati utensile
@@ -954,14 +960,17 @@ Processor::OnPathEndAux( int nInd, const string& sAE)
//----------------------------------------------------------------------------
bool
Processor::OnRapid( int nMove, const DBLVECTOR& AxesEnd, int nAxesMask,
Processor::OnRapid( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd, int nAxesMask,
const Vector3d& vtTool, const Vector3d& vtCorr, const Vector3d& vtAux,
int nFlag, int nFlag2, int nIndex)
{
// cancello variabili estranee
ResetArcData() ;
// assegno Id e indice entità di movimento
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVEID, nEntId) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVEIND, nEntInd) ;
// assegno il tipo di movimento
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVE, nMove) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVE, nMove) ;
// assegno il valore degli assi
int nNumAxes = int( AxesEnd.size()) ;
for ( int i = 1 ; i <= MAX_AXES ; ++ i) {
@@ -991,14 +1000,17 @@ Processor::OnRapid( int nMove, const DBLVECTOR& AxesEnd, int nAxesMask,
//----------------------------------------------------------------------------
bool
Processor::OnLinear( int nMove, const DBLVECTOR& AxesEnd,
Processor::OnLinear( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd,
const Vector3d& vtTool, const Vector3d& vtCorr, const Vector3d& vtAux,
double dFeed, int nFlag, int nFlag2, int nIndex)
{
// cancello variabili estranee
ResetArcData() ;
// assegno Id e indice entità di movimento
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVEID, nEntId) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVEIND, nEntInd) ;
// assegno il tipo di movimento
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVE, nMove) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVE, nMove) ;
// assegno il valore degli assi
int nNumAxes = int( AxesEnd.size()) ;
for ( int i = 1 ; i <= MAX_AXES ; ++ i) {
@@ -1028,12 +1040,16 @@ Processor::OnLinear( int nMove, const DBLVECTOR& AxesEnd,
//----------------------------------------------------------------------------
bool
Processor::OnArc( int nMove, const DBLVECTOR& AxesEnd, const Point3d& ptCen, const Point3d& ptMid, double dRad, double dAngCen,
Processor::OnArc( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd,
const Point3d& ptCen, const Point3d& ptMid, double dRad, double dAngCen,
const Vector3d& vtTool, const Vector3d& vtCorr, const Vector3d& vtAux,
double dFeed, int nFlag, int nFlag2, int nIndex)
{
// assegno Id e indice entità di movimento
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVEID, nEntId) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVEIND, nEntInd) ;
// assegno il tipo di movimento
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVE, nMove) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVE, nMove) ;
// assegno il valore degli assi
int nNumAxes = int( AxesEnd.size()) ;
for ( int i = 1 ; i <= MAX_AXES ; ++ i) {
+5 -3
View File
@@ -59,12 +59,14 @@ class Processor
bool OnPathEnd( int nAE) ;
bool OnPathStartAux( int nInd, const std::string& sAS) ;
bool OnPathEndAux( int nInd, const std::string& sAE) ;
bool OnRapid( int nMove, const DBLVECTOR& AxesEnd, int nAxesMask,
bool OnRapid( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd, int nAxesMask,
const Vector3d& vtTool, const Vector3d& vtCorr, const Vector3d& vtAux,
int nFlag, int nFlag2, int nIndex) ;
bool OnLinear( int nMove, const DBLVECTOR& AxesEnd, const Vector3d& vtTool, const Vector3d& vtCorr, const Vector3d& vtAux,
bool OnLinear( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd,
const Vector3d& vtTool, const Vector3d& vtCorr, const Vector3d& vtAux,
double dFeed, int nFlag, int nFlag2, int nIndex) ;
bool OnArc( int nMove, const DBLVECTOR& AxesEnd, const Point3d& ptCen, const Point3d& ptMid, double dRad, double dAngCen,
bool OnArc( int nEntId, int nEntInd, int nMove, const DBLVECTOR& AxesEnd,
const Point3d& ptCen, const Point3d& ptMid, double dRad, double dAngCen,
const Vector3d& vtTool, const Vector3d& vtCorr, const Vector3d& vtAux,
double dFeed, int nFlag, int nFlag2, int nIndex) ;
bool ResetArcData( void) ;
+12 -25
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 ;
}
@@ -600,14 +608,7 @@ SawFinishing::Update( bool bPostApply)
}
// 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) ;
@@ -1563,18 +1564,6 @@ SawFinishing::CalculateCurvedAcrossToolPath( int nAuxId, int nClId)
// La porto in globale
PL.ToGlob( frSect) ;
// Calcolo eventuale anticipo dell'inizio
double dAddStart = 0 ;
if ( m_Params.m_nLeadLinkType == SAWFIN_LL_OUT) {
BBox3d b3PL ;
PL.GetLocalBBox( b3PL) ;
double dMaxElev = min( dDepth, b3Raw.GetMax().z - b3PL.GetMin().z) ;
if ( dMaxElev > 0.0 && dMaxElev < 0.5 * m_TParams.m_dDiam)
dAddStart = sqrt( dMaxElev * m_TParams.m_dDiam - dMaxElev * dMaxElev) ;
else
dAddStart = 0.5 * m_TParams.m_dDiam ;
}
// Imposto versore fresa come Z+
Vector3d vtTool = Z_AX ;
@@ -1774,7 +1763,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
@@ -1856,7 +1845,6 @@ SawFinishing::ClassifySection( ICurve* pCrv, INTVECTOR& vnClass)
{
const ICurveComposite* pCompo = GetCurveComposite( pCrv) ;
if ( pCompo != nullptr) {
int Ind = 0 ;
const ICurve* pSimpCrv = pCompo->GetFirstCurve() ;
while ( pSimpCrv != nullptr) {
// analizzo la curva
@@ -1874,7 +1862,6 @@ SawFinishing::ClassifySection( ICurve* pCrv, INTVECTOR& vnClass)
else
vnClass.push_back( CCL_FALL) ;
// passo alla curva successiva
++ Ind ;
pSimpCrv = pCompo->GetNextCurve() ;
}
}
+12 -11
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 ;
}
@@ -564,14 +572,7 @@ SawRoughing::Update( bool bPostApply)
}
// 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) ;
@@ -1459,7 +1460,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
+33 -13
View File
@@ -647,8 +647,14 @@ Sawing::Apply( bool bRecalc, bool bPostApply)
// verifico se necessario continuare nell'aggiornamento
if ( ! bRecalc && ! bToolChanged &&
( m_nStatus == MCH_ST_OK || ( ! bPostApply && m_nStatus == MCH_ST_NO_POSTAPPL))) {
// confermo i percorsi di lavorazione
m_nCuts = nCurrCuts ;
LOG_DBG_INFO( GetEMkLogger(), "Sawing apply skipped : status already ok") ;
// eseguo aggiornamento assi macchina e collegamento con operazione precedente
if ( ! Update( bPostApply))
return false ;
LOG_DBG_INFO( GetEMkLogger(), "Update done") ;
// esco con successo
return true ;
}
m_nStatus = MCH_ST_TO_VERIFY ;
@@ -717,6 +723,8 @@ Sawing::Apply( bool bRecalc, bool bPostApply)
// dichiaro successiva da aggiornare
UpdateFollowingOperationsStatus( MCH_ST_OTH_MODIF) ;
LOG_DBG_INFO( GetEMkLogger(), "Sawing apply done") ;
return true ;
}
@@ -735,14 +743,7 @@ Sawing::Update( bool bPostApply)
}
// 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) ;
@@ -1221,7 +1222,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 ;
@@ -1270,7 +1271,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 ;
@@ -1767,10 +1768,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") ;
@@ -1981,7 +1983,10 @@ Sawing::GenerateLinePv( const ICurveLine* pLine, const Vector3d& vtTool, const V
double dMove = ( dElev - dExtraCut) ;
// se sottosquadra (controllo il lato opposto della lama, quindi ...)
if ( m_Params.m_dSideAngle < 0)
dMove -= m_TParams.m_dThick * tan( abs( m_Params.m_dSideAngle) * DEGTORAD) ;
dMove = dElev - dExtraCut - m_TParams.m_dThick * tan( abs( m_Params.m_dSideAngle) * DEGTORAD) ;
// altrimenti tengo conto di dove si trova il sopra del lato esterno
else
dMove = dElev - max( dExtraCut, m_TParams.m_dThick * tan( abs( m_Params.m_dSideAngle) * DEGTORAD)) ;
// vettore movimento
Vector3d vtMove = - dMove * vtCorr ; vtMove.z = 0 ;
// rettangolo per parte di taglio completo
@@ -2012,6 +2017,21 @@ Sawing::GenerateLinePv( const ICurveLine* pLine, const Vector3d& vtTool, const V
int nDwnReId = m_pGeomDB->Copy( nReId, GDB_ID_NULL, nPxId) ;
m_pGeomDB->Translate( nDwnReId, vtMove) ;
m_pGeomDB->SetName( nDwnReId, MCH_PV_DOWN_RLOCUT) ;
// riduzione larghezza regioni per tagli da sopra
if ( m_Params.m_dSideAngle > 0) {
double dRefH = max( m_TParams.m_dThick * sin( m_Params.m_dSideAngle * DEGTORAD) - dExtraCut * cos( m_Params.m_dSideAngle * DEGTORAD), 0.) ;
if ( dRefH > EPS_SMALL) {
double dLargh = vtToolH.LenXY() ;
double dRedLargh = dLargh - dRefH * tan( m_Params.m_dSideAngle * DEGTORAD) - EPS_SMALL ;
double dCoeff = dRedLargh / dLargh ;
Frame3d frScale ;
frScale.Set( ptRCross + vtMove, Z_AX, vtDir) ;
m_pGeomDB->Scale( nDwnRId, frScale, 1, dCoeff, 1) ;
m_pGeomDB->Scale( nDwnRrId, frScale, 1, dCoeff, 1) ;
m_pGeomDB->Scale( nDwnRsId, frScale, 1, dCoeff, 1) ;
m_pGeomDB->Scale( nDwnReId, frScale, 1, dCoeff, 1) ;
}
}
}
// salvo in info gruppo : larghezza XY del taglio, distanza XY tra centro e bordo taglio, extra taglio e quota minima della lama
-6
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 ;
+438 -111
View File
@@ -26,7 +26,9 @@
#include "/EgtDev/Include/EGkCDeSpheClosedSurfTm.h"
#include "/EgtDev/Include/EGkCDeConeFrustumClosedSurfTm.h"
#include "/EgtDev/Include/EGkVolZmap.h"
#include "/EgtDev/Include/EGkGeoVector3d.h"
#include "/EgtDev/Include/EGkStringUtils3d.h"
#include "/EgtDev/Include/EXeCmdLogOff.h"
#include "/EgtDev/Include/EXeConst.h"
#include "/EgtDev/Include/EMkToolConst.h"
#include "/EgtDev/Include/EMkOperationConst.h"
@@ -42,8 +44,11 @@ using namespace std ;
static const double MIN_STEP = 1.0 ;
static const double MAX_STEP = 100.0 ;
static const double MID_STEP = 50.0 ;
static const double COLL_STEP = 10. ;
static const double COEFF_LIM = 0.999 ;
static const double SAFEDIST_STD = 5.0 ;
static const int ERR_OUTSTROKE = 1 ;
static const int ERR_COLLISION = 11 ;
//----------------------------------------------------------------------------
Simulator::Simulator( void)
@@ -67,9 +72,8 @@ Simulator::Simulator( void)
m_nAuxEInd = 0 ;
m_nExit = 0 ;
m_dTDiam = 0 ;
m_dVmTdOffs = 0 ;
m_dVmAdOffs = 0 ;
m_dSafeDist = SAFEDIST_STD ;
m_nAxesMask = 0 ;
m_bEnabAxes = true ;
m_bShowAxes = true ;
m_AxesName.reserve( 8) ;
@@ -157,7 +161,7 @@ Simulator::Start( bool bFirst)
// Arrivo alla preparazione per la prima lavorazione
int nStatus ;
if ( ! FindAndManageOperationStart( true, bFirst, nStatus))
if ( ! FindAndManageOperationStart( true, bFirst, nStatus) && nStatus != MCH_SIM_STOP)
bOk = false ;
// Reset timer
@@ -205,9 +209,10 @@ Simulator::ResetInterpolation( void)
m_nAuxEInd = 0 ;
m_VmId.clear() ;
m_CdId.clear() ;
m_dVmTdOffs = 0 ;
m_dVmAdOffs = 0 ;
m_VmTool.clear() ;
m_CollObj.clear() ;
m_dSafeDist = SAFEDIST_STD ;
m_nAxesMask = 0 ;
m_bEnabAxes = true ;
m_bShowAxes = true ;
return true ;
@@ -311,14 +316,16 @@ Simulator::GetAxisInfoPos( int nI, string& sName, string& sToken, bool& bLinear,
// recupero la posizione
if ( ! m_pMchMgr->GetAxisPos( sName, dVal))
return false ;
// verifico se da invertire
// verifico se da invertire o offsettare
if ( nI < nAxisCount) {
if ( m_AxesInvert[nI])
dVal = - dVal ;
dVal += m_AxesOffset[nI] ;
}
else {
if ( m_AuxAxesInvert[nI - nAxisCount])
dVal = - dVal ;
dVal += m_AxesOffset[nI - nAxisCount] ;
}
return true ;
}
@@ -446,7 +453,7 @@ Simulator::UpdateTool( bool bFirst, int& nErr)
int nCurrErr ;
if ( ! OnToolDeselect( sTool, sHead, nExit, sTcPos, nCurrErr)) {
nErr = ( nErr != 0 ? nErr : nCurrErr) ;
if ( nCurrErr != 11)
if ( nCurrErr != ERR_COLLISION)
return false ;
}
}
@@ -468,29 +475,12 @@ Simulator::UpdateTool( bool bFirst, int& nErr)
// aggiorno gli assi macchina
if ( ! UpdateAxes())
return false ;
// eventuali offset per Vmill (per adattare lo ZeroT macchina con quello di Zmap)
int nToolType ; m_pMchMgr->TdbGetCurrToolParam( TPA_TYPE, nToolType) ;
if ( nToolType == TT_MORTISE_STD) {
double dThick ; m_pMchMgr->TdbGetCurrToolParam( TPA_THICK, dThick) ;
m_dVmTdOffs = 0 ;
m_dVmAdOffs = 0.5 * dThick ;
}
else if ( nToolType == TT_SAW_STD || nToolType == TT_SAW_FLAT) {
double dLen ; m_pMchMgr->TdbGetCurrToolParam( TPA_LEN, dLen) ;
double dThick ; m_pMchMgr->TdbGetCurrToolParam( TPA_THICK, dThick) ;
m_dVmTdOffs = ( ( dLen <= dThick) ? -dLen + dThick : 0) ;
m_dVmAdOffs = 0 ;
}
else {
m_dVmTdOffs = 0 ;
m_dVmAdOffs = 0 ;
}
// se cambiato oppure prima volta, lancio lo script di selezione
if ( bDiffTool || bFirst) {
int nCurrErr ;
if ( ! OnToolSelect( m_sTool, sHead, nExit, sTcPos, bFirst, nCurrErr)) {
nErr = ( nErr != 0 ? nErr : nCurrErr) ;
if ( nCurrErr != 11)
if ( nCurrErr != ERR_COLLISION)
return false ;
}
}
@@ -508,7 +498,7 @@ Simulator::UpdateTool( bool bFirst, int& nErr)
int nCurrErr ;
if ( ! OnToolDeselect( sTool, sHead, nExit, sTcPos, nCurrErr)) {
nErr = ( nErr != 0 ? nErr : nCurrErr) ;
if ( nCurrErr != 11)
if ( nCurrErr != ERR_COLLISION)
return false ;
}
}
@@ -526,7 +516,7 @@ Simulator::UpdateTool( bool bFirst, int& nErr)
int nCurrErr ;
if ( ! OnToolSelect( m_sTool, sHead, nExit, sTcPos, bFirst, nCurrErr)) {
nErr = ( nErr != 0 ? nErr : nCurrErr) ;
if ( nCurrErr != 11)
if ( nCurrErr != ERR_COLLISION)
return false ;
}
return ( nErr == 0) ;
@@ -552,6 +542,9 @@ Simulator::UpdateAxes( void)
bool bInvert ;
m_pMachine->GetAxisInvert( m_AxesName[i], bInvert) ;
m_AxesInvert.push_back( bInvert) ;
double dOffset ;
m_pMachine->GetAxisOffset( m_AxesName[i], dOffset) ;
m_AxesOffset.push_back( dOffset) ;
bool bLinear ;
m_pMachine->GetAxisType( m_AxesName[i], bLinear) ;
m_AxesLinear.push_back( bLinear) ;
@@ -590,6 +583,7 @@ Simulator::ResetAxes( void)
m_AxesInvert.clear() ;
m_AxesLinear.clear() ;
m_AxesVal.clear() ;
m_nAxesMask = 0 ;
return true ;
}
@@ -601,9 +595,11 @@ Simulator::ResetAuxAxes( void)
m_AuxAxesName.clear() ;
m_AuxAxesToken.clear() ;
m_AuxAxesInvert.clear() ;
m_AuxAxesOffset.clear() ;
m_AuxAxesLinear.clear() ;
m_AuxAxesVal.clear() ;
m_AuxAxesEnd.clear() ;
m_AuxAxesLink.clear() ;
// abilito assi principali
m_bEnabAxes = true ;
m_bShowAxes = true ;
@@ -629,13 +625,14 @@ Simulator::FindAndManageOperationStart( bool bStart, bool bFirst, int& nStatus)
// se lavorazione valida
Machining* pMch = GetMachining( m_pGeomDB->GetUserObj( m_nOpId)) ;
if ( pMch != nullptr && ! pMch->IsEmpty()) {
bool bOk = true ;
// aggiorno utensile e assi conseguenti
int nErr ;
if ( ! UpdateTool( bFirst, nErr)) {
string sOut = "Err=" + ToString( nErr) ;
LOG_INFO( GetEMkLogger(), sOut.c_str())
nStatus = CalcStatusOnError( nErr) ;
return false ;
bOk = false ;
}
++ m_nOpInd ;
// imposto la lavorazione come corrente
@@ -651,8 +648,10 @@ Simulator::FindAndManageOperationStart( bool bStart, bool bFirst, int& nStatus)
// richiamo gestione evento inizio lavorazione
if ( ! OnMachiningStart( m_nOpId, m_nOpInd, ptMin, ptMax, vAxMin, vAxMax)) {
nStatus = CalcStatusOnError( 0) ;
return false ;
bOk = false ;
}
if ( ! bOk)
return false ;
break ;
}
// se disposizione con cambio di fase
@@ -942,10 +941,13 @@ Simulator::ManageSingleMove( int& nStatus, double& dMove)
DBLVECTOR AxesEnd = pCamData->GetAxesVal() ;
// Tipo di movimento
int nMoveType = pCamData->GetMoveType() ;
// Se inizio di nuova entità, mascheratura movimento
if ( m_nEntId != GDB_ID_NULL && m_dCoeff < EPS_ZERO)
m_nAxesMask = pCamData->GetAxesMask() ;
// Se movimento in rapido muovo solo gli assi abilitati dal mask
if ( nMoveType == 0) {
for ( size_t i = 0 ; i < m_AxesName.size() ; ++ i) {
if ( ( pCamData->GetAxesMask() & 1 << i) == 0)
if ( ( m_nAxesMask & 1 << i) == 0)
AxesEnd[i] = m_AxesVal[i] ;
}
}
@@ -961,7 +963,7 @@ Simulator::ManageSingleMove( int& nStatus, double& dMove)
// Se movimento in rapido aggiorno quote degli assi disabilitati dal mask
if ( nMoveType == 0) {
for ( size_t i = 0 ; i < m_AxesName.size() ; ++ i) {
if ( ( pCamData->GetAxesMask() & 1 << i) == 0)
if ( ( m_nAxesMask & 1 << i) == 0)
AxesEnd[i] = m_AxesVal[i] ;
}
}
@@ -993,9 +995,13 @@ Simulator::ManageSingleMove( int& nStatus, double& dMove)
m_dCoeff = 1 ;
dMove = ( m_dCoeff - dPrevCoeff) * dDist ;
// Posizione e direzione attuali dell'utensile e riferimento attuale del pezzo (per Vmill)
Point3d ptNoseI ; Vector3d vtDirI ; Vector3d vtAuxI ;
bool bOkI = GetHeadCurrPosDirAux( ptNoseI, vtDirI, vtAuxI) ;
// Posizione e direzione attuali degli utensili e riferimenti dei pezzi (per Vmill)
bool bOkI = true ;
PNTVECTOR vPtNoseI( m_VmTool.size()) ;
VCT3DVECTOR vVtDirI( m_VmTool.size()) ;
VCT3DVECTOR vVtAuxI( m_VmTool.size()) ;
for ( int i = 0 ; i < int( m_VmTool.size()) ; ++ i)
bOkI = GetHeadCurrPosDirAux( m_VmTool[i].sHead, m_VmTool[i].nExit, vPtNoseI[i], vVtDirI[i], vVtAuxI[i]) && bOkI ;
vector<Frame3d> vFrVzmI( m_VmId.size()) ;
for ( int i = 0 ; i < int( m_VmId.size()) ; ++ i)
bOkI = m_pGeomDB->GetGlobFrame( m_VmId[i], vFrVzmI[i]) && bOkI ;
@@ -1004,20 +1010,32 @@ Simulator::ManageSingleMove( int& nStatus, double& dMove)
if ( nMoveType != 2 && nMoveType != 3) {
// se attivo CollisionCheck approssimo movimento con più step
int nStep = 1 ;
if ( NeedCollisionCheck()) {
const double LEN_COLL_STEP = 10. ;
nStep = max( int( dMove / LEN_COLL_STEP), 1) ;
}
if ( NeedCollisionCheck())
nStep = max( int( dMove / COLL_STEP), 1) ;
for ( int i = 1 ; i <= nStep ; ++ i) {
double dCurrCoeff = dPrevCoeff + ( m_dCoeff - dPrevCoeff) / nStep * i ;
DBLVECTOR vDeltaVal( m_AxesName.size()) ;
// assegno posizioni finali
for ( int j = 0 ; j < int( m_AxesName.size()) ; ++ j) {
double dPrevVal ;
m_pMachine->GetAxisPos( m_AxesName[j], dPrevVal) ;
double dVal = m_AxesVal[j] * ( 1 - dCurrCoeff) + AxesEnd[j] * dCurrCoeff ;
m_pMachine->SetAxisPos( m_AxesName[j], dVal) ;
vDeltaVal[j] = dVal - dPrevVal ;
}
// muovo eventuali assi ausiliari
for ( int j = 0 ; j < int( m_AuxAxesName.size()) ; ++ j) {
double dVal = m_AuxAxesVal[j] * ( 1 - dCurrCoeff) + m_AuxAxesEnd[j] * dCurrCoeff ;
double dVal = 0 ;
if ( m_AuxAxesLink[j] == 0) {
dVal = m_AuxAxesVal[j] * ( 1 - dCurrCoeff) + m_AuxAxesEnd[j] * dCurrCoeff ;
}
else {
m_pMachine->GetAxisPos( m_AuxAxesName[j], dVal) ;
if ( m_AuxAxesLink[j] > 0)
dVal += vDeltaVal[m_AuxAxesLink[j] - 1] ;
else
dVal -= vDeltaVal[-m_AuxAxesLink[j] - 1] ;
}
m_pMachine->SetAxisPos( m_AuxAxesName[j], dVal) ;
}
// eseguo eventuale collision check
@@ -1025,12 +1043,15 @@ Simulator::ManageSingleMove( int& nStatus, double& dMove)
}
// se non è rapido o non c'è verifica collisioni, eseguo eventuale Vmill
if ( nMoveType != 0 || ! NeedCollisionCheck()) {
Point3d ptNoseF ; Vector3d vtDirF ; Vector3d vtAuxF ;
bool bOkF = GetHeadCurrPosDirAux( ptNoseF, vtDirF, vtAuxF) ;
for ( int j = 0 ; j < int( m_VmId.size()) ; ++ j) {
Frame3d frVzmF ;
bOkF = m_pGeomDB->GetGlobFrame( m_VmId[j], frVzmF) && bOkF ;
ExecLineVmill( m_VmId[j], ptNoseI, vtDirI, vtAuxI, vFrVzmI[j], ptNoseF, vtDirF, vtAuxF, frVzmF) ;
for ( int i = 0 ; i < int( m_VmTool.size()) ; ++ i) {
Point3d ptNoseF ; Vector3d vtDirF ; Vector3d vtAuxF ;
bool bOkF = GetHeadCurrPosDirAux( m_VmTool[i].sHead, m_VmTool[i].nExit, ptNoseF, vtDirF, vtAuxF) ;
for ( int j = 0 ; j < int( m_VmId.size()) ; ++ j) {
Frame3d frVzmF ;
bOkF = m_pGeomDB->GetGlobFrame( m_VmId[j], frVzmF) && bOkF ;
ExecLineVmill( m_VmId[j], i, m_VmTool[i].dTdOffs, m_VmTool[i].dAdOffs,
vPtNoseI[i], vVtDirI[i], vVtAuxI[i], vFrVzmI[j], ptNoseF, vtDirF, vtAuxF, frVzmF) ;
}
}
}
}
@@ -1058,36 +1079,64 @@ Simulator::ManageSingleMove( int& nStatus, double& dMove)
}
for ( int i = 1 ; i <= nStep ; ++ i) {
double dCurrCoeff = dPrevCoeff + ( m_dCoeff - dPrevCoeff) / nStep * i ;
DBLVECTOR vDeltaVal( m_AxesName.size()) ;
// assi lineari
vtRot.Rotate( vtN, dDiffAng / nStep) ;
m_pMachine->SetAxisPos( m_AxesName[0], ptCen.x + vtRot.x + dCurrCoeff * dDeltaN * vtN.x) ;
m_pMachine->SetAxisPos( m_AxesName[1], ptCen.y + vtRot.y + dCurrCoeff * dDeltaN * vtN.y) ;
m_pMachine->SetAxisPos( m_AxesName[2], ptCen.z + vtRot.z + dCurrCoeff * dDeltaN * vtN.z) ;
double dPrevVal, dVal ;
m_pMachine->GetAxisPos( m_AxesName[0], dPrevVal) ;
dVal = ptCen.x + vtRot.x + dCurrCoeff * dDeltaN * vtN.x ;
m_pMachine->SetAxisPos( m_AxesName[0], dVal) ;
vDeltaVal[0] = dVal - dPrevVal ;
m_pMachine->GetAxisPos( m_AxesName[1], dPrevVal) ;
dVal = ptCen.y + vtRot.y + dCurrCoeff * dDeltaN * vtN.y ;
m_pMachine->SetAxisPos( m_AxesName[1], dVal) ;
vDeltaVal[1] = dVal - dPrevVal ;
m_pMachine->GetAxisPos( m_AxesName[2], dPrevVal) ;
dVal = ptCen.z + vtRot.z + dCurrCoeff * dDeltaN * vtN.z ;
m_pMachine->SetAxisPos( m_AxesName[2], dVal) ;
vDeltaVal[2] = dVal - dPrevVal ;
// assi rotanti
for ( int j = 3 ; j < int( m_AxesName.size()) ; ++ j) {
double dPrevVal ; m_pMachine->GetAxisPos( m_AxesName[j], dPrevVal) ;
double dVal = m_AxesVal[j] * ( 1 - dCurrCoeff) + AxesEnd[j] * dCurrCoeff ;
m_pMachine->SetAxisPos( m_AxesName[j], dVal) ;
vDeltaVal[j] = dVal - dPrevVal ;
}
// eventuali assi ausiliari
for ( int j = 0 ; j < int( m_AuxAxesName.size()) ; ++ j) {
double dVal = m_AuxAxesVal[j] * ( 1 - dCurrCoeff) + m_AuxAxesEnd[j] * dCurrCoeff ;
double dVal = 0 ;
if ( m_AuxAxesLink[j] == 0) {
dVal = m_AuxAxesVal[j] * ( 1 - dCurrCoeff) + m_AuxAxesEnd[j] * dCurrCoeff ;
}
else {
m_pMachine->GetAxisPos( m_AuxAxesName[j], dVal) ;
if ( m_AuxAxesLink[j] > 0)
dVal += vDeltaVal[m_AuxAxesLink[j] - 1] ;
else
dVal -= vDeltaVal[-m_AuxAxesLink[j] - 1] ;
}
m_pMachine->SetAxisPos( m_AuxAxesName[j], dVal) ;
}
// eseguo eventuale Vmill
Point3d ptNoseF ; Vector3d vtDirF ; Vector3d vtAuxF ;
bool bOkF = GetHeadCurrPosDirAux( ptNoseF, vtDirF, vtAuxF) ;
for ( int k = 0 ; k < int( m_VmId.size()) ; ++ k) {
Frame3d frVzmF ;
bOkF = m_pGeomDB->GetGlobFrame( m_VmId[k], frVzmF) && bOkF ;
ExecLineVmill( m_VmId[k], ptNoseI, vtDirI, vtAuxI, vFrVzmI[k], ptNoseF, vtDirF, vtAuxF, frVzmF) ;
// salvo riferimento per prossimo inizio
vFrVzmI[k] = frVzmF ;
for ( int j = 0 ; j < int( m_VmTool.size()) ; ++ j) {
Point3d ptNoseF ; Vector3d vtDirF ; Vector3d vtAuxF ;
bool bOkF = GetHeadCurrPosDirAux( m_VmTool[j].sHead, m_VmTool[j].nExit, ptNoseF, vtDirF, vtAuxF) ;
for ( int k = 0 ; k < int( m_VmId.size()) ; ++ k) {
Frame3d frVzmF ;
bOkF = m_pGeomDB->GetGlobFrame( m_VmId[k], frVzmF) && bOkF ;
ExecLineVmill( m_VmId[k], j, m_VmTool[j].dTdOffs, m_VmTool[j].dAdOffs,
vPtNoseI[j], vVtDirI[j], vVtAuxI[j], vFrVzmI[k], ptNoseF, vtDirF, vtAuxF, frVzmF) ;
// se ultimo utensile, salvo riferimento per prossimo inizio
if ( j == int( m_VmTool.size()) - 1)
vFrVzmI[k] = frVzmF ;
}
// aggiorno prossimo inizio
vPtNoseI[j] = ptNoseF ;
vVtDirI[j] = vtDirF ;
vVtAuxI[j] = vtAuxF ;
}
// eseguo eventuale collision check
bCollCheck = bCollCheck && ExecCollisionCheck( nCdInd, nObjInd, nMoveType) ;
// aggiorno prossimo inizio
ptNoseI = ptNoseF ;
vtDirI = vtDirF ;
}
}
}
@@ -1115,16 +1164,19 @@ Simulator::ManageSingleMove( int& nStatus, double& dMove)
dMove = ( m_dCoeff - dPrevCoeff) * dDist ;
// se attivo CollisionCheck approssimo movimento con più step
int nStep = 1 ;
if ( NeedCollisionCheck()) {
const double LEN_COLL_STEP = 10. ;
nStep = max( int( dMove / LEN_COLL_STEP), 1) ;
}
if ( NeedCollisionCheck())
nStep = max( int( dMove / COLL_STEP), 1) ;
for ( int i = 1 ; i <= nStep ; ++ i) {
double dCurrCoeff = dPrevCoeff + ( m_dCoeff - dPrevCoeff) / nStep * i ;
// muovo eventuali assi ausiliari
for ( int j = 0 ; j < int( m_AuxAxesName.size()) ; ++ j) {
double dVal = m_AuxAxesVal[j] * ( 1 - dCurrCoeff) + m_AuxAxesEnd[j] * dCurrCoeff ;
m_pMachine->SetAxisPos( m_AuxAxesName[j], dVal) ;
if ( m_AuxAxesLink[j] == 0) {
double dVal = m_AuxAxesVal[j] * ( 1 - dCurrCoeff) + m_AuxAxesEnd[j] * dCurrCoeff ;
m_pMachine->SetAxisPos( m_AuxAxesName[j], dVal) ;
}
else {
}
}
// eseguo eventuale collision check
bCollCheck = bCollCheck && ExecCollisionCheck( nCdInd, nObjInd, nMoveType) ;
@@ -1173,9 +1225,9 @@ Simulator::CalcStatusOnError( int nErr)
{
if ( Stopped())
return MCH_SIM_STOP ;
else if ( nErr == 1)
else if ( nErr == ERR_OUTSTROKE)
return MCH_SIM_OUTSTROKE ;
else if ( nErr == 11)
else if ( nErr == ERR_COLLISION)
return MCH_SIM_COLLISION ;
else
return MCH_SIM_ERR ;
@@ -1183,30 +1235,33 @@ Simulator::CalcStatusOnError( int nErr)
//----------------------------------------------------------------------------
bool
Simulator::GetHeadCurrPosDirAux( Point3d& ptH, Vector3d& vtH, Vector3d& vtA)
Simulator::GetHeadCurrPosDirAux( const std::string& sHead, int nExit, Point3d& ptH, Vector3d& vtH, Vector3d& vtA)
{
// ci devono essere almeno i tre assi lineari
if ( m_AxesName.size() < 3)
int nHeadId = m_pMachine->GetHeadId( sHead) ;
int nExitId = m_pMachine->GetExitId( sHead, nExit) ;
if ( nHeadId == GDB_ID_NULL || nExitId == GDB_ID_NULL)
return false ;
// recupero le posizioni degli assi lineari
DBLVECTOR vLinAx( 3) ;
for ( size_t i = 0 ; i < 3 ; ++ i)
m_pMachine->GetAxisPos( m_AxesName[i], vLinAx[i]) ;
// recupero le posizioni degli eventuali assi rotanti
DBLVECTOR vRotAx( m_AxesName.size() - 3) ;
for ( size_t i = 3 ; i < m_AxesName.size() ; ++ i)
m_pMachine->GetAxisPos( m_AxesName[i], vRotAx[i-3]) ;
// determino posizione e orientamento della testa
m_pMachine->GetNoseFromPositions( vLinAx[0], vLinAx[1], vLinAx[2], vRotAx, ptH) ;
m_pMachine->GetToolDirFromAngles( vRotAx, vtH) ;
m_pMachine->GetAuxDirFromAngles( vRotAx, vtA) ;
Frame3d frExit ; m_pGeomDB->GetGroupGlobFrame( nExitId, frExit) ;
ptH = frExit.Orig() ;
vtH = frExit.VersZ() ;
vtA = V_NULL ;
int nDirAuxId = m_pGeomDB->GetFirstNameInGroup( nHeadId, MCH_AUX_VECT) ;
if ( nDirAuxId != GDB_ID_NULL) {
const IGeoVector3d* pGV = GetGeoVector3d( m_pGeomDB->GetGeoObj( nDirAuxId)) ;
if ( pGV != nullptr) {
Frame3d frHead ; m_pGeomDB->GetGroupGlobFrame( nHeadId, frHead) ;
vtA = pGV->GetVector() ;
vtA.ToGlob( frHead) ;
}
}
return true ;
}
//----------------------------------------------------------------------------
bool
Simulator::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)
Simulator::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)
{
// Recupero Zmap
IVolZmap* pVZM = GetVolZmap( m_pGeomDB->GetGeoObj( nVmId)) ;
@@ -1220,16 +1275,17 @@ Simulator::ExecLineVmill( int nVmId, const Point3d& ptHi, const Vector3d& vtHi,
Vector3d vtHfL = vtHf ; vtHfL.ToLoc( frVzmF) ;
Vector3d vtAfL = vtAf ; vtAfL.ToLoc( frVzmF) ;
// Eventuali offset
ptHiL += m_dVmTdOffs * vtHiL + m_dVmAdOffs * vtAiL ;
ptHfL += m_dVmTdOffs * vtHfL + m_dVmAdOffs * vtAfL ;
ptHiL += dVmTdOffs * vtHiL + dVmAdOffs * vtAiL ;
ptHfL += dVmTdOffs * vtHfL + dVmAdOffs * vtAfL ;
// Log per debug
if ( ExeGetDebugLevel() >= 10) {
string sOut = "Pi=(" + ToString( ptHiL) + ") Vi=(" + ToString( vtHiL) + ") Ai=(" + ToString( vtAiL) +
string sOut = "Zmap=" + ToString( nVmId) + " CurrTool=" + ToString( nCurrTool) +
"Pi=(" + ToString( ptHiL) + ") Vi=(" + ToString( vtHiL) + ") Ai=(" + ToString( vtAiL) +
") Pf=(" + ToString( ptHfL) + ") Vf=(" + ToString( vtHfL) + ") Af=(" + ToString( vtAfL) + ")" ;
LOG_DBG_INFO( GetEMkLogger(), sOut.c_str())
}
// Eseguo
return pVZM->MillingStep( ptHiL, vtHiL, vtAiL, ptHfL, vtHfL, vtAfL) ;
return pVZM->MillingStep( nCurrTool, ptHiL, vtHiL, vtAiL, ptHfL, vtHfL, vtAfL) ;
}
//----------------------------------------------------------------------------
@@ -1263,8 +1319,8 @@ Simulator::ExecCollisionCheck( int& nCdInd, int& nObjInd, int nMoveType)
// verifico se è l'utensile attivo
string sHead ; m_pGeomDB->GetName( m_pGeomDB->GetParentId( m_CollObj[j].nFrameId), sHead) ;
string sExit ; m_pGeomDB->GetName( m_CollObj[j].nFrameId, sExit) ;
bool bIsTool = ( sHead == m_sHead &&
( sExit == string( "_T") + ToString( m_nExit) || sExit == string( "_TT") + ToString( m_nExit))) ;
bool bIsTool = m_CollObj[j].bToolOn ||
( sHead == m_sHead && ( sExit == "_T" + ToString( m_nExit) || sExit == "_TT" + ToString( m_nExit))) ;
// se utensile attivo su grezzo in lavoro e non è rapido, salto
if ( bIsTool && bIsRaw && nMoveType != 0)
continue ;
@@ -1456,8 +1512,9 @@ Simulator::OnToolSelect( const string& sTool, const string& sHead, int nExit, co
bool bOk = m_pMachine->LuaCallFunction( ON_SIMUL_TOOL_SELECT) ;
// forzo aggiornamento posizione assi (possono essere stati mossi nello script)
UpdateAxesPos() ;
// recupero distanza di sicurezza per verifica collisione
// recupero dati per verifica collisione
m_pMachine->LuaGetGlobVar( GLOB_VAR + GVAR_SAFEDIST, m_dSafeDist) ;
m_pMachine->LuaGetGlobVar( GLOB_VAR + GVAR_CODET, m_CdId) ;
// verifico codice di errore
bOk = bOk && m_pMachine->LuaGetGlobVar( GLOB_VAR + GVAR_ERR, nErr) ;
// recupero i dati di ritorno per assi ausiliari
@@ -1468,15 +1525,17 @@ Simulator::OnToolSelect( const string& sTool, const string& sHead, int nExit, co
m_AuxAxesName.reserve( nNumAuxAxes) ;
m_AuxAxesToken.reserve( nNumAuxAxes) ;
m_AuxAxesInvert.reserve( nNumAuxAxes) ;
m_AuxAxesOffset.reserve( nNumAuxAxes) ;
m_AuxAxesLinear.reserve( nNumAuxAxes) ;
m_AuxAxesVal.reserve( nNumAuxAxes) ;
m_AuxAxesEnd.reserve( nNumAuxAxes) ;
for ( int i = 1 ; i <= nNumAuxAxes && bOk ; ++ i) {
string sName ; string sToken ; bool bInvert ; bool bLinear ; double dVal ;
string sName ; string sToken ; bool bInvert ; double dOffset ; bool bLinear ; double dVal ;
string sAuxAxName = GLOB_VAR + GVAR_ANN ; ReplaceString( sAuxAxName, "N", ToString( i)) ;
if ( m_pMachine->LuaGetGlobVar( sAuxAxName, sName) &&
m_pMachine->GetAxisToken( sName, sToken) &&
m_pMachine->GetAxisInvert( sName, bInvert) &&
m_pMachine->GetAxisOffset( sName, dOffset) &&
m_pMachine->GetAxisType( sName, bLinear) &&
m_pMachine->GetAxisPos( sName, dVal)) {
// se non è già negli assi principali, lo aggiungo
@@ -1484,9 +1543,11 @@ Simulator::OnToolSelect( const string& sTool, const string& sHead, int nExit, co
m_AuxAxesName.emplace_back( sName) ;
m_AuxAxesToken.emplace_back( sToken) ;
m_AuxAxesInvert.push_back( bInvert) ;
m_AuxAxesOffset.push_back( dOffset) ;
m_AuxAxesLinear.push_back( bLinear) ;
m_AuxAxesVal.emplace_back( dVal) ;
m_AuxAxesEnd.emplace_back( dVal) ;
m_AuxAxesLink.emplace_back( 0) ;
}
}
else
@@ -1669,6 +1730,7 @@ Simulator::OnMoveStart( const CamData* pCamData, int& nErr)
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVEID, m_nEntId) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVEIND, m_nEntInd) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVE, pCamData->GetMoveType()) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MASK, pCamData->GetAxesMask()) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_FLAG, pCamData->GetFlag()) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_FLAG2, pCamData->GetFlag2()) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_INDEX, pCamData->GetIndex()) ;
@@ -1720,6 +1782,7 @@ Simulator::OnMoveStart( const CamData* pCamData, int& nErr)
ResetAuxAxes() ;
// recupero i dati di ritorno
m_pMachine->LuaGetGlobVar( GLOB_VAR + GVAR_MASK, m_nAxesMask) ;
if ( ! m_pMachine->LuaGetGlobVar( GLOB_VAR + GVAR_ENABAXES, m_bEnabAxes))
m_bEnabAxes = true ;
if ( ! m_pMachine->LuaGetGlobVar( GLOB_VAR + GVAR_SHOWAXES, m_bShowAxes))
@@ -1730,32 +1793,63 @@ Simulator::OnMoveStart( const CamData* pCamData, int& nErr)
m_AuxAxesName.reserve( nNumAuxAxes) ;
m_AuxAxesToken.reserve( nNumAuxAxes) ;
m_AuxAxesInvert.reserve( nNumAuxAxes) ;
m_AuxAxesOffset.reserve( nNumAuxAxes) ;
m_AuxAxesLinear.reserve( nNumAuxAxes) ;
m_AuxAxesVal.reserve( nNumAuxAxes) ;
m_AuxAxesEnd.reserve( nNumAuxAxes) ;
for ( int i = 1 ; i <= nNumAuxAxes && bOk ; ++ i) {
string sName ; string sToken ; bool bInvert ; bool bLinear ; double dVal ; double dEnd ;
string sName ; string sToken ; bool bInvert ; double dOffset ; bool bLinear ; double dVal ; double dEnd ; string sLink ;
string sAuxAxVal = GLOB_VAR + GVAR_AN ; ReplaceString( sAuxAxVal, "N", ToString( i)) ;
string sAuxAxName = GLOB_VAR + GVAR_ANN ; ReplaceString( sAuxAxName, "N", ToString( i)) ;
string sAuxAxMaster = GLOB_VAR + GVAR_ANM ; ReplaceString( sAuxAxMaster, "N", ToString( i)) ;
if ( m_pMachine->LuaGetGlobVar( sAuxAxName, sName) &&
m_pMachine->GetAxisToken( sName, sToken) &&
m_pMachine->GetAxisInvert( sName, bInvert) &&
m_pMachine->GetAxisOffset( sName, dOffset) &&
m_pMachine->GetAxisType( sName, bLinear) &&
m_pMachine->GetAxisPos( sName, dVal) &&
m_pMachine->LuaGetGlobVar( sAuxAxVal, dEnd)) {
// se assi principali disabilitati o non è tra questi, lo aggiungo
if ( ! m_bEnabAxes || find( m_AxesName.begin(), m_AxesName.end(), sName) == m_AxesName.end()) {
m_AuxAxesName.emplace_back( sName) ;
m_AuxAxesToken.emplace_back( sToken) ;
m_AuxAxesInvert.push_back( bInvert) ;
m_AuxAxesLinear.push_back( bLinear) ;
m_AuxAxesVal.emplace_back( dVal) ;
m_AuxAxesEnd.emplace_back( dEnd) ;
if ( ! m_pMachine->VerifyOutstroke( sName, dEnd)) {
nErr = 1 ;
bOk = false ;
m_pMachine->GetAxisPos( sName, dVal)) {
// se assi principali abilitati e da agganciare ad asse principale
if ( m_bEnabAxes && m_pMachine->LuaGetGlobVar( sAuxAxMaster, sLink)) {
bool bNeg = ( sLink.find( '-') != string::npos) ;
string sMainAxis = sLink ; ReplaceString( sMainAxis, "-", "") ;
int nInd = 0 ;
for ( int i = 0 ; nInd == 0 && i < int( m_AxesName.size()) ; ++ i) {
if ( m_AxesName[i] == sMainAxis)
nInd = i + 1 ;
}
// se trovato asse principale di riferimento
if ( nInd > 0) {
m_AuxAxesName.emplace_back( sName) ;
m_AuxAxesToken.emplace_back( sToken) ;
m_AuxAxesInvert.push_back( bInvert) ;
m_AuxAxesOffset.push_back( dOffset) ;
m_AuxAxesLinear.push_back( bLinear) ;
m_AuxAxesVal.emplace_back( 0) ;
m_AuxAxesEnd.emplace_back( 0) ;
m_AuxAxesLink.emplace_back( ( bNeg ? -nInd : nInd)) ;
}
}
// se altrimenti specificato valore finale del movimento
else if ( m_pMachine->LuaGetGlobVar( sAuxAxVal, dEnd)) {
// se assi principali disabilitati o non è tra questi, lo aggiungo
if ( ! m_bEnabAxes || find( m_AxesName.begin(), m_AxesName.end(), sName) == m_AxesName.end()) {
m_AuxAxesName.emplace_back( sName) ;
m_AuxAxesToken.emplace_back( sToken) ;
m_AuxAxesInvert.push_back( bInvert) ;
m_AuxAxesOffset.push_back( dOffset) ;
m_AuxAxesLinear.push_back( bLinear) ;
m_AuxAxesVal.emplace_back( dVal) ;
m_AuxAxesEnd.emplace_back( dEnd) ;
m_AuxAxesLink.emplace_back( 0) ;
if ( ! m_pMachine->VerifyOutstroke( sName, dEnd)) {
nErr = 1 ;
bOk = false ;
}
}
}
// altrimenti errore
else
bOk = false ;
}
else
bOk = false ;
@@ -1808,8 +1902,10 @@ Simulator::OnCollision( int nCdInd, int nObjInd, int& nErr)
// verifico codice di errore
m_pMachine->LuaGetGlobVar( GLOB_VAR + GVAR_ERR, nErr) ;
// l'errore standard di collisione è stato portato da 1 a 11 per non collidere con altri tipi di errori
if ( nErr == 1)
nErr = 11 ;
if ( nErr == 1) {
nErr = ERR_COLLISION ;
m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_ERR, nErr) ;
}
return ( nErr == 0) ;
}
@@ -1826,7 +1922,7 @@ Simulator::OnResetMachine( void)
//----------------------------------------------------------------------------
bool
Simulator::AddCollisionObj( int nInd, int nFrameId, int nType, const Vector3d& vtMove, double dPar1, double dPar2, double dPar3)
Simulator::AddCollisionObj( int nInd, bool bToolOn, int nFrameId, int nType, const Vector3d& vtMove, double dPar1, double dPar2, double dPar3)
{
// verifiche sui parametri
if ( nInd <= 0 || nFrameId <= GDB_ID_NULL)
@@ -1852,6 +1948,237 @@ Simulator::AddCollisionObj( int nInd, int nFrameId, int nType, const Vector3d& v
return false ;
}
// aggiungo al vettore
m_CollObj.emplace_back( nInd, nFrameId, nType, vtMove, dPar1, dPar2, dPar3) ;
m_CollObj.emplace_back( nInd, bToolOn, nFrameId, nType, vtMove, dPar1, dPar2, dPar3) ;
return true ;
}
//----------------------------------------------------------------------------
bool
Simulator::SetToolForVmill( const string& sTool, const string& sHead, int nExit, const INTVECTOR& vVmill, bool bFirst)
{
// disabilito eventuale registrazione comandi EXE (riabilitazione automatica)
CmdLogOff cmdLogOff ;
// se vVmill vuoto, esco
if ( vVmill.empty())
return true ;
// se utensile, testa o uscita non definiti, reset ed esco
if ( IsEmptyOrSpaces( sTool) || IsEmptyOrSpaces( sHead) || nExit < 1) {
ExeVolZmapResetTools( vVmill) ;
return false ;
}
// imposto utensile come corrente
string sOldTool ; m_pMchMgr->TdbGetCurrToolParam( TPA_NAME, sOldTool) ;
if ( sTool != sOldTool && ! m_pMchMgr->TdbSetCurrTool( sTool)) {
ExeVolZmapResetTools( vVmill) ;
return false ;
}
// recupero dati utensile
int nFlag = 1 ;
int nType ; m_pMchMgr->TdbGetCurrToolParam( TPA_TYPE, nType) ;
double dLen ; m_pMchMgr->TdbGetCurrToolParam( TPA_LEN, dLen) ;
double dDiam ; m_pMchMgr->TdbGetCurrToolParam( TPA_DIAM, dDiam) ;
double dThick ; m_pMchMgr->TdbGetCurrToolParam( TPA_THICK, dThick) ;
double dCornR ; m_pMchMgr->TdbGetCurrToolParam( TPA_CORNRAD, dCornR) ;
double dSideAng ; m_pMchMgr->TdbGetCurrToolParam( TPA_SIDEANG, dSideAng) ;
double dMaxMat ; m_pMchMgr->TdbGetCurrToolParam( TPA_MAXMAT, dMaxMat) ;
// ricerca dell'outline e del diametro gambo
int nExitId = m_pMachine->GetExitId( sHead, nExit) ;
int nToolId = m_pGeomDB->GetFirstNameInGroup( nExitId, sTool) ;
int nOutlineId = m_pGeomDB->GetFirstNameInGroup( nToolId, "Outline") ;
double dMaxStemDiam = dDiam ; m_pGeomDB->GetInfo( nToolId, "D_STEM", dMaxStemDiam) ;
// imposto profilo utensile per Vmill
if ( nOutlineId != GDB_ID_NULL)
ExeVolZmapSetGenTool( vVmill, sTool, nOutlineId, nFlag, bFirst) ;
else if ( nType == TT_MORTISE_STD)
ExeVolZmapSetMortiserTool( vVmill, sTool, dLen, dDiam, dThick, dCornR, nFlag, bFirst) ;
else if ( nType == TT_SAW_STD || nType == TT_SAW_FLAT)
ExeVolZmapSetSawTool( vVmill, sTool, dLen, dDiam, dThick, 0, dCornR, nFlag, bFirst) ;
else if ( nType == TT_WATERJET)
ExeVolZmapSetStdTool( vVmill, sTool, dLen + 50, dDiam, dCornR, dMaxMat, nFlag, bFirst) ;
else if ( abs( dSideAng) < EPS_ANG_SMALL || abs( dThick) < EPS_SMALL) {
if ( dDiam <= dMaxStemDiam)
ExeVolZmapSetStdTool( vVmill, sTool, dLen, dDiam, dCornR, dMaxMat, nFlag, bFirst) ;
else
ExeVolZmapSetSawTool( vVmill, sTool, dLen, dDiam, dMaxMat, 0, dCornR, nFlag, bFirst) ;
}
else {
bool bExtra = ( dThick > 0) ;
double dTipLen = abs( dThick) ;
double dTotLen = ( bExtra ? dLen + dTipLen : dLen) ;
double dDelta ;
if ( dSideAng > 0) {
if ( dCornR < EPS_SMALL)
dDelta = 2 * dTipLen * tan( dSideAng * DEGTORAD) ;
else
dDelta = 2 * ( dCornR * cos( dSideAng * DEGTORAD) + ( dTipLen - dCornR + dCornR * sin( dSideAng * DEGTORAD)) * tan( dSideAng * DEGTORAD)) ;
}
else
dDelta = 2 * tan( dSideAng * DEGTORAD) * dTipLen ;
double dStemDiam = ( bExtra ? dDiam : dDiam + dDelta) ;
double dTipDiam = ( bExtra ? dDiam - dDelta : dDiam) ;
ExeVolZmapSetAdvTool( vVmill, sTool, dTotLen, dStemDiam, dTipLen, dTipDiam, dCornR, dMaxMat, nFlag, bFirst) ;
}
// eventuali offset per Vmill (per adattare lo ZeroT macchina con quello di Zmap)
double dVmTdOffs = 0 ;
double dVmAdOffs = 0 ;
if ( nType == TT_MORTISE_STD) {
dVmTdOffs = 0 ;
dVmAdOffs = 0.5 * dThick ;
}
else if ( nType == TT_SAW_STD || nType == TT_SAW_FLAT) {
dVmTdOffs = ( ( dLen <= dThick) ? -dLen + dThick : 0) ;
dVmAdOffs = 0 ;
}
// inserisco in lista utensili per virtual milling
if ( bFirst) {
m_VmTool.resize( 1) ;
m_VmTool[0] = VmTool( sTool, sHead, nExit, dVmTdOffs, dVmAdOffs) ;
}
else
m_VmTool.emplace_back( sTool, sHead, nExit, dVmTdOffs, dVmAdOffs) ;
// ripristino eventuale diverso utensile corrente
if ( sTool != sOldTool)
m_pMchMgr->TdbSetCurrTool( sOldTool) ;
return true ;
}
//----------------------------------------------------------------------------
int
Simulator::MoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt)
{
// Salvo lo step di simulazione corrente
double dOrigStep = m_dStep ;
// Verifico ci siano assi da muovere
if ( vAxNaEpSt.empty())
return SIM_AXMV_RES_ERR ;
// Numero assi da muovere
int nAxCount = int( vAxNaEpSt.size()) ;
// Posizioni iniziali
DBLVECTOR vPrev( nAxCount) ;
for ( int i = 0 ; i < nAxCount ; ++ i) {
if ( ! m_pMchMgr->GetAxisPos( vAxNaEpSt[i].sName, vPrev[i]))
return SIM_AXMV_RES_ERR ;
}
// Posizione e direzione attuali degli utensili e riferimenti dei pezzi (per Vmill)
bool bExecVmill = (( nMoveType != 0 || ! NeedCollisionCheck()) && ! m_VmTool.empty() && ! m_VmId.empty()) ;
PNTVECTOR vPtNoseI ;
VCT3DVECTOR vVtDirI ;
VCT3DVECTOR vVtAuxI ;
vector<Frame3d> vFrVzmI ;
if ( bExecVmill) {
vPtNoseI.resize( m_VmTool.size()) ;
vVtDirI.resize( m_VmTool.size()) ;
vVtAuxI.resize( m_VmTool.size()) ;
vFrVzmI.resize( m_VmId.size()) ;
bool bOkI = true ;
for ( int i = 0 ; i < int( m_VmTool.size()) ; ++ i)
bOkI = GetHeadCurrPosDirAux( m_VmTool[i].sHead, m_VmTool[i].nExit, vPtNoseI[i], vVtDirI[i], vVtAuxI[i]) && bOkI ;
for ( int i = 0 ; i < int( m_VmId.size()) ; ++ i)
bOkI = m_pGeomDB->GetGlobFrame( m_VmId[i], vFrVzmI[i]) && bOkI ;
}
// Determino gli step di movimento
static const int STEP_FEED = -1 ;
static const int STEP_RAPID = -2 ;
static const int STEP_RAPROT = -3 ;
static const int STEP_COLLROT = -4 ;
int nStep = 1 ;
for ( int i = 0 ; i < nAxCount ; ++ i) {
double dMove = abs( vAxNaEpSt[i].dEndPos - vPrev[i]) ;
double dStep = vAxNaEpSt[i].dStep ;
if ( dStep < 0) {
if ( abs( dStep - STEP_FEED) < EPS_SMALL)
dStep = m_dStep ;
else if ( abs( dStep - STEP_RAPID) < EPS_SMALL)
dStep = 4 * m_dStep ;
else if ( abs( dStep - STEP_RAPROT) < EPS_SMALL)
dStep = 0.4 * m_dStep ;
else // STEP_COLLROT
dStep = min( 0.4 * m_dStep, 10.) ;
}
dStep = max( dStep, 1.) ;
int nAxStep = int( dMove / dStep) + 1 ;
nStep = max( nStep, nAxStep) ;
}
// Eseguo il movimento
for ( int i = 1 ; i <= nStep ; ++ i) {
// Muovo
bool bMoveOk = true ;
double dCoeff = double( i) / nStep ;
for ( int j = 0 ; j < nAxCount ; ++ j) {
bMoveOk = m_pMchMgr->SetAxisPos( vAxNaEpSt[j].sName, ( 1 - dCoeff) * vPrev[j] + dCoeff * vAxNaEpSt[j].dEndPos) && bMoveOk ;
}
// Eseguo eventuale Vmill
if ( bExecVmill) {
for ( int j = 0 ; j < int( m_VmTool.size()) ; ++ j) {
Point3d ptNoseF ; Vector3d vtDirF ; Vector3d vtAuxF ;
bool bOkF = GetHeadCurrPosDirAux( m_VmTool[j].sHead, m_VmTool[j].nExit, ptNoseF, vtDirF, vtAuxF) ;
for ( int k = 0 ; k < int( m_VmId.size()) ; ++ k) {
Frame3d frVzmF ;
bOkF = m_pGeomDB->GetGlobFrame( m_VmId[k], frVzmF) && bOkF ;
ExecLineVmill( m_VmId[k], j, m_VmTool[j].dTdOffs, m_VmTool[j].dAdOffs,
vPtNoseI[j], vVtDirI[j], vVtAuxI[j], vFrVzmI[k], ptNoseF, vtDirF, vtAuxF, frVzmF) ;
// se ultimo utensile, salvo riferimento per prossimo inizio
if ( j == int( m_VmTool.size()) - 1)
vFrVzmI[k] = frVzmF ;
}
// aggiorno prossimo inizio
vPtNoseI[j] = ptNoseF ;
vVtDirI[j] = vtDirF ;
vVtAuxI[j] = vtAuxF ;
}
}
// Aggiorno visualizzazione
ExeDraw() ;
// Verifico collisioni
int nCdInd, nObjInd ;
bool bCollCheck = ExecCollisionCheck( nCdInd, nObjInd, nMoveType) ;
if ( ! bCollCheck) {
// Richiamo funzione di convalida collisione
int nPrevErr ;
m_pMachine->LuaGetGlobVar( GLOB_VAR + GVAR_ERR, nPrevErr) ;
int nErr ;
if ( ! OnCollision( nCdInd, nObjInd, nErr) && nErr == ERR_COLLISION) {
m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_ERR, nErr) ;
if ( ExeGetEnableUI()) {
// Box di messaggio : Collisione! AVVERTIMENTO
ExeMessageBox( ExeGetMsg( 5319), ExeGetMsg( 5315), MB_OK | MB_ICONWARNING) ;
// Gestione Pausa
m_nUiStatus = MCH_UISIM_PAUSE ;
while ( m_nUiStatus == MCH_UISIM_PAUSE) {
// -11 notifica al simulatore pausa dopo collisione
ExeProcessEvents( -11, 4) ;
}
}
}
else {
m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_ERR, nPrevErr) ;
}
}
// In caso di errore esco
if ( ! bMoveOk)
return SIM_AXMV_RES_ERR ;
// Gestione aggiornamenti...
if ( ExeGetEnableUI()) {
// Aggiornamento interfaccia
ExeProcessEvents( 0, 4) ;
while ( m_nUiStatus == MCH_UISIM_PAUSE) {
ExeProcessEvents( 0, 4) ;
}
// Gestione Stop
if ( m_nUiStatus == MCH_UISIM_STOP)
return SIM_AXMV_RES_STOP ;
// Se cambia lo step di simulazione in modo significativo ...
if ( abs( m_dStep - dOrigStep) > 10 || abs( ( m_dStep - dOrigStep) / ( m_dStep + dOrigStep)) > 0.2) {
double dRat = m_dStep / dOrigStep ;
for ( int j = 0 ; j < nAxCount ; ++ j) {
if ( vAxNaEpSt[j].dStep > 0)
const_cast<double&>( vAxNaEpSt[j].dStep) *= dRat ;
}
return MoveAxes( nMoveType, vAxNaEpSt) ;
}
}
}
return SIM_AXMV_RES_OK ;
}
+48 -13
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,9 +78,10 @@ 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)
@@ -92,17 +111,30 @@ 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 ;
private :
MachMgr* m_pMchMgr ; // puntatore al gestore di tutte le lavorazioni
@@ -128,21 +160,24 @@ class Simulator
double m_dTDiam ; // diametro 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)
} ;
+61 -30
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 ;
}
@@ -593,14 +607,7 @@ SurfFinishing::Update( bool bPostApply)
}
// 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) ;
@@ -840,28 +847,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 +939,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 +1244,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)) {
@@ -1475,7 +1506,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 ;
}
+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
+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 ;
+103 -76
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,26 @@ 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 ;
dMaxDepth = m_tdCurrTool.m_dLen - dSafe ;
if ( m_tdCurrTool.m_dDiam > dTHoldDiam)
dMaxDepth -= dTHoldBase ;
else
dMaxDepth -= dTHoldLen ;
return true ;
}
// se mortasatrice o sega a catena
@@ -730,12 +740,17 @@ ToolsMgr::GetCurrToolThDiam( double& dThDiam) const
( m_tdCurrTool.m_nType & TF_MILL) != 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) ;
}
@@ -766,12 +781,17 @@ ToolsMgr::GetCurrToolThLength( double& dThLen) const
( m_tdCurrTool.m_nType & TF_MILL) != 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) ;
}
@@ -790,7 +810,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 +874,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 +885,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 +905,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 +918,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 +931,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 +980,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 +1006,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 +1038,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 +1052,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 +1105,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 +1142,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 ;
+147 -10
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 ;
}
@@ -725,14 +741,7 @@ WaterJetting::Update( bool bPostApply)
}
// 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) ;
@@ -1176,6 +1185,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 +1276,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 +1482,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 +1544,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
@@ -2769,8 +2899,15 @@ WaterJetting::CalcCorrDir( const ICurveComposite* pCompo, double dU)
bool
WaterJetting::CalcOffset( ICurveComposite* pCompo, double dSignOffs)
{
// determino opzioni di offset
int nFlag = ICurve::OFF_EXTEND ;
if ( pCompo->IsClosed()) {
Vector3d vtStart ; pCompo->GetStartDir( vtStart) ;
Vector3d vtEnd ; pCompo->GetEndDir( vtEnd) ;
if ( ! AreSameVectorEpsilon( vtStart, vtEnd, sin( 5 * DEGTORAD)))
nFlag |= ICurve::OFF_FORCE_OPEN ;
}
// eseguo offset semplice
int nFlag = ICurve::OFF_EXTEND | ICurve::OFF_FORCE_OPEN ;
if ( pCompo->SimpleOffset( dSignOffs, nFlag))
return true ;
// se curva piatta, provo con offset avanzato
+2
View File
@@ -72,6 +72,7 @@ class WaterJetting : public Machining
bool VerifyGeometry( SelData Id, int& nSubs, int& nType) ;
bool GetCurves( SelData Id, ICURVEPLIST& lstPC) ;
bool Chain( int nGrpDestId) ;
bool AdjustCurvesForBridges( ICURVEPOVECTOR& vpCrvs, SELVECTOR& vInds) ;
bool VerifySideAngle( void) ;
bool ProcessPath( int nPathId, int nPvId, int nClId) ;
bool AdjustPathForInternalAngles( ICurveComposite* pCompo) ;
@@ -121,6 +122,7 @@ class WaterJetting : public Machining
SELVECTOR m_vId ; // identificativi entità geometriche da lavorare
WaterJettingData m_Params ; // parametri lavorazione
ToolData m_TParams ; // parametri utensile
double m_dTHoldBase ; // posizione base del porta-utensile
double m_dTHoldLen ; // lunghezza del porta-utensile
double m_dTHoldDiam ; // diametro del porta-utensile
double m_dElev ; // elevazione del percorso tenendo conto dell'angolo di fianco
+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")