183 Commits

Author SHA1 Message Date
Dario Sassi 91d1260d8a EgtExchange 3.1e2 :
- in import BTL aggiunta gestione Tenone Coda di Rondine non limitato dal lato dell'arrotondamento (P04=1).
2026-05-13 11:09:23 +02:00
Dario Sassi aead658f5d EgtExchange 3.1d2 :
- in import CNC aggiunta gestione pausa con G04 (si ignora la linea).
2026-04-22 08:23:18 +02:00
Dario Sassi 82a5161b07 EgtExchange 3.1d1 :
- in import BTL gestite come empty le LapJoint (3/4-030-X) completamente fuori dal pezzo.
2026-04-03 16:16:51 +02:00
Dario Sassi f923477b7e EgtExchange 3.1c2 :
- in import BTL corretta AddMortise (3/4-050-X).
2026-03-05 20:18:50 +01:00
Dario Sassi 96a5f77b12 EgtExchange 3.1c1 :
- ricompilazione con cambio versione.
2026-03-05 11:19:03 +01:00
Dario Sassi c47b3ee4d3 EgtExchange 3.1a4 :
- corretta importazione BTL con tenone a coda di rondine più corto dei raccordi in basso.
2026-02-10 11:08:49 +01:00
Dario Sassi c1f32c6c59 EgtExchenge :
- in import CNC aggiunto salvataggio feed corrente in info di entità.
2026-02-03 18:03:30 +01:00
Dario Sassi 30b1085ef5 EgtExchange 3.1a3 :
- miglioria in import Cnc Siemens (si saltano le linee che iniziano con ID o con DYN).
2026-02-02 10:30:12 +01:00
Dario Sassi 9577795c73 EgtExchange 3.1a2 :
- per BTL aggiunta possibilità di gestione geometrica del PARTOFFSET (controllata da flag).
2026-01-23 18:53:20 +01:00
Dario Sassi e7e7cb21bd EgtExchange 3.1a1 :
- ricompilazione con cambio major version.
2026-01-02 18:28:28 +01:00
Dario Sassi 5e74d640aa EgtExchange 2.7l1 :
- ricompilazione con cambio versione.
2025-12-20 17:55:28 +01:00
Dario Sassi 398f7d86a6 EgtExchange 2.7k2 :
- eliminato include inutile.
2025-12-01 09:16:45 +01:00
Dario Sassi 8eaf7c174f EgtExchange :
- modifiche per inizializzazione BeamMgr senza creare gruppi speciali.
2025-11-04 18:48:03 +01:00
SaraP 18c7c4601a EgtExchange :
- aggiornata pugixml a versione 1.15
- correzioni stilistiche in ImportBTLx.
2025-11-03 10:07:00 +01:00
Dario Sassi df864c93a8 EgtExchange 2.7k1 :
- adattamenti e ricompilazione per passaggio a C++ 20
2025-11-01 17:34:12 +01:00
Dario Sassi e16657f560 EgtExchange 2.7j2 :
- in import BTL corretta lunghezza eventuale tasca per mortase a coda di rondine.
2025-10-25 10:30:11 +02:00
Dario Sassi 1f24ff1dfb EgtExchange :
- in BeamMgr aggiunto calcolo di tutti i solidi dei pezzi in multithread.
2025-10-13 08:47:55 +02:00
Dario Sassi 8d70d31eff EgtExchange 2.7j1 :
- in import BTL gestione di più Info e Assembly in uno stesso progetto (derivano da più importazioni successive).
2025-10-11 10:03:00 +02:00
Dario Sassi a874068e7b EgtExchange 2.7i1 :
- ricompilazione con cambio versione.
2025-09-05 08:19:19 +02:00
SaraP 15dfae1789 EgtExchange :
- in Import3MF eliminata dipendenza inutile da libzip.
2025-08-25 11:12:01 +02:00
Dario Sassi 62aecf63eb EgtExchange 2.7h1 :
- ricompilazione con cambio versione.
2025-08-22 11:47:17 +02:00
Dario Sassi 2bb1767c9d EgtExchange 2.7g2 :
- in import BTL aggiunta possibilità di trim con outline per tutte le feature pareti con esclusione di fori, marcature e testi.
2025-07-24 09:02:38 +02:00
Dario Sassi 798c23e42d EgtExchange 2.7g1 :
- ricompilazione con cambio versione.
2025-07-02 19:49:48 +02:00
Dario Sassi 13c2a1d9e5 EgtExchange 2.7f2 :
- ricompilazione con cambio versione.
2025-06-26 09:47:54 +02:00
Dario Sassi 83215059a5 EgtExchange 2.7f1 :
- ricompilazione con cambio versione.
2025-06-06 17:38:24 +02:00
Dario Sassi 120e341fb7 EgtExchange 2.7d2 :
- ricompilazione con cambio versione.
2025-04-21 11:17:54 +02:00
Dario Sassi b7c3dbc576 EgtExchange :
- in import BTL aggiunto trim con Outline (se abilitato) anche per feature Pocket.
2025-03-31 14:47:29 +02:00
Dario Sassi 1e09cdff14 EgtExchange 2.7c3 :
- in import/manage BTL migliorata segnalazione in Log di Klingschrot con parametri non corretti.
2025-03-25 11:02:07 +01:00
Dario Sassi 53962aa5c1 EgtExchange :
- in import/manage BTL aggiunta gestione fino a due Outline per pezzo (in precedenza erroneamente dava errore).
2025-03-08 22:52:48 +01:00
Dario Sassi c16fba2752 EgtExchange 2.7c2 :
- in import/manage BTL corretta feature 3/4-038-X (Block House Front) da segnalazione Essetre #2316.
2025-03-07 15:39:16 +01:00
Dario Sassi 03eb6707ee EgtExchange :
- in import/gestione BTL migliorata qualità geometrica della sfera.
2025-03-07 08:37:30 +01:00
Dario Sassi c8b4cd9bee EgtExchange 2.7c1 :
- ricompilazione con cambio versione.
2025-03-06 20:11:28 +01:00
Dario Sassi 9331803efc EgtExchange 2.7b2 :
- aggiunta importazione formato PLY
- migliorata importazione formato OFF.
2025-03-02 19:42:10 +01:00
Dario Sassi 050d3acd60 EgtExchange 2.7b1 :
- ricompilazione con cambio versione.
2025-02-28 12:09:30 +01:00
Dario Sassi ac55ab01df EgtExchange :
- in import/gestione BTL aumentati a 25 i parametri gestiti per la feature Variant con script lua.
2025-01-27 12:43:02 +01:00
Dario Sassi 4ab0d89e60 EgtExchange 2.7a2 :
- modifiche in import e gestione BTL per feature Variant con lua.
2025-01-23 11:35:56 +01:00
Dario Sassi b6d4d76783 EgtExchange :
- in import BTL il vincolo sulla lunghezza massima del FreeContour è diventato un vincolo sul suo ingombro massimo.
2025-01-21 11:16:19 +01:00
Dario Sassi b366963eee EgtExchange :
- migliorie nell'importazione formato OFF.
2025-01-13 08:33:50 +01:00
Dario Sassi d1a19ed42f EgtExchange 2.7a1 :
- cambio annuale di versione
- compilazione 32bit senza più limiti per Windows XP.
2025-01-09 17:59:43 +01:00
Dario Sassi ae950c0efa EgtExchange :
- aggiustamenti per modifiche a FromString (in caso di errore non inizializza più a 0 il valore di ritorno).
2025-01-06 18:15:49 +01:00
SaraP aa80fb63af EgtExchange 2.6l3 :
- in import ed export 3MF gestione della gerarchia dei gruppi
- migliorie e correzioni varie.
2024-12-16 10:52:28 +01:00
Dario Sassi 7778cf5027 EgtExchange 2.6l2 :
- piccola modifica in import BTL.
2024-12-04 15:05:33 +01:00
Dario Sassi bb75d9c878 EgtExchange :
- aggiustamento.
2024-11-29 18:53:37 +01:00
Dario Sassi f54f1f8969 EgtExchange 2.6l1 :
- aggiunta importazione formato OFF (Object File Format).
2024-11-29 18:18:28 +01:00
Dario Sassi a71e1211d1 EgtExchange 2.6k1 :
- in import CNC con OSAI si saltano le parti che iniziano con @ (variabili).
2024-11-25 20:32:32 +01:00
Dario Sassi 75d5fc367c EgtExchange 2.6j1 :
- in import BTL le feature FreeContour torte ora sono meglio approssimate utilizzando nei calcoli anche le superfici di Bezier.
2024-10-02 17:29:38 +02:00
Dario Sassi 6624da2a03 EgtExchange 2.6i1 :
- ricompilazione con cambio versione.
2024-09-23 13:05:03 +02:00
Dario Sassi 3d8c83f33c EgtExchange 2.6h2 :
- ricompilazione con cambio versione.
2024-08-22 09:10:59 +02:00
Dario Sassi 584cec6f1c EgtExchange 2.6g5 :
- ricompilazione con cambio versione
2024-07-18 20:19:21 +02:00
Dario Sassi 7ed7f56415 EgtExchange :
- in import BTL piccola modifica per migliorare qualità feature Sfera.
2024-07-09 18:51:34 +02:00
Dario Sassi 22d47e551a EgtExchange 2.6g1 :
- ricompilazione con cambio versione.
2024-07-09 11:15:17 +02:00
Dario Sassi 6434dc6c89 EgtExchange :
- in importBTL in feature LapJoint quando divisa in parti disconnesse si cerca di eliminare quelle troppo piccole, se ne rimangono più di una si disabilita la feature.
2024-06-26 17:42:43 +02:00
Dario Sassi ca58abb125 EgtExchange 2.6f4 :
- ricompilazione con cambio versione.
2024-06-26 08:42:28 +02:00
Dario Sassi f7fb6d3435 EgtExchange 2.6f3 :
- ricompilazione con cambio versione.
2024-06-13 07:59:40 +02:00
Dario Sassi ad9acebd04 EgtExchange 2.6f1 :
- in import BTL gestione di FreeContour con lunghezze elevate (oltre 200 m) come errati (si evitano crash o loop molto lunghi e inutili).
2024-06-04 19:09:53 +02:00
Dario Sassi 3543839299 EgtExchange 2.6e2 :
- in import BTL migliorata geometria FreeContour a due percorsi con torsione.
2024-05-13 07:57:51 +02:00
Dario Sassi b5a3fb5543 EgtExchange 2.6e1 :
- ricompilazione per modifiche a gestione chiave di rete.
2024-04-30 16:54:24 +02:00
Dario Sassi 80634b8fcd EgtExchange 2.6d3 :
- ricompilazione con cambio versione.
2024-04-13 17:10:31 +02:00
Dario Sassi 025336f011 EgtExchange 2.6d1 :
- ricompilazione con cambio versione.
2024-04-05 16:52:05 +02:00
Dario Sassi deaab1767f EgtExchange :
- in gestione BTL imposto visualizzazione spigoli vivi su solidi.
2024-03-10 10:23:28 +01:00
Dario Sassi ee8d0c8c21 EgtExchange 2.6b4 :
- in import BTL agg. variante Klingschrot di feature TyroleanDovetail.
2024-02-28 16:59:17 +01:00
Dario Sassi 1a7483b7c4 EgtExchange :
- in import BTL aggiunta gestione feature 3/4-106-X SPHERE.
2024-02-22 11:59:54 +01:00
Dario Sassi 3205e80262 EgtExchange 2.6b3 :
- ricompilazione con cambio versione.
2024-02-16 08:44:47 +01:00
Dario Sassi 567a7ddba6 EgtExchange :
- in import BTL migliorati FreeContour da due percorsi quando sono superfici torte.
2024-02-05 19:55:36 +01:00
Dario Sassi f8dc7803b5 EgtExchange :
- in gestione BTL irrobustito calcolo del solido.
2024-02-05 12:16:41 +01:00
Dario Sassi d4fb909a0f EgtExchange :
- in import BTLX varie migliorie e correzioni.
2024-02-04 23:53:45 +01:00
Dario Sassi cf05547a38 EgtExchange 2.6b1 :
- in import BTLX abilitato e corretto Planing e corrette LogHouseJoint e RoundArch.
2024-02-04 11:40:00 +01:00
Dario Sassi 926074db57 EgtExchange 2.6a2 :
- in import CNC migliorata gestione di alcuni comandi speciali Siemens.
2024-01-31 10:15:12 +01:00
Dario Sassi 254d4792cf EgtExchange 2.6a1 :
- ricompilazione con cambio versione.
2024-01-16 15:13:12 +01:00
Dario Sassi 0dd44e569a EgtExchange 2.5l3 :
- in import DXF sistemata gestione SPLINE per modifiche a EgtGeomKernel.
2023-12-18 19:57:02 +01:00
Dario Sassi ba8a4c8914 EgtExchange 2.5l1 :
- ricompilazione con cambio versione.
2023-12-01 16:45:09 +01:00
Dario Sassi 55fb88d85b Merge commit 'f25473dfd205909deb17cb433a8658d11991fc52' 2023-11-28 09:37:45 +01:00
Dario Sassi b8fb6d9a07 EgtExchange :
- in import BTL aggiunta correzione P04=63, valore errato messo a 0.
2023-11-28 09:25:00 +01:00
SaraP f25473dfd2 EgtExchange :
- piccola correzione export stl.
2023-11-27 14:48:28 +01:00
Dario Sassi 977fe9f016 EgtExchange :
- in import BTL resa migliore l'approssimazione di FreeContour generati da due percorsi.
2023-11-22 20:23:51 +01:00
Dario Sassi d38beed861 EgtExchange :
- import/export 3dm spostati nella libreria EgtExch3dm.
2023-11-14 18:56:47 +01:00
Daniele Bariletti 55a02dc387 EgtExchange :
- formattazione dell'import dei layer nell'Import3dm.
2023-11-14 15:14:34 +01:00
Daniele Bariletti e18833d837 Merge branch 'master' of https://gitlab.steamware.net/egaltech/EgtExchange 2023-11-13 17:10:31 +01:00
Daniele Bariletti 7d25e262c2 EgtExchange :
- correzione nella gestione dei layer nell'Import3dm.
2023-11-13 17:10:02 +01:00
Dario Sassi e32c603647 EgtExchange :
- riportate modifiche a import BTL per process Variant
- in export 3MF modifiche di indentazione.
2023-11-12 19:29:22 +01:00
Daniele Bariletti b6847a3da7 EgtExchage :
- miglioria al filtro degli oggetti/gruppi negli Export 3MF, Stl,
ThreeJS e Dxf
- modifiche di stile minori a Export3dm.
2023-11-09 15:47:06 +01:00
Daniele Bariletti 0316c32afb EgtExchange :
- piccole modifiche.
2023-11-09 12:53:12 +01:00
Dario Sassi 0db5c4aa91 EgtExchange 2.5k2 :
- in import BTL estesa gestione processo Variant (0/1/2/3/4-900-x).
2023-11-08 17:58:29 +01:00
SaraP 4399074418 EgtExchange :
- piccole modifiche Import3dm.
2023-11-08 17:03:48 +01:00
Daniele Bariletti e0dcd3f3ac EgtExchange 2.5k2 :
- rimosso l'argomento dScaleFactor da Import3dm.
2023-11-08 10:47:38 +01:00
Daniele Bariletti 7a78c4e832 EgtExchange :
- cambio versione.
2023-11-08 08:45:37 +01:00
Daniele Bariletti 77447763b3 Merge branch '3dm_import' 2023-11-07 17:52:47 +01:00
Daniele Bariletti f50d5b7612 EgtExchange :
- correzione al trim delle Bezier importate da NURBS.
2023-11-07 17:37:58 +01:00
Dario Sassi 1636f8c0b4 EgtExchange :
- in import BTL modifiche a FrontSlot per eliminare facce con dietro materiale trascurabile.
2023-11-06 19:52:13 +01:00
Daniele Bariletti c08486acb7 EgtExchange :
- corretti errori nel trim di superfici Bezier importate da NURBS.
2023-11-06 15:56:09 +01:00
Dario Sassi 281e7183bd EgtExchange 2.5k1 :
- ricompilazione con cambio versione.
2023-11-03 17:23:48 +01:00
Daniele Bariletti 8959255d29 EgtExchange :
- corretto il trim di superfici di bezier convertite da superfici NURBS.
2023-11-03 13:14:15 +01:00
Daniele Bariletti d3bf0a7839 EgtExchange :
- corretta la riparametrizzazione tra superficie NURBS e Bezier.
2023-10-31 09:44:26 +01:00
Daniele Bariletti 2e385022f3 EgtExchange :
- correzione del filtro.
- aggiunta del materiale alle trimesh.
2023-10-30 10:35:40 +01:00
Daniele Bariletti de4b31b950 Merge branch 'master' into 3dm_import. 2023-10-24 15:31:00 +02:00
Daniele Bariletti 47e4b3c0a5 EgtExchange :
- correzione sul filtro export 3dm.
2023-10-24 14:52:00 +02:00
Daniele Bariletti 55f20bf4ec EgtExchange :
- aggiunte a import/export 3dm.
2023-10-24 14:33:15 +02:00
SaraP 3557e2652e EgtExchange :
- piccole modifiche stilistiche.
2023-10-24 11:53:26 +02:00
SaraP c18d3e3163 EgtExchange :
- piccole modifiche Export3dm.
2023-10-23 17:34:55 +02:00
Daniele Bariletti db76003aae EgtExchange 2.5j5 :
- aggiornamento versione.
2023-10-23 16:01:41 +02:00
Daniele Bariletti dcfc78e7ca EgtExchange :
- aggiornamento della versione (2.5j4).
2023-10-23 15:57:58 +02:00
Daniele Bariletti 966dfeabae EgtExchange :
- formattazione del testo.
2023-10-23 15:00:12 +02:00
Daniele Bariletti 3428e12cf6 Merge branch 'master' of https://gitlab.steamware.net/egaltech/EgtExchange 2023-10-23 14:31:20 +02:00
Daniele Bariletti 0a3a4ce532 EgtExchange :
- correzioni all'export 3dm.
2023-10-23 14:30:34 +02:00
Daniele Bariletti 44e1517a59 EgtExchange :
- introdotto l'Export di file 3dm.
2023-10-23 12:39:25 +02:00
Daniele Bariletti cc0c8e7ed8 EgtExchange :
- reintrotto il trim delle superfici nell'import3dm.
2023-10-23 12:12:36 +02:00
SaraP ef92d58ac1 EgtExchange 2.5j3 :
- in Export3MF aggiunta esportazione delle info come metadata.
2023-10-20 10:06:55 +02:00
Dario Sassi 7786be93d0 EgtExchange :
- in importBTL modificata gestione FreeContour che è area vietata (LockOut).
2023-10-18 11:21:24 +02:00
Daniele Bariletti 2804bf0b60 EgtExchange :
- correzioni varie a import/export 3dm.
2023-10-17 11:09:23 +02:00
Daniele Bariletti 5e8e6aebb1 EgtExchange :
- modificate delle impostazioni, ora che la libreria opeNURBS è stata
compilata a x32 e x64 con LLVM.
2023-10-13 13:24:49 +02:00
SaraP 93ef6fe319 EgtExchange :
- in import BTLx corretto free contour con lato inclinato
- migliorie nella gestione dei free contour.
2023-10-11 11:26:50 +02:00
Daniele Bariletti 09c8aa2d66 EgtExchange :
- modificate delle impostazioni e link per usare opennurbs compilata
con LLVM.
2023-10-11 11:14:36 +02:00
Daniele Bariletti 2f5e2203c0 EgtExchange :
- aggiunta una funzione di conversione vettori a Import 3dm.
2023-10-11 11:12:55 +02:00
Dario Sassi 06b7d51b0a EgtExchange :
- in import BTLx corretto passaggio path apertura file come wchar.
2023-10-11 08:50:30 +02:00
Dario Sassi a7a0157fed EgtExchange 2.5j2 :
- ricompilazione con cambio versione.
2023-10-11 08:30:31 +02:00
SaraP 3bf1f66883 EgtExchange :
- corretti errori in import BTLx
- migliorie varie.
2023-10-10 14:53:37 +02:00
Dario Sassi 731c4d1b61 EgtExchange 2.5j1 :
- ricompilazione con cambio versione.
2023-10-09 13:04:04 +02:00
Daniele Bariletti 898d979e08 EgtExchange :
- aggiunta delle info agli oggeti nell'export 3dm.
- riformattazione e sistemazione codice dei file import e export 3dm.
2023-10-06 12:28:44 +02:00
Daniele Bariletti e9dff179e0 EgtExchange :
- aggiunta info ai layer e export punti, per file 3dm.
2023-10-04 13:04:14 +02:00
Daniele Bariletti 9f7bdb2202 EgtExchange :
- aggiunte alle funzioni dell' Export 3dm.
Manca :
- trim delle superfici.
2023-10-02 12:45:20 +02:00
Daniele Bariletti 329646ca9d EgtExchange :
- aggiute funzioni al 3dm Export.
2023-10-02 09:30:40 +02:00
Dario Sassi 4c84f4adff EgtExchange 2.5i6 :
- in import BTL per NUM aggiunto salto delle custom macro (G > 99).
2023-09-27 21:09:49 +02:00
Daniele Bariletti 2c9da3e14d EgtExchange :
- aggiunta del 3dm Export. Da completare.
2023-09-21 17:04:32 +02:00
Dario Sassi 39f9fd86e7 EgtExchange 2.5i5 :
- ricompilazione a 64bit con Enable Enhanced Instruction Set = Not Set.
2023-09-21 15:24:13 +02:00
Daniele Bariletti 4cfdf2b872 EgtExchange :
- introduzione delle nurbs periodiche; da finire.
2023-09-21 14:39:36 +02:00
Daniele Bariletti 2a0e7bed0b EgtExchange :
- aggiunti gli oggetti annotazione nell'import dei file 3dm.
2023-09-19 12:35:05 +02:00
Daniele Bariletti 5c8a2974cb EgtExchange :
- corretti un bug sull'import di brep da file 3dm.
Manca :
- oggetti annotazioni
- curve nurbs periodiche.
2023-09-13 16:13:29 +02:00
Daniele Bariletti 31eb6acb0b EgtExchange :
- correzione in import3dm sulla conversione di superfici piane.
2023-09-12 16:37:37 +02:00
Daniele Bariletti def9225e61 EgtExchange :
- correzione di bug nella conversione di superfici e curve NURBS.
Manca :
- bug nel trim delle superfici di Bezier ( spazio parametrico).
2023-09-12 14:56:56 +02:00
Dario Sassi 306734dc97 Merge branch 'master' of https://gitlab.steamware.net/egaltech/EgtExchange 2023-09-11 10:42:11 +02:00
Dario Sassi 9febfb8147 EgtExchange 2.5i1 :
- ricompilazione con cambio versione.
2023-09-11 10:40:58 +02:00
Daniele Bariletti de4d1fc711 EgtExchange :
- corretti alcuni bug nell' import 3dm.
2023-09-08 15:49:46 +02:00
Riccardo Elitropi 8d11dc838a Merge branch 'master' of https://gitlab.steamware.net/egaltech/EgtExchange 2023-09-06 11:10:35 +02:00
Riccardo Elitropi 3ab1488fbb EgtExchange :
- esportazione Layers per 3MF.
2023-09-06 11:10:27 +02:00
Daniele Bariletti c5503427cb EgtExchange :
- aggiunti oggetti all'import3dm e corretti alcuni bug.
2023-09-01 17:22:03 +02:00
Dario Sassi 1dc2992628 EgtExchange 2.5h2 :
- in import BTL aggiunta gestione piani di riferimento a Slot (3/4-016-X)
- in import BTL corretta gestione piani di riferimento in Pocket (4-039-X).
2023-08-30 10:13:34 +02:00
Dario Sassi 7453297954 EgtExchange 2.5h1 :
- in ExportSvg aggiunta gestione spessore geometrico curve (vtExtr + dThick).
2023-08-23 16:46:39 +02:00
Daniele Bariletti 549f3d47bd EgtExchange:
- aggiunto l'import per file 3dm.
2023-08-03 10:18:12 +02:00
DarioS 595452db1e EgtExchange 2.5g3 :
- in import BTL aggiunta gestione riferimento anche quando feature è senza geometria.
2023-07-24 09:31:49 +02:00
DarioS 1061fee7ef EgtExchange 2.5g2 :
- in import BTL aggiunta gestione riferimento a feature Mortise
- in import BTL si salva riferimento di feature solo se non identità.
2023-07-20 20:41:11 +02:00
DarioS f7f2921607 EgtExchange 2.5g1 :
- ricompilazione con cambio versione.
2023-07-10 11:14:49 +02:00
DarioS dc7977d64e EgtExchange 2.5f2 :
- modifica a export Svg per evitare segnalazione di errori trascurabili.
2023-06-23 16:58:58 +02:00
DarioS edf44dd718 Merge branch 'master' of https://gitlab.steamware.net/egaltech/EgtExchange 2023-06-19 08:07:02 +02:00
DarioS ae559b3d58 EgtExchange 2.5f1 :
- ricompilazione con cambio versione.
2023-06-19 08:01:34 +02:00
Riccardo Elitropi 4049b25d7d EgtExchange :
- in ExportThreeJS tolto il piano trasparente della griglia.
2023-06-05 10:25:30 +02:00
Riccardo Elitropi 8c73d977f5 Merge branch 'master' of https://gitlab.steamware.net/egaltech/EgtExchange 2023-05-30 12:58:26 +02:00
Riccardo Elitropi b3d4c9909d EgtExchange :
- modifica render telecamera ortografica e prospettica con resize della window.
2023-05-30 12:58:13 +02:00
DarioS 8426092c6f EgtExchange 2.5e5 :
- migliorato controllo gestione chiave di rete.
2023-05-30 10:25:16 +02:00
DarioS 48a590d27a Merge branch 'master' of https://gitlab.steamware.net/egaltech/EgtExchange 2023-05-27 10:40:15 +02:00
DarioS 69d368e15d EgtExchange 2.5e4 :
- in import BTL corretta gestione fori molto grandi e parzialmente esterni al pezzo
- in import BTL corretta gestione parametri dummy di feature derivate da altre (P05 di House derivata da Tenon).
2023-05-27 10:38:30 +02:00
Riccardo Elitropi 29c62ecc94 EgtExchange :
- piccola modifica telecamera in ExportThreeJs.
2023-05-26 12:37:49 +02:00
DarioS 3f03526fd5 EgtExchange 2.5e3 :
- in import BTL corretta gestione Slot (3/4-016-X) per angolo P10
- in import BTL aggiunta a Pocket (4-039-X) gestione P04 (flag facce aperte).
2023-05-26 08:41:07 +02:00
DarioS 3a47f8962b EgtExchange 2.5e2 :
- in export SVG si assegna una dimensione minima al box di vista.
2023-05-10 16:06:35 +02:00
DarioS d24d500a9e EgtExchange 2.5e1 :
- ricompilazione con cambio versione.
2023-05-08 08:24:39 +02:00
DarioS cdb28104a9 EgtExchange :
- in taglio Feature con Outline portato extra-taglio a 0.05 mm.
2023-04-17 09:29:55 +02:00
DarioS 26b1107e33 EgtExchange 2.5d3 :
- ricompilazione con cambio versione.
2023-04-11 19:36:04 +02:00
DarioS 55449f3c3f EgtExchange :
- in import BTL correzioni gestione basi Tenoni e DtTenoni in caso di annullamento
- aggiustamenti per PtrOwner nuova funzione Set.
2023-03-27 20:42:06 +02:00
DarioS d4cc57e2f9 EgtExchange 2.5c2 :
- in gestione Beam/Btl migliorato trattamento contorni di Mortise.
2023-03-22 17:34:54 +01:00
DarioS a992b48201 EgtExchange 2.5c1 :
- in import BTL aggiunto controllo unicità PDN.
2023-03-13 08:17:56 +01:00
DarioS c2c0e7d246 EgtExchange 2.5b3 :
- ricompilazione con cambio versione.
2023-02-27 08:16:53 +01:00
DarioS a75725dd05 EgtExchange 2.5b2 :
- ricompilazione con cambio versione.
2023-02-20 09:15:22 +01:00
DarioS defa91177e EgtExchange :
- aggiornati flag di compilazione
- tolti include inutili.
2023-01-09 10:11:08 +01:00
DarioS a9d52a5c49 EgtExchange 2.5a1 :
- ricompilazione con cambio versione.
2023-01-03 08:52:55 +01:00
DarioS c9753c73f9 EgtExchange 2.4l3 :
- in import CNC corretta gestione archi specificati con il centro (ora si approssima questo e non il punto finale).
2022-12-20 16:36:09 +01:00
DarioS fcbe6c2db1 EgtExchange 2.4l2 :
- in BTL migliorata gestione Outline con angoli di fianco (ora allungamento dei singoli tratti funzione anche dello spessore).
2022-12-13 10:58:56 +01:00
DarioS 49d3e03199 EgtExchange 2.4l1 :
- in BTL correzione a AddOneFreeContour (eliminata traslazione per portare Z del primo punto nella faccia)
- in BTL modifica a FreeContour per considerarlo da Trim anche con estremi fuori.
2022-12-04 16:51:03 +01:00
DarioS 35b07c0814 EgtExchange 2.4k6 :
- in import BTL aggiunta gestione FreeContour per chiodature al limite delle specifiche generati da S+S.
2022-11-29 09:05:58 +01:00
DarioS fa3e5c4709 EgtExchange 2.4k5 :
- in BeamMgr corretta CalcSolid con utilizzo superfici originali.
2022-11-25 07:46:37 +01:00
DarioS 1615636771 EgtExchange 2.4k4 :
- in import BTL estesa gestione FreeContour per chiodature singole anche al caso di segmenti di lunghezza nulla.
2022-11-22 08:49:19 +01:00
DarioS 036fe2da43 EgtExchange 2.4k3 :
- in import BTL corretta gestione piano supplementare in FrontSlot
- in import BTL corretto allungamento DovetailMortise senza tasca.
2022-11-12 07:57:47 +01:00
DarioS e3c681bfa2 EgtExchange :
- in BeamMgr imposto livello layer per nomi facce a temporaneo.
2022-11-08 19:12:16 +01:00
DarioS c9b38409ca EgtExchange 2.4k2 :
- modifiche in BeamMgr per gestire visualizzazione nomi facce e freccia di carico
- in import BTLX migliorata gestione Shape e visualizzazione Shape a posto di Outline.
2022-11-08 16:40:52 +01:00
Riccardo Elitropi 91d13357f3 egtExchange :
- posizione centrale dell'oggetto esportato
- render pagina web (prime modifiche)
- Posizione telecamera al cambio tra prospettica e ortografica
- rotazione del cubo attorno al target arruale (e non all'origine)
- Correzione grandezza della lista dei vertici nelle mesh.
2022-11-04 15:00:56 +01:00
Riccardo Elitropi d1f284c718 Merge commit '7fd08a55628410fb18a8cd9d1c18128a921f8c82' 2022-11-03 15:44:52 +01:00
DarioS 7fd08a5562 EgtExchange 2.4k1 :
- in import CNC si saltano le linee che iniziano con "MSG" (messaggio video a utente di Siemens).
2022-11-03 08:51:30 +01:00
DarioS 64fe515d8f EgtExchange 2.4j3 :
- in import BTL corretta gestione riconoscimento lato di uscita faro quando vicini a inizio o fine trave.
2022-10-26 08:42:51 +02:00
Riccardo Elitropi 0689e7df19 EgtExchange :
- Correzione orientamento frame e vettori
- Modifica al groupRoot di ThreeJS
- Correzione cambio coordinate tra sistemi differenti.
2022-10-25 17:13:39 +02:00
DarioS 336c172eee EgtExchange 2.4j2 :
- cambio versione e piccola modifica estetica.
2022-10-24 17:28:18 +02:00
Riccardo Elitropi 4b051ea0ec EgtExchange :
- indentazione codice
- modifica posizione telecamera con apertura da URL parametrizzato.
2022-10-24 16:49:02 +02:00
DarioS 3a66786af8 EgtExchange :
- adattamenti a export ThreeJS.
2022-10-24 08:36:53 +02:00
Riccardo Elitropi b26b1ef2f9 Merge commit 'e5eb2e811f6202282d7c7ece6ff19c632f68cf19' 2022-10-20 16:08:50 +02:00
Riccardo Elitropi e5eb2e811f EgtExchange 2.4j1 :
- Modifica e aggiunta funzioni per ExportThreeJS.
2022-10-20 16:07:48 +02:00
Riccardo Elitropi 09bdbe99d6 EgtExchange :
- modifica selezione qrcode e gestione delle mesh
- aggiunta comandi da tastiera.
2022-10-12 14:24:10 +02:00
48 changed files with 19639 additions and 13910 deletions
+440 -88
View File
@@ -18,9 +18,11 @@
#include "/EgtDev/Include/EExDllMain.h"
#include "/EgtDev/Include/EGkStmStandard.h"
#include "/EgtDev/Include/EGkStmFromCurves.h"
#include "/EgtDev/Include/EGkExtText.h"
#include "/EgtDev/Include/EgtKeyCodes.h"
#include "/EgtDev/Include/EgtStringEncoder.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
#include <future>
using namespace std ;
@@ -29,7 +31,7 @@ IBeamMgr*
CreateBeamMgr( void)
{
// verifico la chiave e le opzioni
if ( ! TestKeyForEEx( GetEExKey(), KEYOPT_EEX_INPADV, GetEExLogger()))
if ( ! VerifyKey( KEYOPT_EEX_INPADV))
return nullptr ;
// creo l'oggetto
return static_cast<IBeamMgr*> ( new(nothrow) BeamMgr) ;
@@ -69,7 +71,8 @@ BeamMgr::SetFlag( int nFlag)
bool bSpecialTrim = (( nFlag & EIBFLAG_SPECIAL_TRIM) != 0) ;
bool bTrimWithOutline = (( nFlag & EIBFLAG_TRIM_WITH_OUTLINE) != 0) ;
bool bUseUAttr = (( nFlag & EIBFLAG_USEUATTR) != 0) ;
if ( ! m_BtlGeom.Init( m_pGDB, nFlatVertPos, bSpecialTrim, bTrimWithOutline, bUseUAttr)) {
bool bPartOffset = (( nFlag & EIBFLAG_PARTOFFSET) != 0) ;
if ( ! m_BtlGeom.Init( m_pGDB, nFlatVertPos, bSpecialTrim, bTrimWithOutline, bUseUAttr, bPartOffset, false)) {
LOG_ERROR( GetEExLogger(), " Error on BtlGeom.Init")
return false ;
}
@@ -81,7 +84,7 @@ BeamMgr::SetFlag( int nFlag)
int
BeamMgr::CreatePart( void)
{
// Verifico validità GDB
// Verifico validità GDB
if ( m_pGDB == nullptr)
return GDB_ID_NULL ;
// Aggiorno posizione
@@ -94,7 +97,7 @@ BeamMgr::CreatePart( void)
bool
BeamMgr::SetPart( int nPartId)
{
// Verifico validità GDB
// Verifico validità GDB
if ( m_pGDB == nullptr)
return false ;
// Imposto il pezzo come corrente
@@ -105,7 +108,7 @@ BeamMgr::SetPart( int nPartId)
bool
BeamMgr::ErasePart( void)
{
// Verifico validità GDB
// Verifico validità GDB
if ( m_pGDB == nullptr)
return false ;
// Cancello il pezzo corrente
@@ -116,7 +119,7 @@ BeamMgr::ErasePart( void)
bool
BeamMgr::UpdatePart( void)
{
// Verifico validità GDB
// Verifico validità GDB
if ( m_pGDB == nullptr)
return false ;
// Forzo aggiornamento del pezzo corrente
@@ -127,10 +130,13 @@ BeamMgr::UpdatePart( void)
bool
BeamMgr::SetPartProdNbr( int nProdNbr)
{
// Verifico validità GDB
// Verifico validità GDB
if ( m_pGDB == nullptr)
return false ;
// Imposto il numero di produzione al pezzo corrente
// Verifico validità nuovo PDN
if ( ! m_BtlGeom.VerifyNewPartProdNbr( nProdNbr))
return false ;
// Imposto il numero di produzione sul pezzo corrente
return m_BtlGeom.SetPartProdNbr( nProdNbr) ;
}
@@ -138,10 +144,10 @@ BeamMgr::SetPartProdNbr( int nProdNbr)
bool
BeamMgr::SetPartName( const string& sName)
{
// Verifico validità GDB
// Verifico validità GDB
if ( m_pGDB == nullptr)
return false ;
// Imposto il nome al pezzo corrente
// Imposto il nome sul pezzo corrente
return m_BtlGeom.SetPartName( sName) ;
}
@@ -149,10 +155,10 @@ BeamMgr::SetPartName( const string& sName)
bool
BeamMgr::SetPartCount( int nCount)
{
// Verifico validità GDB
// Verifico validità GDB
if ( m_pGDB == nullptr)
return false ;
// Imposto il numero delle parti da produrre al pezzo corrente
// Imposto il numero delle parti da produrre sul pezzo corrente
return m_BtlGeom.SetPartCount( nCount) ;
}
@@ -160,12 +166,15 @@ BeamMgr::SetPartCount( int nCount)
bool
BeamMgr::SetPartBox( double dLength, double dHeight, double dWidth, bool bUpdate)
{
// Verifico validità GDB
// Verifico validità GDB
if ( m_pGDB == nullptr)
return false ;
// Imposto le dimensioni al pezzo corrente
// Imposto le dimensioni sul pezzo corrente
if ( ! m_BtlGeom.AddPartBox( dLength, dHeight, dWidth))
return false ;
// Eventuale aggiornamento nomi facce e lato di carico
UpdateFacesName() ;
UpdateLoadingSide() ;
// Se richiesto, aggiorno Outline e cancello Solido
if ( bUpdate) {
m_BtlGeom.UpdateOutLine() ;
@@ -178,10 +187,10 @@ BeamMgr::SetPartBox( double dLength, double dHeight, double dWidth, bool bUpdate
bool
BeamMgr::GetSideData( int nSide, Frame3d& frRef, double& dLength, double& dWidth, double& dHeight)
{
// Verifico validità GDB
// Verifico validità GDB
if ( m_pGDB == nullptr)
return false ;
// Verifico validità identificativo di faccia
// Verifico validità identificativo di faccia
if ( nSide < BTL_SIDE_FRONT || nSide > BTL_SIDE_RIGHT)
return false ;
// Recupero riferimento del pezzo corrente
@@ -199,13 +208,164 @@ BeamMgr::GetSideData( int nSide, Frame3d& frRef, double& dLength, double& dWidth
return true ;
}
//----------------------------------------------------------------------------
bool
BeamMgr::ShowFacesName( bool bShow)
{
// Verifico validità GDB
if ( m_pGDB == nullptr)
return false ;
// Verifico esistenza del pezzo corrente
int nPartId = m_BtlGeom.GetCurrPartId() ;
if ( nPartId == GDB_ID_NULL)
return false ;
// Verifico esistenza del gruppo nomi facce
int nFcsNameLayId = m_pGDB->GetFirstNameInGroup( nPartId, FCSNAME_LAYER_NAME) ;
// Se da visualizzare e non esiste il gruppo
if ( bShow && nFcsNameLayId == GDB_ID_NULL) {
// Creazione del gruppo
nFcsNameLayId = m_pGDB->AddGroup( GDB_ID_NULL, nPartId, GLOB_FRM) ;
m_pGDB->SetLevel( nFcsNameLayId, GDB_LV_TEMP) ;
m_pGDB->SetName( nFcsNameLayId, FCSNAME_LAYER_NAME) ;
m_pGDB->SetMaterial( nFcsNameLayId, NAVY) ;
// Scrittura del nome delle facce come testi del layer ausiliario
for ( int nS = BTL_SIDE_FRONT ; nS <= BTL_SIDE_RIGHT ; ++ nS) {
string sFace ;
if ( nS == BTL_SIDE_LEFT)
sFace = "o" ;
else if ( nS == BTL_SIDE_RIGHT)
sFace = "+" ;
else
sFace = "F" + ToString( nS) ;
PtrOwner<IExtText> pText( CreateExtText()) ;
if ( IsNull( pText))
return false ;
double dSLen = m_BtlGeom.GetSideLength( nS) ;
double dSWid = m_BtlGeom.GetSideWidth( nS) ;
Point3d ptPos( 0.5 * dSLen, ( m_BtlGeom.IsTrueSide( nS) ? 10 : 0.5 * dSWid), 1) ;
Vector3d vtDir = ( nS != BTL_SIDE_RIGHT ? X_AX : -X_AX) ;
int nInsPos = ( m_BtlGeom.IsTrueSide( nS) ? ETXT_IPBC : ETXT_IPMC) ;
double dPLen = m_BtlGeom.GetCurrPartLength() ;
double dPHei = m_BtlGeom.GetCurrPartHeight() ;
double dPWid = m_BtlGeom.GetCurrPartWidth() ;
double dCoeff = ( abs( dPHei - dPWid) / abs( dPHei + dPWid) < 0.51 ? 0.1 : 0.2) ;
double dTextHeight = dCoeff * min( { dPLen, dPHei, dPWid}) ;
if ( ! pText->Set( ptPos, Z_AX, vtDir, sFace, "Arial", 100, false, 2 * dTextHeight, 1, 0, nInsPos))
return false ;
// porto il testo nel piano della faccia
Frame3d frRef = m_BtlGeom.GetSideFrame( nS) ;
pText->ToGlob( frRef) ;
// recupero eventuale nome già presente
int nOldTextId = m_pGDB->GetFirstNameInGroup( nFcsNameLayId, sFace) ;
// se gia presente, lo rimpiazzo
if ( nOldTextId != GDB_ID_NULL) {
if ( ! m_pGDB->ReplaceGeoObj( nOldTextId, Release( pText)))
return false ;
}
// altrimenti, lo inserisco
else {
int nTextId = m_pGDB->AddGeoObj( GDB_ID_NULL, nFcsNameLayId, Release( pText)) ;
if ( nTextId == GDB_ID_NULL)
return false ;
// assegno nome
m_pGDB->SetName( nTextId, sFace) ;
}
}
}
// se altrimenti da eliminare ed esiste
else if ( ! bShow && nFcsNameLayId != GDB_ID_NULL) {
m_pGDB->Erase( nFcsNameLayId) ;
}
return true ;
}
//----------------------------------------------------------------------------
bool
BeamMgr::UpdateFacesName( void)
{
int nFcsNameLayId = m_pGDB->GetFirstNameInGroup( m_BtlGeom.GetCurrPartId(), FCSNAME_LAYER_NAME) ;
if ( nFcsNameLayId == GDB_ID_NULL)
return true ;
m_pGDB->Erase( nFcsNameLayId) ;
return ShowFacesName( true) ;
}
//----------------------------------------------------------------------------
bool
BeamMgr::ShowLoadingSide( bool bShow, bool bFromLeft)
{
// Verifico validità GDB
if ( m_pGDB == nullptr)
return false ;
// Verifico esistenza del pezzo corrente
int nPartId = m_BtlGeom.GetCurrPartId() ;
if ( nPartId == GDB_ID_NULL)
return false ;
// Verifico esistenza del gruppo temporaneo lato di carico
int nLsideGrpId = m_pGDB->GetFirstNameInGroup( GDB_ID_ROOT, LOADINGSIDE_GROUP_NAME) ;
// Se da visualizzare e non esiste il gruppo
if ( bShow && nLsideGrpId == GDB_ID_NULL) {
// Creazione del gruppo
nLsideGrpId = m_pGDB->AddGroup( GDB_ID_NULL, GDB_ID_ROOT, GLOB_FRM) ;
m_pGDB->SetLevel( nLsideGrpId, GDB_LV_TEMP) ;
m_pGDB->SetName( nLsideGrpId, LOADINGSIDE_GROUP_NAME) ;
m_pGDB->SetMaterial( nLsideGrpId, NAVY) ;
m_pGDB->SetInfo( nLsideGrpId, IKEY_LSIDE, bFromLeft) ;
// Recupero dati del pezzo
Frame3d frPart ;
if ( ! m_pGDB->GetGroupGlobFrame( nPartId, frPart))
return false ;
BBox3d b3Part( 0, 0, 0, m_BtlGeom.GetCurrPartLength(), m_BtlGeom.GetCurrPartHeight(), m_BtlGeom.GetCurrPartWidth()) ;
b3Part.ToGlob( frPart) ;
// Disegno della freccia
PolyLine PL ;
PL.AddUPoint( 0, Point3d( 140, 0, 0)) ;
PL.AddUPoint( 0, Point3d( 100, -40, 0)) ;
PL.AddUPoint( 0, Point3d( 100, -20, 0)) ;
PL.AddUPoint( 0, Point3d( 0, -20, 0)) ;
PL.AddUPoint( 0, Point3d( 0, 20, 0)) ;
PL.AddUPoint( 0, Point3d( 100, 20, 0)) ;
PL.AddUPoint( 0, Point3d( 100, 40, 0)) ;
PL.AddUPoint( 0, Point3d( 140, 0, 0)) ;
Vector3d vtMove = b3Part.GetMin() + ( b3Part.GetDimX() + 50) * X_AX + b3Part.GetDimY() / 2 * Y_AX - ORIG ;
PL.Translate( vtMove) ;
PtrOwner<ISurfTriMesh> pStm( CreateSurfTriMesh()) ;
if ( IsNull( pStm) || ! pStm->CreateByFlatContour( PL))
return false ;
int nStmId = m_pGDB->AddGeoObj( GDB_ID_NULL, nLsideGrpId, Release( pStm)) ;
if ( nStmId == GDB_ID_NULL)
return false ;
}
// se altrimenti da eliminare ed esiste
else if ( ! bShow && nLsideGrpId != GDB_ID_NULL) {
m_pGDB->Erase( nLsideGrpId) ;
}
return true ;
}
//----------------------------------------------------------------------------
bool
BeamMgr::UpdateLoadingSide( void)
{
int nLsideGrpId = m_pGDB->GetFirstNameInGroup( GDB_ID_ROOT, LOADINGSIDE_GROUP_NAME) ;
if ( nLsideGrpId == GDB_ID_NULL)
return true ;
bool bFromLeft = true ;
m_pGDB->GetInfo( nLsideGrpId, IKEY_LSIDE, bFromLeft) ;
m_pGDB->Erase( nLsideGrpId) ;
return ShowLoadingSide( true, bFromLeft) ;
}
//----------------------------------------------------------------------------
int
BeamMgr::AddProcess( int nGroup, int nProc, int nSide, const string& sDes, int nProcId,
const Frame3d& frRef, const DBLVECTOR& vdPar, const string& sPar, const STRVECTOR& vsUAtt,
int nCrvId, int nCrv2Id, bool bUpdate)
{
// Verifico validità GDB
// Verifico validità GDB
if ( m_pGDB == nullptr)
return GDB_ID_NULL ;
// Recupero i dati di default della feature
@@ -218,7 +378,7 @@ BeamMgr::AddProcess( int nGroup, int nProc, int nSide, const string& sDes, int n
// Imposto i dati della feature
for ( int i = 0 ; i < int( vnDPar.size()) ; ++ i) {
int j = vnDPar[i] ;
if ( j - 1 < int( vdPar.size()))
if ( j > 0 && j - 1 < int( vdPar.size()))
vdBtlPar[i] = vdPar[j-1] ;
}
sBtlPar = sPar ;
@@ -257,7 +417,7 @@ BeamMgr::ModifyProcess( int nGeomId, int nGroup, int nProc, int nSide, const str
const Frame3d& frRef, const DBLVECTOR& vdPar, const string& sPar, const STRVECTOR& vsUAtt,
int nCrvId, int nCrv2Id, bool bUpdate)
{
// Verifico validità GDB
// Verifico validità GDB
if ( m_pGDB == nullptr)
return GDB_ID_NULL ;
// Recupero il pezzo di appartenenza
@@ -306,7 +466,7 @@ BeamMgr::ModifyProcess( int nGeomId, int nGroup, int nProc, int nSide, const str
bool
BeamMgr::EraseProcess( int nGeomId, bool bUpdate)
{
// Verifico validità GDB
// Verifico validità GDB
if ( m_pGDB == nullptr)
return false ;
// Recupero il pezzo di appartenenza
@@ -370,7 +530,7 @@ MyEnableProcess( IGeomDB* pGDB, BtlGeom& BtlG, int nGeomId, bool bEnable)
bool
BeamMgr::EnableProcess( int nGeomId, bool bEnable, bool bUpdate)
{
// Verifico validità GDB
// Verifico validità GDB
if ( m_pGDB == nullptr)
return false ;
// Recupero il pezzo di appartenenza
@@ -402,6 +562,113 @@ BeamMgr::EnableProcess( int nGeomId, bool bEnable, bool bUpdate)
return true ;
}
//----------------------------------------------------------------------------
bool
BeamMgr::CalcAllSolids( bool bShow, bool bRecalc, pcfProcEvents pFun)
{
// Verifico validità GDB
if ( m_pGDB == nullptr)
return false ;
// Recupero tutti i pezzi
INTVECTOR vPartId ;
int nPartId = m_pGDB->GetFirstGroupInGroup( GDB_ID_ROOT) ;
while ( nPartId != GDB_ID_NULL) {
int nLevel ;
if ( m_pGDB->GetLevel( nPartId, nLevel) && nLevel == GDB_LV_USER &&
m_pGDB->GetFirstNameInGroup( nPartId, BOX_LAYER_NAME) != GDB_ID_NULL) {
vPartId.push_back( nPartId) ;
// nascondo il layer del solido per non avere problemi con le visualizzazioni durante i calcoli in multithread
m_pGDB->SetStatus( m_pGDB->GetFirstNameInGroup( nPartId, SOLID_LAYER_NAME), GDB_ST_OFF) ;
}
nPartId = m_pGDB->GetNextGroup( nPartId) ;
}
// Calcolo i solidi
bool bOk = true ;
constexpr bool MULTITHREAD = true ;
if ( MULTITHREAD) {
int nPartCnt = int( vPartId.size()) ;
int nThreadMax = min( max( 1, int( thread::hardware_concurrency()) - 1), nPartCnt) ;
vector< future<bool>> vRes( nPartCnt) ;
INTVECTOR vInd( nThreadMax) ;
// lancio tutto quanto possibile
for ( int i = 0 ; i < nThreadMax ; ++ i) {
vInd[i] = i ;
vRes[vInd[i]] = async( launch::async, &BeamMgr::CalcSolid, this, vPartId[vInd[i]], bRecalc) ;
}
// attesa completamento e rilancio successivi (occupando sempre lo stesso numero di thread)
int nNext = nThreadMax ;
int nTerminated = 0 ;
while ( nTerminated < nPartCnt) {
for ( int i = 0 ; i < nThreadMax ; ++ i) {
if ( vInd[i] >= 0 && vRes[vInd[i]].valid() && vRes[vInd[i]].wait_for( chrono::microseconds{ 1}) == future_status::ready) {
++ nTerminated ;
if ( ! vRes[vInd[i]].get())
bOk = false ;
ShowSolid( vPartId[vInd[i]], bShow) ;
if ( pFun != nullptr)
pFun( ( 100 * nTerminated) / nPartCnt, -1) ;
if ( nNext < nPartCnt) {
vInd[i] = nNext ;
++ nNext ;
vRes[vInd[i]] = async( launch::async, &BeamMgr::CalcSolid, this, vPartId[vInd[i]], bRecalc) ;
}
else
vInd[i] = -1 ;
}
}
}
}
// non multithread solo per DEBUG
else {
int nPartCnt = int( vPartId.size()) ;
for ( int i = 0 ; i < nPartCnt ; ++ i) {
if ( ! CalcSolid( vPartId[i], bRecalc))
bOk = false ;
ShowSolid( vPartId[i], bShow) ;
if ( pFun != nullptr)
pFun( ( 100 * ( i + 1)) / nPartCnt, -1) ;
}
}
return bOk ;
}
//----------------------------------------------------------------------------
bool
BeamMgr::ShowAllSolids( bool bShow, pcfProcEvents pFun)
{
// Verifico validità GDB
if ( m_pGDB == nullptr)
return false ;
// Recupero tutti i pezzi
INTVECTOR vPartId ;
int nPartId = m_pGDB->GetFirstGroupInGroup( GDB_ID_ROOT) ;
while ( nPartId != GDB_ID_NULL) {
int nLevel ;
if ( m_pGDB->GetLevel( nPartId, nLevel) && nLevel == GDB_LV_USER &&
m_pGDB->GetFirstNameInGroup( nPartId, BOX_LAYER_NAME) != GDB_ID_NULL)
vPartId.push_back( nPartId) ;
nPartId = m_pGDB->GetNextGroup( nPartId) ;
}
// Aggiorno visualizzazione dei solidi
bool bOk = true ;
int nPartCnt = int( vPartId.size()) ;
for ( int i = 0 ; i < nPartCnt ; ++ i) {
if ( ! ShowSolid( vPartId[i], bShow))
bOk = false ;
if ( pFun != nullptr)
pFun( ( 100 * ( i + 1)) / nPartCnt, -1) ;
}
return bOk ;
}
//----------------------------------------------------------------------------
static ISurfTriMesh*
RegularizeTriMesh( const ISurfTriMesh* pStm, double dStep)
@@ -455,7 +722,7 @@ RegularizeTriMesh( const ISurfTriMesh* pStm, double dStep)
if ( IsNull( pStmTmp))
return nullptr ;
if ( IsNull( pStmNew))
pStmNew.Set( Release( pStmTmp)) ;
pStmNew.Set( pStmTmp) ;
else
pStmNew->DoSewing( *pStmTmp) ;
// recupero una nuova copia della faccetta originale
@@ -469,11 +736,51 @@ RegularizeTriMesh( const ISurfTriMesh* pStm, double dStep)
return Release( pStmNew) ;
}
//----------------------------------------------------------------------------
static bool
IntersectOneFeature( int nProcId, int nTrim, double dStep, IGeomDB* pGDB, ISurfTriMesh* pStm)
{
// recupero eventuale superficie originale
int nProcSurfId = nProcId ;
int nOrigId = 0 ;
if ( pGDB->GetInfo( nProcSurfId, IKEY_ORIGID, nOrigId))
nProcSurfId += nOrigId ;
// se da utilizzare anche superfici ausiliarie
if ( nTrim == 2) {
int nAux ;
if ( pGDB->GetInfo( nProcSurfId, IKEY_AUXID, nAux)) {
const ISurfTriMesh* pStmProc = GetSurfTriMesh( pGDB->GetGeoObj( nProcSurfId)) ;
const ISurfTriMesh* pAux = GetSurfTriMesh( pGDB->GetGeoObj( nProcSurfId + nAux)) ;
if ( pStmProc != nullptr && ! pStmProc->IsEmpty() && pAux != nullptr && ! pAux->IsEmpty()) {
PtrOwner<ISurfTriMesh> pTrim( pAux->Clone()) ;
if ( IsNull( pTrim) || ! pTrim->DoSewing( *pStmProc))
return false ;
PtrOwner<ISurfTriMesh> pStmTmp( RegularizeTriMesh( pTrim, dStep)) ;
const ISurfTriMesh* pStmTool = ( ! IsNull( pStmTmp) ? Get( pStmTmp) : Get( pTrim)) ;
if ( pStmTool == nullptr || ! pStm->Intersect( *pStmTool))
return false ;
}
}
}
// caso standard
else {
const ISurfTriMesh* pStmProc = GetSurfTriMesh( pGDB->GetGeoObj( nProcSurfId)) ;
if ( ! pStmProc->IsEmpty()) {
PtrOwner<ISurfTriMesh> pStmTmp( RegularizeTriMesh( pStmProc, dStep)) ;
if ( ! IsNull( pStmTmp))
pStmProc = Get( pStmTmp) ;
if ( pStmProc == nullptr || ! pStm->Intersect( *pStmProc))
return false ;
}
}
return true ;
}
//----------------------------------------------------------------------------
bool
BeamMgr::CalcSolid( int nPartId, bool bRecalc)
{
// Verifico validità GDB
// Verifico validità GDB
if ( m_pGDB == nullptr)
return false ;
// Verifico esistenza del pezzo
@@ -491,32 +798,34 @@ BeamMgr::CalcSolid( int nPartId, bool bRecalc)
m_pGDB->SetMaterial( nSolLayId, Color(255, 160, 32)) ;
}
int nSolidId = m_pGDB->GetFirstNameInGroup( nSolLayId, SOLID_SOLID_NAME) ;
const ISurfTriMesh* pOldStm = GetSurfTriMesh( m_pGDB->GetGeoObj( nSolidId)) ;
if ( pOldStm == nullptr || pOldStm->GetFacetCount() == 0)
if ( ! m_pGDB->ExistsInfo( nSolidId, IKEY_VALID))
bRecalc = true ;
if ( bRecalc) {
BBox3d b3Box ;
m_pGDB->GetLocalBBox( nBoxId, b3Box, BBF_STANDARD) ;
Point3d ptMin ; double dDimX, dDimY, dDimz ;
if ( ! b3Box.GetMinDim( ptMin, dDimX, dDimY, dDimz))
const ISurfTriMesh* pOldStm = GetSurfTriMesh( m_pGDB->GetGeoObj( nSolidId)) ;
if ( pOldStm == nullptr || pOldStm->IsEmpty())
bRecalc = true ;
// Se non necessario ricalcolo, esco con successo
if ( ! bRecalc)
return true ;
// Calcolo il solido senza feature
BBox3d b3Box ;
m_pGDB->GetLocalBBox( nBoxId, b3Box, BBF_STANDARD) ;
Point3d ptMin ; double dDimX, dDimY, dDimZ ;
if ( ! b3Box.GetMinDim( ptMin, dDimX, dDimY, dDimZ))
return false ;
PtrOwner<ISurfTriMesh> pSTM( GetSurfTriMeshBox( dDimX, dDimY, dDimZ, false)) ;
if ( IsNull( pSTM))
return false ;
pSTM->Translate( ptMin - ORIG) ;
if ( nSolidId != GDB_ID_NULL) {
if ( ! m_pGDB->ReplaceGeoObj( nSolidId, Release( pSTM)))
return false ;
PtrOwner<ISurfTriMesh> pSTM( GetSurfTriMeshBox( dDimX, dDimY, dDimz, false)) ;
if ( IsNull( pSTM))
return false ;
pSTM->Translate( ptMin - ORIG) ;
if ( nSolidId != GDB_ID_NULL) {
if ( ! m_pGDB->ReplaceGeoObj( nSolidId, Release( pSTM)))
return false ;
}
else {
nSolidId = m_pGDB->AddGeoObj( GDB_ID_NULL, nSolLayId, Release( pSTM)) ;
if ( nSolidId == GDB_ID_NULL)
return false ;
m_pGDB->SetName( nSolidId, SOLID_SOLID_NAME) ;
}
}
else {
return true ;
nSolidId = m_pGDB->AddGeoObj( GDB_ID_NULL, nSolLayId, Release( pSTM)) ;
if ( nSolidId == GDB_ID_NULL)
return false ;
m_pGDB->SetName( nSolidId, SOLID_SOLID_NAME) ;
}
BBox3d b3Solid ;
m_pGDB->GetLocalBBox( nSolidId, b3Solid, BBF_STANDARD) ;
@@ -535,17 +844,21 @@ BeamMgr::CalcSolid( int nPartId, bool bRecalc)
int nDO = 1 ;
m_pGDB->GetInfo( nOutId, IKEY_DO, nDO) ;
if ( nDO != 0 && m_pGDB->GetGeoType( nOutId) == SRF_TRIMESH) {
// sempre standard
const ISurfTriMesh* pStmOut = GetSurfTriMesh( m_pGDB->GetGeoObj( nOutId)) ;
PtrOwner<ISurfTriMesh> pStmTmp( RegularizeTriMesh( pStmOut, dStep)) ;
if ( ! IsNull( pStmTmp))
pStmOut = Get( pStmTmp) ;
if ( pStmOut == nullptr || ! pStm->Intersect( *pStmOut))
return false ;
if ( ! pStmOut->IsEmpty()) {
PtrOwner<ISurfTriMesh> pStmTmp( RegularizeTriMesh( pStmOut, dStep)) ;
if ( ! IsNull( pStmTmp))
pStmOut = Get( pStmTmp) ;
if ( pStmOut == nullptr || ! pStm->Intersect( *pStmOut))
return false ;
}
}
nOutId = m_pGDB->GetNext( nOutId) ;
}
// ciclo sulle features
// ciclo su feature troncanti (taglio di testa,..)
int nProcLayId = m_pGDB->GetFirstNameInGroup( nPartId, PROCESSINGS_LAYER_NAME) ;
INTVECTOR vUsedFea ;
int nProcId = m_pGDB->GetFirstInGroup( nProcLayId) ;
while ( nProcId != GDB_ID_NULL) {
int nDO = 1 ;
@@ -553,34 +866,36 @@ BeamMgr::CalcSolid( int nPartId, bool bRecalc)
m_pGDB->GetInfo( nProcId, IKEY_DO, nDO) ;
m_pGDB->GetInfo( nProcId, IKEY_TRIM, nTrim) ;
if ( nDO != 0 && nTrim != 0 && m_pGDB->GetGeoType( nProcId) == SRF_TRIMESH) {
if ( nTrim == 2) {
int nAux ;
if ( m_pGDB->GetInfo( nProcId, IKEY_AUXID, nAux)) {
const ISurfTriMesh* pStmProc = GetSurfTriMesh( m_pGDB->GetGeoObj( nProcId)) ;
const ISurfTriMesh* pAux = GetSurfTriMesh( m_pGDB->GetGeoObj( nProcId + nAux)) ;
if ( pStmProc != nullptr && pAux != nullptr) {
PtrOwner<ISurfTriMesh> pTrim ;
pTrim.Set( pAux->Clone()) ;
if ( IsNull( pTrim) || ! pTrim->DoSewing( *pStmProc))
return false ;
PtrOwner<ISurfTriMesh> pStmTmp( RegularizeTriMesh( pTrim, dStep)) ;
const ISurfTriMesh* pStmTool = ( ! IsNull( pStmTmp) ? Get( pStmTmp) : Get( pTrim)) ;
if ( pStmTool == nullptr || ! pStm->Intersect( *pStmTool))
return false ;
}
}
}
else {
const ISurfTriMesh* pStmProc = GetSurfTriMesh( m_pGDB->GetGeoObj( nProcId)) ;
PtrOwner<ISurfTriMesh> pStmTmp( RegularizeTriMesh( pStmProc, dStep)) ;
if ( ! IsNull( pStmTmp))
pStmProc = Get( pStmTmp) ;
if ( pStmProc == nullptr || ! pStm->Intersect( *pStmProc))
int nGroup = 0 ;
int nProc = 0 ;
m_pGDB->GetInfo( nProcId, IKEY_GROUP, nGroup) ;
m_pGDB->GetInfo( nProcId, IKEY_PROC, nProc) ;
if ( IS_CUT( nGroup, nProc) || IS_DOUBLE_CUT( nGroup, nProc) ||
IS_TENON( nGroup, nProc) || IS_DOVETAIL_TENON( nGroup, nProc)) {
if ( ! IntersectOneFeature( nProcId, nTrim, dStep, m_pGDB, pStm))
return false ;
vUsedFea.push_back( nProcId) ;
}
}
nProcId = m_pGDB->GetNext( nProcId) ;
}
// ciclo sulle altre features
nProcId = m_pGDB->GetFirstInGroup( nProcLayId) ;
while ( nProcId != GDB_ID_NULL) {
int nDO = 1 ;
int nTrim = 1 ;
m_pGDB->GetInfo( nProcId, IKEY_DO, nDO) ;
m_pGDB->GetInfo( nProcId, IKEY_TRIM, nTrim) ;
if ( find( vUsedFea.begin(), vUsedFea.end(), nProcId) == vUsedFea.end() &&
nDO != 0 && nTrim != 0 && m_pGDB->GetGeoType( nProcId) == SRF_TRIMESH) {
if ( ! IntersectOneFeature( nProcId, nTrim, dStep, m_pGDB, pStm))
return false ;
}
nProcId = m_pGDB->GetNext( nProcId) ;
}
// imposto visualizzazione spigoli
pStm->SetShowEdges( true) ;
// dichiaro calcolato il solido
m_pGDB->SetInfo( nSolidId, IKEY_VALID, 1) ;
return true ;
@@ -590,7 +905,7 @@ BeamMgr::CalcSolid( int nPartId, bool bRecalc)
int
BeamMgr::GetSolid( int nPartId) const
{
// Verifico validità GDB
// Verifico validità GDB
if ( m_pGDB == nullptr)
return false ;
// Recupero layer del solido e Id del solido
@@ -603,7 +918,7 @@ BeamMgr::GetSolid( int nPartId) const
bool
BeamMgr::ShowSolid( int nPartId, bool bShow)
{
// Verifico validità GDB
// Verifico validità GDB
if ( m_pGDB == nullptr)
return false ;
// Verifico esistenza del pezzo
@@ -618,35 +933,61 @@ BeamMgr::ShowSolid( int nPartId, bool bShow)
m_pGDB->SetStatus( nOutlLayId, ( bShow ? GDB_ST_OFF : GDB_ST_ON)) ;
int nProcsLayId = m_pGDB->GetFirstNameInGroup( nPartId, PROCESSINGS_LAYER_NAME) ;
m_pGDB->SetStatus( nProcsLayId, ( bShow ? GDB_ST_OFF : GDB_ST_ON)) ;
int nFcsNameLayId = m_pGDB->GetFirstNameInGroup( nPartId, FCSNAME_LAYER_NAME) ;
m_pGDB->SetStatus( nFcsNameLayId, ( bShow ? GDB_ST_OFF : GDB_ST_ON)) ;
return true ;
}
//----------------------------------------------------------------------------
bool
BeamMgr::GetBuildingIsOn( void) const
BeamMgr::GetBuildingIsOn( int nAssGrpId) const
{
// verifico esistenza gruppo di assemblaggio
int nAssGrpId = m_pGDB->GetFirstNameInGroup( GDB_ID_ROOT, ASSEMBLY_GROUP_NAME) ;
if ( nAssGrpId == GDB_ID_NULL)
// Verifico validità GDB
if ( m_pGDB == nullptr)
return false ;
// se gruppo di assemblaggio indicato lo verifico
if ( nAssGrpId != GDB_ID_NULL) {
string sAssName ;
if ( ! m_pGDB->GetName( nAssGrpId, sAssName) || sAssName != ASSEMBLY_GROUP_NAME)
return false ;
}
// altrimenti cerco il primo gruppo di assemblaggio
else {
nAssGrpId = m_pGDB->GetFirstNameInGroup( GDB_ID_ROOT, ASSEMBLY_GROUP_NAME) ;
if ( nAssGrpId == GDB_ID_NULL)
return false ;
}
// recupero il primo oggetto nel gruppo
int nAssId = m_pGDB->GetFirstInGroup( nAssGrpId) ;
if ( nAssId == GDB_ID_NULL)
return false ;
// se contiene oggetti, assemblaggio è On
// se contiene oggetti, assemblaggio è On
return ( m_pGDB->GetGroupObjs( nAssId) > 0) ;
}
//----------------------------------------------------------------------------
bool
BeamMgr::ShowBuilding( bool bShow)
BeamMgr::ShowBuilding( int nAssGrpId, bool bShow)
{
// verifico esistenza gruppo di assemblaggio
int nAssGrpId = m_pGDB->GetFirstNameInGroup( GDB_ID_ROOT, ASSEMBLY_GROUP_NAME) ;
if ( nAssGrpId == GDB_ID_NULL)
// Verifico validità GDB
if ( m_pGDB == nullptr)
return false ;
// se gruppo di assemblaggio indicato lo verifico
if ( nAssGrpId != GDB_ID_NULL) {
string sAssName ;
if ( ! m_pGDB->GetName( nAssGrpId, sAssName) || sAssName != ASSEMBLY_GROUP_NAME)
return false ;
}
// altrimenti cerco il primo gruppo di assemblaggio
else {
nAssGrpId = m_pGDB->GetFirstNameInGroup( GDB_ID_ROOT, ASSEMBLY_GROUP_NAME) ;
if ( nAssGrpId == GDB_ID_NULL)
return false ;
}
// ciclo sul gruppo di assemblaggio
int nAssId = m_pGDB->GetFirstInGroup( nAssGrpId) ;
while ( nAssId != GDB_ID_NULL) {
@@ -659,7 +1000,7 @@ BeamMgr::ShowBuilding( bool bShow)
if ( m_pGDB->GetInfo( nAssId, GDB_SI_SOURCE, nSouId)) {
m_pGDB->SetMode( nSouId, GDB_MD_STD) ;
m_pGDB->SetStatus( nSouId, GDB_ST_ON) ;
// se già utilizzato, ne faccio una copia
// se già utilizzato, ne faccio una copia
if ( m_pGDB->GetParentId( nSouId) != GDB_ID_ROOT) {
int nCopyId = m_pGDB->Copy( nSouId, GDB_ID_NULL, GDB_ID_ROOT) ;
if ( nCopyId != GDB_ID_NULL) {
@@ -670,7 +1011,7 @@ BeamMgr::ShowBuilding( bool bShow)
m_pGDB->SetInfo( nAssId, GDB_SI_SOURCE, nSouId) ;
}
}
m_pGDB->SetStatus( m_pGDB->GetFirstNameInGroup( nSouId, BOX_LAYER_NAME), GDB_ST_OFF) ;
m_pGDB->SetMode( m_pGDB->GetFirstNameInGroup( nSouId, BOX_LAYER_NAME), GDB_MD_HIDDEN) ;
m_pGDB->GroupSwap( nSouId, nAssId, true, true) ;
}
}
@@ -685,12 +1026,23 @@ BeamMgr::ShowBuilding( bool bShow)
m_pGDB->SetInfo( nBaseId, GDB_SI_SOURCE, nCopyId) ;
}
else {
m_pGDB->SetStatus( m_pGDB->GetFirstNameInGroup( nAssId, BOX_LAYER_NAME), GDB_ST_ON) ;
m_pGDB->SetMode( m_pGDB->GetFirstNameInGroup( nAssId, BOX_LAYER_NAME), GDB_MD_STD) ;
}
}
}
// passo al successivo
nAssId = nNextId ;
}
// Nascondo o visualizzo tutti i pezzi sotto la radice
int nPartId = m_pGDB->GetFirstInGroup( GDB_ID_ROOT) ;
while ( nPartId != GDB_ID_NULL) {
int nLevel ;
if ( m_pGDB->GetLevel( nPartId, nLevel) && nLevel == GDB_LV_USER &&
m_pGDB->GetFirstNameInGroup( nPartId, BOX_LAYER_NAME) != GDB_ID_NULL)
m_pGDB->SetStatus( nPartId, ( bShow ? GDB_ST_OFF : GDB_ST_ON)) ;
nPartId = m_pGDB->GetNext( nPartId) ;
}
return true ;
}
+8 -2
View File
@@ -31,6 +31,8 @@ class BeamMgr : public IBeamMgr
bool SetPartCount( int nCount) override ;
bool SetPartBox( double dLength, double dHeight, double dWidth, bool bUpdate = true) override ;
bool GetSideData( int nSide, Frame3d& frRef, double& dLength, double& dWidth, double& dHeight) override ;
bool ShowFacesName( bool bShow) override ;
bool ShowLoadingSide( bool bShow, bool bFromLeft) override ;
int AddProcess( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId,
const Frame3d& frRef, const DBLVECTOR& vdPar, const std::string& sPar, const STRVECTOR& vsUAtt,
int nCrvId, int nCrv2Id, bool bUpdate = true) override ;
@@ -39,16 +41,20 @@ class BeamMgr : public IBeamMgr
int nCrvId, int nCrv2Id, bool bUpdate = true) override ;
bool EraseProcess( int nGeomId, bool bUpdate = true) override ;
bool EnableProcess( int nGeomId, bool bEnable, bool bUpdate = true) override ;
bool CalcAllSolids( bool bShow, bool bRecalc, pcfProcEvents pFun = nullptr) override ;
bool ShowAllSolids( bool bShow, pcfProcEvents pFun = nullptr) override ;
bool CalcSolid( int nPartId, bool bRecalc = false) override ;
int GetSolid( int nPartId) const override ;
bool ShowSolid( int nPartId, bool bShow) override ;
bool GetBuildingIsOn( void) const override ;
bool ShowBuilding( bool bShow) override ;
bool GetBuildingIsOn( int nAssGrpId) const override ;
bool ShowBuilding( int nAssGrpId, bool bShow) override ;
public :
BeamMgr( void) ;
private :
bool UpdateFacesName( void) ;
bool UpdateLoadingSide( void) ;
private :
IGeomDB* m_pGDB ;
+182 -10
View File
@@ -22,6 +22,7 @@
#include "/EgtDev/Include/EGkStmStandard.h"
#include "/EgtDev/Include/EGkStmFromCurves.h"
#include "/EgtDev/Include/EGkExtText.h"
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EGnStringUtils.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
#include <unordered_map>
@@ -30,6 +31,8 @@ using namespace std ;
//----------------------------------------------------------------------------
string BtlGeom::m_sBtlAuxDir ;
string BtlGeom::m_sBtlLuaLibsDir ;
string BtlGeom::m_sBtlLuaLastRequire ;
//----------------------------------------------------------------------------
BtlGeom::BtlGeom( void)
@@ -39,10 +42,12 @@ BtlGeom::BtlGeom( void)
m_bSpecialTrim = false ;
m_bTrimWithOutline = false ;
m_bUseUAttr = false ;
m_bPartOffset = false ;
m_BoxCol = Color( 255, 128, 0, 15) ;
m_OffsCol = Color( 255, 0, 0, 15) ;
m_OutsCol = Color( 224, 128, 0, 50) ;
m_ProcsCol = Color( 80, 160, 160, 100) ;
m_ProcsOffCol = Color( 160, 160, 160, 15) ;
m_ProcsOffCol = Color( 160, 160, 160, 30) ;
m_MarkCol = Color( 96, 192, 192, 100) ;
m_SolidCol = Color(255, 160, 32, 100) ;
m_nInfoId = GDB_ID_NULL ;
@@ -58,11 +63,24 @@ BtlGeom::BtlGeom( void)
m_nSolidsId = GDB_ID_NULL ;
m_vtDim = V_NULL ;
m_nCount = 0 ;
m_nProcId = GDB_ID_NULL ;
m_nBtlLine = 0 ;
}
//----------------------------------------------------------------------------
BtlGeom::~BtlGeom( void)
{
// chiudo lua ( se era aperto)
if ( m_LuaMgr.Exit()) {
string sLua = "Lua BtlGeom interpreter closed" ;
LOG_INFO( GetEExLogger(), sLua.data())
}
}
//----------------------------------------------------------------------------
bool
BtlGeom::Init( IGeomDB* pGDB, int nFlatVertPos, bool bSpecialTrim, bool bTrimWithOutline, bool bUseUAttr)
BtlGeom::Init( IGeomDB* pGDB, int nFlatVertPos, bool bSpecialTrim,
bool bTrimWithOutline, bool bUseUAttr, bool bPartOffset, bool bIsAdding)
{
// salvo puntatore a DB geometrico
m_pGDB = pGDB ;
@@ -73,17 +91,35 @@ BtlGeom::Init( IGeomDB* pGDB, int nFlatVertPos, bool bSpecialTrim, bool bTrimWit
m_bSpecialTrim = bSpecialTrim ;
m_bTrimWithOutline = bTrimWithOutline ;
m_bUseUAttr = bUseUAttr ;
// se non esiste, creo gruppo per informazioni varie
m_nInfoId = m_pGDB->GetFirstNameInGroup( GDB_ID_ROOT, INFO_GROUP_NAME) ;
if ( m_nInfoId == GDB_ID_NULL && ! CreateInfoGroup())
m_bPartOffset = bPartOffset ;
// gruppo per informazioni varie, se in aggiunta lo creo sempre
m_nInfoId = ( bIsAdding ? GDB_ID_NULL : m_pGDB->GetFirstNameInGroup( GDB_ID_ROOT, INFO_GROUP_NAME)) ;
if ( bIsAdding && ! CreateInfoGroup())
return false ;
// se non esiste, creo gruppo per assemblaggio
m_nAsseId = m_pGDB->GetFirstNameInGroup( GDB_ID_ROOT, ASSEMBLY_GROUP_NAME) ;
if ( m_nAsseId == GDB_ID_NULL && ! CreateAssemblyGroup())
// gruppo per assemblaggio, se in aggiunta lo creo sempre
m_nAsseId = ( bIsAdding ? GDB_ID_NULL : m_pGDB->GetFirstNameInGroup( GDB_ID_ROOT, ASSEMBLY_GROUP_NAME)) ;
if ( bIsAdding && ! CreateAssemblyGroup())
return false ;
// recupero eventuali riferimenti a gruppi per grezzi e compositi
m_nRawPartsId = m_pGDB->GetFirstNameInGroup( GDB_ID_ROOT, RAWPARTS_GROUP_NAME) ;
m_nCompositesId = m_pGDB->GetFirstNameInGroup( GDB_ID_ROOT, COMPOSITES_GROUP_NAME) ;
// inizializzo interprete lua
if ( ! m_LuaMgr.Init())
return false ;
// carico le funzioni speciali
if ( ! LuaInstallEgtFunctions( m_LuaMgr))
return false ;
// recupero la versione di Lua
string sLua ;
if ( m_LuaMgr.GetVersion( sLua))
sLua += " BtlGeom interpreter started" ;
else
sLua = "Lua *.* BtlGeom interpreter started" ;
LOG_INFO( GetEExLogger(), sLua.data())
// imposto il direttorio delle librerie
m_LuaMgr.SetLuaLibsDir( m_sBtlLuaLibsDir) ;
// carico la libreria standard
m_LuaMgr.Require( m_sBtlLuaLastRequire) ;
return true ;
}
@@ -272,7 +308,29 @@ BtlGeom::ErasePart( void)
//----------------------------------------------------------------------------
bool
BtlGeom::SetPartProdNbr( int nProdNbr)
BtlGeom::VerifyNewPartProdNbr( int nProdNbr)
{
// se non c'è il DB geometrico, errore
if ( m_pGDB == nullptr)
return false ;
// ciclo su tutti i pezzi
int nPartId = m_pGDB->GetFirstGroupInGroup( GDB_ID_ROOT) ;
while ( nPartId != GDB_ID_NULL) {
int nLev ;
if ( m_pGDB->GetCalcLevel( nPartId, nLev) && nLev == GDB_LV_USER) {
int nSN = -1 ;
// se SN richiesto già esiste, esco con errore
if ( m_pGDB->GetInfo( nPartId, IKEY_PROD_NBR, nSN) && nSN >= 0 && nProdNbr == nSN)
return false ;
}
nPartId = m_pGDB->GetNextGroup( nPartId) ;
}
return true ;
}
//----------------------------------------------------------------------------
bool
BtlGeom::SetPartProdNbr( int nProdNbr, int nPdnErr)
{
// se non c'è il DB geometrico o il pezzo corrente, errore
if ( m_pGDB == nullptr || m_nPartId == GDB_ID_NULL)
@@ -280,7 +338,16 @@ BtlGeom::SetPartProdNbr( int nProdNbr)
// assegno il numero di produzione del pezzo
if ( ! m_pGDB->SetInfo( m_nPartId, IKEY_PROD_NBR, nProdNbr))
return false ;
// se è correzione
if ( nPdnErr >= 0)
m_pGDB->SetInfo( m_nPartId, IKEY_PDN_ERR, nPdnErr) ;
// costruisco il nome del pezzo
string sName = ToString( nProdNbr) ;
if ( nPdnErr >= 0)
sName += "-X" ;
string sDes ;
if ( m_pGDB->GetInfo( m_nPartId, IKEY_NAME, sDes))
sName += "-" + sDes ;
// assegnazione del nome al pezzo
return m_pGDB->SetName( m_nPartId, sName) ;
}
@@ -292,12 +359,17 @@ BtlGeom::SetPartName( const string& sDes)
// se non c'è il DB geometrico o il pezzo corrente, errore
if ( m_pGDB == nullptr || m_nPartId == GDB_ID_NULL)
return false ;
// assegno il nome del pezzo
// assegno la descrizione
if ( ! m_pGDB->SetInfo( m_nPartId, IKEY_NAME, sDes))
return false ;
// costruisco il nome del pezzo
int nPdnErr = -1 ;
m_pGDB->GetInfo( m_nPartId, IKEY_PDN_ERR, nPdnErr) ;
int nProdNbr = 0 ;
m_pGDB->GetInfo( m_nPartId, IKEY_PROD_NBR, nProdNbr) ;
string sName = ToString( nProdNbr) ;
if ( nPdnErr >= 0)
sName += "-X" ;
if ( ! sDes.empty())
sName += "-" + sDes ;
// assegnazione del nome al pezzo
@@ -559,6 +631,67 @@ BtlGeom::AddObjectRef( const string& sUID, const Frame3d& frRef)
return true ;
}
//----------------------------------------------------------------------------
bool
BtlGeom::AddPartOffset( const DBLVECTOR& vdPar)
{
// se non c'è il DB geometrico o il pezzo corrente, errore
if ( m_pGDB == nullptr || m_nPartId == GDB_ID_NULL)
return false ;
// recupero le dimensioni del pezzo corrente
if ( m_vtDim.IsSmall())
return false ;
// se non abilitato, esco
if ( ! m_bPartOffset)
return true ;
// aggiusto i solidi di rappresentazione dell'offset
for ( int i = 1 ; i <= 4 ; ++ i) {
string sOffsName = BOX_OFFSX_NAME + ToString( i) ;
int nOffsId = m_pGDB->GetFirstNameInGroup( m_nBoxId, sOffsName) ;
// se valore offset significativo, modifico o aggiungo nuovo solido
if ( vdPar[i] > EPS_SMALL) {
double dDimX = m_vtDim.x ;
double dDimY = (( i == 1 || i == 3) ? vdPar[i] : m_vtDim.y) ;
double dDimZ = (( i == 1 || i == 3) ? m_vtDim.z : vdPar[i]) ;
// creo il solido (parallelepipedo)
PtrOwner<ISurfTriMesh> pStm( GetSurfTriMeshBox( dDimX, dDimY, dDimZ)) ;
if ( IsNull( pStm))
return false ;
// lo traslo opportunamente
Vector3d vtMove ;
if ( i == 1)
vtMove = Vector3d( 0, -vdPar[i], 0) ;
else if ( i == 2)
vtMove = Vector3d( 0, 0, -vdPar[i]) ;
else if ( i == 3)
vtMove = Vector3d( 0, m_vtDim.y, 0) ;
else
vtMove = Vector3d( 0, 0, m_vtDim.z) ;
pStm->Translate( vtMove) ;
// se gia presente, lo rimpiazzo
if ( nOffsId != GDB_ID_NULL) {
if ( ! m_pGDB->ReplaceGeoObj( nOffsId, Release( pStm)))
return false ;
}
// altrimenti, lo inserisco nel layer box del pezzo
else {
nOffsId = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nBoxId, Release( pStm)) ;
if ( nOffsId == GDB_ID_NULL)
return false ;
// assegno nome
m_pGDB->SetName( nOffsId, sOffsName) ;
}
// assegno il colore
m_pGDB->SetMaterial( nOffsId, m_OffsCol) ;
}
// elimino eventuale vecchio solido
else {
m_pGDB->Erase( nOffsId) ;
}
}
return true ;
}
//----------------------------------------------------------------------------
bool
BtlGeom::ResetPartSolid( void)
@@ -797,6 +930,45 @@ BtlGeom::SetAlpha( int nId, int nAlpha)
return m_pGDB->SetMaterial( nId, cCol) ;
}
//----------------------------------------------------------------------------
bool
BtlGeom::AdjustSnForParts( void)
{
// tabella Id-SN dei pezzi e massimo SN trovato
INTINTVECTOR vIdSN ;
int nMaxSN = 0 ;
// recupero il numero di serie di ogni singolo pezzo
int nPartId = m_pGDB->GetFirstGroupInGroup( GDB_ID_ROOT) ;
while ( nPartId != GDB_ID_NULL) {
int nLev ;
if ( m_pGDB->GetCalcLevel( nPartId, nLev) && nLev == GDB_LV_USER) {
int nSN = 0 ;
m_pGDB->GetInfo( nPartId, IKEY_PROD_NBR, nSN) ;
if ( nSN <= 0)
nSN = 0 ;
else if ( find_if( vIdSN.begin(), vIdSN.end(),
[&]( const INTINT& Data) { return Data.second == nSN ; }) != vIdSN.end())
nSN = -abs( nSN) ;
vIdSN.emplace_back( nPartId, nSN) ;
nMaxSN = max( nMaxSN, nSN) ;
}
nPartId = m_pGDB->GetNextGroup( nPartId) ;
}
// aggiusto tutti gli SN nulli o negativi (derivano da mancanti o ripetuti)
for ( auto& Data : vIdSN) {
if ( Data.second <= 0) {
SetPart( Data.first) ;
SetPartProdNbr( ++ nMaxSN, -Data.second) ;
AddPartBox( GetCurrPartLength(), GetCurrPartHeight(), GetCurrPartWidth()) ;
Data.second = nMaxSN ;
}
}
return true ;
}
//----------------------------------------------------------------------------
bool
BtlGeom::SortObjects( int nGroupId, Point3d& ptIns)
+28 -12
View File
@@ -18,15 +18,16 @@
#include "/EgtDev/Include/EGkCurveComposite.h"
#include "/EgtDev/Include/EGkPolygon3d.h"
#include "/EgtDev/Include/EGkSurfTriMesh.h"
#include "/EgtDev/Include/EGnLuaMgr.h"
//----------------------------------------------------------------------------
class BtlGeom
{
public :
BtlGeom( void) ;
public :
bool Init( IGeomDB* pGDB, int nFlatPos, bool bSpecialTrim, bool bTrimWithOutline, bool bUseUAttr) ;
~BtlGeom( void) ;
bool Init( IGeomDB* pGDB, int nFlatPos, bool bSpecialTrim,
bool bTrimWithOutline, bool bUseUAttr, bool bPartOffset, bool bIsAdding) ;
bool CreatePart( void) ;
bool SetPart( int nPartId) ;
bool ErasePart( void) ;
@@ -36,23 +37,26 @@ class BtlGeom
{ return m_nOutsId ; }
int GetCurrProcsLayId( void)
{ return m_nProcsId ; }
bool SetPartProdNbr( int nProdNbr) ;
bool VerifyNewPartProdNbr( int nProdNbr) ;
bool SetPartProdNbr( int nProdNbr, int nPdnErr = -1) ;
bool SetPartName( const std::string& sDes) ;
bool SetPartCount( int nCount) ;
bool AddPartBox( double dLength, double dHeight, double dWidth) ;
double GetCurrPartLength( void)
{ return ( m_nPartId != GDB_ID_NULL ? m_vtDim.x : 0) ;}
double GetCurrPartHeight( void)
{ return ( m_nPartId != GDB_ID_NULL ? m_vtDim.z : 0) ;}
double GetCurrPartWidth( void)
{ return ( m_nPartId != GDB_ID_NULL ? m_vtDim.y : 0) ;}
double GetCurrPartWidth( void)
{ return ( m_nPartId != GDB_ID_NULL ? m_vtDim.z : 0) ;}
bool AddPartTransformation( const std::string& sUID, const Frame3d& frRef) ;
bool AddObjectRef( const std::string& sUID, const Frame3d& frRef) ;
bool AddPartOffset( const DBLVECTOR& vdPar) ;
bool AdjustPartFlatOrVertPos( void) ;
bool ResetPartSolid( void) ;
std::string GetPartName( void) ;
bool SetUserAttribute( int nUAttrDest, const std::string& sString) ;
bool SetUserAttribute( int nUAttrDest, const std::string& sKey, const std::string& sVal) ;
bool AdjustSnForParts( void) ;
bool SortObjects( int nGroupId, Point3d& ptIns) ;
bool UpdateNextOrigin( void) ;
int GetRawPartsGroup( bool bCreate = false) ;
@@ -127,6 +131,7 @@ class BtlGeom
ICurve* GetFaceContour( int nSide) ;
bool IsPointOnFaceContour( const Point3d& ptP, int nSide) ;
bool IsPointNearFaceContour( const Point3d& ptP, int nSide) ;
bool IsPointOutFaceContour( const Point3d& ptP, int nSide) ;
bool SetPointOnFaceContour( Point3d& ptP, int nSide) ;
bool TrimRayWithFaceContour( const Point3d& ptP, const Vector3d& vtDir, int nSide, Point3d& ptInt) ;
@@ -141,7 +146,7 @@ class BtlGeom
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt) ;
bool AddSawCut( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId,
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt) ;
bool AddSlot( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId,
bool AddSlot( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId, const Frame3d& frRef,
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt) ;
bool AddFrontSlot( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId,
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt) ;
@@ -173,7 +178,7 @@ class BtlGeom
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt) ;
bool AddTenon( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId,
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt) ;
bool AddMortise( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId,
bool AddMortise( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId, const Frame3d& frRef,
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt) ;
bool AddMortiseFront( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId,
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt) ;
@@ -207,6 +212,8 @@ class BtlGeom
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt) ;
bool AddRoundArch( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId,
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt) ;
bool AddSphere( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId,
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt) ;
bool AddTriangleCut( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId,
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt) ;
bool AddTyroleanDovetail( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId,
@@ -217,14 +224,18 @@ class BtlGeom
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt) ;
bool AddVariant( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId,
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt) ;
bool AddVariantLua( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId,
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt, const std::string& sLuaPath) ;
bool AddVariantNge( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId,
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt, const std::string& sNgePath) ;
ICurveComposite* GetFreeContourCurve( int nProcId, const Frame3d& frRef, bool bOnlyStartOk = false) ;
ISurfTriMesh* CreateOneCurveFreeContour( const ICurveComposite* pCrvCompo) ;
bool AdjustFreeContourCurve( ICurve* pCrv, int nSide, bool& bClosed, bool& bEndsOnCont) ;
bool AdjustFreeContourCurve( ICurve* pCrv, int nSide, bool& bClosed, bool& bEndsOnOrOutCont) ;
bool VerifyFreeContourCurveSideAng( const ICurveComposite* pCrvCompo) ;
bool GetFreeContourCurveSideAngles( const ICurveComposite* pCrvCompo, DBLVECTOR& vSideAng) ;
bool CreatePolygonInBox( const Point3d& ptP, const Vector3d& vtN, int nSide, Polygon3d& Polyg,
double dMatMin = FACE_MIN_BACK_MAT, double dAreaMin = FACE_MIN_BACK_AREA) ;
double GetPlaneElevation( const Plane3d& plPlane) ;
double GetDistanceBeamPlane( const Plane3d& plPlane) ;
bool TrimPolygons( Polygon3d& plyP1, Polygon3d& plyP2, bool bInVsOut, bool bOnEq) ;
bool VerifyPolygonSize( Polygon3d& plyP, double dMinDim = FACE_MIN_CROSS_DIM) ;
bool VerifyPolygonBackMat( Polygon3d& plyP, double dMatMin = FACE_MIN_BACK_MAT, double dAreaMin = FACE_MIN_BACK_AREA) ;
@@ -253,17 +264,20 @@ class BtlGeom
bool GetUserParam( const STRVECTOR& vsUAtt, const std::string& sKey, double& dVal) ;
bool GetWaveLengths( int nWaves, double dLen, DBLVECTOR& vLen) ;
bool GetWaveReductions( int nWaves, double dWidth, DBLVECTOR& vRed) ;
bool InsertEmptySurface( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId,
bool InsertEmptySurface( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId, const Frame3d& frRef,
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt) ;
bool AdjustPointForPlaneNearBoxVertex( Point3d& ptP, const Vector3d& vtN, int nSide) ;
private :
IGeomDB* m_pGDB ;
LuaMgr m_LuaMgr ; // interprete per Variant parametrici
int m_nFlatVertPos ; // flag per posizionamento pezzi (0=come sono, 1=di piatto, 2=in verticale, 3=ruotato 90deg, 4=da outline o piatto)
bool m_bSpecialTrim ; // flag per trim speciale regioni per pareti (solo con feature passanti)
bool m_bTrimWithOutline ; // flag per trim delle feature con l'outline (se presente)
bool m_bUseUAttr ; // flag per utilizzo attributi utente per modificare geometria features
bool m_bPartOffset ; // flag per gestione geometrica di PARTOFFSET
Color m_BoxCol ; // colore per box pezzi
Color m_OffsCol ; // colore per offset pezzi
Color m_OutsCol ; // colore per outline pezzi
Color m_ProcsCol ; // colore per lavorazioni pezzi
Color m_ProcsOffCol ; // colore per lavorazioni pezzi disabilitate
@@ -288,5 +302,7 @@ class BtlGeom
FCEDEQUE m_FcData ; // dati per contorni liberi in definizione
public :
static std::string m_sBtlAuxDir ; // direttorio in cui cercare i dati per le feature Variant
static std::string m_sBtlAuxDir ; // direttorio in cui cercare i dati per le feature Variant
static std::string m_sBtlLuaLibsDir ; // direttorio librerie lua per Variant
static std::string m_sBtlLuaLastRequire ; // ultimo require lua per Variant
} ;
+67 -1
View File
@@ -17,6 +17,56 @@
#include "/EgtDev/Include/EgtStringBase.h"
#include <deque>
//----------------------------------------------------------------------------
// Riconoscimento feature
#define IS_CUT( nG, nP) ( ( nG == 1 || nG == 2) && nP == 10)
#define IS_LONGIT_CUT( nG, nP) ( ( nG == 0 || nG == 3 || nG == 4) && nP == 10)
#define IS_DOUBLE_CUT( nG, nP) ( ( nG == 1 || nG == 2) && nP == 11)
#define IS_RIDGEVALLEY_CUT( nG, nP) ( ( nG == 0) && nP == 12)
#define IS_SAW_CUT( nG, nP) ( ( nG == 0 || nG == 3 || nG == 4) && nP == 13)
#define IS_SLOT( nG, nP) ( ( nG == 3 || nG == 4) && nP == 16)
#define IS_FRONT_SLOT( nG, nP) ( ( nG == 3 || nG == 4) && nP == 17)
#define IS_BIRDS_MOUTH( nG, nP) ( ( nG == 3 || nG == 4) && nP == 20)
#define IS_RAFTER_NOTCH( nG, nP) ( ( nG == 3 || nG == 4) && nP == 25)
#define IS_RIDGE_LAP( nG, nP) ( ( nG == 1 || nG == 2) && nP == 30)
#define IS_LAP_JOINT( nG, nP) ( ( nG == 3 || nG == 4) && nP == 30)
#define IS_NOTCH( nG, nP) ( ( nG == 3 || nG == 4) && nP == 32)
#define IS_LOGHOUSE_HL2( nG, nP) ( ( nG == 3 || nG == 4) && nP == 33)
#define IS_SEATHING_CUT( nG, nP) ( ( nG == 3 || nG == 4) && nP == 34)
#define IS_FRENCH_RIDGELAP( nG, nP) ( ( nG == 1 || nG == 2) && nP == 35)
#define IS_CHAMFER( nG, nP) ( ( nG == 3 || nG == 4) && nP == 36)
#define IS_LOGHOUSE_HL4( nG, nP) ( ( nG == 4) && nP == 37)
#define IS_LOGHOUSE_FRONT( nG, nP) ( ( nG == 3 || nG == 4) && nP == 38)
#define IS_POCKET( nG, nP) ( ( nG == 4) && nP == 39)
#define IS_DRILL( nG, nP) ( ( nG == 3 || nG == 4) && nP == 40)
#define IS_TENON( nG, nP) ( ( nG == 1 || nG == 2) && nP == 50)
#define IS_MORTISE( nG, nP) ( ( nG == 3 || nG == 4) && nP == 50)
#define IS_MORTISE_FRONT( nG, nP) ( ( nG == 3 || nG == 4) && nP == 51)
#define IS_HOUSE( nG, nP) ( ( nG == 1 || nG == 2 || nG == 3 || nG == 4) && nP == 52)
#define IS_HOUSE_MORTISE( nG, nP) ( ( nG == 3 || nG == 4) && nP == 53)
#define IS_DOVETAIL_TENON( nG, nP) ( ( nG == 1 || nG == 2) && nP == 55)
#define IS_DOVETAIL_MORTISE( nG, nP) ( ( nG == 3 || nG == 4) && nP == 55)
#define IS_DTMORTISE_FRONT( nG, nP) ( ( nG == 3 || nG == 4) && nP == 56)
#define IS_MARKING( nG, nP) ( ( nG == 3 || nG == 4) && nP == 60)
#define IS_TEXT( nG, nP) ( ( nG == 4) && nP == 61)
#define IS_SIMPLESCARF( nG, nP) ( ( nG == 1 || nG == 2) && nP == 70)
#define IS_SCARFJOINT( nG, nP) ( ( nG == 1 || nG == 2) && nP == 71)
#define IS_STEPJOINT( nG, nP) ( ( nG == 1 || nG == 2) && nP == 80)
#define IS_STEPJOINTNOTCH( nG, nP) ( ( nG == 3 || nG == 4) && nP == 80)
#define IS_PLANING( nG, nP) ( ( nG == 3 || nG == 4) && nP == 90)
#define IS_PROF_FRONT( nG, nP) ( ( nG == 3 || nG == 4) && nP == 100)
#define IS_PROF_HEADCONCAVE( nG, nP) ( ( nG == 3 || nG == 4) && nP == 101)
#define IS_PROF_HEADCONVEX( nG, nP) ( ( nG == 3 || nG == 4) && nP == 102)
#define IS_PROF_HEADCAMBERED( nG, nP) ( ( nG == 3 || nG == 4) && nP == 103)
#define IS_PROF_HEAD( nG, nP) ( ( nG == 3 || nG == 4) && nP == 106)
#define IS_ROUND_ARCH( nG, nP) ( ( nG == 4) && nP == 104)
#define IS_SPHERE( nG, nP) ( ( nG == 3 || nG == 4) && nP == 107)
#define IS_TRIANGLE_CUT( nG, nP) ( ( nG == 4) && nP == 120)
#define IS_TYROLEAN_DOVETAIL( nG, nP) ( ( nG == 1 || nG == 2 || nG == 3 || nG == 4) && nP == 136)
#define IS_DOVETAIL( nG, nP) ( ( nG == 1 || nG == 2 || nG == 3 || nG == 4) && nP == 138)
#define IS_FREE_CONTOUR( nG, nP) ( ( nG == 0 || nG == 3 || nG == 4) && (nP == 250 || nP == 251 || nP == 252))
#define IS_VARIANT( nG, nP) ( ( nG == 0 || nG == 1 || nG == 2 || nG == 3 || nG == 4) && nP == 900)
//----------------------------------------------------------------------------
// nome gruppo di sistema per informazioni varie
static const std::string INFO_GROUP_NAME = "BtlInfo" ;
@@ -26,25 +76,31 @@ static const std::string ASSEMBLY_GROUP_NAME = "AsseBase" ;
static const std::string RAWPARTS_GROUP_NAME = "RawParts" ;
// nome gruppo di sistema per compositi
static const std::string COMPOSITES_GROUP_NAME = "Composites" ;
// nome gruppo temporaneo per direzione di carico
static const std::string LOADINGSIDE_GROUP_NAME = "LoadingSide" ;
// nomi layer standard dei pezzi
static const std::string AUX_LAYER_NAME = "Part" ;
static const std::string BOX_LAYER_NAME = "Box" ;
static const std::string OUTLINE_LAYER_NAME = "Outline" ;
static const std::string PROCESSINGS_LAYER_NAME = "Processings" ;
static const std::string SOLID_LAYER_NAME = "Solid" ;
static const std::string FCSNAME_LAYER_NAME = "FcsName" ;
// nomi entità standard dei pezzi
static const std::string AUX_PART_NAME = "Name" ;
static const std::string BOX_BOX_NAME = "Box" ;
static const std::string BOX_OFFSX_NAME = "Offs" ;
static const std::string OL_OUTSTM_NAME = "Out" ;
static const std::string OL_APERTURESTM_NAME = "Ape" ;
static const std::string OL_TOPREGION_NAME = "Top" ;
static const std::string OL_BOTTOMREGION_NAME = "Bot" ;
static const std::string OL_SUFFIX_REGION_NAME = "Region" ;
static const std::string OL_SHAPE_NAME = "Shape" ;
static const std::string SOLID_SOLID_NAME = "Solid" ;
// chiavi di informazioni associate alle info varie
static const std::string IKEY_BTL_PATH = "BTL" ;
// chiavi di informazioni associate ai pezzi
static const std::string IKEY_PROD_NBR = "PDN" ;
static const std::string IKEY_PDN_ERR = "PDN_ERR" ;
static const std::string IKEY_NAME = "NAM" ;
static const std::string IKEY_COUNT = "CNT" ;
static const std::string IKEY_LENGTH = "L" ;
@@ -80,10 +136,13 @@ static const std::string IKEY_TRIM = "TRIM" ;
static const std::string IKEY_COL_A = "COL_A" ;
// chiavi di informazioni associate al solido
static const std::string IKEY_VALID = "VALID" ;
// chiavi di informazioni associate al lato di carico
static const std::string IKEY_LSIDE = "LSIDE" ;
// distanza tra pezzi nella disposizione standard lungo Y
const double PART_OFFSET = 300 ;
// costanti di approssimazione per curve
const double CRV_LIN_APPROX = 0.05 ;
const double CRV_LIN_FINE_APPROX = 0.01 ;
const double CRV_ANG_APPROX_DEG = 22.5 ;
// costante di compattazione di superfici
const double STM_COMPACT_APPROX = 0.01 ;
@@ -94,6 +153,8 @@ const double FACE_MIN_BACK_MAT = 2.0 ;
const double FACE_MIN_BACK_AREA = 400.0 ;
// minimo materiale dietro la faccia, limite assoluto
const double FACE_ZERO_BACK_MAT = 0.5 ;
// minima area di componente staccata
const double FACE_DETACHED_MIN_AREA = 400.0 ;
// minimo spostamento per vari tipi di Mortise
const double MORTISE_DISPL_MIN = 0.5 ;
// raggio fresa di default
@@ -102,11 +163,12 @@ const double MILL_DEF_RAD = 12.5 ;
const double DTMILL_DEF_RAD = 30.0 ;
// angolo coda di rondine di default
const double DOVETAIL_DEF_ANG = 15.0 ;
// lunghezza extra per tenoni coda di rondine passanti
const double DTTEN_EXTRA_LEN = 5.0 ;
// lunghezza extra per mortase coda di rondine passanti
const double DTMORT_EXTRA_LEN = 10.0 ;
// minima e massima dimensione tasca per mortasa a coda di rondine
const double MIN_DTMORT_POCKET = 70.0 ;
const double MAX_DTMORT_POCKET = 200.0 ;
const double MIN_DTMORT_AREA = 100.0 ;
// tolleranza fuoriuscita curve di tasche di code di rondine
const double DTMORT_OUT_CRV_TOL = 30.0 ;
@@ -115,6 +177,10 @@ const double FC_SIDEANG_DEF = 0.0 ;
const double FC_SIDEANG_NONE = 999.0 ;
// tolleranza fuoriuscita curve di contorni liberi
const double FC_OUT_CRV_TOL = 50.0 ;
// dimensione massima di contorno libero
const double FC_MAX_DIM = 200000.0 ;
// distanza limite tra diagonali per quadrilatero con twist di freecontour
const double FC_TWIST_DIAG_DIST = 2.0 ;
//----------------------------------------------------------------------------
// Numero processo speciale Riferimento ad altro oggetto
+77 -42
View File
@@ -19,9 +19,11 @@
#include "/EgtDev/Include/EGkCurveArc.h"
#include "/EgtDev/Include/EGkCurveComposite.h"
#include "/EgtDev/Include/EgkChainCurves.h"
#include "/EgtDev/Include/EGkOffsetCurve.h"
#include "/EgtDev/Include/EGkSfrCreate.h"
#include "/EgtDev/Include/EGkStmStandard.h"
#include "/EgtDev/Include/EGkStmFromCurves.h"
#include "/EgtDev/Include/EGkStmFromTriangleSoup.h"
#include "/EgtDev/Include/EGkExtText.h"
#include "/EgtDev/Include/EGnStringUtils.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
@@ -494,6 +496,18 @@ BtlGeom::UpdateOutLine( void)
// taglio con tutte le features
TrimOutlineWithProcesses() ;
// se presente Shape e abilitato, nascondo Outline
int nDO ;
int nShapeId = m_pGDB->GetFirstNameInGroup( m_nOutsId, OL_SHAPE_NAME) ;
if ( nShapeId != GDB_ID_NULL && m_pGDB->GetInfo( nShapeId, IKEY_DO, nDO) && nDO != 0) {
int nEntId = m_pGDB->GetFirstInGroup( m_nOutsId) ;
while ( nEntId != GDB_ID_NULL) {
if ( nEntId != nShapeId)
m_pGDB->SetStatus( nEntId, GDB_ST_OFF) ;
nEntId = m_pGDB->GetNext( nEntId) ;
}
}
return true ;
}
@@ -560,12 +574,12 @@ BtlGeom::AddPartCustomOutline( void)
bOk = ( bOk && ! IsNull( pLoop2) && ! IsNull( pMySfr2) && pLoop2->FromPolyLine( vPL[1]) && pMySfr2->AddExtLoop( Release( pLoop2))) ;
bOk = bOk && pMySfr2->Invert() ;
if ( AreSameVectorApprox( pMySfr1->GetNormVersor(), frRef.VersZ())) {
pSfr1.Set( Release( pMySfr1)) ;
pSfr2.Set( Release( pMySfr2)) ;
pSfr1.Set( pMySfr1) ;
pSfr2.Set( pMySfr2) ;
}
else {
pSfr1.Set( Release( pMySfr2)) ;
pSfr2.Set( Release( pMySfr1)) ;
pSfr1.Set( pMySfr2) ;
pSfr2.Set( pMySfr1) ;
}
}
// se non riesce, li calcolo in modo approssimato
@@ -749,13 +763,18 @@ BtlGeom::UseProcessToTrimOutline( int nProcId)
bool
BtlGeom::TrimOutline( int nProcSurfId)
{
// Recupero tipo di trim
int nTrim = 0 ;
m_pGDB->GetInfo( nProcSurfId, IKEY_TRIM, nTrim) ;
// Recupero eventuale superficie originale
int nOrigId = 0 ;
if ( m_pGDB->GetInfo( nProcSurfId, IKEY_ORIGID, nOrigId))
nProcSurfId += nOrigId ;
// Se processo con più superfici da usare insieme per trim, devo unirle
int nTrim ;
if ( m_pGDB->GetInfo( nProcSurfId, IKEY_TRIM, nTrim) && nTrim == 2) {
// Recupero le due superfici del processo di lavorazione (eventualmente le originali)
int nOrigId = 0 ;
if ( m_pGDB->GetInfo( nProcSurfId, IKEY_ORIGID, nOrigId))
nProcSurfId += nOrigId ;
if ( nTrim == 2) {
// Recupero le due superfici del processo di lavorazione
int nAux ;
if ( m_pGDB->GetInfo( nProcSurfId, IKEY_AUXID, nAux) && nAux != 0) {
const ISurfTriMesh* pStm = GetSurfTriMesh( m_pGDB->GetGeoObj( nProcSurfId)) ;
@@ -769,10 +788,8 @@ BtlGeom::TrimOutline( int nProcSurfId)
}
return false ;
}
// Recupero la superficie del processo di lavorazione (eventualmente l'originale)
int nOrigId = 0 ;
if ( m_pGDB->GetInfo( nProcSurfId, IKEY_ORIGID, nOrigId))
nProcSurfId += nOrigId ;
// Trim con una sola superficie
const ISurfTriMesh* pStm = GetSurfTriMesh( m_pGDB->GetGeoObj( nProcSurfId)) ;
if ( pStm == nullptr)
return false ;
@@ -1057,8 +1074,8 @@ BtlGeom::AdjustOneOutlineFace( int nSide, ICURVEPOVECTOR& vCrvP)
// concateno le linee senza invertirle
const double TOLER = 10 * EPS_SMALL ;
ChainCurves chainC ;
chainC.Init( false, TOLER, int( vCrvP.size())) ;
for ( size_t i = 0 ; i < vCrvP.size() ; ++ i) {
chainC.Init( false, TOLER, ssize( vCrvP)) ;
for ( int i = 0 ; i < ssize( vCrvP) ; ++ i) {
Point3d ptStart, ptEnd ;
Vector3d vtStart, vtEnd ;
if ( ! vCrvP[i]->GetStartPoint( ptStart) || ! vCrvP[i]->GetStartDir( vtStart) ||
@@ -1075,7 +1092,7 @@ BtlGeom::AdjustOneOutlineFace( int nSide, ICURVEPOVECTOR& vCrvP)
if ( IsNull( pCrvCompo))
return false ;
// recupero le curve semplici e le inserisco nella curva composita
for ( size_t i = 0 ; i < vId2s.size() ; ++ i) {
for ( int i = 0 ; i < ssize( vId2s) ; ++ i) {
// indice della curva
int j = vId2s[i] - 1 ;
// la aggiungo alla curva composta
@@ -1130,7 +1147,7 @@ BtlGeom::AdjustOneOutlineFace( int nSide, ICURVEPOVECTOR& vCrvP)
}
// se la regione sottrazione totale non esiste, la assegno
if ( IsNull( pSubReg))
pSubReg.Set( Release( pSfrReg)) ;
pSubReg.Set( pSfrReg) ;
// altrimenti la combino con la nuova
else {
// salvo una copia della regione sottrazione totale
@@ -1141,7 +1158,7 @@ BtlGeom::AdjustOneOutlineFace( int nSide, ICURVEPOVECTOR& vCrvP)
pSubReg->Intersect( *pSfrReg) ;
// se non rimane alcunché, provo a unirle
if ( ! pSubReg->IsValid()) {
pSubReg.Set( Release( pSubCopy)) ;
pSubReg.Set( pSubCopy) ;
pSubReg->Add( *pSfrReg) ;
}
}
@@ -1210,7 +1227,7 @@ bool
BtlGeom::IsPointNearFaceContour( const Point3d& ptP, int nSide)
{
// Il punto è nel riferimento faccia
// Verifico se sta vicino al contorno o fuori
// Verifico se sta vicino al contorno o fuori entro il limite
const double EPS_IN_NEAR = 0.2 ;
const double EPS_OUT_NEAR = 5.0 ;
double dL = GetSideLength( nSide) ;
@@ -1221,6 +1238,16 @@ BtlGeom::IsPointNearFaceContour( const Point3d& ptP, int nSide)
( ptP.y > dW - EPS_IN_NEAR && ptP.y < dW + EPS_OUT_NEAR)) ;
}
//----------------------------------------------------------------------------
bool
BtlGeom::IsPointOutFaceContour( const Point3d& ptP, int nSide)
{
// Il punto è nel riferimento faccia
// Verifico se sta all'esterno del contorno
return ( ptP.x < -EPS_SMALL || ptP.x > GetSideLength( nSide) - EPS_SMALL ||
ptP.y < -EPS_SMALL || ptP.y > GetSideWidth( nSide) - EPS_SMALL) ;
}
//----------------------------------------------------------------------------
bool
BtlGeom::SetPointOnFaceContour( Point3d& ptP, int nSide)
@@ -1344,17 +1371,27 @@ BtlGeom::TrimProcessWithOutline( int nProcId)
m_pGDB->SetInfo( nCopyId, IKEY_AUXID, sAuxId) ;
m_pGDB->SetMode( nCopy2Id, GDB_MD_HIDDEN) ;
}
// eseguo piccolo offset della curva per evitare problemi di sovrapposizioni
OffsetCurve OffsCrv ;
if ( ! OffsCrv.Make( pCrv, -50 * EPS_SMALL, ICurve::OFF_EXTEND) || OffsCrv.GetCurveCount() == 0) {
return false ;
}
PtrOwner<ICurve> pCopyCrv( OffsCrv.GetLongerCurve()) ;
// eseguo il trim
return ( pStm->GeneralizedCut( *pCrv, false) &&
( pStm2 == nullptr || pStm2->GeneralizedCut( *pCrv, false))) ;
return ( pStm->GeneralizedCut( *pCopyCrv, false) &&
( pStm2 == nullptr || pStm2->GeneralizedCut( *pCopyCrv, false))) ;
}
//----------------------------------------------------------------------------
bool
BtlGeom::AddShapeBTLX( const INTMATRIX& vFacesVertices, const PNTVECTOR& vPoints)
{
PtrOwner<ISurfTriMesh> pShape( CreateSurfTriMesh()) ;
StmFromTriangleSoup StmFts ;
if ( ! StmFts.Start()) {
LOG_ERROR( GetEExLogger(), " Error reading Part Shape: StmFts.Start error")
return false ;
}
for ( auto it = vFacesVertices.begin() ; it != vFacesVertices.end() ; it++) {
INTVECTOR vVertices = *it ;
if ( vVertices.size() < 3) {
@@ -1364,30 +1401,28 @@ BtlGeom::AddShapeBTLX( const INTMATRIX& vFacesVertices, const PNTVECTOR& vPoints
// creo il contorno della faccia
PtrOwner<ICurveComposite> pCurveCompo( CreateCurveComposite()) ;
pCurveCompo->AddPoint( vPoints[vVertices[0]]) ;
for ( size_t i = 1 ; i != vVertices.size() ; i++)
pCurveCompo->AddLine( vPoints[vVertices[i]]) ;
for ( int i = 1 ; i < ssize( vVertices) ; i++)
pCurveCompo->AddLine( vPoints[vVertices[i]]) ;
pCurveCompo->AddLine( vPoints[vVertices[0]]) ;
if ( it == vFacesVertices.begin() || ! pShape->IsValid())
pShape.Set( GetSurfTriMeshByFlatContour( pCurveCompo)) ;
else {
PtrOwner<ISurfTriMesh> pSurf( GetSurfTriMeshByFlatContour( pCurveCompo)) ;
// controllo che pCurveCompo racchiuda veramente una superficie
if ( ! IsNull( pSurf)) {
if ( ! pShape->DoSewing( * pSurf)) {
LOG_ERROR( GetEExLogger(), " Error reading Part Shape: stm.DoSewing error")
return false ;
}
}
}
// creo la faccia e recupero i suoi triangoli
PtrOwner<ISurfTriMesh> pSurf( GetSurfTriMeshByFlatContour( pCurveCompo)) ;
if ( ! IsNull( pSurf))
StmFts.AddSurfTriMesh( *pSurf) ;
}
int nId = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nPartId + 3, Release( pShape)) ; // salvo in outline
if ( ! StmFts.End()) {
LOG_ERROR( GetEExLogger(), " Error reading Part Shape: StmFts.End error")
return false ;
}
PtrOwner<ISurfTriMesh> pShape( StmFts.GetSurf()) ;
int nId = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nOutsId, Release( pShape)) ;
if ( nId == GDB_ID_NULL)
return false ;
m_pGDB->SetName( nId, "Shape") ;
m_pGDB->SetName( nId, OL_SHAPE_NAME) ;
m_pGDB->SetMaterial( nId, m_OutsCol) ;
m_pGDB->SetStatus( nId, 0) ;
m_pGDB->SetStatus( nId, GDB_ST_OFF) ;
m_pGDB->SetInfo( nId, IKEY_DO, 0) ;
return true ;
}
+1010 -361
View File
File diff suppressed because it is too large Load Diff
+3 -2
View File
@@ -1,7 +1,7 @@
//----------------------------------------------------------------------------
// EgalTech 2014-2014
// EgalTech 2014-2023
//----------------------------------------------------------------------------
// File : DllMain.h Data : 04.04.14 Versione : 1.5d1
// File : DllMain.h Data : 30.05.23 Versione : 2.5e5
// Contenuto : Prototipi funzioni per uso locale della DLL.
//
//
@@ -20,3 +20,4 @@
ILogger* GetEExLogger( void) ;
const std::string& GetEExKey( void) ;
bool GetEExNetHwKey( void) ;
bool VerifyKey( int nKeyOpt) ;
+30
View File
@@ -16,6 +16,7 @@
#include "DllMain.h"
#include "/EgtDev/Include/EExDllMain.h"
#include "/EgtDev/Include/EGnGetModuleVer.h"
#include "/EgtDev/Include/EGnGetKeyData.h"
#include "/EgtDev/Include/EgtTrace.h"
//--------------------------- Costanti ----------------------------------------
@@ -118,3 +119,32 @@ GetEExNetHwKey( void)
{
return s_bNetHwKey ;
}
//-----------------------------------------------------------------------------
bool
VerifyKey( int nKeyOpt)
{
// Controllo della licenza
unsigned int nOpt1, nOpt2 ;
int nOptExpDays ;
int nRet = GetEGnKeyOptions( KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV,
nOpt1, nOpt2, nOptExpDays) ;
if ( ! GetEExNetHwKey())
nRet = GetKeyOptions( GetEExKey(), KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV,
nOpt1, nOpt2, nOptExpDays) ;
if ( nRet != KEY_OK && ! EqualNoCase( GetEExKey(), "EExBase")) {
if ( nRet != KEY_OK) {
std::string sErr = "Error on Key (EXC/" + ToString( nRet) + ")" ;
LOG_ERROR( GetEExLogger(), sErr.c_str()) ;
return false ;
}
if ( ( nOpt1 & ( KEYOPT_EEX_INPBASE|KEYOPT_EEX_EXPBASE)) == 0 ||
( nKeyOpt != 0 && ( nOpt1 & nKeyOpt) == 0) ||
nOptExpDays < GetCurrDay()) {
std::string sErr = "Warning on Key (EXC/OPT)" ;
LOG_ERROR( GetEExLogger(), sErr.c_str()) ;
return false ;
}
}
return true ;
}
BIN
View File
Binary file not shown.
+2 -2
View File
@@ -1,7 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.645
# Visual Studio Version 17
VisualStudioVersion = 17.12.35521.163
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EgtExchange", "EgtExchange.vcxproj", "{80FCBEA4-1883-4542-939D-8582E66D8D51}"
EndProject
+105 -17
View File
@@ -22,14 +22,14 @@
<ProjectGuid>{80FCBEA4-1883-4542-939D-8582E66D8D51}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>EgtExchange</RootNamespace>
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v141_xp</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
@@ -42,7 +42,7 @@
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v141_xp</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
@@ -101,10 +101,10 @@
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;I_AM_EEX;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<OpenMPSupport>true</OpenMPSupport>
<OpenMPSupport>false</OpenMPSupport>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<AdditionalIncludeDirectories>
</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp20</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -127,10 +127,10 @@ copy $(TargetPath) \EgtProg\DllD32</Command>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;I_AM_EEX;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<OpenMPSupport>true</OpenMPSupport>
<AdditionalIncludeDirectories>
</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp17</LanguageStandard>
<AdditionalOptions>-Wno-tautological-undefined-compare</AdditionalOptions>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp20</LanguageStandard>
<AdditionalOptions>
</AdditionalOptions>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -162,8 +162,8 @@ copy $(TargetPath) \EgtProg\DllD64</Command>
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
<WholeProgramOptimization>false</WholeProgramOptimization>
<AdditionalIncludeDirectories>
</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp20</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -191,14 +191,13 @@ copy $(TargetPath) \EgtProg\Dll32</Command>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OpenMPSupport>false</OpenMPSupport>
<EnableEnhancedInstructionSet>AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
<EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
<OmitFramePointers>true</OmitFramePointers>
<EnableFiberSafeOptimizations>false</EnableFiberSafeOptimizations>
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
<WholeProgramOptimization>false</WholeProgramOptimization>
<AdditionalIncludeDirectories>
</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp17</LanguageStandard>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp20</LanguageStandard>
<AdditionalOptions>-Wno-tautological-undefined-compare</AdditionalOptions>
</ClCompile>
<Link>
@@ -217,19 +216,102 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
</ResourceCompile>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="..\Include\EExBeamConst.h" />
<ClInclude Include="..\Include\EExBeamMgr.h" />
<ClInclude Include="..\Include\EExDllMain.h" />
<ClInclude Include="..\Include\EExExcExecutor.h" />
<ClInclude Include="..\Include\EExExport3MF.h" />
<ClInclude Include="..\Include\EExExportConst.h" />
<ClInclude Include="..\Include\EExExportDxf.h" />
<ClInclude Include="..\Include\EExExportStl.h" />
<ClInclude Include="..\Include\EExExportSvg.h" />
<ClInclude Include="..\Include\EExExportThreeJS.h" />
<ClInclude Include="..\Include\EExImport3MF.h" />
<ClInclude Include="..\Include\EExImportBtl.h" />
<ClInclude Include="..\Include\EExImportBtlx.h" />
<ClInclude Include="..\Include\EExImportCnc.h" />
<ClInclude Include="..\Include\EExImportCsf.h" />
<ClInclude Include="..\Include\EExImportDxf.h" />
<ClInclude Include="..\Include\EExImportOff.h" />
<ClInclude Include="..\Include\EExImportPnt.h" />
<ClInclude Include="..\Include\EExImportStl.h" />
<ClInclude Include="..\Include\EGkAngle.h" />
<ClInclude Include="..\Include\EGkArcSpecial.h" />
<ClInclude Include="..\Include\EGkBBox3d.h" />
<ClInclude Include="..\Include\EGkChainCurves.h" />
<ClInclude Include="..\Include\EGkColor.h" />
<ClInclude Include="..\Include\EGkCurve.h" />
<ClInclude Include="..\Include\EGkCurveArc.h" />
<ClInclude Include="..\Include\EGkCurveAux.h" />
<ClInclude Include="..\Include\EGkCurveBezier.h" />
<ClInclude Include="..\Include\EGkCurveByInterp.h" />
<ClInclude Include="..\Include\EGkCurveComposite.h" />
<ClInclude Include="..\Include\EGkCurveLine.h" />
<ClInclude Include="..\Include\EGkCurvePointDiffGeom.h" />
<ClInclude Include="..\Include\EGkExtDimension.h" />
<ClInclude Include="..\Include\EGkExtText.h" />
<ClInclude Include="..\Include\EGkFrame3d.h" />
<ClInclude Include="..\Include\EGkGdbConst.h" />
<ClInclude Include="..\Include\EGkGdbIterator.h" />
<ClInclude Include="..\Include\EGkGeoCollection.h" />
<ClInclude Include="..\Include\EGkGeoConst.h" />
<ClInclude Include="..\Include\EGkGeoFrame3d.h" />
<ClInclude Include="..\Include\EGkGeomDB.h" />
<ClInclude Include="..\Include\EGkGeoObj.h" />
<ClInclude Include="..\Include\EGkGeoObjType.h" />
<ClInclude Include="..\Include\EGkGeoPoint3d.h" />
<ClInclude Include="..\Include\EGkGeoVector3d.h" />
<ClInclude Include="..\Include\EGkIntersCurves.h" />
<ClInclude Include="..\Include\EGkIntersLineBox.h" />
<ClInclude Include="..\Include\EGkIntersLinePlane.h" />
<ClInclude Include="..\Include\EGkIntersSurfTmSurfTm.h" />
<ClInclude Include="..\Include\EGkIntervals.h" />
<ClInclude Include="..\Include\EGkMaterial.h" />
<ClInclude Include="..\Include\EGkObjGraphics.h" />
<ClInclude Include="..\Include\EGkOffsetCurve.h" />
<ClInclude Include="..\Include\EGkPlane3d.h" />
<ClInclude Include="..\Include\EGkPoint3d.h" />
<ClInclude Include="..\Include\EGkPointGrid3d.h" />
<ClInclude Include="..\Include\EGkPolyArc.h" />
<ClInclude Include="..\Include\EGkPolygon3d.h" />
<ClInclude Include="..\Include\EGkPolyLine.h" />
<ClInclude Include="..\Include\EGkSfrCreate.h" />
<ClInclude Include="..\Include\EGkStmFromCurves.h" />
<ClInclude Include="..\Include\EGkStmFromTriangleSoup.h" />
<ClInclude Include="..\Include\EGkStmStandard.h" />
<ClInclude Include="..\Include\EGkStringUtils3d.h" />
<ClInclude Include="..\Include\EGkSurf.h" />
<ClInclude Include="..\Include\EGkSurfBezier.h" />
<ClInclude Include="..\Include\EGkSurfFlatRegion.h" />
<ClInclude Include="..\Include\EGkSurfTriMesh.h" />
<ClInclude Include="..\Include\EGkTriangle3d.h" />
<ClInclude Include="..\Include\EGkUserObj.h" />
<ClInclude Include="..\Include\EGkVector3d.h" />
<ClInclude Include="..\Include\EGnCmdExecutor.h" />
<ClInclude Include="..\Include\EGnCmdParser.h" />
<ClInclude Include="..\Include\EGnFileUtils.h" />
<ClInclude Include="..\Include\EGnGetModuleVer.h" />
<ClInclude Include="..\Include\EGnScanner.h" />
<ClInclude Include="..\Include\EGnStringKeyVal.h" />
<ClInclude Include="..\Include\EGnStringUtils.h" />
<ClInclude Include="..\Include\EGnWriter.h" />
<ClInclude Include="..\Include\EGrScene.h" />
<ClInclude Include="..\Include\EgtExecMgr.h" />
<ClInclude Include="..\Include\EgtILogger.h" />
<ClInclude Include="..\Include\EgtKeyCodes.h" />
<ClInclude Include="..\Include\EgtLibVer.h" />
<ClInclude Include="..\Include\EgtNumCollection.h" />
<ClInclude Include="..\Include\EgtNumUtils.h" />
<ClInclude Include="..\Include\EgtPointerOwner.h" />
<ClInclude Include="..\Include\EgtStringBase.h" />
<ClInclude Include="..\Include\EgtStringConverter.h" />
<ClInclude Include="..\Include\EgtStringDecoder.h" />
<ClInclude Include="..\Include\EgtStringEncoder.h" />
<ClInclude Include="..\Include\EgtTargetVer.h" />
<ClInclude Include="..\Include\EgtTrace.h" />
<ClInclude Include="..\Include\ENkCplxCollection.h" />
<ClInclude Include="..\Include\ENkPolynomialRoots.h" />
<ClInclude Include="..\Include\SELkKeyProc.h" />
<ClInclude Include="BeamMgr.h" />
<ClInclude Include="BtlConst.h" />
<ClInclude Include="BtlGeom.h" />
@@ -249,7 +331,10 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClInclude Include="ImportCnc.h" />
<ClInclude Include="ImportCsf.h" />
<ClInclude Include="ImportDxf.h" />
<ClInclude Include="ImportOff.h" />
<ClInclude Include="ImportPly.h" />
<ClInclude Include="ImportStl.h" />
<ClInclude Include="miniply.h" />
<ClInclude Include="pugiconfig.hpp" />
<ClInclude Include="pugixml.hpp" />
<ClInclude Include="resource.h" />
@@ -291,8 +376,11 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClCompile Include="ImportDxfEnts.cpp" />
<ClCompile Include="ImportDxfHeader.cpp" />
<ClCompile Include="ImportDxfTabs.cpp" />
<ClCompile Include="ImportOff.cpp" />
<ClCompile Include="ImportPly.cpp" />
<ClCompile Include="ImportPnt.cpp" />
<ClCompile Include="ImportStl.cpp" />
<ClCompile Include="miniply.cpp" />
<ClCompile Include="pugixml.cpp" />
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
+267
View File
@@ -129,6 +129,264 @@
<ClInclude Include="ExportThreeJS.h">
<Filter>File di intestazione</Filter>
</ClInclude>
<ClInclude Include="..\Include\EExBeamConst.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EExExcExecutor.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EExExport3MF.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EExExportSvg.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EExExportThreeJS.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EExImport3MF.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EExImportPnt.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkAngle.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkArcSpecial.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkBBox3d.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkChainCurves.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkColor.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkCurve.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkCurveArc.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkCurveAux.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkCurveBezier.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkCurveByInterp.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkCurveComposite.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkCurveLine.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkCurvePointDiffGeom.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkExtDimension.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkExtText.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkFrame3d.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkGdbConst.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkGdbIterator.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkGeoCollection.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkGeoFrame3d.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkGeomDB.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkGeoObj.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkGeoObjType.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkGeoPoint3d.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkGeoVector3d.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkIntersCurves.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkIntersLineBox.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkIntersLinePlane.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkIntersSurfTmSurfTm.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkIntervals.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkMaterial.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkObjGraphics.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkOffsetCurve.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkPlane3d.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkPoint3d.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkPointGrid3d.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkPolyArc.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkPolygon3d.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkPolyLine.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkSfrCreate.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkStmFromCurves.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkStmFromTriangleSoup.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkStmStandard.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkStringUtils3d.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkSurf.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkSurfBezier.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkSurfFlatRegion.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkSurfTriMesh.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkTriangle3d.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkUserObj.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkVector3d.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGnCmdExecutor.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGnCmdParser.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGnFileUtils.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGnGetModuleVer.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGnStringKeyVal.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGnStringUtils.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGnWriter.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGrScene.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EgtExecMgr.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EgtILogger.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EgtKeyCodes.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EgtLibVer.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EgtNumCollection.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EgtNumUtils.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EgtPointerOwner.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EgtStringBase.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EgtStringConverter.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EgtStringDecoder.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EgtStringEncoder.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EgtTargetVer.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EgtTrace.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\ENkCplxCollection.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\ENkPolynomialRoots.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\SELkKeyProc.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="ImportOff.h">
<Filter>File di intestazione</Filter>
</ClInclude>
<ClInclude Include="..\Include\EExImportOff.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="ImportPly.h">
<Filter>File di intestazione</Filter>
</ClInclude>
<ClInclude Include="miniply.h">
<Filter>File di intestazione</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">
@@ -209,6 +467,15 @@
<ClCompile Include="ExportThreeJS.cpp">
<Filter>File di origine</Filter>
</ClCompile>
<ClCompile Include="ImportOff.cpp">
<Filter>File di origine</Filter>
</ClCompile>
<ClCompile Include="ImportPly.cpp">
<Filter>File di origine</Filter>
</ClCompile>
<ClCompile Include="miniply.cpp">
<Filter>File di origine</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="EgtExchange.rc">
+36
View File
@@ -43,6 +43,7 @@ ExcExecutor::ExcExecutor( void)
m_ExecMgr.Insert( "IMPORTCNC", &ExcExecutor::ExecuteImportCnc) ;
m_ExecMgr.Insert( "IMPORTDXF", &ExcExecutor::ExecuteImportDxf) ;
m_ExecMgr.Insert( "IMPORTSTL", &ExcExecutor::ExecuteImportStl) ;
//m_ExecMgr.Insert( "IMPORT3DM", &ExcExecutor::ExecuteImport3dm) ;
}
//----------------------------------------------------------------------------
@@ -234,3 +235,38 @@ ExcExecutor::ExecuteImportStl( const string& sCmd2, const STRVECTOR& vsParams)
return bOk ;
}
////----------------------------------------------------------------------------
//bool
//ExcExecutor::ExecuteImport3dm( const string& sCmd2, const STRVECTOR& vsParams)
//{
// // 2 o 3 parametri : nome del file, Id del gruppo[, ScaleFactor]
// if ( vsParams.size() != 2 && vsParams.size() != 3)
// return false ;
// // eventuale conversione di token nel nome file
// string sFile = vsParams[0] ;
// m_pParser->DirReplace( sFile) ;
// // recupero l'Id
// int nId = m_pParser->GetIdParam( vsParams[1]) ;
// if ( nId == CMD_ID_ERROR)
// return false ;
// // gestisco ScaleFactor
// double dScaleFactor = 1 ;
// if ( vsParams.size() >= 3)
// FromString( vsParams[2], dScaleFactor) ;
//
// // preparo l'importatore
// IImport3dm* pImp3dm = CreateImport3dm() ;
// if ( pImp3dm == nullptr) {
// LOG_ERROR( GetEExLogger(), "Error : CreateImportStl")
// return false ;
// }
// // eseguo l'importazione
// //bool bOk = pImp3dm->Import( sFile, m_pGDB, nId, dScaleFactor) ;
// // cancello l'importatore
// delete pImp3dm ;
//
// //return bOk ;
//
// //return true ;
//}
+1
View File
@@ -40,6 +40,7 @@ class ExcExecutor : public IExcExecutor
bool ExecuteImportDxf( const std::string& sCmd2, const STRVECTOR& vsParams) ;
bool ExecuteImportCnc( const std::string& sCmd2, const STRVECTOR& vsParams) ;
bool ExecuteImportStl( const std::string& sCmd2, const STRVECTOR& vsParams) ;
//bool ExecuteImport3dm( const std::string& sCmd2, const STRVECTOR& vsParams) ;
private :
IGeomDB* m_pGDB ;
+168 -113
View File
@@ -17,25 +17,22 @@
#include "Export3MF.h"
#include "DllMain.h"
#include "/EgtDev/Include/EExDllMain.h"
#include "/EgtDev/Include/EGkGeomDB.h"
#include "/EgtDev/Include/EGkSurfFlatRegion.h"
#include "/EgtDev/Include/EGkSurfTriMesh.h"
#include "/EgtDev/Include/EGkGdbIterator.h"
#include "/EgtDev/Include/EGnStringUtils.h"
#include "/EgtDev/Include/SELkKeyProc.h"
#include "/EgtDev/Include/EgtKeyCodes.h"
#include "/EgtDev/Include/EgtStringConverter.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
using namespace std ;
using namespace Lib3MF ;
using namespace Lib3MF ;
//----------------------------------------------------------------------------
static string sInfoNamespace = "CustomInfo" ;
//----------------------------------------------------------------------------
IExport3MF*
CreateExport3MF( void)
{
// verifico la chiave e le opzioni
if ( ! GetEExNetHwKey() && ! TestKeyForEEx( GetEExKey(), KEYOPT_EEX_EXPBASE, GetEExLogger()))
if ( ! VerifyKey( KEYOPT_EEX_EXPBASE))
return nullptr ;
// creo l'oggetto
return static_cast<IExport3MF*> ( new(nothrow) Export3MF) ;
@@ -46,6 +43,7 @@ bool
Export3MF::SetOptions( int nFilter)
{
m_nFilter = nFilter ;
CalcGroupFilter() ;
return true ;
}
@@ -65,15 +63,15 @@ Export3MF::Export( IGeomDB* pGDB, int nId, const string& sFile)
return false ;
}
// libreria 3MF
// libreria 3MF
m_wrapper = CWrapper::loadLibrary() ;
if ( ! m_wrapper) {
if ( m_wrapper == nullptr) {
LOG_ERROR( GetEExLogger(), "Export3MF : Error on lib3mf Wrapper")
return false ;
}
// creo model per 3MF
m_model = m_wrapper->CreateModel() ;
if ( ! m_model) {
if ( m_model == nullptr) {
LOG_ERROR( GetEExLogger(), "Export3MF : Error on lib3mf Model")
return false ;
}
@@ -87,10 +85,11 @@ Export3MF::Export( IGeomDB* pGDB, int nId, const string& sFile)
if ( IsNull( pIter))
return false ;
pIter->GoTo( nId) ;
// esporto l'oggetto e i suoi eventuali figli
if ( ! ExportObject( *pIter))
return false ;
// scrivo il file
try {
PWriter writer = m_model->QueryWriter( "3mf") ;
@@ -108,79 +107,80 @@ Export3MF::Export( IGeomDB* pGDB, int nId, const string& sFile)
//----------------------------------------------------------------------------
bool
Export3MF::ExportObject( const IGdbIterator& iIter)
Export3MF::ExportObject( const IGdbIterator& iIter, PComponentsObject pParent, bool bSaveGrpAsComponent)
{
switch ( iIter.GetGdbType()) {
case GDB_TY_GEO :
{
// recupero l'oggetto geometrico
const IGeoObj* pGeoObj = iIter.GetGeoObj() ;
if ( pGeoObj == nullptr)
return true ;
// se non è una superficie esco
if ( pGeoObj->GetType() != SRF_TRIMESH && pGeoObj->GetType() != SRF_FLATRGN)
return true ;
// recupero il riferimento globale dell'oggetto
Frame3d frFrame ;
if ( ! iIter.GetGlobFrame( frFrame))
return false ;
// recupero il livello dell'oggetto
int nLev = GDB_LV_USER ;
iIter.GetCalcLevel( nLev) ;
// recupero il modo dell'oggetto
int nMode = GDB_MD_STD ;
iIter.GetCalcMode( nMode) ;
// recupero lo stato dell'oggetto
int nStat = GDB_ST_ON ;
iIter.GetCalcStatus( nStat) ;
// se il filtro lo abilita
if ( TestFilter( nLev, nMode, nStat)) {
// recupero eventuale nome
string sName ;
if ( ! iIter.GetName( sName))
sName = ToString( iIter.GetId()) ;
// recupero il colore
// recupero il livello dell'oggetto
int nLev = GDB_LV_USER ;
iIter.GetCalcLevel( nLev) ;
// recupero il modo dell'oggetto
int nMode = GDB_MD_STD ;
iIter.GetCalcMode( nMode) ;
// recupero lo stato dell'oggetto
int nStat = GDB_ST_ON ;
iIter.GetCalcStatus( nStat) ;
int nType = iIter.GetGdbType() ;
// se il filtro lo abilita
if ( TestFilter( nLev, nMode, nStat, nType == GDB_TY_GROUP)) {
// se è un oggetto geometrico diverso da una superficie esco
int nGeoType = iIter.GetGeoType() ;
if ( nGeoType != GEO_NONE && nGeoType != SRF_TRIMESH && nGeoType != SRF_FLATRGN)
return true ;
// recupero nome
string sName ;
iIter.GetName( sName) ;
// recupero info
STRVECTOR vsInfo ;
iIter.GetAllInfo( vsInfo) ;
// esporto
switch ( nType) {
case GDB_TY_GEO :
{
// recupero l'oggetto geometrico
const IGeoObj* pGeoObj = iIter.GetGeoObj() ;
if ( pGeoObj == nullptr)
return false ;
// recupero il riferimento globale dell'oggetto
Frame3d frFrame ;
if ( ! iIter.GetGlobFrame( frFrame))
return false ;
// recupero il colore
Color cCol ;
bool bCol = GetColor( cCol, iIter.GetGDB(), iIter.GetId()) ;
iIter.GetCalcMaterial( cCol) ;
// emetto l'oggetto
switch ( pGeoObj->GetType()) {
switch ( nGeoType) {
case SRF_TRIMESH :
if ( ! ExportSTM( sName, pGeoObj, frFrame, bCol ? &cCol : nullptr))
return false ;
break ;
return ExportSTM( pGeoObj, frFrame, sName, vsInfo, cCol, pParent) ;
case SRF_FLATRGN :
if ( ! ExportSFR( sName, pGeoObj, frFrame, bCol ? &cCol : nullptr))
return false ;
break ;
return ExportSFR( pGeoObj, frFrame, sName, vsInfo, cCol, pParent) ;
default :
break ;
return false ;
}
}
}
return true ;
case GDB_TY_GROUP :
// esploro il gruppo
return ScanGroup( iIter) ;
default :
return false ;
}
case GDB_TY_GROUP :
return ExportGroup( iIter, sName, vsInfo, pParent, bSaveGrpAsComponent) ;
default :
return false ;
}
}
return true ;
}
//----------------------------------------------------------------------------
bool
Export3MF::TestFilter( int nLev, int nMode, int nStat)
Export3MF::TestFilter( int nLev, int nMode, int nStat, bool bGroup) const
{
if ( ( nLev == GDB_LV_USER && ( m_nFilter & EEXFLT_LEVUSER) == 0) ||
( nLev == GDB_LV_SYSTEM && ( m_nFilter & EEXFLT_LEVSYSTEM) == 0) ||
( nLev == GDB_LV_TEMP && ( m_nFilter & EEXFLT_LEVTEMP) == 0))
int nFilter = bGroup ? m_nGroupFilter : m_nFilter ;
if ( ( nLev == GDB_LV_USER && ( nFilter & EEXFLT_LEVUSER) == 0) ||
( nLev == GDB_LV_SYSTEM && ( nFilter & EEXFLT_LEVSYSTEM) == 0) ||
( nLev == GDB_LV_TEMP && ( nFilter & EEXFLT_LEVTEMP) == 0))
return false ;
if ( ( nMode == GDB_MD_STD && ( m_nFilter & EEXFLT_MODESTD) == 0) ||
( nMode == GDB_MD_LOCKED && ( m_nFilter & EEXFLT_MODELOCKED) == 0) ||
( nMode == GDB_MD_HIDDEN && ( m_nFilter & EEXFLT_MODEHIDDEN) == 0))
if ( ( nMode == GDB_MD_STD && ( nFilter & EEXFLT_MODESTD) == 0) ||
( nMode == GDB_MD_LOCKED && ( nFilter & EEXFLT_MODELOCKED) == 0) ||
( nMode == GDB_MD_HIDDEN && ( nFilter & EEXFLT_MODEHIDDEN) == 0))
return false ;
if ( ( nStat == GDB_ST_OFF && ( m_nFilter & EEXFLT_STAOFF) == 0) ||
( nStat == GDB_ST_ON && ( m_nFilter & EEXFLT_STAON) == 0) ||
( nStat == GDB_ST_SEL && ( m_nFilter & EEXFLT_STASEL) == 0))
if ( ( nStat == GDB_ST_OFF && ( nFilter & EEXFLT_STAOFF) == 0) ||
( nStat == GDB_ST_ON && ( nFilter & EEXFLT_STAON) == 0) ||
( nStat == GDB_ST_SEL && ( nFilter & EEXFLT_STASEL) == 0))
return false ;
return true ;
@@ -188,7 +188,38 @@ Export3MF::TestFilter( int nLev, int nMode, int nStat)
//----------------------------------------------------------------------------
bool
Export3MF::ExportSFR( const string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color* pCol)
Export3MF::CalcGroupFilter( void)
{
m_nGroupFilter = 0 ;
// Status
if ( ( m_nFilter & EEXFLT_STASEL) != 0)
m_nGroupFilter += EEXFLT_STASEL + EEXFLT_STAOFF + EEXFLT_STAON ;
else if ( ( m_nFilter & EEXFLT_STAOFF) != 0)
m_nGroupFilter += EEXFLT_STAOFF + EEXFLT_STAON ;
else
m_nGroupFilter += EEXFLT_STAON ;
// Mode
if ( ( m_nFilter & EEXFLT_MODELOCKED) != 0)
m_nGroupFilter += EEXFLT_MODELOCKED + EEXFLT_MODEHIDDEN + EEXFLT_MODESTD ;
else if ( ( m_nFilter & EEXFLT_MODEHIDDEN) != 0)
m_nGroupFilter += EEXFLT_MODEHIDDEN + EEXFLT_MODESTD ;
else
m_nGroupFilter += EEXFLT_MODESTD ;
// Level
if ( ( m_nFilter & EEXFLT_LEVSYSTEM) != 0)
m_nGroupFilter += EEXFLT_LEVSYSTEM + EEXFLT_LEVTEMP + EEXFLT_LEVUSER ;
else if ( ( m_nFilter & EEXFLT_LEVTEMP) != 0)
m_nGroupFilter += EEXFLT_LEVTEMP + EEXFLT_LEVUSER ;
else
m_nGroupFilter += EEXFLT_LEVUSER ;
return true ;
}
//----------------------------------------------------------------------------
bool
Export3MF::ExportSFR( const IGeoObj* pGeoObj, const Frame3d& frFrame, const string& sName, const STRVECTOR& vInfo,
const Color& cCol, PComponentsObject pParent)
{
// verifico oggetto
const ISurfFlatRegion* pSFR = GetSurfFlatRegion( pGeoObj) ;
@@ -196,12 +227,13 @@ Export3MF::ExportSFR( const string& sName, const IGeoObj* pGeoObj, const Frame3d
return false ;
// ricavo la trimesh equivalente
const ISurfTriMesh* pStm = pSFR->GetAuxSurf() ;
return ExportSTM( sName, pStm, frFrame, pCol) ;
return ExportSTM( pStm, frFrame, sName, vInfo, cCol, pParent) ;
}
//----------------------------------------------------------------------------
bool
Export3MF::ExportSTM( const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color* pCol)
Export3MF::ExportSTM( const IGeoObj* pGeoObj, const Frame3d& frFrame, const string& sName, const STRVECTOR& vInfo,
const Color& cCol, PComponentsObject pParent)
{
// verifico oggetto
const ISurfTriMesh* pSTM = GetSurfTriMesh( pGeoObj) ;
@@ -224,7 +256,7 @@ Export3MF::ExportSTM( const std::string& sName, const IGeoObj* pGeoObj, const Fr
int k = 0 ;
for ( int i = 0 ; i < pSTM->GetTriangleSize() ; i++) {
int nIdVert[3] ;
// se il triangolo non è valido passo al successivo
// se il triangolo non è valido passo al successivo
if ( ! pSTM->GetTriangle( i, nIdVert))
continue ;
// assegno gli indici dei vertici
@@ -235,78 +267,101 @@ Export3MF::ExportSTM( const std::string& sName, const IGeoObj* pGeoObj, const Fr
}
if ( vVertices.size() == 0 || vTriangles.size() == 0) {
LOG_ERROR( GetEExLogger(), ( "Export3MF : surface \"" + sName + "\" is empty. Ignored.").c_str()) ;
LOG_ERROR( GetEExLogger(), "Export3MF : empty surface ignored") ;
return true ;
}
// creo mesh 3MF
PMeshObject meshObject = m_model->AddMeshObject() ;
if ( ! meshObject) {
if ( meshObject == nullptr) {
LOG_ERROR( GetEExLogger(), "Export3MF : Error on lib3mf Mesh Object")
return false ;
}
meshObject->SetName( sName) ;
meshObject->SetGeometry( vVertices, vTriangles) ;
// assegno il colore
if ( pCol != nullptr) {
Lib3MF_uint32 nColId = ColorHandler3MF( pCol) ;
meshObject->SetObjectLevelProperty( 1, nColId) ;
// assegno il nome
if ( ! sName.empty())
meshObject->SetName( sName) ;
// assegno le info
PMetaDataGroup metaDataGrp = meshObject->GetMetaDataGroup() ;
for ( const string& sInfo : vInfo) {
string sKey, sVal ;
SplitFirst( sInfo, "=", sKey, sVal) ;
metaDataGrp->AddMetaData( sInfoNamespace, sKey, sVal, "xs:string", 0) ;
}
// assegno il colore
Lib3MF_uint32 nColId = ColorHandler3MF( cCol) ;
meshObject->SetObjectLevelProperty( 1, nColId) ;
// aggiungo al modello
if ( pParent == nullptr)
m_model->AddBuildItem( meshObject.get(), m_wrapper->GetIdentityTransform()) ;
else
pParent->AddComponent( meshObject.get(), m_wrapper->GetIdentityTransform()) ;
m_model->AddBuildItem( meshObject.get(), m_wrapper->GetIdentityTransform()) ;
return true ;
}
//----------------------------------------------------------------------------
bool
Export3MF::ScanGroup( const IGdbIterator& iIter)
Export3MF::ExportGroup( const IGdbIterator& iIter, const string& sName, const STRVECTOR& vsInfo, PComponentsObject pParent,
bool bSaveAsComponent)
{
// creo un iteratore
PtrOwner<IGdbIterator> pIter( CreateGdbIterator( iIter.GetGDB())) ;
if ( IsNull( pIter))
return false ;
// scandisco il gruppo
bool bOk = true ;
for ( bool bNext = pIter->GoToFirstInGroup( iIter) ;
bNext ;
bNext = pIter->GoToNext()) {
if ( ! ExportObject( *pIter))
bOk = false ;
PComponentsObject pComponent = pParent ;
// se il layer va salvato come componente, la creo
if ( bSaveAsComponent) {
pComponent = m_model->AddComponentsObject() ;
if ( ! sName.empty())
pComponent->SetName( sName) ;
}
// salvo le info sulla componente ( se il gruppo viene esportato come tale) o sul modello
PMetaDataGroup metaDataGrp ;
if ( bSaveAsComponent)
metaDataGrp = pComponent->GetMetaDataGroup() ;
else
metaDataGrp = m_model->GetMetaDataGroup() ;
for ( const string& sInfo : vsInfo) {
string sKey, sVal ;
SplitFirst( sInfo, "=", sKey, sVal) ;
metaDataGrp->AddMetaData( sInfoNamespace, sKey, sVal, "xs:string", 0) ;
}
return bOk ;
}
// scandisco il gruppo per inserire i suoi oggetti
PtrOwner<IGdbIterator> pIter( CreateGdbIterator( iIter.GetGDB())) ;
if ( IsNull( pIter))
return false ;
for ( bool bNext = pIter->GoToFirstInGroup( iIter) ; bNext ; bNext = pIter->GoToNext()) {
if ( ! ExportObject( *pIter, pComponent, true))
return false ;
}
//----------------------------------------------------------------------------
bool
Export3MF::GetColor( Color& pCol, const IGeomDB * pGDB, const int& nId)
{
if ( nId == GDB_ID_NULL)
return false ;
if ( ! pGDB->GetMaterial( nId, pCol))
// se fallisce cerco il colore del parent
return GetColor( pCol, pGDB, pGDB->GetParentId( nId)) ;
// se il gruppo va salvato come componente, lo aggiungo al modello
if ( bSaveAsComponent && pComponent->GetComponentCount() > 0) {
if ( pParent == nullptr)
m_model->AddBuildItem( pComponent.get(), m_wrapper->GetIdentityTransform()) ;
else
pParent->AddComponent( pComponent.get(), m_wrapper->GetIdentityTransform()) ;
}
return true ;
}
//----------------------------------------------------------------------------
Lib3MF_uint32
Export3MF::ColorHandler3MF( const Color* pCol)
Export3MF::ColorHandler3MF( const Color& cCol)
{
PColorGroup pColorGrp = m_model->GetColorGroupByID( 1) ;
// converto il colore nel formato usato da 3MF
Lib3MF_uint8 nAlpha = ( int)( pCol->GetIntAlpha() * 2.55 + 0.5) ;
sColor cCol3mf = m_wrapper->RGBAToColor( pCol->GetIntRed(), pCol->GetIntGreen(), pCol->GetIntBlue(), nAlpha) ;
// verifico se il colore è già presente nel colorgroup
Lib3MF_uint8 nAlpha = ( int)( cCol.GetIntAlpha() * 2.55 + 0.5) ;
sColor cCol3mf = m_wrapper->RGBAToColor( cCol.GetIntRed(), cCol.GetIntGreen(), cCol.GetIntBlue(), nAlpha) ;
// verifico se il colore è già presente nel colorgroup
UINTVECTOR vColorIdx ;
pColorGrp->GetAllPropertyIDs( vColorIdx) ;
for ( Lib3MF_uint32 i : vColorIdx) {
sColor cColTmp = pColorGrp->GetColor( i) ;
if ( cColTmp.m_Red == cCol3mf.m_Red && cColTmp.m_Green == cCol3mf.m_Green && cColTmp.m_Blue == cCol3mf.m_Blue
&& cColTmp.m_Alpha == cCol3mf.m_Alpha)
if ( cColTmp.m_Red == cCol3mf.m_Red && cColTmp.m_Green == cCol3mf.m_Green && cColTmp.m_Blue == cCol3mf.m_Blue &&
cColTmp.m_Alpha == cCol3mf.m_Alpha)
return i ;
}
// se non fosse presente, lo aggiungo
+16 -10
View File
@@ -13,7 +13,7 @@
#pragma once
#define NOMINMAX
#define NOMINMAX
#include "/EgtDev/Extern/Lib3MF/Include/lib3mf_implicit.hpp"
#include "/EgtDev/Include/EExExport3MF.h"
@@ -27,19 +27,25 @@ class Export3MF : public IExport3MF
virtual bool Export( IGeomDB* pGDB, int nId, const std::string& sFile) ;
public :
Export3MF( void) : m_nFilter( EEXFLT_DEFAULT) {}
Export3MF( void) : m_nFilter( EEXFLT_DEFAULT) {
CalcGroupFilter() ;
}
private :
bool ExportObject( const IGdbIterator& iIter) ;
bool ScanGroup( const IGdbIterator& iIter) ;
bool TestFilter( int nLev, int nMode, int nStat) ;
bool ExportSFR( const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color* pCol) ;
bool ExportSTM( const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color* pCol) ;
Lib3MF_uint32 ColorHandler3MF( const Color* pCol) ;
bool GetColor( Color& pCol, const IGeomDB * pGBD, const int& nId) ;
bool ExportObject( const IGdbIterator& iIter, Lib3MF::PComponentsObject pParent = nullptr, bool bSaveGrpAsComponent = false) ;
bool ExportGroup( const IGdbIterator& iIter, const std::string& sName, const STRVECTOR& vsInfo, Lib3MF::PComponentsObject pParent,
bool bSaveAsComponent) ;
bool ExportSFR( const IGeoObj* pGeoObj, const Frame3d& frFrame, const std::string& sName, const STRVECTOR& vInfo,
const Color& cCol, Lib3MF::PComponentsObject pParent) ;
bool ExportSTM( const IGeoObj* pGeoObj, const Frame3d& frFrame, const std::string& sName, const STRVECTOR& vInfo,
const Color& cCol, Lib3MF::PComponentsObject pParent) ;
bool TestFilter( int nLev, int nMode, int nStat, bool bGroup) const ;
bool CalcGroupFilter( void) ;
Lib3MF_uint32 ColorHandler3MF( const Color& cCol) ;
private :
int m_nFilter ; // filtro su livello, modo e stato
int m_nFilter ; // filtro su livello, modo e stato, se l'oggetto da valutare è un oggetto geometrico
int m_nGroupFilter ; // filtro su livello, modo e stato, se l'oggetto da valutare è un gruppo
Lib3MF::PWrapper m_wrapper ; // lib3mf wrapper
Lib3MF::PModel m_model ; // lib3mf model
} ;
+112 -80
View File
@@ -33,8 +33,6 @@
#include "/EgtDev/Include/EGkStringUtils3d.h"
#include "/EgtDev/Include/EGnStringUtils.h"
#include "/EgtDev/Include/EGnFileUtils.h"
#include "/EgtDev/Include/SELkKeyProc.h"
#include "/EgtDev/Include/EgtKeyCodes.h"
#include "/EgtDev/Include/EgtStringConverter.h"
#include "/EgtDev/Include/EgtStringDecoder.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
@@ -46,7 +44,7 @@ IExportDxf*
CreateExportDxf( void)
{
// verifico la chiave e le opzioni
if ( ! GetEExNetHwKey() && ! TestKeyForEEx( GetEExKey(), KEYOPT_EEX_EXPBASE, GetEExLogger()))
if ( ! VerifyKey( KEYOPT_EEX_EXPBASE))
return nullptr ;
// creo l'oggetto
return static_cast<IExportDxf*> ( new(nothrow) ExportDxf) ;
@@ -57,6 +55,7 @@ bool
ExportDxf::SetOptions( int nFilter, int nFlag)
{
m_nFilter = nFilter ;
CalcGroupFilter() ;
m_bCompoundLayer = (( nFlag & EEXFLAG_COMP_LAYER) != 0) ;
m_bColorByLayer = (( nFlag & EEXFLAG_COL_BY_LAYER) != 0) ;
m_bAdvancedNames = (( nFlag & EEXFLAG_ADV_NAMES) != 0) ;
@@ -100,7 +99,7 @@ ExportDxf::Export( IGeomDB* pGDB, int nId, const string& sFile)
if ( ! ExportBlocks( pGDB, nId))
bOk = false ;
// scrivo la sezione entità
// scrivo la sezione entit
if ( ! ExportEntities( pGDB, nId))
bOk = false ;
@@ -602,7 +601,7 @@ ExportDxf::WriteLayersTable( IGeomDB* pGDB, int nId)
bool
ExportDxf::FindLayers( const IGdbIterator& iIter, const string& sLay, LAYDATVECTOR& vLayDat)
{
// se non è un gruppo, esco subito
// se non un gruppo, esco subito
if ( iIter.GetGdbType() != GDB_TY_GROUP)
return true ;
@@ -616,7 +615,7 @@ ExportDxf::FindLayers( const IGdbIterator& iIter, const string& sLay, LAYDATVECT
int nStat = GDB_ST_ON ;
iIter.GetCalcStatus( nStat) ;
// se il filtro non lo abilita, esco subito
if ( ! TestFilter( nLev, nMode, nStat))
if ( ! TestFilter( nLev, nMode, nStat, true))
return true ;
// aggiorno nome layer
@@ -634,7 +633,7 @@ ExportDxf::FindLayers( const IGdbIterator& iIter, const string& sLay, LAYDATVECT
string s2 = sNewLay ;
if ( ToUpper( s1) == ToUpper( s2)) {
bFound = true ;
// se è il nome esatto, aggiorno il colore
// se il nome esatto, aggiorno il colore
if ( bExactLay)
vLayDat[i].second = nCol ;
}
@@ -720,9 +719,9 @@ ExportDxf::WriteStylesTable( IGeomDB* pGDB, int nId)
bool
ExportDxf::FindTextStyles( const IGdbIterator& iIter, STRVECTOR& vFontName)
{
// se è una entità geometrica
// se una entit geometrica
if ( iIter.GetGdbType() == GDB_TY_GEO) {
// se è un testo
// se un testo
if ( const IExtText* pTXT = GetExtText( iIter.GetGeoObj())) {
// se font non presente, lo aggiungo al vettore dei font
bool bFound = false ;
@@ -918,7 +917,7 @@ ExportDxf::ExportBlocks( IGeomDB* pGDB, int nId)
bool
ExportDxf::ExportEntities( IGeomDB* pGDB, int nId)
{
// intestazione sezione entità
// intestazione sezione entit
if ( ! WriteItem( 0, "SECTION") ||
! WriteItem( 2, "ENTITIES"))
return false ;
@@ -932,7 +931,7 @@ ExportDxf::ExportEntities( IGeomDB* pGDB, int nId)
if ( ! ExportGdbObject( *pIter, LAY_DEFAULT))
return false ;
// terminazione sezione entità
// terminazione sezione entit
if ( ! WriteItem( 0, "ENDSEC"))
return false ;
@@ -943,35 +942,36 @@ ExportDxf::ExportEntities( IGeomDB* pGDB, int nId)
bool
ExportDxf::ExportGdbObject( const IGdbIterator& iIter, const string& sLay)
{
// recupero il livello dell'oggetto
int nLev = GDB_LV_USER ;
iIter.GetCalcLevel( nLev) ;
// recupero il modo dell'oggetto
int nMode = GDB_MD_STD ;
iIter.GetCalcMode( nMode) ;
// recupero lo stato dell'oggetto
int nStat = GDB_ST_ON ;
iIter.GetCalcStatus( nStat) ;
// recupero il tipo dell'oggetto
int nGdbType = iIter.GetGdbType() ;
// se gruppo di oggetti
if ( nGdbType == GDB_TY_GROUP) {
// esporto il gruppo
return ExportGdbGroup( iIter, sLay) ;
}
// se oggetto geometrico
else if ( nGdbType == GDB_TY_GEO) {
// recupero l'oggetto geometrico
const IGeoObj* pGeoObj = iIter.GetGeoObj() ;
if ( pGeoObj == nullptr)
return true ;
// recupero il riferimento globale dell'oggetto
Frame3d frFrame ;
if ( ! iIter.GetGlobFrame( frFrame))
return false ;
// recupero il livello dell'oggetto
int nLev = GDB_LV_USER ;
iIter.GetCalcLevel( nLev) ;
// recupero il modo dell'oggetto
int nMode = GDB_MD_STD ;
iIter.GetCalcMode( nMode) ;
// recupero lo stato dell'oggetto
int nStat = GDB_ST_ON ;
iIter.GetCalcStatus( nStat) ;
// se il filtro lo abilita
if ( TestFilter( nLev, nMode, nStat)) {
// recupero colore (trasformato in formato ACI)
// se il filtro lo abilita
if ( TestFilter( nLev, nMode, nStat, nGdbType == GDB_TY_GROUP)) {
// se gruppo di oggetti
if ( nGdbType == GDB_TY_GROUP) {
// esporto il gruppo
return ExportGdbGroup( iIter, sLay) ;
}
// se oggetto geometrico
else if ( nGdbType == GDB_TY_GEO) {
// recupero l'oggetto geometrico
const IGeoObj* pGeoObj = iIter.GetGeoObj() ;
if ( pGeoObj == nullptr)
return true ;
// recupero il riferimento globale dell'oggetto
Frame3d frFrame ;
if ( ! iIter.GetGlobFrame( frFrame))
return false ;
// recupero colore (trasformato in formato ACI)
int nCol = COL_DEFAULT ;
Color cCol ;
if ( ( m_bColorByLayer && iIter.GetMaterial( cCol)) ||
@@ -1016,11 +1016,12 @@ ExportDxf::ExportGdbObject( const IGdbIterator& iIter, const string& sLay)
return false ;
break ;
}
}
return true ;
}
else
return false ;
return true ;
}
else
return false ;
}
return true ;
}
//----------------------------------------------------------------------------
@@ -1077,7 +1078,7 @@ ExportDxf::ExportLine( const string& sLay, int nCol, const IGeoObj* pGeoObj, con
const ICurveLine* pLine = GetCurveLine( pGeoObj) ;
if ( pLine == nullptr)
return false ;
// scrivo l'entità
// scrivo l'entit
return WriteLine( sLay, nCol, pLine, frFrame) ;
}
@@ -1089,7 +1090,7 @@ ExportDxf::ExportArc( const string& sLay, int nCol, const IGeoObj* pGeoObj, cons
const ICurveArc* pArc = GetCurveArc( pGeoObj) ;
if ( pArc == nullptr)
return false ;
// se è un'elica o con estrusione non parallela a N
// se un'elica o con estrusione non parallela a N
if ( ! pArc->IsPlane()) {
// esporto come polilinea 3d
return WriteCurve3d( sLay, nCol, pArc, frFrame) ;
@@ -1162,9 +1163,9 @@ ExportDxf::ExportSTM( const string& sLay, int nCol, const IGeoObj* pGeoObj, cons
const ISurfTriMesh* pSTM = GetSurfTriMesh( pGeoObj) ;
if ( pSTM == nullptr)
return false ;
// posso esportare come unica polymesh solo se il numero dei vertici e dei triangoli è inferiore a 32767
// posso esportare come unica polymesh solo se il numero dei vertici e dei triangoli inferiore a 32767
if ( pSTM->GetVertexCount() < SHRT_MAX && pSTM->GetTriangleCount() < SHRT_MAX) {
// identificativo entità
// identificativo entit
if ( ! WriteItem( 0, "POLYLINE"))
return false ;
// layer
@@ -1173,7 +1174,7 @@ ExportDxf::ExportSTM( const string& sLay, int nCol, const IGeoObj* pGeoObj, cons
// colore
if ( ! WriteItem( 62, nCol))
return false ;
// flag segnalazione entità successive dipendenti (vertex)
// flag segnalazione entit successive dipendenti (vertex)
if ( ! WriteItem( 66, 1))
return false ;
// punto inutile ma obbligatorio
@@ -1196,7 +1197,7 @@ ExportDxf::ExportSTM( const string& sLay, int nCol, const IGeoObj* pGeoObj, cons
nId != SVT_NULL ;
nId = pSTM->GetNextVertex( nId, ptP)) {
ptP.ToGlob( frFrame) ;
// entità vertice
// entit vertice
if ( ! WriteItem( 0, "VERTEX"))
return false ;
// layer
@@ -1216,7 +1217,7 @@ ExportDxf::ExportSTM( const string& sLay, int nCol, const IGeoObj* pGeoObj, cons
for ( int nId = pSTM->GetFirstTriangle( nIdVert) ;
nId != SVT_NULL ;
nId = pSTM->GetNextTriangle( nId, nIdVert)) {
// entità vertice
// entit vertice
if ( ! WriteItem( 0, "VERTEX"))
return false ;
// layer
@@ -1239,7 +1240,7 @@ ExportDxf::ExportSTM( const string& sLay, int nCol, const IGeoObj* pGeoObj, cons
! WriteItem( 73, nIdVert[2] + 1))
return false ;
}
// entità termine dei vertici
// entit termine dei vertici
if ( ! WriteItem( 0, "SEQEND"))
return false ;
// layer
@@ -1255,7 +1256,7 @@ ExportDxf::ExportSTM( const string& sLay, int nCol, const IGeoObj* pGeoObj, cons
nId != SVT_NULL ;
nId = pSTM->GetNextTriangle( nId, Tria)) {
Tria.ToGlob( frFrame) ;
// entità 3dface
// entit 3dface
if ( ! WriteItem( 0, "3DFACE"))
return false ;
// layer
@@ -1311,7 +1312,7 @@ ExportDxf::ExportText( const string& sLay, int nCol, const IGeoObj* pGeoObj, con
// ciclo sui diversi testi semplici
bool bOk = true ;
for ( int i = 0 ; i < int( vTxt.size()) ; ++ i) {
// identificativo entità
// identificativo entit
if ( ! WriteItem( 0, "TEXT"))
return false ;
// layer
@@ -1354,7 +1355,7 @@ ExportDxf::ExportText( const string& sLay, int nCol, const IGeoObj* pGeoObj, con
! WriteItem( 220, vtN.y) ||
! WriteItem( 230, vtN.z))
return false ;
// libero l'entità
// libero l'entit
delete vTxt[i] ;
}
return bOk ;
@@ -1396,7 +1397,7 @@ ExportDxf::AdjustText( string& sText)
bool
ExportDxf::WritePoint( const string& sLay, int nCol, const Point3d& ptP, const Vector3d& vtV, const Frame3d& frFrame)
{
// identificativo entità
// identificativo entit
if ( ! WriteItem( 0, "POINT"))
return false ;
// layer
@@ -1430,10 +1431,10 @@ ExportDxf::WritePoint( const string& sLay, int nCol, const Point3d& ptP, const V
bool
ExportDxf::WriteLine( const string& sLay, int nCol, const ICurveLine* pLine, const Frame3d& frFrame)
{
// verifico validità linea
// verifico validit linea
if ( pLine == nullptr)
return false ;
// identificativo entità
// identificativo entit
if ( ! WriteItem( 0, "LINE"))
return false ;
// layer
@@ -1481,7 +1482,7 @@ ExportDxf::WriteLine( const string& sLay, int nCol, const ICurveLine* pLine, con
bool
ExportDxf::WriteCircle( const string& sLay, int nCol, const ICurveArc* pArc, const Frame3d& frFrame)
{
// verifico validità arco
// verifico validit arco
if ( pArc == nullptr)
return false ;
// verifico verso eventuale estrusione
@@ -1493,7 +1494,7 @@ ExportDxf::WriteCircle( const string& sLay, int nCol, const ICurveArc* pArc, con
vtN.ToGlob( frFrame) ;
Frame3d frOCS ;
frOCS.Set( ORIG, vtN) ;
// identificativo entità
// identificativo entit
if ( ! WriteItem( 0, "CIRCLE"))
return false ;
// layer
@@ -1532,7 +1533,7 @@ ExportDxf::WriteCircle( const string& sLay, int nCol, const ICurveArc* pArc, con
bool
ExportDxf::WriteArc( const string& sLay, int nCol, const ICurveArc* pArc, const Frame3d& frFrame)
{
// verifico validità arco
// verifico validit arco
if ( pArc == nullptr)
return false ;
// verifico verso eventuale estrusione
@@ -1544,7 +1545,7 @@ ExportDxf::WriteArc( const string& sLay, int nCol, const ICurveArc* pArc, const
vtN.ToGlob( frFrame) ;
Frame3d frOCS ;
frOCS.Set( ORIG, vtN) ;
// identificativo entità
// identificativo entit
if ( ! WriteItem( 0, "ARC"))
return false ;
// layer
@@ -1596,7 +1597,7 @@ bool
ExportDxf::WriteCurve2d( const string& sLay, int nCol, const ICurve* pCrv,
const Frame3d& frPlane, const Frame3d& frFrame)
{
// verifico validità curva
// verifico validit curva
if ( pCrv == nullptr)
return false ;
// trasformo in poliarco
@@ -1637,7 +1638,7 @@ ExportDxf::WriteCurve2d( const string& sLay, int nCol, const ICurve* pCrv,
// colore
if ( ! WriteItem( 62, nCol))
return false ;
// flag segnalazione entità successive dipendenti (vertex)
// flag segnalazione entit successive dipendenti (vertex)
if ( ! WriteItem( 66, 1))
return false ;
// punto per sola elevazione : X,Y inutili Z elevazione
@@ -1669,7 +1670,7 @@ ExportDxf::WriteCurve2d( const string& sLay, int nCol, const ICurve* pCrv,
for ( bool bPnt = PA.GetFirstPoint( ptP, dBulge) ;
bPnt ;
bPnt = PA.GetNextPoint( ptP, dBulge, bClosed)) {
// entità vertice
// entit vertice
if ( ! WriteItem( 0, "VERTEX"))
return false ;
// layer
@@ -1688,7 +1689,7 @@ ExportDxf::WriteCurve2d( const string& sLay, int nCol, const ICurve* pCrv,
if ( ! WriteItem( 70, 0))
return false ;
}
// entità termine dei vertici
// entit termine dei vertici
if ( ! WriteItem( 0, "SEQEND"))
return false ;
// layer
@@ -1701,7 +1702,7 @@ ExportDxf::WriteCurve2d( const string& sLay, int nCol, const ICurve* pCrv,
bool
ExportDxf::WriteCurve3d( const string& sLay, int nCol, const ICurve* pCrv, const Frame3d& frFrame)
{
// verifico validità curva
// verifico validit curva
if ( pCrv == nullptr)
return false ;
// trasformo in polilinea
@@ -1726,7 +1727,7 @@ ExportDxf::WriteCurve3d( const string& sLay, int nCol, const ICurve* pCrv, const
// colore
if ( ! WriteItem( 62, nCol))
return false ;
// flag segnalazione entità successive dipendenti (vertex)
// flag segnalazione entit successive dipendenti (vertex)
if ( ! WriteItem( 66, 1))
return false ;
// punto inutile ma obbligatorio
@@ -1742,7 +1743,7 @@ ExportDxf::WriteCurve3d( const string& sLay, int nCol, const ICurve* pCrv, const
for ( bool bPnt = PL.GetFirstPoint( ptP) ;
bPnt ;
bPnt = PL.GetNextPoint( ptP)) {
// entità vertice
// entit vertice
if ( ! WriteItem( 0, "VERTEX"))
return false ;
// layer
@@ -1758,7 +1759,7 @@ ExportDxf::WriteCurve3d( const string& sLay, int nCol, const ICurve* pCrv, const
if ( ! WriteItem( 70, 32))
return false ;
}
// entità termine dei vertici
// entit termine dei vertici
if ( ! WriteItem( 0, "SEQEND"))
return false ;
// layer
@@ -1771,7 +1772,7 @@ ExportDxf::WriteCurve3d( const string& sLay, int nCol, const ICurve* pCrv, const
for ( bool bPnt = PL.GetFirstLine( ptStart, ptEnd) ;
bPnt ;
bPnt = PL.GetNextLine( ptStart, ptEnd)) {
// identificativo entità
// identificativo entit
if ( ! WriteItem( 0, "LINE"))
return false ;
// layer
@@ -1811,24 +1812,55 @@ ExportDxf::WriteCurve3d( const string& sLay, int nCol, const ICurve* pCrv, const
//----------------------------------------------------------------------------
bool
ExportDxf::TestFilter( int nLev, int nMode, int nStat)
ExportDxf::TestFilter( int nLev, int nMode, int nStat, bool bGroup)
{
if ( ( nLev == GDB_LV_USER && ( m_nFilter & EEXFLT_LEVUSER) == 0) ||
( nLev == GDB_LV_SYSTEM && ( m_nFilter & EEXFLT_LEVSYSTEM) == 0) ||
( nLev == GDB_LV_TEMP && ( m_nFilter & EEXFLT_LEVTEMP) == 0))
int nFilter = bGroup ? m_nGroupFilter : m_nFilter ;
if ( ( nLev == GDB_LV_USER && ( nFilter & EEXFLT_LEVUSER) == 0) ||
( nLev == GDB_LV_SYSTEM && ( nFilter & EEXFLT_LEVSYSTEM) == 0) ||
( nLev == GDB_LV_TEMP && ( nFilter & EEXFLT_LEVTEMP) == 0))
return false ;
if ( ( nMode == GDB_MD_STD && ( m_nFilter & EEXFLT_MODESTD) == 0) ||
( nMode == GDB_MD_LOCKED && ( m_nFilter & EEXFLT_MODELOCKED) == 0) ||
( nMode == GDB_MD_HIDDEN && ( m_nFilter & EEXFLT_MODEHIDDEN) == 0))
if ( ( nMode == GDB_MD_STD && ( nFilter & EEXFLT_MODESTD) == 0) ||
( nMode == GDB_MD_LOCKED && ( nFilter & EEXFLT_MODELOCKED) == 0) ||
( nMode == GDB_MD_HIDDEN && ( nFilter & EEXFLT_MODEHIDDEN) == 0))
return false ;
if ( ( nStat == GDB_ST_OFF && ( m_nFilter & EEXFLT_STAOFF) == 0) ||
( nStat == GDB_ST_ON && ( m_nFilter & EEXFLT_STAON) == 0) ||
( nStat == GDB_ST_SEL && ( m_nFilter & EEXFLT_STASEL) == 0))
if ( ( nStat == GDB_ST_OFF && ( nFilter & EEXFLT_STAOFF) == 0) ||
( nStat == GDB_ST_ON && ( nFilter & EEXFLT_STAON) == 0) ||
( nStat == GDB_ST_SEL && ( nFilter & EEXFLT_STASEL) == 0))
return false ;
return true ;
}
//----------------------------------------------------------------------------
bool
ExportDxf::CalcGroupFilter( void)
{
m_nGroupFilter = 0 ;
// Status
if ( ( m_nFilter & EEXFLT_STASEL) != 0)
m_nGroupFilter += EEXFLT_STASEL + EEXFLT_STAOFF + EEXFLT_STAON ;
else if ( ( m_nFilter & EEXFLT_STAOFF) != 0)
m_nGroupFilter += EEXFLT_STAOFF + EEXFLT_STAON ;
else
m_nGroupFilter += EEXFLT_STAON ;
// Mode
if ( ( m_nFilter & EEXFLT_MODELOCKED) != 0)
m_nGroupFilter += EEXFLT_MODELOCKED + EEXFLT_MODEHIDDEN + EEXFLT_MODESTD ;
else if ( ( m_nFilter & EEXFLT_MODEHIDDEN) != 0)
m_nGroupFilter += EEXFLT_MODEHIDDEN + EEXFLT_MODESTD ;
else
m_nGroupFilter += EEXFLT_MODESTD ;
// Level
if ( ( m_nFilter & EEXFLT_LEVSYSTEM) != 0)
m_nGroupFilter += EEXFLT_LEVSYSTEM + EEXFLT_LEVTEMP + EEXFLT_LEVUSER ;
else if ( ( m_nFilter & EEXFLT_LEVTEMP) != 0)
m_nGroupFilter += EEXFLT_LEVTEMP + EEXFLT_LEVUSER ;
else
m_nGroupFilter += EEXFLT_LEVUSER ;
return true ;
}
//----------------------------------------------------------------------------
bool
ExportDxf::WriteItem( int nCode, int nVal)
+4 -2
View File
@@ -71,7 +71,8 @@ class ExportDxf : public IExportDxf
bool WriteCurve2d( const std::string& sLay, int nCol, const ICurve* pCrv,
const Frame3d& frPlane, const Frame3d& frFrame) ;
bool WriteCurve3d( const std::string& sLay, int nCol, const ICurve* pCrv, const Frame3d& frFrame) ;
bool TestFilter( int nLev, int nMode, int nStat) ;
bool TestFilter( int nLev, int nMode, int nStat, bool bGroup) ;
bool CalcGroupFilter( void) ;
bool WriteItem( int nCode, int nVal) ;
bool WriteItem( int nCode, double dVal, int nPrec = 6) ;
bool WriteItem( int nCode, const std::string& sVal) ;
@@ -81,7 +82,8 @@ class ExportDxf : public IExportDxf
std::string AdjustFontName( const std::string& sFontName) ;
private :
int m_nFilter ; // filtro su livello, modo e stato
int m_nFilter ; // filtro su livello, modo e stato, se l'oggeto da valutare è un oggetto geometrico
int m_nGroupFilter ; // filtro su livello, modo e stato, se l'oggetto da valutare è un gruppo
bool m_bCompoundLayer ;
bool m_bColorByLayer ;
bool m_bAdvancedNames ;
+77 -45
View File
@@ -21,8 +21,6 @@
#include "/EgtDev/Include/EGkSurfTriMesh.h"
#include "/EgtDev/Include/EGkGdbIterator.h"
#include "/EgtDev/Include/EGnStringUtils.h"
#include "/EgtDev/Include/SELkKeyProc.h"
#include "/EgtDev/Include/EgtKeyCodes.h"
#include "/EgtDev/Include/EgtStringConverter.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
#include <fstream>
@@ -34,7 +32,7 @@ IExportStl*
CreateExportStl( void)
{
// verifico la chiave e le opzioni
if ( ! GetEExNetHwKey() && ! TestKeyForEEx( GetEExKey(), KEYOPT_EEX_EXPBASE, GetEExLogger()))
if ( ! VerifyKey( KEYOPT_EEX_EXPBASE))
return nullptr ;
// creo l'oggetto
return static_cast<IExportStl*> ( new(nothrow) ExportStl) ;
@@ -45,6 +43,7 @@ bool
ExportStl::SetOptions( int nFilter)
{
m_nFilter = nFilter ;
CalcGroupFilter() ;
return true ;
}
@@ -89,34 +88,35 @@ ExportStl::Export( IGeomDB* pGDB, int nId, const string& sFile)
bool
ExportStl::ExportObject( const IGdbIterator& iIter)
{
switch ( iIter.GetGdbType()) {
case GDB_TY_GEO :
{
// recupero l'oggetto geometrico
const IGeoObj* pGeoObj = iIter.GetGeoObj() ;
if ( pGeoObj == nullptr)
return true ;
// recupero il riferimento globale dell'oggetto
Frame3d frFrame ;
if ( ! iIter.GetGlobFrame( frFrame))
return false ;
// recupero il livello dell'oggetto
int nLev = GDB_LV_USER ;
iIter.GetCalcLevel( nLev) ;
// recupero il modo dell'oggetto
int nMode = GDB_MD_STD ;
iIter.GetCalcMode( nMode) ;
// recupero lo stato dell'oggetto
int nStat = GDB_ST_ON ;
iIter.GetCalcStatus( nStat) ;
// se il filtro lo abilita
if ( TestFilter( nLev, nMode, nStat)) {
// recupero eventuale nome
// recupero il livello dell'oggetto
int nLev = GDB_LV_USER ;
iIter.GetCalcLevel( nLev) ;
// recupero il modo dell'oggetto
int nMode = GDB_MD_STD ;
iIter.GetCalcMode( nMode) ;
// recupero lo stato dell'oggetto
int nStat = GDB_ST_ON ;
iIter.GetCalcStatus( nStat) ;
int nType = iIter.GetGdbType() ;
// se il filtro lo abilita
if ( TestFilter( nLev, nMode, nStat, nType == GDB_TY_GROUP)) {
switch ( nType) {
case GDB_TY_GEO :
{
// recupero l'oggetto geometrico
const IGeoObj* pGeoObj = iIter.GetGeoObj() ;
if ( pGeoObj == nullptr)
return true ;
// recupero il riferimento globale dell'oggetto
Frame3d frFrame ;
if ( ! iIter.GetGlobFrame( frFrame))
return false ;
// recupero eventuale nome
string sName ;
if ( ! iIter.GetName( sName))
sName = ToString( iIter.GetId()) ;
// emetto l'oggetto
switch ( pGeoObj->GetType()) {
switch ( pGeoObj->GetType()) {
case SRF_TRIMESH :
if ( ! ExportSTM( sName, pGeoObj, frFrame))
return false ;
@@ -128,37 +128,69 @@ ExportStl::ExportObject( const IGdbIterator& iIter)
default :
break ;
}
}
}
return true ;
case GDB_TY_GROUP :
// esploro il gruppo
return ScanGroup( iIter) ;
default :
return false ;
}
return true ;
case GDB_TY_GROUP :
// esploro il gruppo
return ScanGroup( iIter) ;
default :
return false ;
}
}
return true ;
}
//----------------------------------------------------------------------------
bool
ExportStl::TestFilter( int nLev, int nMode, int nStat)
ExportStl::TestFilter( int nLev, int nMode, int nStat, bool bGroup)
{
if ( ( nLev == GDB_LV_USER && ( m_nFilter & EEXFLT_LEVUSER) == 0) ||
( nLev == GDB_LV_SYSTEM && ( m_nFilter & EEXFLT_LEVSYSTEM) == 0) ||
( nLev == GDB_LV_TEMP && ( m_nFilter & EEXFLT_LEVTEMP) == 0))
int nFilter = bGroup ? m_nGroupFilter : m_nFilter ;
if ( ( nLev == GDB_LV_USER && ( nFilter & EEXFLT_LEVUSER) == 0) ||
( nLev == GDB_LV_SYSTEM && ( nFilter & EEXFLT_LEVSYSTEM) == 0) ||
( nLev == GDB_LV_TEMP && ( nFilter & EEXFLT_LEVTEMP) == 0))
return false ;
if ( ( nMode == GDB_MD_STD && ( m_nFilter & EEXFLT_MODESTD) == 0) ||
( nMode == GDB_MD_LOCKED && ( m_nFilter & EEXFLT_MODELOCKED) == 0) ||
( nMode == GDB_MD_HIDDEN && ( m_nFilter & EEXFLT_MODEHIDDEN) == 0))
if ( ( nMode == GDB_MD_STD && ( nFilter & EEXFLT_MODESTD) == 0) ||
( nMode == GDB_MD_LOCKED && ( nFilter & EEXFLT_MODELOCKED) == 0) ||
( nMode == GDB_MD_HIDDEN && ( nFilter & EEXFLT_MODEHIDDEN) == 0))
return false ;
if ( ( nStat == GDB_ST_OFF && ( m_nFilter & EEXFLT_STAOFF) == 0) ||
( nStat == GDB_ST_ON && ( m_nFilter & EEXFLT_STAON) == 0) ||
( nStat == GDB_ST_SEL && ( m_nFilter & EEXFLT_STASEL) == 0))
if ( ( nStat == GDB_ST_OFF && ( nFilter & EEXFLT_STAOFF) == 0) ||
( nStat == GDB_ST_ON && ( nFilter & EEXFLT_STAON) == 0) ||
( nStat == GDB_ST_SEL && ( nFilter & EEXFLT_STASEL) == 0))
return false ;
return true ;
}
//----------------------------------------------------------------------------
bool
ExportStl::CalcGroupFilter( void)
{
m_nGroupFilter = 0 ;
// Status
if ( ( m_nFilter & EEXFLT_STASEL) != 0)
m_nGroupFilter += EEXFLT_STASEL + EEXFLT_STAOFF + EEXFLT_STAON ;
else if ( ( m_nFilter & EEXFLT_STAOFF) != 0)
m_nGroupFilter += EEXFLT_STAOFF + EEXFLT_STAON ;
else
m_nGroupFilter += EEXFLT_STAON ;
// Mode
if ( ( m_nFilter & EEXFLT_MODELOCKED) != 0)
m_nGroupFilter += EEXFLT_MODELOCKED + EEXFLT_MODEHIDDEN + EEXFLT_MODESTD ;
else if ( ( m_nFilter & EEXFLT_MODEHIDDEN) != 0)
m_nGroupFilter += EEXFLT_MODEHIDDEN + EEXFLT_MODESTD ;
else
m_nGroupFilter += EEXFLT_MODESTD ;
// Level
if ( ( m_nFilter & EEXFLT_LEVSYSTEM) != 0)
m_nGroupFilter += EEXFLT_LEVSYSTEM + EEXFLT_LEVTEMP + EEXFLT_LEVUSER ;
else if ( ( m_nFilter & EEXFLT_LEVTEMP) != 0)
m_nGroupFilter += EEXFLT_LEVTEMP + EEXFLT_LEVUSER ;
else
m_nGroupFilter += EEXFLT_LEVUSER ;
return true ;
}
//----------------------------------------------------------------------------
bool
ExportStl::ExportSFR( const string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame)
+7 -3
View File
@@ -28,16 +28,20 @@ class ExportStl : public IExportStl
virtual bool Export( IGeomDB* pGDB, int nId, const std::string& sFile) ;
public :
ExportStl( void) : m_nFilter( EEXFLT_DEFAULT) {}
ExportStl( void) : m_nFilter( EEXFLT_DEFAULT) {
CalcGroupFilter() ;
}
private :
bool ExportObject( const IGdbIterator& iIter) ;
bool ScanGroup( const IGdbIterator& iIter) ;
bool TestFilter( int nLev, int nMode, int nStat) ;
bool TestFilter( int nLev, int nMode, int nStat, bool bGroup) ;
bool CalcGroupFilter( void) ;
bool ExportSFR( const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame) ;
bool ExportSTM( const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame) ;
private :
int m_nFilter ; // filtro su livello, modo e stato
int m_nFilter ; // filtro su livello, modo e stato, se l'oggeto da valutare è un oggetto geometrico
int m_nGroupFilter ; // filtro su livello, modo e stato, se l'oggetto da valutare è un gruppo
Writer m_Writer ; // scrittore di file di testo
} ;
+179 -8
View File
@@ -28,8 +28,6 @@
#include "/EgtDev/Include/EGkGdbIterator.h"
#include "/EgtDev/Include/EGkStringUtils3d.h"
#include "/EgtDev/Include/EGnStringUtils.h"
#include "/EgtDev/Include/SELkKeyProc.h"
#include "/EgtDev/Include/EgtKeyCodes.h"
#include "/EgtDev/Include/EgtStringConverter.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
#include <fstream>
@@ -41,7 +39,7 @@ IExportSvg*
CreateExportSvg( void)
{
// verifico la chiave e le opzioni
if ( ! GetEExNetHwKey() && ! TestKeyForEEx( GetEExKey(), KEYOPT_EEX_EXPBASE, GetEExLogger()))
if ( ! VerifyKey( KEYOPT_EEX_EXPBASE))
return nullptr ;
// creo l'oggetto
return static_cast<IExportSvg*> ( new(nothrow) ExportSvg) ;
@@ -93,8 +91,8 @@ ExportSvg::Export( IGeomDB* pGDB, int nId, const string& sFile)
{ return a.second < b.second ; }) ;
// scrivo la sezione di intestazione
double dDimX = b3All.GetMax().x - b3All.GetMin().x ;
double dDimY = b3All.GetMax().y - b3All.GetMin().y ;
double dDimX = b3All.GetDimX() ;
double dDimY = b3All.GetDimY() ;
if ( ! ExportHeader( dDimX, dDimY))
bOk = false ;
@@ -189,6 +187,9 @@ ExportSvg::ExportHeader( double dDimX, double dDimY)
{
if ( ! m_Writer.OutText( "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"))
return false ;
const double MIN_DIM = 10 ;
dDimX = max( dDimX, MIN_DIM) ;
dDimY = max( dDimY, MIN_DIM) ;
const double COEFF = 0.05 ;
double dExtraX = COEFF * dDimX ;
double dExtraY = COEFF * dDimY ;
@@ -333,6 +334,18 @@ ExportSvg::ExportPoint( const string& sName, const Color& colObj, const IGeoObj*
return m_Writer.OutText( sOut) ;
}
//----------------------------------------------------------------------------
static bool
AddLink( const Point3d& ptStart, const Vector3d& vtDir, double dLen, const Frame3d& frFrame, ICRVLINEPOVECTOR& vLink)
{
if ( ! ptStart.IsValid() || vtDir.IsSmall() || abs( dLen) < 2 * EPS_SMALL)
return false ;
vLink.emplace_back( CreateCurveLine()) ;
vLink.back()->SetPVL( ptStart, vtDir, dLen) ;
vLink.back()->ToGlob( frFrame) ;
return true ;
}
//----------------------------------------------------------------------------
bool
ExportSvg::ExportLine( const string& sName, const Color& colObj, const IGeoObj* pGeoObj, const Frame3d& frFrame)
@@ -346,9 +359,34 @@ ExportSvg::ExportLine( const string& sName, const Color& colObj, const IGeoObj*
if ( IsNull( pMyLine))
return false ;
pMyLine->ToGlob( frFrame) ;
// eventuali curve per spessore e collegamenti
PtrOwner<ICurveLine> pMyLine2 ;
ICRVLINEPOVECTOR vMyLink ;
Vector3d vtExtr ; double dThick ;
if ( pLine->GetExtrusion( vtExtr) && ! vtExtr.IsSmallXY() &&
pLine->GetThickness( dThick) && abs( dThick) > EPS_SMALL) {
// curva sullo spessore
pMyLine2.Set( pLine->Clone()) ;
if ( IsNull( pMyLine2))
return false ;
pMyLine2->Translate( dThick * vtExtr) ;
pMyLine2->ToGlob( frFrame) ;
// collegamenti
for ( double dU = 0 ; dU < 1 + EPS_PARAM ; dU += 1) {
Point3d ptP ;
pLine->GetPointD1D2( dU, ICurve::FROM_MINUS, ptP) ;
AddLink( ptP, vtExtr, dThick, frFrame, vMyLink) ;
}
}
// porto nel piano XY globale (se si riduce ad un punto la salto)
if ( ! pMyLine->Scale( GLOB_FRM, 1, 1, 0))
return true ;
// trasformo anche l'eventuale copia
if ( ! IsNull( pMyLine2))
pMyLine2->Scale( GLOB_FRM, 1, 1, 0) ;
// trasformo anche gli eventuali collegamenti
for ( auto& pLink : vMyLink)
pLink->Scale( GLOB_FRM, 1, 1, 0) ;
// questo oggetto non può avere fill
bool bFill = false ;
// assegno tipo
@@ -361,6 +399,16 @@ ExportSvg::ExportLine( const string& sName, const Color& colObj, const IGeoObj*
sOut +=GetStartString( pMyLine) ;
// arco
sOut += GetCurveString( pMyLine) ;
// eventuale curva copia per spessore
if ( ! IsNull( pMyLine2)) {
sOut += GetStartString( pMyLine2) ;
sOut += GetCurveString( pMyLine2) ;
}
// eventuali collegamenti per spessore
for ( const auto& pLink : vMyLink) {
sOut += GetStartString( pLink) ;
sOut += GetCurveString( pLink) ;
}
// termino i dati geometrici
sOut += "\"" ;
// colore e spessore
@@ -379,18 +427,44 @@ ExportSvg::ExportArc( const string& sName, const Color& colObj, const IGeoObj* p
const ICurveArc* pArc = GetCurveArc( pGeoObj) ;
if ( pArc == nullptr)
return false ;
// lo inglobo in una curva composita e lo porto in globale
// lo copio e lo porto in globale
PtrOwner<ICurveComposite> pMyCompo( CreateCurveComposite()) ;
if ( IsNull( pMyCompo))
return false ;
pMyCompo->AddCurve( *pArc) ;
pMyCompo->ToGlob( frFrame) ;
// eventuali curve per spessore e collegamenti
PtrOwner<ICurveComposite> pMyCompo2 ;
ICRVLINEPOVECTOR vMyLink ;
Vector3d vtExtr ; double dThick ;
if ( pArc->GetExtrusion( vtExtr) && ! vtExtr.IsSmallXY() &&
pArc->GetThickness( dThick) && abs( dThick) > EPS_SMALL) {
// curva sullo spessore
pMyCompo2.Set( CreateCurveComposite()) ;
if ( IsNull( pMyCompo2))
return false ;
pMyCompo2->AddCurve( *pArc) ;
pMyCompo2->Translate( dThick * vtExtr) ;
pMyCompo2->ToGlob( frFrame) ;
// collegamenti
for ( double dU = 0 ; dU < 1 + EPS_PARAM ; dU += 0.25) {
Point3d ptP ;
pArc->GetPointD1D2( dU, ICurve::FROM_MINUS, ptP) ;
AddLink( ptP, vtExtr, dThick, frFrame, vMyLink) ;
}
}
// verifico se la curva giace in un piano parallelo a XY globale
Plane3d plPlane ;
if ( ! pMyCompo->IsFlat( plPlane, false, 10 * EPS_SMALL) ||
! AreSameOrOppositeVectorApprox( plPlane.GetVersN(), Z_AX)) {
// porto nel piano XY globale
pMyCompo->Scale( GLOB_FRM, 1, 1, 0) ;
// trasformo anche l'eventuale copia
if ( ! IsNull( pMyCompo2))
pMyCompo2->Scale( GLOB_FRM, 1, 1, 0) ;
// trasformo anche gli eventuali collegamenti
for ( auto& pLink : vMyLink)
pLink->Scale( GLOB_FRM, 1, 1, 0) ;
}
// assegno tipo
string sOut = " <path" ;
@@ -402,6 +476,16 @@ ExportSvg::ExportArc( const string& sName, const Color& colObj, const IGeoObj* p
sOut +=GetStartString( pMyCompo) ;
// arco
sOut += GetCurveString( pMyCompo) ;
// eventuale curva copia per spessore
if ( ! IsNull( pMyCompo2)) {
sOut += GetStartString( pMyCompo2) ;
sOut += GetCurveString( pMyCompo2) ;
}
// eventuali collegamenti per spessore
for ( const auto& pLink : vMyLink) {
sOut += GetStartString( pLink) ;
sOut += GetCurveString( pLink) ;
}
// termino i dati geometrici
sOut += "\"" ;
// colore e spessore
@@ -425,6 +509,25 @@ ExportSvg::ExportBezier( const string& sName, const Color& colObj, const IGeoObj
if ( IsNull( pMyBez))
return false ;
pMyBez->ToGlob( frFrame) ;
// eventuali curve per spessore e collegamenti
PtrOwner<ICurveBezier> pMyBez2 ;
ICRVLINEPOVECTOR vMyLink ;
Vector3d vtExtr ; double dThick ;
if ( pBez->GetExtrusion( vtExtr) && ! vtExtr.IsSmallXY() &&
pBez->GetThickness( dThick) && abs( dThick) > EPS_SMALL) {
// curva sullo spessore
pMyBez2.Set( pBez->Clone()) ;
if ( IsNull( pMyBez2))
return false ;
pMyBez2->Translate( dThick * vtExtr) ;
pMyBez2->ToGlob( frFrame) ;
// collegamenti
for ( double dU = 0 ; dU < 1 + EPS_PARAM ; dU += 0.25) {
Point3d ptP ;
pBez->GetPointD1D2( dU, ICurve::FROM_MINUS, ptP) ;
AddLink( ptP, vtExtr, dThick, frFrame, vMyLink) ;
}
}
// verifico se la curva giace in un piano parallelo a XY globale
Plane3d plPlane ;
if ( ! pMyBez->IsFlat( plPlane, false, 10 * EPS_SMALL) ||
@@ -432,6 +535,12 @@ ExportSvg::ExportBezier( const string& sName, const Color& colObj, const IGeoObj
// la porto nel piano XY globale (se si riduce ad un punto la salto)
if ( ! pMyBez->Scale( GLOB_FRM, 1, 1, 0))
return true ;
// trasformo anche l'eventuale copia
if ( ! IsNull( pMyBez2))
pMyBez2->Scale( GLOB_FRM, 1, 1, 0) ;
// trasformo anche gli eventuali collegamenti
for ( auto& pLink : vMyLink)
pLink->Scale( GLOB_FRM, 1, 1, 0) ;
}
// assegno tipo
string sOut = " <path" ;
@@ -443,6 +552,16 @@ ExportSvg::ExportBezier( const string& sName, const Color& colObj, const IGeoObj
sOut +=GetStartString( pMyBez) ;
// curva di Bezier
sOut += GetCurveString( pMyBez) ;
// eventuale curva copia per spessore
if ( ! IsNull( pMyBez2)) {
sOut += GetStartString( pMyBez2) ;
sOut += GetCurveString( pMyBez2) ;
}
// eventuali collegamenti per spessore
for ( const auto& pLink : vMyLink) {
sOut += GetStartString( pLink) ;
sOut += GetCurveString( pLink) ;
}
// termino i dati geometrici
sOut += "\"" ;
// colore e spessore
@@ -466,6 +585,42 @@ ExportSvg::ExportComposite( const string& sName, const Color& colObj, const IGeo
if ( IsNull( pMyCompo))
return false ;
pMyCompo->ToGlob( frFrame) ;
// eventuali curve per spessore e collegamenti
PtrOwner<ICurveComposite> pMyCompo2 ;
ICRVLINEPOVECTOR vMyLink ;
Vector3d vtExtr ; double dThick ;
if ( pCompo->GetExtrusion( vtExtr) && ! vtExtr.IsSmallXY() &&
pCompo->GetThickness( dThick) && abs( dThick) > EPS_SMALL) {
// curva sullo spessore
pMyCompo2.Set( pCompo->Clone()) ;
if ( IsNull( pMyCompo2))
return false ;
pMyCompo2->Translate( dThick * vtExtr) ;
pMyCompo2->ToGlob( frFrame) ;
// collegamenti
const ICurve* pSmpCrv = pCompo->GetFirstCurve() ;
while ( pSmpCrv != nullptr) {
// tipo di curva
int nType = pSmpCrv->GetType() ;
// step sui collegamenti a seconda del tipo
double dDelta = 1 ;
if ( nType == CRV_ARC)
dDelta = 0.5 ;
else if ( nType == CRV_BEZIER)
dDelta = 0.25 ;
// calcolo i collegamenti
for ( double dU = 0 ; dU < 1 - EPS_PARAM ; dU += dDelta) {
Point3d ptP ;
pSmpCrv->GetPointD1D2( dU, ICurve::FROM_MINUS, ptP) ;
AddLink( ptP, vtExtr, dThick, frFrame, vMyLink) ;
}
// passo alla curva successiva
pSmpCrv = pCompo->GetNextCurve() ;
}
Point3d ptEnd ;
pCompo->GetEndPoint( ptEnd) ;
AddLink( ptEnd, vtExtr, dThick, frFrame, vMyLink) ;
}
// verifico se la curva giace in un piano parallelo a XY globale
Plane3d plPlane ;
if ( ! pMyCompo->IsFlat( plPlane, false, 10 * EPS_SMALL) ||
@@ -473,6 +628,12 @@ ExportSvg::ExportComposite( const string& sName, const Color& colObj, const IGeo
// la porto nel piano XY globale (se si riduce ad un punto la salto)
if ( ! pMyCompo->Scale( GLOB_FRM, 1, 1, 0))
return true ;
// trasformo anche l'eventuale copia
if ( ! IsNull( pMyCompo2))
pMyCompo2->Scale( GLOB_FRM, 1, 1, 0) ;
// trasformo anche gli eventuali collegamenti
for ( auto& pLink : vMyLink)
pLink->Scale( GLOB_FRM, 1, 1, 0) ;
}
// assegno tipo
string sOut = " <path" ;
@@ -484,6 +645,16 @@ ExportSvg::ExportComposite( const string& sName, const Color& colObj, const IGeo
sOut += GetStartString( pMyCompo) ;
// curva composita
sOut += GetCurveString( pMyCompo) ;
// eventuale curva copia per spessore
if ( ! IsNull( pMyCompo2)) {
sOut += GetStartString( pMyCompo2) ;
sOut += GetCurveString( pMyCompo2) ;
}
// eventuali collegamenti per spessore
for ( const auto& pLink : vMyLink) {
sOut += GetStartString( pLink) ;
sOut += GetCurveString( pLink) ;
}
// termino i dati geometrici
sOut += "\"" ;
// colore e spessore
@@ -533,7 +704,7 @@ ExportSvg::ExportFlatRegion( const string& sName, const Color& colObj, const IGe
if ( IsNull( pMyCompo))
return false ;
pMyCompo->AddCurve( Release( pLoop)) ;
pLoop.Set( Release( pMyCompo)) ;
pLoop.Set( pMyCompo) ;
}
pLoop->Scale( GLOB_FRM, 1, 1, 0) ;
}
@@ -601,7 +772,7 @@ ExportSvg::ExportTriMesh( const string& sName, const Color& colObj, const IGeoOb
continue ;
POLYLINEVECTOR vPL ;
if ( ! pStm->GetFacetLoops( nF, vPL))
return false ;
continue ;
// ciclo sui loop di una faccia
for ( int nL = 0 ; nL < int( vPL.size()) ; ++ nL) {
PtrOwner<ICurveComposite> pLoop( CreateCurveComposite()) ;
+3023 -2631
View File
File diff suppressed because it is too large Load Diff
+62 -53
View File
@@ -1,12 +1,12 @@
//----------------------------------------------------------------------------
// EgalWare 2022-2022
//----------------------------------------------------------------------------
// File : ExportThreeJS.h Data : 05.07.22 Versione : 1.5h2
// File : ExportThreeJS.h Data : 05.07.22 Versione : 2.4j1
// Contenuto : Dichiarazione della classe ExportThreeJS.
//
//
//
// Modifiche : 08.07.22
// Modifiche : 19.10.22
//
//
//----------------------------------------------------------------------------
@@ -18,66 +18,75 @@
#include "/EgtDev/Include/EGkColor.h"
#include "/EgtDev/Include/EGkIntersSurfTmSurfTm.h"
class IGdbIterator;
class IGeoObj;
class Frame3d;
class IGdbIterator ;
class IGeoObj ;
class Frame3d ;
struct sSurfDist {
const ISurfTriMesh* SurvAlpha;
double dDistance = 0;
std::string sName;
const ISurfTriMesh* SurvAlpha ;
double dDistance = 0 ;
std::string sName ;
};
//----------------------------------------------------------------------------
class ExportThreeJS : public IExportThreeJS
{
public:
virtual bool SetOptions(int nFilter);
virtual bool Export(IGeomDB* pGDB, int nId, const std::string& sFile, IEGrScene* pScene, bool bUdm);
public:
virtual bool SetOptions( int nFilter) ;
virtual bool Export( IGeomDB* pGDB, int nId, IEGrScene* pScene, bool bUdm, const std::string& sFile) ;
public:
ExportThreeJS(void) : m_nFilter(EEXFLT_DEFAULT) {}
public:
ExportThreeJS( void) : m_nFilter( EEXFLT_DEFAULT), m_bShowGrid( true), m_nGroupCount( -1), m_nCont( 0) {
CalcGroupFilter() ;
}
private:
bool HeadAmbient( IEGrScene* pScene, IGeomDB* pGDB, int nId) ;
bool FinishAmbient() ;
bool ExportVector3D( const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color& cCol, const int nIdGroup) ;
bool ExportPoint3D( const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color& cCol, const int nIdGroup) ;
bool ExportFrame3D( const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color& cCol, const int nIdGroup) ;
bool ExportLine3D( const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color& cCol, const int nIdGroup) ;
bool ExportCurveComp3D( const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color& cCol, const int nIdGroup) ; //archi e curve composite
bool ExportSTM( const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color& cCol, const int nIdGroup) ;
bool ExportSFR( const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color& cCol, const int nIdGroup) ;
bool ExportSBezier(const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color& cCol, const int nIdGroup) ;
bool ExportText( const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color& cCol, const int nIdGroup) ;
bool ExportDimension( const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color& cCol, const int nIdGroup) ;
bool ScanGroup( const IGdbIterator& iIter, IGeomDB* pGDB, const int nIdGroup) ;
bool ExportObject( const IGdbIterator& iIter, IGeomDB* pGDB, const int nIdGroup) ;
bool TestFilter( int nLev, int nMode, int nStat) ;
private:
bool HeadAmbient( IEGrScene* pScene, IGeomDB* pGDB, int nId) ;
bool FinishAmbient( void) ;
bool CompressAll( const std::string& sFile) ;
bool ExportVector3D( const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color& cCol, const int nIdGroup) ;
bool ExportPoint3D( const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color& cCol, const int nIdGroup) ;
bool ExportFrame3D( const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color& cCol, const int nIdGroup) ;
bool ExportLine3D( const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color& cCol, const int nIdGroup) ;
bool ExportCurveComp3D( const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color& cCol, const int nIdGroup) ;
bool ExportSTM( const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color& cCol, const int nIdGroup) ;
bool ExportSFR( const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color& cCol, const int nIdGroup) ;
bool ExportSBezier(const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color& cCol, const int nIdGroup) ;
bool ExportText( const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color& cCol, const int nIdGroup) ;
bool ExportDimension( const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color& cCol, const int nIdGroup) ;
bool ScanGroup( const IGdbIterator& iIter, IGeomDB* pGDB, const int nIdGroup) ;
bool ExportObject( const IGdbIterator& iIter, IGeomDB* pGDB, const int nIdGroup) ;
bool TestFilter( int nLev, int nMode, int nStat, bool bGroup) ;
bool CalcGroupFilter( void) ;
private:
int m_nFilter; // filtro su livello, modo e stato
Writer m_Writer; // scrittore di file di testo oggetto
Point3d m_ptMin; // punto minimo del box3d
bool m_bUdm_mm; // se l'unità di misura è in mm
double m_dimX; // dimX Box3d Global
double m_dimY; // dimY Box3d Global
double m_dimZ; // dimZ Box3d Global
double m_dDistance; // scala per pan e zoom
int m_nCont = 0; // contatore per linee interne ai testi
Point3d m_ptCamera; // Camera look at
Point3d m_ptCenter; // Camera center
double m_dHalfWidth; // Lunghezza/2 piano di proiezione (culling)
double m_dHalfHeight; // Altezza/2 piano di proiezione (culling)
double m_ZNear; // Distanza (lungo Z) piano di proiezione da origine (culling)
double m_ZFar; // Distanza (lungo Z) piano di culling da origine (culling)
int m_ANG_TOL_STD_DEG = 15; // Interpolazione testo
Frame3d m_frTHREEJSFrame; // frame di ThreeJS
std::list< sSurfDist> m_lTranspSurf; // Lista di superfici trasparenti
int m_nGroupCount = -1; // Contatore del gruppo
std::string m_sCodMenu; // Stringa per la creazione del menu laterale della scena
std::string m_spath; // Path dove salvare il file
std::string m_sUdm; // udm della scena
};
private:
int m_nFilter ; // filtro su livello, modo e stato, se l'oggeto da valutare è un oggetto geometrico
int m_nGroupFilter ; // filtro su livello, modo e stato, se l'oggetto da valutare è un gruppo
Point3d m_ptMin ; // Punto minimo del box3d
double m_dimX ; // DimX Box3d Global
double m_dimY ; // DimY Box3d Global
double m_dimZ ; // DimZ Box3d Global
double m_dDistance ; // Scala per pan e zoom
Point3d m_ptCamera ; // Camera position
Point3d m_ptCenter ; // Camera look at
double m_dHalfWidth ; // Semilunghezza piano di proiezione (culling)
double m_dHalfHeight ; // Semialtezza piano di proiezione (culling)
double m_dZNear ; // Distanza (lungo Z) piano di proiezione da origine (culling)
double m_dZFar ; // Distanza (lungo Z) piano di culling da origine (culling)
double m_dCameraPhi ; // Angolo phi in coordinate polari della telecamera [0,180]
double m_dCameraTheta ; // Angolo Theta in coordinate polari della telecamera [0, 360)
Frame3d m_frTHREEJSFrame ; // Frame di ThreeJS
bool m_bShowGrid ; // Flag di esportazione griglia di scena
bool m_bUdm_mm ; // Flag unità di misura in mm
std::string m_sUdm ; // Stringa per unità di misura della scena
int m_nGroupCount ; // Contatore del gruppo
int m_nCont ; // contatore per linee interne ai testi
std::vector< sSurfDist> m_vTranspSurf ; // Vettore di superfici trasparenti
std::string m_sCodMenu ; // Stringa per la creazione del menu laterale della scena
Writer m_Writer ; // Scrittore di file di testo oggetto
public :
static std::string m_sThreeJSLibDir ; // Direttorio librerie
} ;
+105 -215
View File
@@ -17,10 +17,8 @@
#include "stdafx.h"
#include "Import3MF.h"
#include "DllMain.h"
#include "pugixml.hpp"
#include "/EgtDev/Include/EExDllMain.h"
#include "/EgtDev/Include/EGkStmFromTriangleSoup.h"
#include "/EgtDev/Extern/libzip/Include/zip.h"
#include "/EgtDev/Include/EGkSurfTriMesh.h"
using namespace std ;
using namespace Lib3MF ;
@@ -29,16 +27,16 @@ using namespace Lib3MF ;
IImport3MF*
CreateImport3MF( void)
{
// verifico la chiave e le opzioni
if ( ! GetEExNetHwKey() && ! TestKeyForEEx( GetEExKey(), KEYOPT_EEX_INPBASE, GetEExLogger()))
// verifico la chiave e le opzioni
if ( ! VerifyKey( KEYOPT_EEX_INPBASE))
return nullptr ;
// creo l'oggetto
// creo l'oggetto
return static_cast<IImport3MF*> ( new( nothrow) Import3MF) ;
}
//----------------------------------------------------------------------------
bool
Import3MF::Import( const string& sFile, IGeomDB* pGDB, int nIdGroup)
Import3MF::Import( const string& sFile, IGeomDB* pGDB, int nIdGroup, int nFlag)
{
LOG_INFO( GetEExLogger(), ( "Import3MF : " + sFile).c_str()) ;
@@ -55,7 +53,10 @@ Import3MF::Import( const string& sFile, IGeomDB* pGDB, int nIdGroup)
return false ;
}
m_nIdGroup = nIdGroup ;
// imposto le opzioni di importazione
m_nFlag = nFlag ;
try {
if ( ! DoImport( sFile))
return false ;
@@ -73,15 +74,15 @@ bool
Import3MF::DoImport( const string& sFile)
{
// libreria 3MF
PWrapper m_wrapper = CWrapper::loadLibrary() ;
if ( ! m_wrapper) {
m_wrapper = CWrapper::loadLibrary() ;
if ( m_wrapper == nullptr) {
LOG_ERROR( GetEExLogger(), " Import3MF : Error on lib3mf Wrapper") ;
return false ;
}
// creazione del 3MF model
m_model = m_wrapper->CreateModel() ;
if ( ! m_model) {
if ( m_model == nullptr) {
LOG_ERROR( GetEExLogger(), " Import3MF : Error on lib3mf Model") ;
return false ;
}
@@ -89,33 +90,34 @@ Import3MF::DoImport( const string& sFile)
// lettura file
PReader reader = m_model->QueryReader( "3mf") ;
reader->ReadFromFile( sFile) ;
for ( Lib3MF_uint32 iWarning = 0 ; iWarning < reader->GetWarningCount() ; iWarning ++) {
for ( Lib3MF_uint32 nWarning = 0 ; nWarning < reader->GetWarningCount() ; nWarning ++) {
Lib3MF_uint32 nErrorCode ;
string sWarningMsg = reader->GetWarning( iWarning, nErrorCode) ;
string sErrorMsg = " Reading 3MF file encountered warning # " + to_string( nErrorCode) + " : " + sWarningMsg ;
string sWarningMsg = reader->GetWarning( nWarning, nErrorCode) ;
string sErrorMsg = " Reading 3MF file encountered warning # " + to_string( nErrorCode) + " : " + sWarningMsg ;
LOG_ERROR( GetEExLogger(), sErrorMsg.c_str()) ;
}
switch ( m_model->GetUnit()) {
case eModelUnit::MicroMeter :
m_nScaleFactor = 0.001 ;
m_dScaleFactor = 0.001 ;
break ;
case eModelUnit::MilliMeter :
m_nScaleFactor = 1.0 ;
m_dScaleFactor = 1.0 ;
break ;
case eModelUnit::CentiMeter :
m_nScaleFactor = 10.0 ;
m_dScaleFactor = 10.0 ;
break ;
case eModelUnit::Inch :
m_nScaleFactor = 25.4 ;
m_dScaleFactor = 25.4 ;
break ;
case eModelUnit::Foot :
m_nScaleFactor = 304.8 ;
m_dScaleFactor = 304.8 ;
break ;
case eModelUnit::Meter :
m_nScaleFactor = 1000.0 ;
m_dScaleFactor = 1000.0 ;
break ;
default:
m_nScaleFactor = 1.0 ;
m_dScaleFactor = 1.0 ;
}
// analisi metadata
@@ -123,83 +125,54 @@ Import3MF::DoImport( const string& sFile)
Lib3MF_uint32 nMetaDataCount = metaDataGrp->GetMetaDataCount() ;
for ( Lib3MF_uint32 i = 0 ; i < nMetaDataCount ; i ++) {
PMetaData metaData = metaDataGrp->GetMetaData( i) ;
string sMetaDataValue = metaData->GetValue() ;
string sMetaDataName = metaData->GetName() ;
if ( ! sMetaDataValue.empty() && ! sMetaDataName.empty())
m_pGDB->SetInfo( m_nIdGroup, sMetaDataName, sMetaDataValue) ;
string sName = metaData->GetName() ;
string sValue = metaData->GetValue() ;
if ( ! sName.empty() && ! sValue.empty())
m_pGDB->SetInfo( m_nIdGroup, sName, sValue) ;
}
// scorro gli items nel build node
PBuildItemIterator pBuildItemsIter = m_model->GetBuildItems() ;
while ( pBuildItemsIter->MoveNext()) {
if ( ! ReadItem( pBuildItemsIter->GetCurrent()))
return false ;
PBuildItem pItem = pBuildItemsIter->GetCurrent() ;
// ignoro i suoi attributes e i suoi metadata
// recupero la sua trasformazione
sTransform sTransf = pItem->GetObjectTransform() ;
// lettura oggetto associato
if ( ! ReadObject( pItem->GetObjectResource(), sTransf, m_nIdGroup))
return false ;
}
return true ;
}
//----------------------------------------------------------------------------------------------------
bool
Import3MF::ReadItem( const PBuildItem pItem)
{
if ( ! pItem)
return false ;
// trasformazione
sTransform sTransf = pItem->GetObjectTransform() ;
// attributes
ATTRVECTOR vAttr ;
string sProp = pItem->GetPartNumber() ;
if ( ! sProp.empty())
vAttr.push_back( make_pair( "Item partnumber", pItem->GetPartNumber())) ;
bool bUUID ;
sProp = pItem->GetUUID( bUUID) ;
if ( bUUID)
vAttr.push_back( make_pair( "Item UUID", sProp)) ;
// metadata
PMetaDataGroup pMetaDataGrp = pItem->GetMetaDataGroup() ;
if ( pMetaDataGrp)
ReadMetaDataGroup( pMetaDataGrp, vAttr, Item) ;
// lettura oggetto associato
return ReadObject( pItem->GetObjectResource(), vAttr, sTransf) ;
}
//-------------------------------------------------------------------------------------------------
bool
Import3MF::ReadObject( const PObject pObj, ATTRVECTOR& vAttr, sTransform& sTransf)
Import3MF::ReadObject( const PObject pObj, const sTransform& Transform, int nParentId)
{
if ( ! pObj)
if ( pObj == nullptr)
return false ;
bool bMeshObj = pObj->IsMeshObject() ;
// attributes
string sProp = pObj->GetName() ;
INFOVECTOR vInfo ;
string sName = pObj->GetName() ;
string sProp = pObj->GetPartNumber() ;
if ( ! sProp.empty())
vAttr.push_back( make_pair( "name", sProp)) ;
sProp = pObj->GetPartNumber() ;
if ( ! sProp.empty())
vAttr.push_back( make_pair( "partnumber", sProp)) ;
vInfo.emplace_back( "PartNumber", sProp) ;
bool bUUID = false ;
sProp = pObj->GetUUID( bUUID) ;
if ( bUUID) {
string sPropName = bMeshObj ? "UUID" : "object UUID" ;
vAttr.push_back( make_pair( sPropName, sProp)) ;
}
if ( bUUID)
vInfo.emplace_back( "UUID", sProp) ;
switch ( pObj->GetType()) {
case eObjectType::Model :
vAttr.push_back( make_pair( "type", "Model")) ;
vInfo.emplace_back( "Type", "Model") ;
break ;
case eObjectType::Support :
vAttr.push_back( make_pair( "type", "Support")) ;
vInfo.emplace_back( "Type", "Support") ;
break ;
case eObjectType::SolidSupport :
vAttr.push_back( make_pair( "type", "SolidSupport")) ;
vInfo.emplace_back( "Type", "SolidSupport") ;
break ;
default :
break ;
@@ -207,29 +180,34 @@ Import3MF::ReadObject( const PObject pObj, ATTRVECTOR& vAttr, sTransform& sTrans
// metadata
PMetaDataGroup pMetaDataGrp = pObj->GetMetaDataGroup() ;
if ( pMetaDataGrp)
ReadMetaDataGroup( pMetaDataGrp, vAttr, bMeshObj ? Mesh : Component) ;
for ( Lib3MF_uint32 i = 0 ; i < pMetaDataGrp->GetMetaDataCount() ; i ++) {
PMetaData metaData = pMetaDataGrp->GetMetaData( i) ;
string sMetaDataName = metaData->GetName() ;
string sMetaDataValue = metaData->GetValue() ;
if ( ! sMetaDataName.empty() && ! sMetaDataValue.empty())
vInfo.emplace_back( sMetaDataName, sMetaDataValue) ;
}
if ( pObj->IsMeshObject())
return ReadMesh( pObj->GetResourceID(), vAttr, sTransf) ;
return ReadMesh( pObj->GetResourceID(), sName, vInfo, Transform, nParentId) ;
else if ( pObj->IsComponentsObject())
return ReadComponents( pObj->GetResourceID(), vAttr, sTransf) ;
return ReadComponent( pObj->GetResourceID(), sName, vInfo, Transform, nParentId) ;
return false ;
}
//----------------------------------------------------------------------------------------------------------------
bool
Import3MF::ReadMesh( const Lib3MF_uint32& nId, ATTRVECTOR& vAttr, sTransform& sTransf)
Import3MF::ReadMesh( Lib3MF_uint32 nId, const string& sName, const INFOVECTOR& vInfo, const sTransform& Transform, int nParentId)
{
// Recupero puntatore alla mesh 3MF
PMeshObject pMesh = m_model->GetMeshObjectByID( nId) ;
if ( pMesh.get() == nullptr)
if ( pMesh == nullptr)
return false ;
// Creo e inizializzo trimesh
PtrOwner<ISurfTriMesh> pStm( CreateSurfTriMesh()) ;
if ( IsNull( pStm) || ! pStm->Init( 3, 1)) {
if ( IsNull( pStm) || ! pStm->Init( pMesh->GetVertexCount(), pMesh->GetTriangleCount())) {
LOG_ERROR( GetEExLogger(), " Error reading 3MF mesh : ISurfTriMesh Create error") ;
return false ;
}
@@ -242,15 +220,15 @@ Import3MF::ReadMesh( const Lib3MF_uint32& nId, ATTRVECTOR& vAttr, sTransform& sT
// applico la trasformazione
double x = 0.0, y = 0.0, z = 0.0 ;
for ( int k = 0 ; k < 3 ; k ++) {
x += pVertex.m_Coordinates[k] * sTransf.m_Fields[k][0] ;
y += pVertex.m_Coordinates[k] * sTransf.m_Fields[k][1] ;
z += pVertex.m_Coordinates[k] * sTransf.m_Fields[k][2] ;
x += pVertex.m_Coordinates[k] * Transform.m_Fields[k][0] ;
y += pVertex.m_Coordinates[k] * Transform.m_Fields[k][1] ;
z += pVertex.m_Coordinates[k] * Transform.m_Fields[k][2] ;
}
x += sTransf.m_Fields[3][0] ;
y += sTransf.m_Fields[3][1] ;
z += sTransf.m_Fields[3][2] ;
x += Transform.m_Fields[3][0] ;
y += Transform.m_Fields[3][1] ;
z += Transform.m_Fields[3][2] ;
// inserisco il vertice nella trimesh
if ( pStm->AddVertex( Point3d( x, y, z)) == SVT_NULL) {
if ( pStm->AddVertex( Point3d( x, y, z) * m_dScaleFactor) == SVT_NULL) {
LOG_ERROR( GetEExLogger(), " Error reading 3MF mesh : ISurfTriMesh AddVertex error") ;
return false ;
}
@@ -277,7 +255,7 @@ Import3MF::ReadMesh( const Lib3MF_uint32& nId, ATTRVECTOR& vAttr, sTransform& sT
}
// Inserimento nel DB geometrico
int nGeoId = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nIdGroup, Release( pStm)) ;
int nGeoId = m_pGDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pStm)) ;
if ( nGeoId == GDB_ID_NULL) {
LOG_ERROR( GetEExLogger(), " Error reading 3MF mesh : error adding GeoObject") ;
return false ;
@@ -292,125 +270,65 @@ Import3MF::ReadMesh( const Lib3MF_uint32& nId, ATTRVECTOR& vAttr, sTransform& sT
}
// attributes
for ( size_t i = 0 ; i < vAttr.size() ; i++) {
if ( vAttr[i].first == "name")
m_pGDB->SetName( nGeoId, vAttr[i].second) ;
else
m_pGDB->SetInfo( nGeoId, vAttr[i].first, vAttr[i].second) ;
}
if ( ! sName.empty())
m_pGDB->SetName( nGeoId, sName) ;
for ( int i = 0 ; i < int( vInfo.size()) ; i++)
m_pGDB->SetInfo( nGeoId, vInfo[i].first, vInfo[i].second) ;
return true ;
#if 0
PMeshObject pMesh = m_model->GetMeshObjectByID( nId) ;
StmFromTriangleSoup Stm ;
if ( ! Stm.Start()) {
LOG_ERROR( GetEExLogger(), " Error reading 3MF mesh : StmFromTriangleSoup error") ;
return false ;
}
// vertici
vector<Point3d> vVertices( pMesh->GetVertexCount()) ;
for ( Lib3MF_uint32 i = 0 ; i < pMesh->GetVertexCount() ; i ++) {
sPosition pVertex = pMesh->GetVertex( i) ;
// applico la trasformazione
double x = 0.0, y = 0.0, z = 0.0 ;
for ( Lib3MF_uint32 k = 0 ; k < 3 ; k ++) {
x += pVertex.m_Coordinates[k] * sTransf.m_Fields[k][0] ;
y += pVertex.m_Coordinates[k] * sTransf.m_Fields[k][1] ;
z += pVertex.m_Coordinates[k] * sTransf.m_Fields[k][2] ;
}
x += sTransf.m_Fields[3][0] ;
y += sTransf.m_Fields[3][1] ;
z += sTransf.m_Fields[3][2] ;
Point3d pt( x, y, z) ;
vVertices[i] = pt * m_nScaleFactor ;
}
// triangoli
for ( Lib3MF_uint32 i = 0 ; i < pMesh->GetTriangleCount() ; i ++) {
sTriangle tTrg = pMesh->GetTriangle( i) ;
if ( ! Stm.AddTriangle( vVertices[tTrg.m_Indices[0]], vVertices[tTrg.m_Indices[1]], vVertices[tTrg.m_Indices[2]])) {
LOG_ERROR( GetEExLogger(), " Error reading 3MF mesh : StmFromTriangleSoup AddTriangle error") ;
return false ;
}
}
if ( ! Stm.End()) {
LOG_ERROR( GetEExLogger(), " Error reading 3MF mesh : StmFromTriangleSoup error") ;
return false ;
}
ISurfTriMesh* pSurf = Stm.GetSurf() ;
if ( pSurf == nullptr) {
LOG_ERROR( GetEExLogger(), " Error reading 3MF mesh : StmFromTriangleSoup GetSurf error") ;
return false ;
}
int nGeoId = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nIdGroup, pSurf) ;
if ( nGeoId == GDB_ID_NULL) {
LOG_ERROR( GetEExLogger(), " Error reading 3MF mesh : error adding GeoObject") ;
return false ;
}
// colore
Lib3MF_uint32 pid, pindex ;
if ( pMesh->GetObjectLevelProperty( pid, pindex)) {
Color cCol ;
if ( FindColor( pid, pindex, cCol))
m_pGDB->SetMaterial( nGeoId, cCol) ;
}
// attributes
for ( size_t i = 0 ; i < vAttr.size() ; i++) {
if ( vAttr[i].first == "name")
m_pGDB->SetName( nGeoId, vAttr[i].second) ;
else
m_pGDB->SetInfo( nGeoId, vAttr[i].first, vAttr[i].second) ;
}
return true ;
#endif
}
//-----------------------------------------------------------------------------------
bool
Import3MF::ReadComponents( const Lib3MF_uint32& nId, ATTRVECTOR& attributes, sTransform& sTransfItem)
Import3MF::ReadComponent( Lib3MF_uint32 nId, const string& sName, const INFOVECTOR& vInfo, const sTransform& Transform, int nParentId)
{
PComponentsObject pComponents = m_model->GetComponentsObjectByID( nId) ;
// se va conservata la gerarchia ogni componente corrisponde ad un layer, altrimenti gli elementi della componente vengono
// inseriti direttamente in m_nIdGroup e i suoi attributes vengono ignorati
// Scorro tutte le componenti
for ( Lib3MF_uint32 iC = 0 ; iC < pComponents->GetComponentCount() ; iC ++ ) {
PComponentsObject pComponents = m_model->GetComponentsObjectByID( nId) ;
if ( pComponents == nullptr)
return false ;
int nLayerId = nParentId ;
// se importo gerarchia creo il layer corrispondente alla componente
if ( ( m_nFlag & EI3FLAG_KEEP_GROUPS) != 0) {
nLayerId = m_pGDB->AddGroup( GDB_ID_NULL, nParentId, GLOB_FRM) ;
// assegno nome e info
if ( ! sName.empty())
m_pGDB->SetName( nLayerId, sName) ;
for ( int i = 0 ; i < int( vInfo.size()) ; i++)
m_pGDB->SetInfo( nLayerId, vInfo[i].first, vInfo[i].second) ;
}
// scorro tutti i suoi oggetti
for ( Lib3MF_uint32 nC = 0 ; nC < pComponents->GetComponentCount() ; nC++) {
PComponent pComponent = pComponents->GetComponent( iC) ;
sTransform sTransfComp = pComponent->GetTransform() ;
// combino le trasformazioni
sTransform sTransfRes ;
// inizializzo sTransfRes a zero
PComponent pComponent = pComponents->GetComponent( nC) ;
// combino le trasformazioni
sTransform TransfComp = pComponent->GetTransform() ;
sTransform TransfRes ;
// inizializzo TransfRes a zero
for ( Lib3MF_uint32 i = 0 ; i < 4 ; i++)
fill( sTransfRes.m_Fields[i], sTransfRes.m_Fields[i] + 3, ( Lib3MF_single)0.0) ;
fill( TransfRes.m_Fields[i], TransfRes.m_Fields[i] + 3, ( Lib3MF_single) 0.0) ;
for ( Lib3MF_uint32 i = 0 ; i < 4 ; i ++)
for ( Lib3MF_uint32 j = 0 ; j < 3 ; j++)
for ( Lib3MF_uint32 k = 0 ; k < 3 ; k ++)
sTransfRes.m_Fields[i][j] += sTransfComp.m_Fields[i][k] * sTransfItem.m_Fields[k][j] ; // prodotto fra matrici
TransfRes.m_Fields[i][j] += TransfComp.m_Fields[i][k] * Transform.m_Fields[k][j] ; // prodotto fra matrici
for ( Lib3MF_uint32 j = 0 ; j < 3 ; j ++)
sTransfRes.m_Fields[3][j] += sTransfItem.m_Fields[3][j] ;
TransfRes.m_Fields[3][j] += Transform.m_Fields[3][j] ;
if ( ! ReadObject( pComponent->GetObjectResource(), attributes, sTransfRes))
if ( ! ReadObject( pComponent->GetObjectResource(), TransfRes, nLayerId))
return false ;
}
return true ;
}
//------------------------------------------------------------------------------------
bool
Import3MF::FindColor( const Lib3MF_uint32& pid, const Lib3MF_uint32& pindex, Color& cCol)
Import3MF::FindColor( Lib3MF_uint32 pid, Lib3MF_uint32 pindex, Color& cCol) const
{
sColor sCol ;
@@ -433,12 +351,12 @@ Import3MF::FindColor( const Lib3MF_uint32& pid, const Lib3MF_uint32& pindex, Col
// multiproperty corrispondente a pindex
UINTVECTOR pindices ;
pMultiPropGrp->GetMultiProperty( pindex, pindices) ;
// analizzo i layers alla ricerca di una proprietà che definisca un colore
// analizzo i layers alla ricerca di una proprietà che definisca un colore
Lib3MF_uint32 nLayers = pMultiPropGrp->GetLayerCount() ;
for ( Lib3MF_uint32 i = 0 ; i < nLayers ; i ++) {
sMultiPropertyLayer layer = pMultiPropGrp->GetLayer( i) ;
Lib3MF_uint32 pidLayer = layer.m_ResourceID ;
// appena trovo una propietà che definisce un colore mi fermo
// appena trovo una propietà che definisce un colore mi fermo
if ( m_model->GetPropertyTypeByID( pidLayer) == ePropertyType::BaseMaterial ||
m_model->GetPropertyTypeByID( pidLayer) == ePropertyType::Colors)
return FindColor( pidLayer, pindices[i], cCol) ;
@@ -455,19 +373,19 @@ Import3MF::FindColor( const Lib3MF_uint32& pid, const Lib3MF_uint32& pindex, Col
// check sui valori in vComposite
double dMixSum = 0.0 ;
for( size_t i = 0 ; i < vComposite.size(); i ++)
for( int i = 0 ; i < int( vComposite.size()) ; i ++)
dMixSum += vComposite[i].m_MixingRatio ;
// se fossero tutti zero, considero proporzioni uguali per ogni colore
if ( abs( dMixSum) < EPS_SMALL) {
dMixSum = vComposite.size() ;
for ( size_t i = 0 ; i < vComposite.size() ; i++)
for ( int i = 0 ; i < int( vComposite.size()) ; i++)
vComposite[i].m_MixingRatio = 1 ;
}
double dRed = 0.0, dGreen = 0.0, dBlue = 0.0, dAlpha = 0.0 ; // colore finale
Lib3MF_uint8 nRedTmp, nGreenTmp, nBlueTmp, nAlphaTmp ; // colore del BaseMaterial
// per ogni elemento di composite aggiungo il suo colore con l'opportuno coefficiente
for ( size_t i = 0 ; i < vComposite.size() ; i++) {
for ( int i = 0 ; i < int( vComposite.size()) ; i++) {
sCol = pBaseMatGrp->GetDisplayColor( vComposite[i].m_PropertyID) ;
m_wrapper->ColorToRGBA( sCol, nRedTmp, nGreenTmp, nBlueTmp, nAlphaTmp) ;
double dMixingRatio = vComposite[i].m_MixingRatio / dMixSum ;
@@ -492,31 +410,3 @@ Import3MF::FindColor( const Lib3MF_uint32& pid, const Lib3MF_uint32& pindex, Col
return true ;
}
//----------------------------------------------------------------------------------------------------
bool
Import3MF::ReadMetaDataGroup( const PMetaDataGroup pMetaDataGrp, ATTRVECTOR& vAttr, const MDGCaller& caller)
{
for ( Lib3MF_uint32 i = 0 ; i < pMetaDataGrp->GetMetaDataCount() ; i ++) {
PMetaData metaData = pMetaDataGrp->GetMetaData( i) ;
string sMetaDataValue = metaData->GetValue() ;
if ( sMetaDataValue.empty())
continue ;
string sMetaDataName ;
switch ( caller) {
case Item :
sMetaDataName = "Item " ;
break ;
case Component :
sMetaDataName = "Object " ;
break ;
case Mesh :
sMetaDataName = "" ;
}
sMetaDataName += metaData->GetName() ;
vAttr.push_back( make_pair( sMetaDataName, sMetaDataValue)) ;
}
return true ;
}
+16 -19
View File
@@ -13,39 +13,36 @@
#pragma once
#include <unordered_map>
#include "/EgtDev/Include/EExImport3MF.h"
#include "pugixml.hpp"
#include "/EgtDev/Extern/libzip/Include/zip.h"
#define NOMINMAX
#include "/EgtDev/Extern/Lib3MF/Include/lib3mf_implicit.hpp"
#include "/EgtDev/Include/EExImport3MF.h"
#include "/EgtDev/Extern/lib3MF/Include/lib3mf_implicit.hpp"
#include <unordered_map>
//----------------------------------------------------------------------------
class Import3MF : public IImport3MF
{
private :
typedef std::vector<std::pair<std::string, std::string>> ATTRVECTOR ;
enum MDGCaller { Item = 0, Component = 1, Mesh = 2 } ;
typedef std::vector<std::pair<std::string, std::string>> INFOVECTOR ;
public :
virtual bool Import( const std::string& sFile, IGeomDB* pGDB, int nIdGroup) ;
virtual bool Import( const std::string& sFile, IGeomDB* pGDB, int nIdGroup, int nFlag = 0) ;
private :
bool DoImport( const std::string& sFile) ;
bool ReadItem( const Lib3MF::PBuildItem item) ;
bool ReadObject( const Lib3MF::PObject pObj, ATTRVECTOR& vAttr, Lib3MF::sTransform& sTransf) ;
bool ReadComponents( const Lib3MF_uint32& nId, ATTRVECTOR& vAttr, Lib3MF::sTransform& sTransfItem) ;
bool ReadMesh( const Lib3MF_uint32& nId, ATTRVECTOR& vAttr, Lib3MF::sTransform& sTransfr) ;
bool ReadMetaDataGroup( const Lib3MF::PMetaDataGroup pMetaDataGrp, ATTRVECTOR& vAttr, const MDGCaller& caller) ;
bool FindColor( const Lib3MF_uint32& pid, const Lib3MF_uint32& pindex, Color& cCol) ;
bool ReadObject( const Lib3MF::PObject pObj, const Lib3MF::sTransform& Transform, int nParentId) ;
bool ReadComponent( Lib3MF_uint32 nId, const std::string& sName, const INFOVECTOR& vInfo, const Lib3MF::sTransform& Transform,
int nParentId) ;
bool ReadMesh( Lib3MF_uint32 nId, const std::string& sName, const INFOVECTOR& vInfo, const Lib3MF::sTransform& Transfrorm,
int nParentId) ;
bool FindColor( Lib3MF_uint32 pid, Lib3MF_uint32 pindex, Color& cCol) const ;
private :
double m_nScaleFactor ;
private :
double m_dScaleFactor ;
IGeomDB* m_pGDB ;
int m_nIdGroup ;
int m_nFlag ;
Lib3MF::PWrapper m_wrapper ;
Lib3MF::PModel m_model ;
} ;
+66 -14
View File
@@ -20,9 +20,8 @@
#include "/EgtDev/Include/EGkStmStandard.h"
#include "/EgtDev/Include/EGkStringUtils3d.h"
#include "/EgtDev/Include/EGnFileUtils.h"
#include "/EgtDev/Include/EgtKeyCodes.h"
#include "/EgtDev/Include/EgtStringEncoder.h"
#include "/EgtDev/Include/EgtStringEncoder.h"
#include "/EgtDev/Include/EgtNumUtils.h"
using namespace std ;
@@ -34,12 +33,21 @@ SetBtlAuxDir( const string& sBtlAuxDir)
return ExistsDirectory( sBtlAuxDir) ;
}
//----------------------------------------------------------------------------
bool
SetBtlLuaData( const string& sLuaLibsDir, const string& sLuaLastRequire)
{
BtlGeom::m_sBtlLuaLibsDir = sLuaLibsDir ;
BtlGeom::m_sBtlLuaLastRequire = sLuaLastRequire ;
return ExistsDirectory( sLuaLibsDir) ;
}
//----------------------------------------------------------------------------
IImportBtl*
CreateImportBtl( void)
{
// verifico la chiave e le opzioni
if ( ! GetEExNetHwKey() && ! TestKeyForEEx( GetEExKey(), KEYOPT_EEX_INPADV, GetEExLogger()))
if ( ! VerifyKey( KEYOPT_EEX_INPADV))
return nullptr ;
// creo l'oggetto
return static_cast<IImportBtl*> ( new(nothrow) ImportBtl) ;
@@ -49,6 +57,7 @@ CreateImportBtl( void)
ImportBtl::ImportBtl( void)
{
m_nBuild = 10000 ;
m_nEdition = 0 ;
m_dScale = 1 ;
}
@@ -78,7 +87,8 @@ ImportBtl::Import( const string& sFile, IGeomDB* pGDB, int nFlag)
bool bSpecialTrim = (( nFlag & EIBFLAG_SPECIAL_TRIM) != 0) ;
bool bTrimWithOutline = (( nFlag & EIBFLAG_TRIM_WITH_OUTLINE) != 0) ;
bool bUseUAttr = (( nFlag & EIBFLAG_USEUATTR) != 0) ;
if ( ! m_BtlGeom.Init( pGDB, nFlatVertPos, bSpecialTrim, bTrimWithOutline, bUseUAttr)) {
bool bPartOffset = (( nFlag & EIBFLAG_PARTOFFSET) != 0) ;
if ( ! m_BtlGeom.Init( pGDB, nFlatVertPos, bSpecialTrim, bTrimWithOutline, bUseUAttr, bPartOffset, true)) {
LOG_ERROR( GetEExLogger(), " Error on BtlGeom.Init")
return false ;
}
@@ -156,6 +166,9 @@ ImportBtl::Import( const string& sFile, IGeomDB* pGDB, int nFlag)
m_BtlGeom.AdjustRefForRawParts() ;
m_BtlGeom.AdjustRefForComposites() ;
// verifica definizione e unicità SN ed eventuale sistemazione
m_BtlGeom.AdjustSnForParts() ;
// eventuale ordinamento degli oggetti secondo SN
bool bSort = (( nFlag & EIBFLAG_SORT) != 0) ;
if ( bSort) {
@@ -296,7 +309,7 @@ ImportBtl::ReadGeneral( bool& bEnd)
Trim( sVal, " \t\r\n\"") ;
int nUnit ;
if ( FromString( sVal, nUnit)) {
m_dScale = pow( 10, - nUnit) ;
m_dScale = Pow( 10, -nUnit) ;
++ nRead ;
}
m_BtlGeom.SetUserAttribute( UATD_INFO, sKey, sVal) ;
@@ -524,8 +537,14 @@ ImportBtl::ReadObject( ObjType nType, bool& bEnd)
m_BtlGeom.SetUserAttribute( UATD_PART, sKey, sVal) ;
break ;
case KEY_PART_PARTOFFSET : // offset pezzo
Trim( sVal, " \t\r\n\"") ;
m_BtlGeom.SetUserAttribute( UATD_PART, sKey, sVal) ;
{
DBLVECTOR vdPar ;
if ( ReadPartOffset( sVal, vdPar)) {
m_BtlGeom.AddPartOffset( vdPar) ;
string sVal = ToString( vdPar) ;
m_BtlGeom.SetUserAttribute( UATD_PART, sPartKey[KEY_PART_PARTOFFSET], sVal) ;
}
}
break ;
case KEY_PART_PROCESSINGQUALITY : // qualità di lavorazione
Trim( sVal, " \t\r\n\"") ;
@@ -673,6 +692,21 @@ ImportBtl::ReadTransformation( const string& sVal, Frame3d& frRef)
return frRef.Set( ptO, ptO + vtX, ptO + vtY) ;
}
//----------------------------------------------------------------------------
bool
ImportBtl::ReadPartOffset( const string& sVal, DBLVECTOR& vdPar)
{
// assegno i valori di default
vdPar = { 0, 0, 0, 0, 0} ;
// leggo i valori
GetParamP( sVal, 4, vdPar[0]) ;
GetParamP( sVal, 11, vdPar[1]) ;
GetParamP( sVal, 12, vdPar[2]) ;
GetParamP( sVal, 13, vdPar[3]) ;
GetParamP( sVal, 14, vdPar[4]) ;
return true ;
}
//----------------------------------------------------------------------------
bool
ImportBtl::ReadOutline( void)
@@ -701,6 +735,18 @@ ImportBtl::ReadOutline( void)
break ;
}
// leggo i dati
// leggo faccia di riferimento
int nCurrSide ;
if ( GetInfo( sVal, PAR_SIDE, nCurrSide)) {
// se non ancora assegnata
if ( nSide == BTL_SIDE_NONE)
nSide = nCurrSide ;
// altrimenti è un nuovo outline, si assegna questo e si esce
else if ( nSide != nCurrSide) {
m_theScanner.UngetLine( sLine) ;
return m_BtlGeom.AddPartOutline( nSide, dqFce, nContType, nContData, dContPar, vsUAtt) ;
}
}
// tipo
int nFlag ;
GetParamP( sVal, 8, nFlag) ;
@@ -713,9 +759,6 @@ ImportBtl::ReadOutline( void)
bProcFound = true ;
}
}
// se non ancora assegnata, leggo faccia di riferimento
if ( nSide == BTL_SIDE_NONE)
GetInfo( sVal, PAR_SIDE, nSide) ;
// punto principale
Point3d ptP ;
GetParamP( sVal, 1, ptP.x) ;
@@ -834,13 +877,13 @@ ImportBtl::ReadColor( const string& sVal, Color& colRes)
// leggo i valori
string sRes ;
GetParam( sVal, PAR_R, sRes) ;
int nRed ; FromString( sRes, nRed) ;
int nRed = 0 ; FromString( sRes, nRed) ;
GetParam( sVal, PAR_G, sRes) ;
int nGreen ; FromString( sRes, nGreen) ;
int nGreen = 0 ; FromString( sRes, nGreen) ;
GetParam( sVal, PAR_B, sRes) ;
int nBlue ; FromString( sRes, nBlue) ;
int nBlue = 0 ; FromString( sRes, nBlue) ;
GetParam( sVal, PAR_A, sRes) ;
int nAlpha ; FromString( sRes, nAlpha) ; nAlpha = nAlpha * 100 / 255 ;
int nAlpha = 0 ; FromString( sRes, nAlpha) ; nAlpha = nAlpha * 100 / 255 ;
colRes.Set( nRed, nGreen, nBlue, nAlpha) ;
return true ;
}
@@ -1230,6 +1273,9 @@ ImportBtl::GetParam( const string& sText, const string& sPar, string& sVal)
bool
ImportBtl::GetParamP( const string& sText, int nInd, int& nVal)
{
// verifico se dummy
if ( nInd < 0)
return true ;
// creo l'identificativo
string sPar = PAR_P + ToString( nInd, 2) ;
// leggo il parametro
@@ -1243,6 +1289,9 @@ ImportBtl::GetParamP( const string& sText, int nInd, int& nVal)
bool
ImportBtl::GetParamP( const string& sText, int nInd, double& dVal)
{
// verifico se dummy
if ( nInd < 0)
return true ;
// creo l'identificativo
string sPar = PAR_P + ToString( nInd, 2) ;
// leggo il parametro
@@ -1253,6 +1302,9 @@ ImportBtl::GetParamP( const string& sText, int nInd, double& dVal)
bool
ImportBtl::GetParamP( const string& sText, int nInd, string& sVal)
{
// verifico se dummy
if ( nInd < 0)
return true ;
// creo l'identificativo
string sPar = PAR_P + ToString( nInd, 2) ;
// leggo il parametro
+1
View File
@@ -34,6 +34,7 @@ class ImportBtl : public IImportBtl
bool ReadGeneral( bool& bEnd) ;
bool ReadObject( ObjType nType, bool& bEnd) ;
bool ReadTransformation( const std::string& sVal, Frame3d& frRef) ;
bool ReadPartOffset( const std::string& sVal, DBLVECTOR& vdPar) ;
bool ReadOutline( void) ;
bool ReadAperture( void) ;
bool ReadColor( const std::string& sVal, Color& colRes) ;
+312 -443
View File
File diff suppressed because it is too large Load Diff
+8 -9
View File
@@ -28,7 +28,7 @@ public :
bool ReadFileHistory( pugi::xml_node node) ;
bool ReadProjectAttributes( pugi::xml_attribute attr) ;
bool ReadUserAttributes( pugi::xml_node node, int caller, std::vector<std::string> * pvsAttr = nullptr) ;
bool ReadUserAttributes( pugi::xml_node node, int caller, STRVECTOR* pvsAttr = nullptr) ;
bool ReadPart( pugi::xml_node node) ;
bool ReadPartAttributes( pugi::xml_attribute attr) ;
bool ReadCamber( pugi::xml_node node) ;
@@ -42,7 +42,7 @@ public :
bool ReadAperture( pugi::xml_node node, int nSide) ;
bool ReadUserReferencePlane( pugi::xml_node node) ;
bool ReadShape( pugi::xml_node node) ;
bool CheckGuid ( std::string s) ;
bool CheckGuid( const std::string& s) ;
// processing
bool ReadJackRafterCutParams( pugi::xml_node process, int& nGroup, int& nProc, int& nSide, INTVECTOR& vnDPar, int& nSPar,
@@ -115,17 +115,16 @@ public :
DBLVECTOR& vdPar, std::string& sPar) ;
bool ReadDovetailParams( pugi::xml_node process, int& nGroup, int& nProc, int& nSide, INTVECTOR& vnDPar, int& nSPar,
DBLVECTOR& vdPar, std::string& sPar) ;
bool ReadFreeContourParams( pugi::xml_node process, int& nGroup, int& nProc, int& nSide, INTVECTOR& vnDPar, int& nSPar,
DBLVECTOR& vdPar, std::string& sPar, int& curve_counter, STRVECTOR& vsUAtt) ;
bool ReadSContourParams( pugi::xml_node process, int nType, int nOtherId, int& nGroup, int& nProc, int& nSide,
INTVECTOR& vnDPar, int& nSPar, DBLVECTOR& vdPar, std::string& sPar, int& curve_counter, STRVECTOR& vsUAtt) ;
bool ReadDContourParams( pugi::xml_node process, int& nGroup, int& nProc, int& nSide,
INTVECTOR& vnDPar, int& nSPar, DBLVECTOR& vdPar, std::string& sPar, int& curve_counter, STRVECTOR& vsUAtt) ;
bool ReadFreeContourParams( pugi::xml_node process, const STRVECTOR& vsUAtt) ;
bool ReadSContourParams( pugi::xml_node process, int nType, int nOtherId, int nGroup, int nProc, int nSide, bool bCounterSink,
int& nCrvCnt, const STRVECTOR& vsUAtt) ;
bool ReadDContourParams( pugi::xml_node process, int nGroup, int nProc, int nSide, bool bCounterSink,
int& nCrvCnt, const STRVECTOR& vsUAtt) ;
private :
BtlGeom m_BtlGeom ; // gestore geometria pezzi Btl
std::string m_sVersion ; // versione btlx
std::unordered_map< int, Frame3d> MapURefPlanes ;
std::unordered_map< int, Frame3d> m_mapRefPlanes ;
} ;
+225 -223
View File
File diff suppressed because it is too large Load Diff
+68 -11
View File
@@ -23,9 +23,8 @@
#include "/EgtDev/Include/EGkCurveLine.h"
#include "/EgtDev/Include/EGkCurveArc.h"
#include "/EgtDev/Include/EGkCurveComposite.h"
#include "/EgtDev/Include/EGkArcSpecial.h"
#include "/EgtDEv/Include/EGnScanner.h"
#include "/EgtDev/Include/SELkKeyProc.h"
#include "/EgtDev/Include/EgtKeyCodes.h"
#include "/EgtDev/Include/EgtStringConverter.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
@@ -42,6 +41,7 @@ static const string KEY_EXIT = "EXIT" ;
static const string KEY_TPOS = "TPOS" ;
static const string KEY_TPOS2 = "TPOS2" ;
static const string KEY_SPEED = "SPEED" ;
static const string KEY_FEED = "FEED" ;
static const string KEY_ROTAX_A = "A" ;
static const string KEY_ROTAX_B = "B" ;
static const string KEY_ROTAX_C = "C" ;
@@ -52,7 +52,7 @@ IImportCnc*
CreateImportCnc( void)
{
// verifico la chiave e le opzioni
if ( ! GetEExNetHwKey() && ! TestKeyForEEx( GetEExKey(), KEYOPT_EEX_INPBASE, GetEExLogger()))
if ( ! VerifyKey( KEYOPT_EEX_INPBASE))
return nullptr ;
// creo l'oggetto
return static_cast<IImportCnc*> ( new(nothrow) ImportCnc) ;
@@ -124,6 +124,7 @@ ImportCnc::Import( const string& sFile, IGeomDB* pGDB, int nIdGroup, int nFlag)
m_colCurr = BLACK ;
m_sToolName.clear() ;
m_nExit = 1 ;
m_dFeed = 0 ;
// se estensione xpi è NUM
string sFileTitle, sFileExt ;
@@ -170,7 +171,7 @@ ImportCnc::ProcessLine( const string& sLine)
return ParseRemark( sLine) ;
// altre linee da saltare
if ( sLine[0] == '$' || sLine[0] == '!')
if ( sLine[0] == '$' || sLine[0] == '!' || sLine.starts_with( "MSG"))
return true ;
// eliminazione di commenti intermedi o finali
@@ -178,6 +179,8 @@ ImportCnc::ProcessLine( const string& sLine)
// se controllo OSAI elimino le parti dopo ;
if ( m_nCNC == CNC_OSAI) {
size_t nStart = sMyLine.find( ';') ;
if ( nStart == string::npos)
nStart = sMyLine.find( "@") ;
if ( nStart != string::npos)
sMyLine.erase( nStart) ;
}
@@ -192,13 +195,21 @@ ImportCnc::ProcessLine( const string& sLine)
sMyLine.erase( nStart) ;
}
}
// se controllo SIEMENS elimino i cicli 800 e 832
// se controllo SIEMENS elimino alcuni comandi speciali ed effettuo conversioni o salti
else if ( m_nCNC == CNC_SIEMENS) {
if ( sMyLine.starts_with( "ID"))
return true ;
if ( sMyLine.starts_with( "DYN"))
return true ;
size_t nStart = sMyLine.find( "CYCLE800") ;
if ( nStart == string::npos)
nStart = sMyLine.find( "CYCLE832") ;
if ( nStart == string::npos)
nStart = sMyLine.find( "/WHEN") ;
if ( nStart != string::npos)
sMyLine.erase( nStart) ;
ReplaceString( sMyLine, "SUPA", "G79") ;
ReplaceString( sMyLine, "AC(", "") ;
}
// divido la linea in parti
@@ -206,7 +217,7 @@ ImportCnc::ProcessLine( const string& sLine)
TokenizePlus( sMyLine, "NGXYZIJKPQRUVWABCFTMHhDEL", vsTokens) ;
// analizzo ogni singola parte
for ( size_t i = 0 ; i < vsTokens.size() ; ++ i) {
for ( int i = 0 ; i < ssize( vsTokens) ; ++ i) {
// analizzo per categorie determinate dal primo carattere del token
switch ( vsTokens[i][0]) {
case 'G' :
@@ -251,6 +262,9 @@ ImportCnc::ProcessLine( const string& sLine)
case 'T' :
ParseT( vsTokens[i]) ;
break ;
case 'F' :
ParseF( vsTokens[i]) ;
break ;
case 'M' :
ParseM( vsTokens[i]) ;
break ;
@@ -273,8 +287,11 @@ ImportCnc::ProcessLine( const string& sLine)
// se utensile da caricare
if ( m_bLoadTool)
m_nTool = m_nNextTool ;
// se comando da ignorare
if ( m_nCommand == SKIP)
;
// se comando di movimento o riconosciuto movimento, lo eseguo
if ( m_nCommand == MOVE || m_bToMove)
else if ( m_nCommand == MOVE || m_bToMove)
bOk = ExecMovement() ;
// se comando di impostazione piano di interpolazione
else if ( m_nCommand == IPL)
@@ -362,7 +379,8 @@ ImportCnc::ParseRemark( const string& sLine)
if ( iExit == string::npos)
iExit = sLine.find( "EXIT=") ;
if ( iExit != string::npos) {
FromString( sLine.substr( iExit + 5), m_nExit) ;
if ( ! FromString( sLine.substr( iExit + 5), m_nExit))
m_nExit = 0 ;
return true ;
}
// cerco indicazione posizione nel TC
@@ -434,6 +452,9 @@ ImportCnc::ParseG( const string& sToken)
m_nCommand = MOVE ;
m_nMoveType = ARC_CCW ;
break ;
case 4 :
m_nCommand = SKIP ;
break ;
case 14 :
m_nCommand = MOVE ;
m_nMoveType = ARC_MID_3D ;
@@ -498,6 +519,12 @@ ImportCnc::ParseG( const string& sToken)
m_bAbsCoord = false ;
break ;
}
// per saltare le macro custom su NUM (tipo G101... di S3)
if ( m_nCNC == CNC_NUM && nVal > 99) {
m_nCommand = NO_CMD ;
m_nMoveType = RAPID ;
m_bZeroMach = true ;
}
return true ;
}
@@ -516,6 +543,8 @@ ImportCnc::ParseX( const string& sToken)
case OFFS :
m_vtOffs.x = dVal ;
break ;
case SKIP :
break ;
default :
if ( m_bZeroMach)
m_ptNext.x = m_ptHome.x + dVal ;
@@ -543,6 +572,8 @@ ImportCnc::ParseY( const string& sToken)
case OFFS :
m_vtOffs.y = dVal ;
break ;
case SKIP :
break ;
default :
if ( m_bZeroMach)
m_ptNext.y = m_ptHome.y + dVal ;
@@ -570,6 +601,8 @@ ImportCnc::ParseZ( const string& sToken)
case OFFS :
m_vtOffs.z = dVal ;
break ;
case SKIP :
break ;
default :
if ( m_bZeroMach)
m_ptNext.z = m_ptHome.z + dVal ;
@@ -623,7 +656,6 @@ ImportCnc::ParseJ( const string& sToken)
case ZX : m_ptCen.x = dVal ; break ;
}
}
m_nArcType = CENTER ;
m_bToMove = true ;
return true ;
@@ -764,6 +796,17 @@ ImportCnc::ParseT( const string& sToken)
return true ;
}
//----------------------------------------------------------------------------
bool
ImportCnc::ParseF( const string& sToken)
{
double dVal ;
int nStart = ( sToken[1] == '=' ? 2 : 1) ;
if ( FromString( sToken.substr( nStart), dVal))
m_dFeed = dVal ;
return true ;
}
//----------------------------------------------------------------------------
bool
ImportCnc::ParseM( const string& sToken)
@@ -896,6 +939,9 @@ ImportCnc::AddPoint( int nPntType)
m_pGDB->SetInfo( nId, KEY_ROTAX_B, m_dRotAxB) ;
if ( ! isnan( m_dRotAxC))
m_pGDB->SetInfo( nId, KEY_ROTAX_C, m_dRotAxC) ;
// assegnazione eventuale Feed
if ( nPntType == P_PNT && abs( m_dFeed) > 0.1)
m_pGDB->SetInfo( nId, KEY_FEED, m_dFeed) ;
// assegnazione eventuali info
SetInfos( nId) ;
m_vInfos.clear() ;
@@ -955,6 +1001,9 @@ ImportCnc::AddLine( int nLineType)
m_pGDB->SetInfo( nId, KEY_ROTAX_B, m_dRotAxB) ;
if ( ! isnan( m_dRotAxC))
m_pGDB->SetInfo( nId, KEY_ROTAX_C, m_dRotAxC) ;
// assegnazione eventuale Feed
if ( nLineType == L_LINE && abs( m_dFeed) > 0.1)
m_pGDB->SetInfo( nId, KEY_FEED, m_dFeed) ;
// assegnazione eventuali info
SetInfos( nId) ;
m_vInfos.clear() ;
@@ -995,7 +1044,8 @@ ImportCnc::AddArc( bool bCCW)
switch ( VerifyArcCenter( vtN)) {
case A_ARC :
// punti estremi e centro
if ( ! pCrvArc->SetC2PN( m_ptCen, m_ptLast, m_ptNext, vtN))
pCrvArc.Set( GetArc2PCN( m_ptLast, m_ptNext, m_ptCen, vtN)) ;
if ( IsNull( pCrvArc))
return false ;
// verifico senso di rotazione
if ( ( bCCW && pCrvArc->GetAngCenter() < 0) ||
@@ -1045,6 +1095,9 @@ ImportCnc::AddArc( bool bCCW)
m_pGDB->SetInfo( nId, KEY_ROTAX_B, m_dRotAxB) ;
if ( ! isnan( m_dRotAxC))
m_pGDB->SetInfo( nId, KEY_ROTAX_C, m_dRotAxC) ;
// assegnazione eventuale Feed
if ( abs( m_dFeed) > 0.1)
m_pGDB->SetInfo( nId, KEY_FEED, m_dFeed) ;
// assegnazione eventuali info
SetInfos( nId) ;
m_vInfos.clear() ;
@@ -1111,6 +1164,9 @@ ImportCnc::AddArc3P( bool bIs2D)
m_pGDB->SetInfo( nId, KEY_ROTAX_B, m_dRotAxB) ;
if ( ! isnan( m_dRotAxC))
m_pGDB->SetInfo( nId, KEY_ROTAX_C, m_dRotAxC) ;
// assegnazione eventuale Feed
if ( abs( m_dFeed) > 0.1)
m_pGDB->SetInfo( nId, KEY_FEED, m_dFeed) ;
// assegnazione eventuali info
SetInfos( nId) ;
m_vInfos.clear() ;
@@ -1323,7 +1379,8 @@ ImportCnc::PostProcess( void)
int nNextId = m_pGDB->GetNext( nId) ;
// estraggo la curva e la accodo alla composita
ICurve* pCrv = GetCurve( m_pGDB->RemoveGeoObjAndErase( nId)) ;
pCompo->AddCurve( pCrv) ;
if ( ! pCompo->AddCurve( pCrv, true, 10 * EPS_SMALL))
return false ;
// passo alla successiva
nId = nNextId ;
// se G40 termino la composita
+3 -1
View File
@@ -42,6 +42,7 @@ class ImportCnc : public IImportCnc
bool ParseB( const std::string& sToken) ;
bool ParseC( const std::string& sToken) ;
bool ParseT( const std::string& sToken) ;
bool ParseF( const std::string& sToken) ;
bool ParseM( const std::string& sToken) ;
bool ParseH( const std::string& sToken) ;
bool ExecSetIPL( void) ;
@@ -73,7 +74,7 @@ class ImportCnc : public IImportCnc
private :
enum CncName { CNC_STD = 0, CNC_OSAI = 1, CNC_FANUC = 2, CNC_NUM = 3, CNC_SIEMENS = 4, CNC_TPA = 5, CNC_MAZAK = 6, CNC_FAGOR} ;
enum InterpPl { XY = 1, YZ = 2, ZX = 3} ;
enum Command { NO_CMD = 0, MOVE = 1, IPL = 2, OFFS = 3} ;
enum Command { NO_CMD = 0, MOVE = 1, IPL = 2, OFFS = 3, SKIP = 4} ;
enum MoveType { RAPID = 0, LINE = 1, ARC_CW = 2, ARC_CCW = 3, ARC_MID_2D = 4, ARC_MID_3D = 5} ;
enum PntType { P_RAPID = 0, P_PNT = 1, P_ERROR = 2} ;
enum LineType { L_RAPID = 0, L_LINE = 1, L_ERROR = 2} ;
@@ -125,5 +126,6 @@ class ImportCnc : public IImportCnc
std::string m_sToolPos ;
std::string m_sToolPos2 ;
std::string m_sSpeed ;
double m_dFeed ;
STRVECTOR m_vInfos ;
} ;
+2 -4
View File
@@ -25,8 +25,6 @@
#include "/EgtDev/Include/EGkExtText.h"
#include "/EgtDev/Include/EGnStringUtils.h"
#include "/EgtDev/Include/EGnFileUtils.h"
#include "/EgtDev/Include/SELkKeyProc.h"
#include "/EgtDev/Include/EgtKeyCodes.h"
#include "/EgtDev/Include/EgtStringConverter.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
#include <fstream>
@@ -62,7 +60,7 @@ IImportCsf*
CreateImportCsf( void)
{
// verifico la chiave e le opzioni
if ( ! GetEExNetHwKey() && ! TestKeyForEEx( GetEExKey(), KEYOPT_EEX_INPBASE, GetEExLogger()))
if ( ! VerifyKey( KEYOPT_EEX_INPBASE))
return nullptr ;
// creo l'oggetto
return static_cast<IImportCsf*> ( new(nothrow) ImportCsf) ;
@@ -599,7 +597,7 @@ ImportCsf::ProcessExtendedText( const CsfEnt& csfEnt)
}
// salvataggio testo con un punto di inserimento per ogni carattere
else if ( etData.sText.size() == etData.vPnt.size()) {
for ( size_t i = 0 ; i < etData.sText.size() ; ++ i) {
for ( int i = 0 ; i < ssize( etData.sText) ; ++ i) {
// creo il testo
PtrOwner<IExtText> pTxt( CreateExtText()) ;
if ( IsNull( pTxt))
+1 -4
View File
@@ -19,18 +19,15 @@
#include "/EgtDev/Include/EExDllMain.h"
#include "/EgtDev/Include/EGkGdbIterator.h"
#include "/EgtDev/Include/EGnStringUtils.h"
#include "/EgtDev/Include/SELkKeyProc.h"
#include "/EgtDev/Include/EgtKeyCodes.h"
using namespace std ;
//----------------------------------------------------------------------------
IImportDxf*
CreateImportDxf( void)
{
// verifico la chiave e le opzioni
if ( ! GetEExNetHwKey() && ! TestKeyForEEx( GetEExKey(), KEYOPT_EEX_INPBASE, GetEExLogger()))
if ( ! VerifyKey( KEYOPT_EEX_INPBASE))
return nullptr ;
// creo l'oggetto
return static_cast<IImportDxf*> ( new(nothrow) ImportDxf) ;
+29 -20
View File
@@ -398,9 +398,9 @@ bool
ImportDxf::ReadArc( bool& bFileEnd)
{
Point3d ptCen ;
double dRadius ;
double dStartAng ;
double dEndAng ;
double dRadius = 0 ;
double dStartAng = 0 ;
double dEndAng = 0 ;
Vector3d vtExtr = Z_AX ;
double dThick = 0 ;
string sLayer ;
@@ -529,7 +529,7 @@ bool
ImportDxf::ReadCircle( bool& bFileEnd)
{
Point3d ptCen ;
double dRadius ;
double dRadius = 0 ;
Vector3d vtExtr = Z_AX ;
double dThick = 0 ;
string sLayer ;
@@ -1378,7 +1378,7 @@ ImportDxf::ReadPoint( bool& bFileEnd)
if ( ! pGeoPnt->Set( ptP))
return false ;
// lo passo all'oggetto geometrico generico
pGeoObj.Set( Release( pGeoPnt)) ;
pGeoObj.Set( pGeoPnt) ;
}
else {
// creo il vettore con punto base
@@ -1389,7 +1389,7 @@ ImportDxf::ReadPoint( bool& bFileEnd)
if ( ! pGeoVect->Set( dThick * vtExtr, ptP))
return false ;
// lo passo all'oggetto geometrico generico
pGeoObj.Set( Release( pGeoVect)) ;
pGeoObj.Set( pGeoVect) ;
}
// inserisco l'entità nel DB
int nId = m_pGDB->AddGeoObj( GDB_ID_NULL, GetGroupId( sLayer), Release( pGeoObj)) ;
@@ -2146,47 +2146,55 @@ ImportDxf::ReadSpline( bool& bFileEnd)
sLayer = m_sCurrItem ;
break ;
case 10 :
FromString( m_sCurrItem, ptP.x) ;
if ( ! FromString( m_sCurrItem, ptP.x))
ptP.x = 0 ;
++ nContX ;
if ( nContX == nContY && nContY == nContZ)
cnData.vCP.push_back( ptP) ;
break ;
case 20 :
FromString( m_sCurrItem, ptP.y) ;
if ( ! FromString( m_sCurrItem, ptP.y))
ptP.y = 0 ;
++ nContY ;
if ( nContX == nContY && nContY == nContZ)
cnData.vCP.push_back( ptP) ;
break ;
case 30 :
FromString( m_sCurrItem, ptP.z) ;
if ( ! FromString( m_sCurrItem, ptP.z))
ptP.z = 0 ;
++ nContZ ;
if ( nContX == nContY && nContY == nContZ)
cnData.vCP.push_back( ptP) ;
break ;
case 11 :
FromString( m_sCurrItem, ptInt.x) ;
if ( ! FromString( m_sCurrItem, ptInt.x))
ptInt.x = 0 ;
++ nIntX ;
if ( nIntX == nIntY && nIntY == nIntZ)
vIntPnt.push_back( ptInt) ;
break ;
case 21 :
FromString( m_sCurrItem, ptInt.y) ;
if ( ! FromString( m_sCurrItem, ptInt.y))
ptInt.y = 0 ;
++ nIntY ;
if ( nIntX == nIntY && nIntY == nIntZ)
vIntPnt.push_back( ptInt) ;
break ;
case 31 :
FromString( m_sCurrItem, ptInt.z) ;
if ( ! FromString( m_sCurrItem, ptInt.z))
ptInt.z = 0 ;
++ nIntZ ;
if ( nIntX == nIntY && nIntY == nIntZ)
vIntPnt.push_back( ptInt) ;
break ;
case 40 :
FromString( m_sCurrItem, dTemp) ;
if ( ! FromString( m_sCurrItem, dTemp))
dTemp = 0 ;
cnData.vU.push_back( dTemp) ;
break;
case 41 :
FromString( m_sCurrItem, dTemp) ;
if ( ! FromString( m_sCurrItem, dTemp))
dTemp = 0 ;
cnData.vW.push_back( dTemp) ;
break;
case 60 :
@@ -2253,8 +2261,9 @@ ImportDxf::ReadSpline( bool& bFileEnd)
}
// assegnazione flag
cnData.bRat = (( nFlag & SPL_RATIONAL) != 0) ;
cnData.bPeriodic = (( nFlag & SPL_PERIODIC) != 0 && ( nKnotNbr != nCPntNbr + cnData.nDeg +1)) ;
cnData.bPeriodic = (( nFlag & SPL_PERIODIC) != 0 && ( nKnotNbr != nCPntNbr + cnData.nDeg + 1)) ;
cnData.bClosed = (( nFlag & SPL_CLOSED) != 0) ;
cnData.bClamped = true ;
cnData.bExtraKnotes = true ;
// Verifico il numero di nodi
if ( cnData.vU.size() != nKnotNbr || nKnotNbr < 4)
@@ -2301,7 +2310,7 @@ ImportDxf::ReadText( int nGroupId, bool& bFileEnd)
string sText ;
string sLayer ;
string sStyle = "STANDARD" ;
double dH ;
double dH = 0 ;
double dAngDeg = 0 ;
double dRat = 1 ;
int nSpace = ENT_MODELSPACE ;
@@ -2499,7 +2508,7 @@ ImportDxf::ReadMText( bool& bFileEnd)
string sText ;
string sLayer ;
string sStyle = "STANDARD" ;
double dH ;
double dH = 0 ;
double dTextMaxWidth = 0 ;
double dAngRad = 0 ;
int nInsPos = ETXT_IPBL ;
@@ -2686,16 +2695,16 @@ ImportDxf::AdjustMText( string& sText, double dTextMaxWidth, double dW)
// coefficiente empirico che in generale migliora l'adattamento
const double COEFF_LARGH = 1.2 ;
// gestione max lunghezza riga di testo
size_t nLastSp = - 1 ;
int nLastSp = -1 ;
double dCurrWidth = 0 ;
for ( size_t i = 0 ; i < sText.size() ; ++ i) {
for ( int i = 0 ; i < ssize( sText) ; ++ i) {
// posso dividere solo sugli spazi
if ( sText[i] == ' ')
nLastSp = i ;
// se c'è già un a capo
if ( sText[i] == '\n') {
dCurrWidth = 0 ;
nLastSp = - 1 ;
nLastSp = -1 ;
}
// se supera il limite
else if ( dCurrWidth > COEFF_LARGH * dTextMaxWidth) {
+206
View File
@@ -0,0 +1,206 @@
//----------------------------------------------------------------------------
// EgalTech 2024-2024
//----------------------------------------------------------------------------
// File : ImportOff.cpp Data : 28.11.24 Versione : 2.6k2
// Contenuto : Implementazione della classe per l'importazione di OFF.
//
//
//
// Modifiche : 28.11.24 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "ImportOff.h"
#include "DllMain.h"
#include "/EgtDev/Include/EExDllMain.h"
#include "/EgtDev/Include/EGkStmFromTriangleSoup.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
using namespace std ;
//----------------------------------------------------------------------------
IImportOff*
CreateImportOff( void)
{
// verifico la chiave e le opzioni
if ( ! VerifyKey( KEYOPT_EEX_INPBASE))
return nullptr ;
// creo l'oggetto
return static_cast<IImportOff*> ( new( nothrow) ImportOff) ;
}
//----------------------------------------------------------------------------
bool
ImportOff::Import( const string& sFile, IGeomDB* pGDB, int nIdGroup, double dScaleFactor)
{
// verifico il DB geometrico
if ( pGDB == nullptr) {
LOG_ERROR( GetEExLogger(), "ImportOff : Error on GeomDB")
return false ;
}
m_pGDB = pGDB ;
// verifico l'Id di gruppo
if ( ! m_pGDB->ExistsObj( nIdGroup)) {
LOG_ERROR( GetEExLogger(), "ImportOff : Error on IdGroup")
return false ;
}
m_nIdGroup = nIdGroup ;
// verifico il fattore di scala
if ( dScaleFactor < EPS_SMALL) {
LOG_ERROR( GetEExLogger(), "ImportOff : Error on ScaleFactor too small (minimum 0.001).")
return false ;
}
m_dScaleFactor = dScaleFactor ;
// inizializzo lo scanner
if ( ! m_theScanner.Init( sFile, "#")) {
LOG_ERROR( GetEExLogger(), "ImportOff : Error on Init")
return false ;
}
// lettura intestazione
if ( ! ReadData()) {
string sOut = " ImportOff : Error in ReadData on line " + ToString( m_theScanner.GetCurrLineNbr()) ;
LOG_ERROR( GetEExLogger(), sOut.c_str())
return false ;
}
return true ;
}
//----------------------------------------------------------------------------
bool
ImportOff::ReadData( void)
{
string sLine ;
// Intestazione opzionale OFF
if ( ! m_theScanner.GetLine( sLine))
return false ;
bool bOFF = ( sLine.find( "OFF") != string::npos) ;
// Numero di vertici, di facce e di spigoli (ignorato)
if ( bOFF && ! m_theScanner.GetLine( sLine))
return false ;
STRVECTOR vsTok ;
Tokenize( sLine, " ", vsTok) ;
if ( vsTok.size() < 3)
return false ;
int nVerts = 0, nFaces = 0 ;
if ( ! FromString( vsTok[0], nVerts) || nVerts <= 0 ||
! FromString( vsTok[1], nFaces) || nFaces <= 0)
return false ;
// Vettore dei vertici
PNTVECTOR vVert( nVerts) ;
// lettura dei vertici
for ( int i = 0 ; i < nVerts ; ++ i) {
if ( ! m_theScanner.GetLine( sLine))
return false ;
STRVECTOR vsTok ;
Tokenize( sLine, " ", vsTok) ;
if ( vsTok.size() < 3)
return false ;
if ( ! FromString( vsTok[0], vVert[i].x) || ! FromString( vsTok[1],vVert[i].y) || ! FromString( vsTok[2], vVert[i].z))
return false ;
vVert[i] *= m_dScaleFactor ;
}
// Costruttore di trimesh da insieme disordinato di triangoli
StmFromTriangleSoup StmFts ;
if ( ! StmFts.Start())
return false ;
// lettura delle facce
int nBadFaces = 0 ;
for ( int i = 0 ; i < nFaces ; ++ i) {
if ( ! m_theScanner.GetLine( sLine))
return false ;
STRVECTOR vsTok ;
Tokenize( sLine, " ", vsTok) ;
if ( vsTok.empty())
return false ;
int nFVs = 0 ;
if ( ! FromString( vsTok[0], nFVs) || int( vsTok.size()) < nFVs + 1)
return false ;
// se triangolo
if ( nFVs == 3) {
Triangle3d Tria ;
for ( int j = 0 ; j < 3 ; ++ j) {
int nV = -1 ;
if ( ! FromString( vsTok[j+1], nV) || nV < 0 || nV >= nVerts)
return false ;
Tria.SetP( j, vVert[nV]) ;
}
if ( Tria.Validate( true)) {
if ( ! StmFts.AddTriangle( Tria))
return false ;
}
else
++ nBadFaces ;
}
// se quadrilatero
else if ( nFVs == 4) {
Triangle3d TriaA, TriaB ;
for ( int j = 0 ; j < 4 ; ++ j) {
int nV = -1 ;
if ( ! FromString( vsTok[j+1], nV) || nV < 0 || nV >= nVerts)
return false ;
if ( j != 3)
TriaA.SetP( j, vVert[nV]) ;
if ( j != 1)
TriaB.SetP( ( j == 0 ? j : j - 1), vVert[nV]) ;
}
if ( TriaA.Validate( true)) {
if ( ! StmFts.AddTriangle( TriaA))
return false ;
}
else
++ nBadFaces ;
if ( TriaB.Validate( true)) {
if ( ! StmFts.AddTriangle( TriaB))
return false ;
}
else
++ nBadFaces ;
}
// altrimenti poligono generico
else {
PolyLine PL ;
for ( int j = 0 ; j < nFVs ; ++ j) {
int nV = -1 ;
if ( ! FromString( vsTok[j+1], nV) || nV < 0 || nV >= nVerts)
return false ;
PL.AddUPoint( j, vVert[nV]) ;
}
PL.Close() ;
PL.FlattenInAutoPlane( 1.) ;
PtrOwner<ISurfTriMesh> pStm( CreateSurfTriMesh()) ;
if ( ! IsNull( pStm) && pStm->CreateByFlatContour( PL)) {
if ( ! StmFts.AddSurfTriMesh( *pStm))
return false ;
}
else
++ nBadFaces ;
}
}
if ( nBadFaces > 0) {
string sOut = " ImportOff : found " + ToString( nBadFaces) + " bad faces" ;
LOG_ERROR( GetEExLogger(), sOut.c_str())
}
// Valido la superficie e calcolo le adiacenze
if ( ! StmFts.End())
return false ;
// inserisco l'oggetto nel DB geometrico
PtrOwner<ISurfTriMesh> pSTM( StmFts.GetSurf()) ;
int nIdNew = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nIdGroup, Release( pSTM)) ;
if ( nIdNew == GDB_ID_NULL)
return false ;
return true ;
}
+33
View File
@@ -0,0 +1,33 @@
//----------------------------------------------------------------------------
// EgalTech 2024-2024
//----------------------------------------------------------------------------
// File : ImportOff.h Data : 28.11.24 Versione : 2.6k2
// Contenuto : Dichiarazione della classe ImportOff.
//
//
//
// Modifiche : 28.11.24 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
#pragma once
#include "/EgtDev/Include/EExImportOff.h"
#include "/EgtDEv/Include/EGnScanner.h"
//----------------------------------------------------------------------------
class ImportOff : public IImportOff
{
public :
virtual bool Import( const std::string& sFile, IGeomDB* pGDB, int nIdGroup, double dScaleFactor = 1) ;
private :
bool ReadData( void) ;
private :
Scanner m_theScanner ;
IGeomDB* m_pGDB ;
int m_nIdGroup ;
double m_dScaleFactor ;
} ;
+169
View File
@@ -0,0 +1,169 @@
//----------------------------------------------------------------------------
// EgalTech 2025-2025
//----------------------------------------------------------------------------
// File : ImportPLY.cpp Data : 28.02.25 Versione : 2.7b2
// Contenuto : Implementazione della classe per l'importazione di PLY.
//
//
//
// Modifiche : 28.02.25 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "ImportPly.h"
#include "DllMain.h"
#include "/EgtDev/Include/EExDllMain.h"
#include "/EgtDev/Include/EGkStmFromTriangleSoup.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
using namespace std ;
//----------------------------------------------------------------------------
IImportPly*
CreateImportPly( void)
{
// verifico la chiave e le opzioni
if ( ! VerifyKey( KEYOPT_EEX_INPBASE))
return nullptr ;
// creo l'oggetto
return static_cast<IImportPly*> ( new( nothrow) ImportPly) ;
}
//----------------------------------------------------------------------------
bool
ImportPly::Import( const string& sFile, IGeomDB* pGDB, int nIdGroup, double dScaleFactor)
{
// verifico il DB geometrico
if ( pGDB == nullptr) {
LOG_ERROR( GetEExLogger(), "ImportPly : Error on GeomDB")
return false ;
}
m_pGDB = pGDB ;
// verifico l'Id di gruppo
if ( ! m_pGDB->ExistsObj( nIdGroup)) {
LOG_ERROR( GetEExLogger(), "ImportPly : Error on IdGroup")
return false ;
}
m_nIdGroup = nIdGroup ;
// verifico il fattore di scala
if ( dScaleFactor < EPS_SMALL) {
LOG_ERROR( GetEExLogger(), "ImportPly : Error on ScaleFactor too small (minimum 0.001).")
return false ;
}
m_dScaleFactor = dScaleFactor ;
// inizializzo il lettore
miniply::PLYReader TheReader( sFile.data()) ;
if ( ! TheReader.valid()) {
LOG_ERROR( GetEExLogger(), "ImportPly : Error on Init")
return false ;
}
// lettura dati
return ReadData( TheReader) ;
}
//----------------------------------------------------------------------------
bool
ImportPly::ReadData( miniply::PLYReader& TheReader)
{
typedef std::vector<float> FLTVECTOR ; // vettore di float
uint32_t propIdxs[3] ;
bool bGotVerts = false, bGotFaces = false ;
int nVerts = 0 ;
FLTVECTOR vVert ;
int nTrias = 0 ;
INTVECTOR vTria ;
while ( TheReader.has_element() && ( ! bGotVerts || ! bGotFaces)) {
// Recupero i vertici
if ( TheReader.element_is( miniply::kPLYVertexElement) && TheReader.load_element() && TheReader.find_pos( propIdxs)) {
nVerts = TheReader.num_rows() ;
vVert.resize( 3 * nVerts) ;
TheReader.extract_properties( propIdxs, 3, miniply::PLYPropertyType::Float, vVert.data()) ;
bGotVerts = true ;
}
// Recupero gli indici dei vertici dei triangoli delle facce
else if ( TheReader.element_is( miniply::kPLYFaceElement) && TheReader.load_element() && TheReader.find_indices( propIdxs)) {
bool bPolys = TheReader.requires_triangulation( propIdxs[0]) ;
if ( bPolys && ! bGotVerts) {
string sOut = " ImportPly : need vertex positions to triangulate faces" ;
LOG_ERROR( GetEExLogger(), sOut.c_str())
return false ;
}
if ( bPolys) {
nTrias = TheReader.num_triangles( propIdxs[0]) ;
vTria.resize( 3 * nTrias) ;
TheReader.extract_triangles( propIdxs[0], vVert.data(), nVerts, miniply::PLYPropertyType::Int, vTria.data()) ;
}
else {
nTrias = TheReader.num_rows() ;
vTria.resize( 3 * nTrias) ;
TheReader.extract_list_property( propIdxs[0], miniply::PLYPropertyType::Int, vTria.data()) ;
}
bGotFaces = true ;
}
if ( bGotVerts && bGotFaces)
break ;
TheReader.next_element() ;
}
// Controllo lettura effettiuata di vertici e facce
if ( ! bGotVerts) {
string sOut = " ImportPly : vertex positions not found" ;
LOG_ERROR( GetEExLogger(), sOut.c_str())
return false ;
}
if ( ! bGotFaces) {
string sOut = " ImportPly : face indices not found" ;
LOG_ERROR( GetEExLogger(), sOut.c_str())
return false ;
}
// Costruttore di trimesh da insieme disordinato di triangoli
StmFromTriangleSoup StmFts ;
if ( ! StmFts.Start())
return false ;
// ciclo sui triangoli
int nBadTrias = 0 ;
for ( int i = 0 ; i < nTrias ; ++ i) {
int nT = 3 * i ;
Triangle3d Tria ;
for ( int j = 0 ; j < 3 ; ++ j) {
int nV = 3 * vTria[nT+j] ;
Point3d ptP( vVert[nV], vVert[nV+1], vVert[nV+2]) ;
ptP *= m_dScaleFactor ;
Tria.SetP( j, ptP) ;
}
if ( Tria.Validate( true)) {
if ( ! StmFts.AddTriangle( Tria)) {
string sOut = " ImportPly : error adding triangle" ;
LOG_ERROR( GetEExLogger(), sOut.c_str())
return false ;
}
}
else
++ nBadTrias ;
}
if ( nBadTrias > 0) {
string sOut = " ImportPly : found " + ToString( nBadTrias) + " bad triangles" ;
LOG_ERROR( GetEExLogger(), sOut.c_str())
}
// Valido la superficie e calcolo le adiacenze
if ( ! StmFts.End())
return false ;
// inserisco l'oggetto nel DB geometrico
PtrOwner<ISurfTriMesh> pSTM( StmFts.GetSurf()) ;
int nIdNew = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nIdGroup, Release( pSTM)) ;
if ( nIdNew == GDB_ID_NULL)
return false ;
return true ;
}
+32
View File
@@ -0,0 +1,32 @@
//----------------------------------------------------------------------------
// EgalTech 2025-2025
//----------------------------------------------------------------------------
// File : ImportPly.h Data : 28.02.25 Versione : 2.7b2
// Contenuto : Dichiarazione della classe ImportPly.
//
//
//
// Modifiche : 28.02.25 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
#pragma once
#include "miniply.h"
#include "/EgtDev/Include/EExImportPly.h"
//----------------------------------------------------------------------------
class ImportPly : public IImportPly
{
public :
virtual bool Import( const std::string& sFile, IGeomDB* pGDB, int nIdGroup, double dScaleFactor = 1) ;
private :
bool ReadData( miniply::PLYReader& TheReader) ;
private :
IGeomDB* m_pGDB ;
int m_nIdGroup ;
double m_dScaleFactor ;
} ;
+1 -2
View File
@@ -18,7 +18,6 @@
#include "/EgtDev/Include/EExDllMain.h"
#include "/EgtDev/Include/EGkGeoPoint3d.h"
#include "/EgtDEv/Include/EGnScanner.h"
#include "/EgtDev/Include/EgtKeyCodes.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
using namespace std ;
@@ -28,7 +27,7 @@ IImportPnt*
CreateImportPnt( void)
{
// verifico la chiave e le opzioni
if ( ! GetEExNetHwKey() && ! TestKeyForEEx( GetEExKey(), KEYOPT_EEX_INPBASE, GetEExLogger()))
if ( ! VerifyKey( KEYOPT_EEX_INPBASE))
return nullptr ;
// creo l'oggetto
return static_cast<IImportPnt*> ( new(nothrow) ImportPnt) ;
+8 -9
View File
@@ -16,13 +16,10 @@
#include "ImportStl.h"
#include "DllMain.h"
#include "/EgtDev/Include/EExDllMain.h"
#include "/EgtDev/Include/EGkGeomDB.h"
#include "/EgtDev/Include/EGkStmFromTriangleSoup.h"
#include "/EgtDEv/Include/EGnScanner.h"
#include "/EgtDev/Include/EGnStringUtils.h"
#include "/EgtDev/Include/EGkGeomDB.h"
#include "/EgtDev/Include/EGkSurfTriMesh.h"
#include "/EgtDev/Include/EGkStmFromTriangleSoup.h"
#include "/EgtDev/Include/SELkKeyProc.h"
#include "/EgtDev/Include/EgtKeyCodes.h"
#include "/EgtDev/Include/EgtStringConverter.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
#include <fstream>
@@ -34,7 +31,7 @@ IImportStl*
CreateImportStl( void)
{
// verifico la chiave e le opzioni
if ( ! GetEExNetHwKey() && ! TestKeyForEEx( GetEExKey(), KEYOPT_EEX_INPBASE, GetEExLogger()))
if ( ! VerifyKey( KEYOPT_EEX_INPBASE))
return nullptr ;
// creo l'oggetto
return static_cast<IImportStl*> ( new(nothrow) ImportStl) ;
@@ -199,14 +196,16 @@ ImportStl::LoadSolid( Scanner& TheScanner, bool& bEnd)
return false ;
}
// inserisco l'oggetto nel DB geometrico
ISurfTriMesh* pSTM = StmFts.GetSurf() ;
int nIdNew = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nIdGroup, pSTM) ;
PtrOwner<ISurfTriMesh> pSTM( StmFts.GetSurf()) ;
int nIdNew = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nIdGroup, Release( pSTM)) ;
if ( nIdNew == GDB_ID_NULL)
return false ;
// se previsto il nome, lo assegno
if ( ! sName.empty())
m_pGDB->SetName( nIdNew, sName) ;
bEnd = false ;
return ( nIdNew != GDB_ID_NULL) ;
return true ;
}
//----------------------------------------------------------------------------
+2058
View File
File diff suppressed because it is too large Load Diff
+317
View File
@@ -0,0 +1,317 @@
/*
MIT License
Copyright (c) 2019 Vilya Harvey
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#ifndef MINIPLY_H
#define MINIPLY_H
#include <cstdarg>
#include <cstdint>
#include <cstdio>
#include <string>
#include <vector>
/// miniply - A simple and fast parser for PLY files
/// ================================================
///
/// For details about the PLY format see:
/// * http://paulbourke.net/dataformats/ply/
/// * https://en.wikipedia.org/wiki/PLY_(file_format)
namespace miniply {
//
// Constants
//
static constexpr uint32_t kInvalidIndex = 0xFFFFFFFFu;
// Standard PLY element names
extern const char* kPLYVertexElement; // "vertex"
extern const char* kPLYFaceElement; // "face"
//
// PLY Parsing types
//
enum class PLYFileType {
ASCII,
Binary,
BinaryBigEndian,
};
enum class PLYPropertyType {
Char,
UChar,
Short,
UShort,
Int,
UInt,
Float,
Double,
None, //!< Special value used in Element::listCountType to indicate a non-list property.
};
struct PLYProperty {
std::string name;
PLYPropertyType type = PLYPropertyType::None; //!< Type of the data. Must be set to a value other than None.
PLYPropertyType countType = PLYPropertyType::None; //!< None indicates this is not a list type, otherwise it's the type for the list count.
uint32_t offset = 0; //!< Byte offset from the start of the row.
uint32_t stride = 0;
std::vector<uint8_t> listData;
std::vector<uint32_t> rowCount; // Entry `i` is the number of items (*not* the number of bytes) in row `i`.
};
struct PLYElement {
std::string name; //!< Name of this element.
std::vector<PLYProperty> properties;
uint32_t count = 0; //!< The number of items in this element (e.g. the number of vertices if this is the vertex element).
bool fixedSize = true; //!< `true` if there are only fixed-size properties in this element, i.e. no list properties.
uint32_t rowStride = 0; //!< The number of bytes from the start of one row to the start of the next, for this element.
void calculate_offsets();
/// Returns the index for the named property in this element, or `kInvalidIndex`
/// if it can't be found.
uint32_t find_property(const char* propName) const;
/// Return the indices for several properties in one go. Use it like this:
/// ```
/// uint32_t indexes[3];
/// if (elem.find_properties(indexes, 3, "foo", "bar", "baz")) { ... }
/// ```
/// `propIdxs` is where the property indexes will be stored. `numIdxs` is
/// the number of properties we will look up. There must be exactly
/// `numIdxs` parameters after `numIdxs`; each of the is a c-style string
/// giving the name of a property.
///
/// The return value will be true if all properties were found. If it was
/// not true, you should not use any values from propIdxs.
bool find_properties(uint32_t propIdxs[], uint32_t numIdxs, ...) const;
/// Same as `find_properties`, for when you already have a `va_list`. This
/// is called internally by both `PLYElement::find_properties` and
/// `PLYReader::find_properties`.
bool find_properties_va(uint32_t propIdxs[], uint32_t numIdxs, va_list names) const;
/// Call this on the element at some point before you load its data, when
/// you know that every row's list will have the same length. It will
/// replace the single variable-size property with a set of new fixed-size
/// properties: one for the list count, followed by one for each of the
/// list values. This will allow miniply to load and extract the property
/// data a lot more efficiently, giving a big performance increase.
///
/// After you've called this, you must use PLYReader's `extract_columns`
/// method to get the data, rather than `extract_list_column`.
///
/// The `newPropIdxs` parameter must be an array with at least `listSize`
/// entries. If the function returns true, this will have been populated
/// with the indices of the new properties that represent the list values
/// (i.e. not including the list count property, which will have the same
/// index as the old list property).
///
/// The function returns false if the property index is invalid, or the
/// property it refers to is not a list property. In these cases it will
/// not modify anything. Otherwise it will return true.
bool convert_list_to_fixed_size(uint32_t listPropIdx, uint32_t listSize, uint32_t newPropIdxs[]);
};
class PLYReader {
public:
PLYReader(const char* filename);
~PLYReader();
bool valid() const;
bool has_element() const;
const PLYElement* element() const;
bool load_element();
void next_element();
PLYFileType file_type() const;
int version_major() const;
int version_minor() const;
uint32_t num_elements() const;
uint32_t find_element(const char* name) const;
PLYElement* get_element(uint32_t idx);
/// Check whether the current element has the given name.
bool element_is(const char* name) const;
/// Number of rows in the current element.
uint32_t num_rows() const;
/// Returns the index for the named property in the current element, or
/// `kInvalidIndex` if it can't be found.
uint32_t find_property(const char* name) const;
/// Equivalent to calling `find_properties` on the current element.
bool find_properties(uint32_t propIdxs[], uint32_t numIdxs, ...) const;
/// Copy the data for the specified properties into `dest`, which must be
/// an array with at least enough space to hold all of the extracted column
/// data. `propIdxs` is an array containing the indexes of the properties
/// to copy; it has `numProps` elements.
///
/// `destType` specifies the data type for values stored in `dest`. All
/// property values will be converted to this type if necessary.
///
/// This function does some checks up front to pick the most efficient code
/// path for extracting the data. It considers:
/// (a) whether any data conversion is required.
/// (b) whether all property values to be extracted are in contiguous
/// memory locations for any given item.
/// (c) whether the data for all rows is contiguous in memory.
/// In the best case it reduces to a single memcpy call. In the worst case
/// we must iterate over all values to be copied, applying type conversions
/// as we go.
///
/// Note that this function does not handle list-valued properties. Use
/// `extract_list_column()` for those instead.
bool extract_properties(const uint32_t propIdxs[], uint32_t numProps, PLYPropertyType destType, void* dest) const;
/// The same as `extract_properties`, but does not require rows in the
/// destination to be contiguous: `destStride` is the number of bytes
/// between the start of one row and the start of the next row in the
/// destination memory.
///
/// This is useful for when your destination is an array of structs where
/// you cannot extract all of the properties with a single
/// `extract_properties` call, e.g. when not all of the struct members
/// have the same type, or when the data you're extracting is only a
/// subset of the columns in each destination row.
///
/// This is a tiny bit slower than `extract_properties`. Wherever possible
/// you should use `extract_properties` in preference to this method.
bool extract_properties_with_stride(const uint32_t propIdxs[], uint32_t numProps, PLYPropertyType destType, void* dest, uint32_t destStride) const;
/// Get the array of item counts for a list property. Entry `i` in this
/// array is the number of items in the `i`th list.
const uint32_t* get_list_counts(uint32_t propIdx) const;
/// Get the sum of all item counts for a list property. This can be useful
/// to determine how big a destination array you'll need for a call to
/// `extract_list_property`. It's equivalent to summing up all the values
/// in the array returned by `get_list_counts`, but faster.
uint32_t sum_of_list_counts(uint32_t propIdx) const;
const uint8_t* get_list_data(uint32_t propIdx) const;
bool extract_list_property(uint32_t propIdx, PLYPropertyType destType, void* dest) const;
uint32_t num_triangles(uint32_t propIdx) const;
bool requires_triangulation(uint32_t propIdx) const;
bool extract_triangles(uint32_t propIdx, const float pos[], uint32_t numVerts, PLYPropertyType destType, void* dest) const;
bool find_pos(uint32_t propIdxs[3]) const;
bool find_normal(uint32_t propIdxs[3]) const;
bool find_texcoord(uint32_t propIdxs[2]) const;
bool find_color(uint32_t propIdxs[3]) const;
bool find_indices(uint32_t propIdxs[1]) const;
private:
bool refill_buffer();
bool rewind_to_safe_char();
bool accept();
bool advance();
bool next_line();
bool match(const char* str);
bool which(const char* values[], uint32_t* index);
bool which_property_type(PLYPropertyType* type);
bool keyword(const char* kw);
bool identifier(char* dest, size_t destLen);
template <class T> // T must be a type compatible with uint32_t.
bool typed_which(const char* values[], T* index) {
return which(values, reinterpret_cast<uint32_t*>(index));
}
bool int_literal(int* value);
bool float_literal(float* value);
bool double_literal(double* value);
bool parse_elements();
bool parse_element();
bool parse_property(std::vector<PLYProperty>& properties);
bool load_fixed_size_element(PLYElement& elem);
bool load_variable_size_element(PLYElement& elem);
bool load_ascii_scalar_property(PLYProperty& prop, size_t& destIndex);
bool load_ascii_list_property(PLYProperty& prop);
bool load_binary_scalar_property(PLYProperty& prop, size_t& destIndex);
bool load_binary_list_property(PLYProperty& prop);
bool load_binary_scalar_property_big_endian(PLYProperty& prop, size_t& destIndex);
bool load_binary_list_property_big_endian(PLYProperty& prop);
bool ascii_value(PLYPropertyType propType, uint8_t value[8]);
private:
FILE* m_f = nullptr;
char* m_buf = nullptr;
const char* m_bufEnd = nullptr;
const char* m_pos = nullptr;
const char* m_end = nullptr;
bool m_inDataSection = false;
bool m_atEOF = false;
int64_t m_bufOffset = 0;
bool m_valid = false;
PLYFileType m_fileType = PLYFileType::ASCII; //!< Whether the file was ascii, binary little-endian, or binary big-endian.
int m_majorVersion = 0;
int m_minorVersion = 0;
std::vector<PLYElement> m_elements; //!< Element descriptors for this file.
size_t m_currentElement = 0;
bool m_elementLoaded = false;
std::vector<uint8_t> m_elementData;
char* m_tmpBuf = nullptr;
};
/// Given a polygon with `n` vertices, where `n` > 3, triangulate it and
/// store the indices for the resulting triangles in `dst`. The `pos`
/// parameter is the array of all vertex positions for the mesh; `indices` is
/// the list of `n` indices for the polygon we're triangulating; and `dst` is
/// where we write the new indices to.
///
/// The triangulation will always produce `n - 2` triangles, so `dst` must
/// have enough space for `3 * (n - 2)` indices.
///
/// If `n == 3`, we simply copy the input indices to `dst`. If `n < 3`,
/// nothing gets written to dst.
///
/// The return value is the number of triangles.
uint32_t triangulate_polygon(uint32_t n, const float pos[], uint32_t numVerts, const int indices[], int dst[]);
} // namespace miniply
#endif // MINIPLY_H
+38 -38
View File
@@ -1,15 +1,15 @@
/**
* pugixml parser - version 1.11
* --------------------------------------------------------
* Copyright (C) 2006-2020, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
* Report bugs and download new versions at https://pugixml.org/
*
* This library is distributed under the MIT License. See notice at the end
* of this file.
*
* This work is based on the pugxml parser, which is:
* Copyright (C) 2003, by Kristen Wegner (kristen@tima.net)
*/
* pugixml parser - version 1.15
* --------------------------------------------------------
* Copyright (C) 2006-2025, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
* Report bugs and download new versions at https://pugixml.org/
*
* This library is distributed under the MIT License. See notice at the end
* of this file.
*
* This work is based on the pugxml parser, which is:
* Copyright (C) 2003, by Kristen Wegner (kristen@tima.net)
*/
#ifndef HEADER_PUGICONFIG_HPP
#define HEADER_PUGICONFIG_HPP
@@ -46,35 +46,35 @@
// Uncomment this to switch to header-only version
// #define PUGIXML_HEADER_ONLY
// Uncomment this to enable long long support
// Uncomment this to enable long long support (usually enabled automatically)
// #define PUGIXML_HAS_LONG_LONG
// Uncomment this to enable support for std::string_view (usually enabled automatically)
// #define PUGIXML_HAS_STRING_VIEW
#endif
/**
* Copyright (c) 2006-2020 Arseny Kapoulkine
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
* Copyright (c) 2006-2025 Arseny Kapoulkine
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
+9831 -9297
View File
File diff suppressed because it is too large Load Diff
+204 -119
View File
@@ -1,20 +1,20 @@
/**
* pugixml parser - version 1.11
* --------------------------------------------------------
* Copyright (C) 2006-2020, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
* Report bugs and download new versions at https://pugixml.org/
*
* This library is distributed under the MIT License. See notice at the end
* of this file.
*
* This work is based on the pugxml parser, which is:
* Copyright (C) 2003, by Kristen Wegner (kristen@tima.net)
*/
* pugixml parser - version 1.15
* --------------------------------------------------------
* Copyright (C) 2006-2025, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
* Report bugs and download new versions at https://pugixml.org/
*
* This library is distributed under the MIT License. See notice at the end
* of this file.
*
* This work is based on the pugxml parser, which is:
* Copyright (C) 2003, by Kristen Wegner (kristen@tima.net)
*/
#ifndef PUGIXML_VERSION
// Define version macro; evaluates to major * 1000 + minor * 10 + patch so that it's safe to use in less-than comparisons
// Note: pugixml used major * 100 + minor * 10 + patch format up until 1.9 (which had version identifier 190); starting from pugixml 1.10, the minor version number is two digits
# define PUGIXML_VERSION 1110
#ifndef PUGIXML_VERSION
# define PUGIXML_VERSION 1150 // 1.15
#endif
// Include user configuration file (this can define various configuration macros)
@@ -38,6 +38,20 @@
# include <string>
#endif
// Check if std::string_view is available
#if !defined(PUGIXML_HAS_STRING_VIEW) && !defined(PUGIXML_NO_STL)
# if __cplusplus >= 201703L
# define PUGIXML_HAS_STRING_VIEW
# elif defined(_MSVC_LANG) && _MSVC_LANG >= 201703L
# define PUGIXML_HAS_STRING_VIEW
# endif
#endif
// Include string_view if appropriate
#ifdef PUGIXML_HAS_STRING_VIEW
# include <string_view>
#endif
// Macro for deprecated features
#ifndef PUGIXML_DEPRECATED
# if defined(__GNUC__)
@@ -82,14 +96,14 @@
# endif
#endif
// If C++ is 2011 or higher, add 'noexcept' specifiers
// If C++ is 2011 or higher, use 'noexcept' specifiers
#ifndef PUGIXML_NOEXCEPT
# if __cplusplus >= 201103
# define PUGIXML_NOEXCEPT noexcept
# elif defined(_MSC_VER) && _MSC_VER >= 1900
# define PUGIXML_NOEXCEPT noexcept
# else
# define PUGIXML_NOEXCEPT
# define PUGIXML_NOEXCEPT throw()
# endif
#endif
@@ -115,6 +129,8 @@
#ifndef PUGIXML_NULL
# if __cplusplus >= 201103
# define PUGIXML_NULL nullptr
# elif defined(_MSC_VER) && _MSC_VER >= 1600
# define PUGIXML_NULL nullptr
# else
# define PUGIXML_NULL 0
# endif
@@ -136,7 +152,12 @@ namespace pugi
#ifndef PUGIXML_NO_STL
// String type used for operations that work with STL string; depends on PUGIXML_WCHAR_MODE
typedef std::basic_string<PUGIXML_CHAR, std::char_traits<PUGIXML_CHAR>, std::allocator<PUGIXML_CHAR> > string_t;
typedef std::basic_string<PUGIXML_CHAR> string_t;
#endif
#ifdef PUGIXML_HAS_STRING_VIEW
// String view type used for operations that can work with a length delimited string; depends on PUGIXML_WCHAR_MODE
typedef std::basic_string_view<PUGIXML_CHAR> string_view_t;
#endif
}
@@ -211,6 +232,10 @@ namespace pugi
// This flag is off by default.
const unsigned int parse_embed_pcdata = 0x2000;
// This flag determines whether determines whether the the two pcdata should be merged or not, if no intermediatory data are parsed in the document.
// This flag is off by default.
const unsigned int parse_merge_pcdata = 0x4000;
// The default parsing mode.
// Elements, PCDATA and CDATA sections are added to the DOM tree, character/reference entities are expanded,
// End-of-Line characters are normalized, attribute values are normalized using CDATA normalization rules.
@@ -291,12 +316,12 @@ namespace pugi
class xml_text;
#ifndef PUGIXML_NO_XPATH
#ifndef PUGIXML_NO_XPATH
class xpath_node;
class xpath_node_set;
class xpath_query;
class xpath_variable_set;
#endif
#endif
// Range-based for loop support
template <typename It> class xml_object_range
@@ -312,6 +337,8 @@ namespace pugi
It begin() const { return _begin; }
It end() const { return _end; }
bool empty() const { return _begin == _end; }
private:
It _begin, _end;
};
@@ -320,7 +347,7 @@ namespace pugi
class PUGIXML_CLASS xml_writer
{
public:
virtual ~xml_writer() {}
virtual ~xml_writer();
// Write memory chunk into stream/file/whatever
virtual void write(const void* data, size_t size) = 0;
@@ -339,22 +366,22 @@ namespace pugi
void* file;
};
#ifndef PUGIXML_NO_STL
#ifndef PUGIXML_NO_STL
// xml_writer implementation for streams
class PUGIXML_CLASS xml_writer_stream: public xml_writer
{
public:
// Construct writer from an output stream object
xml_writer_stream(std::basic_ostream<char, std::char_traits<char> >& stream);
xml_writer_stream(std::basic_ostream<wchar_t, std::char_traits<wchar_t> >& stream);
xml_writer_stream(std::basic_ostream<char>& stream);
xml_writer_stream(std::basic_ostream<wchar_t>& stream);
virtual void write(const void* data, size_t size) PUGIXML_OVERRIDE;
private:
std::basic_ostream<char, std::char_traits<char> >* narrow_stream;
std::basic_ostream<wchar_t, std::char_traits<wchar_t> >* wide_stream;
std::basic_ostream<char>* narrow_stream;
std::basic_ostream<wchar_t>* wide_stream;
};
#endif
#endif
// A light-weight handle for manipulating attributes in DOM tree
class PUGIXML_CLASS xml_attribute
@@ -388,7 +415,7 @@ namespace pugi
bool operator<=(const xml_attribute& r) const;
bool operator>=(const xml_attribute& r) const;
// Check if attribute is empty
// Check if attribute is empty (null)
bool empty() const;
// Get attribute name/value, or "" if attribute is empty
@@ -404,17 +431,25 @@ namespace pugi
double as_double(double def = 0) const;
float as_float(float def = 0) const;
#ifdef PUGIXML_HAS_LONG_LONG
#ifdef PUGIXML_HAS_LONG_LONG
long long as_llong(long long def = 0) const;
unsigned long long as_ullong(unsigned long long def = 0) const;
#endif
#endif
// Get attribute value as bool (returns true if first character is in '1tTyY' set), or the default value if attribute is empty
bool as_bool(bool def = false) const;
// Set attribute name/value (returns false if attribute is empty or there is not enough memory)
bool set_name(const char_t* rhs);
bool set_name(const char_t* rhs, size_t size);
#ifdef PUGIXML_HAS_STRING_VIEW
bool set_name(string_view_t rhs);
#endif
bool set_value(const char_t* rhs);
bool set_value(const char_t* rhs, size_t size);
#ifdef PUGIXML_HAS_STRING_VIEW
bool set_value(string_view_t rhs);
#endif
// Set attribute value with type conversion (numbers are converted to strings, boolean is converted to "true"/"false")
bool set_value(int rhs);
@@ -427,10 +462,10 @@ namespace pugi
bool set_value(float rhs, int precision);
bool set_value(bool rhs);
#ifdef PUGIXML_HAS_LONG_LONG
#ifdef PUGIXML_HAS_LONG_LONG
bool set_value(long long rhs);
bool set_value(unsigned long long rhs);
#endif
#endif
// Set attribute value (equivalent to set_value without error checking)
xml_attribute& operator=(const char_t* rhs);
@@ -442,10 +477,14 @@ namespace pugi
xml_attribute& operator=(float rhs);
xml_attribute& operator=(bool rhs);
#ifdef PUGIXML_HAS_LONG_LONG
#ifdef PUGIXML_HAS_STRING_VIEW
xml_attribute& operator=(string_view_t rhs);
#endif
#ifdef PUGIXML_HAS_LONG_LONG
xml_attribute& operator=(long long rhs);
xml_attribute& operator=(unsigned long long rhs);
#endif
#endif
// Get next/previous attribute in the attribute list of the parent node
xml_attribute next_attribute() const;
@@ -497,7 +536,7 @@ namespace pugi
bool operator<=(const xml_node& r) const;
bool operator>=(const xml_node& r) const;
// Check if node is empty.
// Check if node is empty (null)
bool empty() const;
// Get node type
@@ -536,9 +575,18 @@ namespace pugi
xml_attribute attribute(const char_t* name) const;
xml_node next_sibling(const char_t* name) const;
xml_node previous_sibling(const char_t* name) const;
#ifdef PUGIXML_HAS_STRING_VIEW
xml_node child(string_view_t name) const;
xml_attribute attribute(string_view_t name) const;
xml_node next_sibling(string_view_t name) const;
xml_node previous_sibling(string_view_t name) const;
#endif
// Get attribute, starting the search from a hint (and updating hint so that searching for a sequence of attributes is fast)
xml_attribute attribute(const char_t* name, xml_attribute& hint) const;
#ifdef PUGIXML_HAS_STRING_VIEW
xml_attribute attribute(string_view_t name, xml_attribute& hint) const;
#endif
// Get child value of current node; that is, value of the first child node of type PCDATA/CDATA
const char_t* child_value() const;
@@ -548,13 +596,27 @@ namespace pugi
// Set node name/value (returns false if node is empty, there is not enough memory, or node can not have name/value)
bool set_name(const char_t* rhs);
bool set_name(const char_t* rhs, size_t size);
#ifdef PUGIXML_HAS_STRING_VIEW
bool set_name(string_view_t rhs);
#endif
bool set_value(const char_t* rhs);
bool set_value(const char_t* rhs, size_t size);
#ifdef PUGIXML_HAS_STRING_VIEW
bool set_value(string_view_t rhs);
#endif
// Add attribute with specified name. Returns added attribute, or empty attribute on errors.
xml_attribute append_attribute(const char_t* name);
xml_attribute prepend_attribute(const char_t* name);
xml_attribute insert_attribute_after(const char_t* name, const xml_attribute& attr);
xml_attribute insert_attribute_before(const char_t* name, const xml_attribute& attr);
#ifdef PUGIXML_HAS_STRING_VIEW
xml_attribute append_attribute(string_view_t name);
xml_attribute prepend_attribute(string_view_t name);
xml_attribute insert_attribute_after(string_view_t name, const xml_attribute& attr);
xml_attribute insert_attribute_before(string_view_t name, const xml_attribute& attr);
#endif
// Add a copy of the specified attribute. Returns added attribute, or empty attribute on errors.
xml_attribute append_copy(const xml_attribute& proto);
@@ -573,6 +635,12 @@ namespace pugi
xml_node prepend_child(const char_t* name);
xml_node insert_child_after(const char_t* name, const xml_node& node);
xml_node insert_child_before(const char_t* name, const xml_node& node);
#ifdef PUGIXML_HAS_STRING_VIEW
xml_node append_child(string_view_t name);
xml_node prepend_child(string_view_t name);
xml_node insert_child_after(string_view_t, const xml_node& node);
xml_node insert_child_before(string_view_t name, const xml_node& node);
#endif
// Add a copy of the specified node as a child. Returns added node, or empty node on errors.
xml_node append_copy(const xml_node& proto);
@@ -589,6 +657,9 @@ namespace pugi
// Remove specified attribute
bool remove_attribute(const xml_attribute& a);
bool remove_attribute(const char_t* name);
#ifdef PUGIXML_HAS_STRING_VIEW
bool remove_attribute(string_view_t name);
#endif
// Remove all attributes
bool remove_attributes();
@@ -596,6 +667,9 @@ namespace pugi
// Remove specified child
bool remove_child(const xml_node& n);
bool remove_child(const char_t* name);
#ifdef PUGIXML_HAS_STRING_VIEW
bool remove_child(string_view_t name);
#endif
// Remove all children
bool remove_children();
@@ -657,10 +731,10 @@ namespace pugi
xml_node find_child_by_attribute(const char_t* name, const char_t* attr_name, const char_t* attr_value) const;
xml_node find_child_by_attribute(const char_t* attr_name, const char_t* attr_value) const;
#ifndef PUGIXML_NO_STL
#ifndef PUGIXML_NO_STL
// Get the absolute node path from root as a text string.
string_t path(char_t delimiter = '/') const;
#endif
#endif
// Search for a node by path consisting of node names and . or .. elements.
xml_node first_element_by_path(const char_t* path, char_t delimiter = '/') const;
@@ -668,7 +742,7 @@ namespace pugi
// Recursively traverse subtree with xml_tree_walker
bool traverse(xml_tree_walker& walker);
#ifndef PUGIXML_NO_XPATH
#ifndef PUGIXML_NO_XPATH
// Select single node by evaluating XPath query. Returns first node from the resulting node set.
xpath_node select_node(const char_t* query, xpath_variable_set* variables = PUGIXML_NULL) const;
xpath_node select_node(const xpath_query& query) const;
@@ -681,16 +755,16 @@ namespace pugi
PUGIXML_DEPRECATED xpath_node select_single_node(const char_t* query, xpath_variable_set* variables = PUGIXML_NULL) const;
PUGIXML_DEPRECATED xpath_node select_single_node(const xpath_query& query) const;
#endif
#endif
// Print subtree using a writer object
void print(xml_writer& writer, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, xml_encoding encoding = encoding_auto, unsigned int depth = 0) const;
#ifndef PUGIXML_NO_STL
#ifndef PUGIXML_NO_STL
// Print subtree to stream
void print(std::basic_ostream<char, std::char_traits<char> >& os, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, xml_encoding encoding = encoding_auto, unsigned int depth = 0) const;
void print(std::basic_ostream<wchar_t, std::char_traits<wchar_t> >& os, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, unsigned int depth = 0) const;
#endif
void print(std::basic_ostream<char>& os, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, xml_encoding encoding = encoding_auto, unsigned int depth = 0) const;
void print(std::basic_ostream<wchar_t>& os, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, unsigned int depth = 0) const;
#endif
// Child nodes iterators
typedef xml_node_iterator iterator;
@@ -706,9 +780,12 @@ namespace pugi
// Range-based for support
xml_object_range<xml_node_iterator> children() const;
xml_object_range<xml_named_node_iterator> children(const char_t* name) const;
xml_object_range<xml_attribute_iterator> attributes() const;
// Range-based for support for all children with the specified name
// Note: name pointer must have a longer lifetime than the returned object; be careful with passing temporaries!
xml_object_range<xml_named_node_iterator> children(const char_t* name) const;
// Get node offset in parsed file/string (in char_t units) for debugging purposes
ptrdiff_t offset_debug() const;
@@ -749,7 +826,7 @@ namespace pugi
// Borland C++ workaround
bool operator!() const;
// Check if text object is empty
// Check if text object is empty (null)
bool empty() const;
// Get text, or "" if object is empty
@@ -764,16 +841,20 @@ namespace pugi
double as_double(double def = 0) const;
float as_float(float def = 0) const;
#ifdef PUGIXML_HAS_LONG_LONG
#ifdef PUGIXML_HAS_LONG_LONG
long long as_llong(long long def = 0) const;
unsigned long long as_ullong(unsigned long long def = 0) const;
#endif
#endif
// Get text as bool (returns true if first character is in '1tTyY' set), or the default value if object is empty
bool as_bool(bool def = false) const;
// Set text (returns false if object is empty or there is not enough memory)
bool set(const char_t* rhs);
bool set(const char_t* rhs, size_t size);
#ifdef PUGIXML_HAS_STRING_VIEW
bool set(string_view_t rhs);
#endif
// Set text with type conversion (numbers are converted to strings, boolean is converted to "true"/"false")
bool set(int rhs);
@@ -786,10 +867,10 @@ namespace pugi
bool set(float rhs, int precision);
bool set(bool rhs);
#ifdef PUGIXML_HAS_LONG_LONG
#ifdef PUGIXML_HAS_LONG_LONG
bool set(long long rhs);
bool set(unsigned long long rhs);
#endif
#endif
// Set text (equivalent to set without error checking)
xml_text& operator=(const char_t* rhs);
@@ -801,10 +882,14 @@ namespace pugi
xml_text& operator=(float rhs);
xml_text& operator=(bool rhs);
#ifdef PUGIXML_HAS_LONG_LONG
#ifdef PUGIXML_HAS_STRING_VIEW
xml_text& operator=(string_view_t rhs);
#endif
#ifdef PUGIXML_HAS_LONG_LONG
xml_text& operator=(long long rhs);
xml_text& operator=(unsigned long long rhs);
#endif
#endif
// Get the data node (node_pcdata or node_cdata) for this object
xml_node data() const;
@@ -834,9 +919,9 @@ namespace pugi
typedef xml_node* pointer;
typedef xml_node& reference;
#ifndef PUGIXML_NO_STL
#ifndef PUGIXML_NO_STL
typedef std::bidirectional_iterator_tag iterator_category;
#endif
#endif
// Default constructor
xml_node_iterator();
@@ -851,10 +936,10 @@ namespace pugi
xml_node& operator*() const;
xml_node* operator->() const;
const xml_node_iterator& operator++();
xml_node_iterator& operator++();
xml_node_iterator operator++(int);
const xml_node_iterator& operator--();
xml_node_iterator& operator--();
xml_node_iterator operator--(int);
};
@@ -876,9 +961,9 @@ namespace pugi
typedef xml_attribute* pointer;
typedef xml_attribute& reference;
#ifndef PUGIXML_NO_STL
#ifndef PUGIXML_NO_STL
typedef std::bidirectional_iterator_tag iterator_category;
#endif
#endif
// Default constructor
xml_attribute_iterator();
@@ -893,10 +978,10 @@ namespace pugi
xml_attribute& operator*() const;
xml_attribute* operator->() const;
const xml_attribute_iterator& operator++();
xml_attribute_iterator& operator++();
xml_attribute_iterator operator++(int);
const xml_attribute_iterator& operator--();
xml_attribute_iterator& operator--();
xml_attribute_iterator operator--(int);
};
@@ -912,14 +997,15 @@ namespace pugi
typedef xml_node* pointer;
typedef xml_node& reference;
#ifndef PUGIXML_NO_STL
#ifndef PUGIXML_NO_STL
typedef std::bidirectional_iterator_tag iterator_category;
#endif
#endif
// Default constructor
xml_named_node_iterator();
// Construct an iterator which points to the specified node
// Note: name pointer is stored in the iterator and must have a longer lifetime than iterator itself
xml_named_node_iterator(const xml_node& node, const char_t* name);
// Iterator operators
@@ -929,10 +1015,10 @@ namespace pugi
xml_node& operator*() const;
xml_node* operator->() const;
const xml_named_node_iterator& operator++();
xml_named_node_iterator& operator++();
xml_named_node_iterator operator++(int);
const xml_named_node_iterator& operator--();
xml_named_node_iterator& operator--();
xml_named_node_iterator operator--(int);
private:
@@ -1041,11 +1127,11 @@ namespace pugi
// Destructor, invalidates all node/attribute handles to this document
~xml_document();
#ifdef PUGIXML_HAS_MOVE
#ifdef PUGIXML_HAS_MOVE
// Move semantics support
xml_document(xml_document&& rhs) PUGIXML_NOEXCEPT_IF_NOT_COMPACT;
xml_document& operator=(xml_document&& rhs) PUGIXML_NOEXCEPT_IF_NOT_COMPACT;
#endif
#endif
// Removes all nodes, leaving the empty document
void reset();
@@ -1053,11 +1139,11 @@ namespace pugi
// Removes all nodes, then copies the entire contents of the specified document
void reset(const xml_document& proto);
#ifndef PUGIXML_NO_STL
#ifndef PUGIXML_NO_STL
// Load document from stream.
xml_parse_result load(std::basic_istream<char, std::char_traits<char> >& stream, unsigned int options = parse_default, xml_encoding encoding = encoding_auto);
xml_parse_result load(std::basic_istream<wchar_t, std::char_traits<wchar_t> >& stream, unsigned int options = parse_default);
#endif
xml_parse_result load(std::basic_istream<char>& stream, unsigned int options = parse_default, xml_encoding encoding = encoding_auto);
xml_parse_result load(std::basic_istream<wchar_t>& stream, unsigned int options = parse_default);
#endif
// (deprecated: use load_string instead) Load document from zero-terminated string. No encoding conversions are applied.
PUGIXML_DEPRECATED xml_parse_result load(const char_t* contents, unsigned int options = parse_default);
@@ -1083,11 +1169,11 @@ namespace pugi
// Save XML document to writer (semantics is slightly different from xml_node::print, see documentation for details).
void save(xml_writer& writer, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, xml_encoding encoding = encoding_auto) const;
#ifndef PUGIXML_NO_STL
#ifndef PUGIXML_NO_STL
// Save XML document to stream (semantics is slightly different from xml_node::print, see documentation for details).
void save(std::basic_ostream<char, std::char_traits<char> >& stream, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, xml_encoding encoding = encoding_auto) const;
void save(std::basic_ostream<wchar_t, std::char_traits<wchar_t> >& stream, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default) const;
#endif
void save(std::basic_ostream<char>& stream, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, xml_encoding encoding = encoding_auto) const;
void save(std::basic_ostream<wchar_t>& stream, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default) const;
#endif
// Save XML to file
bool save_file(const char* path, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, xml_encoding encoding = encoding_auto) const;
@@ -1185,11 +1271,11 @@ namespace pugi
xpath_variable_set(const xpath_variable_set& rhs);
xpath_variable_set& operator=(const xpath_variable_set& rhs);
#ifdef PUGIXML_HAS_MOVE
#ifdef PUGIXML_HAS_MOVE
// Move semantics support
xpath_variable_set(xpath_variable_set&& rhs) PUGIXML_NOEXCEPT;
xpath_variable_set& operator=(xpath_variable_set&& rhs) PUGIXML_NOEXCEPT;
#endif
#endif
// Add a new variable or get the existing one, if the types match
xpath_variable* add(const char_t* name, xpath_value_type type);
@@ -1229,11 +1315,11 @@ namespace pugi
// Destructor
~xpath_query();
#ifdef PUGIXML_HAS_MOVE
#ifdef PUGIXML_HAS_MOVE
// Move semantics support
xpath_query(xpath_query&& rhs) PUGIXML_NOEXCEPT;
xpath_query& operator=(xpath_query&& rhs) PUGIXML_NOEXCEPT;
#endif
#endif
// Get query expression return type
xpath_value_type return_type() const;
@@ -1246,11 +1332,11 @@ namespace pugi
// If PUGIXML_NO_EXCEPTIONS is not defined, throws std::bad_alloc on out of memory errors.
double evaluate_number(const xpath_node& n) const;
#ifndef PUGIXML_NO_STL
#ifndef PUGIXML_NO_STL
// Evaluate expression as string value in the specified context; performs type conversion if necessary.
// If PUGIXML_NO_EXCEPTIONS is not defined, throws std::bad_alloc on out of memory errors.
string_t evaluate_string(const xpath_node& n) const;
#endif
#endif
// Evaluate expression as string value in the specified context; performs type conversion if necessary.
// At most capacity characters are written to the destination buffer, full result size is returned (includes terminating zero).
@@ -1279,13 +1365,13 @@ namespace pugi
bool operator!() const;
};
#ifndef PUGIXML_NO_EXCEPTIONS
#if defined(_MSC_VER)
// C4275 can be ignored in Visual C++ if you are deriving
// from a type in the Standard C++ Library
#pragma warning(push)
#pragma warning(disable: 4275)
#endif
#ifndef PUGIXML_NO_EXCEPTIONS
#if defined(_MSC_VER)
// C4275 can be ignored in Visual C++ if you are deriving
// from a type in the Standard C++ Library
#pragma warning(push)
#pragma warning(disable: 4275)
#endif
// XPath exception class
class PUGIXML_CLASS xpath_exception: public std::exception
{
@@ -1297,15 +1383,15 @@ namespace pugi
explicit xpath_exception(const xpath_parse_result& result);
// Get error message
virtual const char* what() const throw() PUGIXML_OVERRIDE;
virtual const char* what() const PUGIXML_NOEXCEPT PUGIXML_OVERRIDE;
// Get parse result
const xpath_parse_result& result() const;
};
#if defined(_MSC_VER)
#pragma warning(pop)
#endif
#endif
#if defined(_MSC_VER)
#pragma warning(pop)
#endif
#endif
// XPath node class (either xml_node or xml_attribute)
class PUGIXML_CLASS xpath_node
@@ -1379,11 +1465,11 @@ namespace pugi
xpath_node_set(const xpath_node_set& ns);
xpath_node_set& operator=(const xpath_node_set& ns);
#ifdef PUGIXML_HAS_MOVE
#ifdef PUGIXML_HAS_MOVE
// Move semantics support
xpath_node_set(xpath_node_set&& rhs) PUGIXML_NOEXCEPT;
xpath_node_set& operator=(xpath_node_set&& rhs) PUGIXML_NOEXCEPT;
#endif
#endif
// Get collection type
type_t type() const;
@@ -1422,12 +1508,12 @@ namespace pugi
#ifndef PUGIXML_NO_STL
// Convert wide string to UTF8
std::basic_string<char, std::char_traits<char>, std::allocator<char> > PUGIXML_FUNCTION as_utf8(const wchar_t* str);
std::basic_string<char, std::char_traits<char>, std::allocator<char> > PUGIXML_FUNCTION as_utf8(const std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >& str);
std::basic_string<char> PUGIXML_FUNCTION as_utf8(const wchar_t* str);
std::basic_string<char> PUGIXML_FUNCTION as_utf8(const std::basic_string<wchar_t>& str);
// Convert UTF8 to wide string
std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > PUGIXML_FUNCTION as_wide(const char* str);
std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > PUGIXML_FUNCTION as_wide(const std::basic_string<char, std::char_traits<char>, std::allocator<char> >& str);
std::basic_string<wchar_t> PUGIXML_FUNCTION as_wide(const char* str);
std::basic_string<wchar_t> PUGIXML_FUNCTION as_wide(const std::basic_string<char>& str);
#endif
// Memory allocation function interface; returns pointer to allocated memory or NULL on failure
@@ -1474,27 +1560,26 @@ namespace std
#endif
/**
* Copyright (c) 2006-2020 Arseny Kapoulkine
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
* Copyright (c) 2006-2025 Arseny Kapoulkine
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
+2
View File
@@ -31,8 +31,10 @@
#pragma comment(lib, EGTLIBDIR "EgtGeneral" EGTLIBVER ".lib")
#pragma comment(lib, EGTLIBDIR "EgtNumKernel" EGTLIBVER ".lib")
#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 "/libzip/Lib/zip" EGTLIBVER ".lib")
#pragma comment(lib, EGTEXTDIR "/lib3mf/Lib/lib3mf" EGTLIBVER ".lib")
#pragma comment(lib, EGTEXTDIR "Lua/Lib/Lua54" EGTLIBVER ".lib")