Compare commits

...

507 Commits

Author SHA1 Message Date
Riccardo Elitropi 5d5a8bd01e Merge commit 'e31fcee3386361d8265e138accf2b6bf49858643' into ModelessDialog 2026-05-08 08:44:13 +02:00
Riccardo Elitropi 292361139a EgtExecutor (ModelessDialog) :
- primo commit.
2026-05-08 08:40:01 +02:00
Dario Sassi e31fcee338 EgtExecutor 3.1e1 :
- ricompilazione con cambio versione.
2026-05-07 12:23:40 +02:00
Daniele Bariletti 4746474864 EgtExecutor :
- aggiunto argomento alla RegolarizeSurfaceLocally.
2026-05-07 11:29:44 +02:00
Daniele Bariletti 7cefd64b2a EgtExecutor :
- modificata funzione per la regolarize.
2026-04-22 16:42:46 +02:00
Daniele Bariletti 8a51d5e3a5 Merge branch 'Trimming' 2026-04-21 15:09:38 +02:00
Daniele Bariletti d32fdc5417 EgtExecutor :
- aggiunte funzioni per regolarizzare i bordi di una surf di trimming.
2026-04-21 15:06:24 +02:00
Daniele Bariletti ccaaa5bd22 Merge branch 'master' into Trimming 2026-04-20 09:27:37 +02:00
Dario Sassi 00e6d24f2e EgtExecutor 3.1d3 :
- piccoli aggiustamenti.
2026-04-19 10:55:49 +02:00
Daniele Bariletti 2d4d4ddf03 EgtExecutor .
- aggiunto controllo.
2026-04-17 13:23:56 +02:00
Dario Sassi cfcb844923 EgtExecutor 3.1d2 :
- nelle funzioni exe e lua di proiezione di curve su superfici aggiunto paramtetro bFromVsTo.
2026-04-15 08:56:43 +02:00
Dario Sassi e9f368a85f EgtExecutor 3.1d1 :
- aggiunta funzione Exe/lua Redraw
- aggiunte funzioni Exe/lua SurfTmGetSmoothAng e VolZmapGetShowEdges.
2026-04-08 19:30:11 +02:00
Riccardo Elitropi 1abcac8aa4 EgtExecutor :
- In ExePocketing aggiunti parametri per lucidatura.
2026-03-31 19:02:17 +02:00
Daniele Bariletti a9b5d9627a Merge branch 'master' of https://gitlab.steamware.net/egaltech/EgtExecutor 2026-03-31 15:02:04 +02:00
Daniele Bariletti 41790f7d57 EgtExecutor :
- aggiunto controllo.
2026-03-31 15:01:56 +02:00
Riccardo Elitropi c33cbe7b9f EgtExecutor 3.1c6 :
- In Nesting aggiunto controllo e gestione di collisioni con i loop interni delle regioni piane
- in nesting aggiunte funzioni per interferenza tra regioni piane
- aggiunto controllo per allineamento e riposizionamento nel caso di lavorazioni con Waterjet.
2026-03-31 14:24:05 +02:00
Riccardo Elitropi 35455e011e Merge commit '1d9ecd9b7874511eb24965b857a7d7b21dc9b8b3' 2026-03-31 14:21:08 +02:00
Riccardo Elitropi 1d9ecd9b78 EgtExecutor (Nst_SurfFr) :
- migliorata la collisione e l'allineamento per Regioni Piane.
2026-03-31 13:22:51 +02:00
Riccardo Elitropi 6c2437831d EgtExecutor (Nst_SurfFr) :
- aggiunti controlli aggiuntivi per collisioni.
2026-03-30 18:17:52 +02:00
Riccardo Elitropi d87b349788 EgtExecutor (Nst_SurfFr) :
- primo commit per CAv tra Regioni Piane con loop interni e Interferenza tra Regioni Piane.
2026-03-27 18:43:36 +01:00
Dario Sassi 1141af30d7 EgtExecutor :
- aggiunta funzione lua EgtGetCalcAnglesEx per calcolo assi rotanti in centri di lavoro con più di due assi
- funzione lua EgtVerifyOutstroke estesa per accettare fino a 4 assi rotanti.
2026-03-25 16:48:10 +01:00
Riccardo Elitropi 4a34b2e45d EgtExecutor 3.1c5 :
- aggiunto controllo sulla dimensione alle funzioni di creazione ZMap per versioni a 32Bit.
2026-03-24 16:01:43 +01:00
Dario Sassi bdd0e89b78 EgtExecutor :
- piccole modifiche estetiche.
2026-03-23 08:25:59 +01:00
Dario Sassi 4b8f8ee87e EgtExecutor :
- aggiunto parametro nRefType a funzione VolZMapRemoveFins.
2026-03-20 09:02:56 +01:00
Dario Sassi 5314a1926b EgtExecutor :
- cambio nome di funzione exe/lua da EraseFins in RemoveFins
- cambio nome di funzione exe/lua da UniformVolZmap a VolZmapMakeUniform.
2026-03-19 19:31:36 +01:00
Riccardo Elitropi 0699f7ffd1 EgtExecutor :
- aggiunta funzione EraseFins per gli Zmap.
2026-03-19 18:43:11 +01:00
Daniele Bariletti a6e3732296 Merge branch 'master' of https://gitlab.steamware.net/egaltech/EgtExecutor 2026-03-19 14:53:45 +01:00
Riccardo Elitropi 6b6fd884a0 EgtExecutor 3.1c4 :
- in MachMgr aggiunte funzioni per ottenere vTDir, vCDir e vADir per entità CamData.
2026-03-18 15:56:28 +01:00
Daniele Bariletti e96bcefcc3 Merge branch 'master' of https://gitlab.steamware.net/egaltech/EgtExecutor 2026-03-16 17:07:22 +01:00
Dario Sassi 7412a3085f EgtExecutor :
- la funzione Exe/Lua SurfBezierParamsFromPoint ora restituisce solo i valori dei parametri U e V che corrispondono al punto
- piccole migliorie.
2026-03-13 13:33:46 +01:00
Daniele Bariletti e1b2c93f22 EgtExecutor :
- piccola correzione.
2026-03-13 09:14:07 +01:00
Daniele Bariletti 2687fd90dc EgtExecutor :
- cambio restituzione valori per ExeSurfBezParamsFromPoint.
2026-03-12 18:12:21 +01:00
Daniele Bariletti 7af8d0ae41 EgtExecutor :
- modificata funzione ExeSurfBezParamsFromPoint.
2026-03-10 17:35:08 +01:00
SaraP b010769af6 EgtExecutor 3.1c3 :
- piccola miglioria nel concatenamento delle curve nelle intersezioni con piano per gestire meglio i tratti di lunghezza inferiore alla tolleranza.
2026-03-10 10:01:56 +01:00
Daniele Bariletti fec60b2ea7 EgtExecutor 3.1c2 :
- cambio versione.
2026-03-05 10:47:42 +01:00
Daniele Bariletti 6056ac41cd EgtExecutor :
- piccola correzione.
2026-03-04 16:04:26 +01:00
Daniele Bariletti 4925444552 EgtExecutor :
- piccola correzione.
2026-03-04 15:48:22 +01:00
Daniele Bariletti dc759d5eb3 EgtExecutor :
- aggiunta funzione per ottenere part e shell di una faccia di una trimesh.
2026-03-04 15:43:16 +01:00
Daniele Bariletti bc167e8832 EgtExecutor :
- aggiunta funzione per richiedere i parametri di un punto di una bezier.
2026-03-04 14:49:15 +01:00
Dario Sassi 6356d67034 EgtExecutor 3.1c1 :
- aggiunta funzione ExeChangePreviewMachiningToolShow.
2026-03-03 18:34:50 +01:00
Dario Sassi 0da1798029 EgtExecutor :
- piccole modifiche a scelta colore per dialogo lua.
2026-02-24 08:42:06 +01:00
Riccardo Elitropi 71009205b5 EgtExecutor :
- in LUA_GENERAL migliorato e corretto il dialogo di tipo Brush/ColorPicker.
2026-02-23 15:53:39 +01:00
Daniele Bariletti 7b48821c00 Merge branch 'master' of https://gitlab.steamware.net/egaltech/EgtExecutor 2026-02-23 09:47:48 +01:00
Daniele Bariletti 9611421fbc EgtExecutor :
- aggiunto flag alla funzione EgtSurfBezierLeaves.
2026-02-23 09:47:41 +01:00
Riccardo Elitropi 5723c92e09 EgtExecutor 3.1b2 :
- in Trimming aggiunte funzioni per interpolazione curve di sincronizzazione
- in LUA_GENERAL aggiunto il dialogo di tipo Brush/ColorPicker.
2026-02-20 16:51:40 +01:00
Daniele Bariletti e9f38149ac EgtExecutor :
- piccola correzione.
2026-02-19 16:01:21 +01:00
Dario Sassi 9d611b80a8 EgtExecutor 3.1b1 :
- correzioni a recupero nome da nota NcName di Gruppo di Lavoro per generazione e stima.
2026-02-19 10:02:17 +01:00
Daniele Bariletti 09dd6cc2f7 EgtExecutor :
- aggiunta possibilità di approsimare con curve di bezier.
2026-02-11 16:46:25 +01:00
Daniele Bariletti 7bb53a0e3f EgtExecutor :
- ripristinata tollerenza corretta.
2026-02-10 15:44:43 +01:00
Riccardo Elitropi d55f02a7b2 EgtExecutor :
- in Trimming migliorata la funzione per il calcolo delle curve di sincronizzazione.
2026-02-09 14:52:30 +01:00
Dario Sassi 50dcd97857 EgtExecutor :
- aggiunte info in ProjectCurveOnSurf
- piccolo aggiustamento per ricavere curve di sincro da trimming.
2026-02-09 08:25:27 +01:00
Dario Sassi f5f9b9813d EgtExecutor :
- aggiunta funzione exe/lua GetClEntFeed.
2026-02-03 17:46:42 +01:00
Riccardo Elitropi 039f261f0c EgtExecutor 3.1a4 :
- in Trimming aggiunte le funzioni per riconoscimento di fori e asole
- in Trimming pulizia del codice.
2026-02-03 17:20:21 +01:00
Dario Sassi d6c79cbf78 EgtExecutor 3.1a3 :
- aggiunto a funzioni lua EgtCurveCompoSetTempProp e EgtCurveCompoSetTempParam il parametro opzionale indice (default 0).
2026-02-02 10:32:05 +01:00
Riccardo Elitropi 7cf368e518 EgtExecutor :
- in Trimming piccole migliorie/correzioni.
2026-01-26 18:04:19 +01:00
Dario Sassi e68153fb70 EgtExecutor :
- a Exe e lua TestSurfaceSurface aggiunto il parametro opzionale bTestEnclusion per segnalare collisione anche quando una delle due è chiusa (ovvero racchiude un volume) e contiene l'altra
2026-01-23 10:22:02 +01:00
Riccardo Elitropi f2dc3876b0 EgtExecutor :
- in Trimming piccola miglioria nella scelta delle curve di sincronizzazione da visualizzare.
2026-01-22 19:25:01 +01:00
Daniele Bariletti ab3681e209 EgtExecutor :
- modifica alla funzione GetSurfBezierRuledGuided.
2026-01-22 11:22:59 +01:00
Riccardo Elitropi 11c47c4394 EgtExecutor :
- in Trimming semplificazione delle funzioni per le curve di sincronizzazione.
2026-01-21 18:28:33 +01:00
Riccardo Elitropi 54a1a882de EgtExecutor 3.1a2 :
- modifiche e migliorie alla funzioni di Trimming.
2026-01-20 17:30:32 +01:00
Daniele Bariletti c306967cb2 EgtExecutor :
- modificata la chiamata alla GetSurfBezierRuledGuided.
2026-01-19 12:33:59 +01:00
Daniele Bariletti 23a46d56cd EgtExecutor :
- aggiunto controllo alla funzione MyCurveCurveInters.
2026-01-15 11:53:26 +01:00
Daniele Bariletti 2aa7669c7b EgtExecutor :
- aggiunti argomenti alla funzione GetSurfBezierRuledGuided.
2026-01-15 11:52:39 +01:00
Dario Sassi 5a8d472ddf Executor :
- aggiunta funzione lua EraseNonEmptyDirectory.
2026-01-09 19:00:36 +01:00
Dario Sassi fb188d566e EgtExecutor :
- piccole correzioni.
2026-01-07 09:23:32 +01:00
Dario Sassi b1fcb75e4f EgtExecutor :
- aggiunte funzioni di striping per trimming dei termoformati
2026-01-04 20:39:53 +01:00
Dario Sassi 116e7c0061 EgtExecutor 3.1a1 :
- ricompilazione con cambio major version.
2026-01-02 12:34:15 +01:00
Dario Sassi e0c2b9dacd EgtExecutor :
- aggiunta funzione exe/lua DuplicateGeomDB.
2025-12-23 15:36:20 +01:00
Riccardo Elitropi 0e8f8d0502 EgtExecutor :
- prima versione per Trimming.
2025-12-22 17:07:44 +01:00
Riccardo Elitropi 9a719b94cf EgtExecutor :
- in Redis aggiunta gestione per riconnessioni.
2025-12-22 17:05:30 +01:00
Dario Sassi c50ecf7d53 EgtExecutor :
- piccole migliorie al salvataggio progetti per salvataggio e ripristioni CamStatus.
2025-12-22 11:43:54 +01:00
Dario Sassi 6ca16a587c EgtExecutor :
- aggiunte funzioni exe/lua SetCalcSolCh e GetCalcSolCh.
2025-12-19 09:49:26 +01:00
Riccardo Elitropi fb29be348a EgtExecutor :
- modifica prototipi in Machining Optimization.
2025-12-18 09:06:41 +01:00
Riccardo Elitropi d256c5f5ea EgtExecutor :
- in Machining Optimization aggiunta gestione OpenBounds.
2025-12-17 15:05:18 +01:00
Riccardo Elitropi 0ea77e1e6a EgtExecutor 2.7l3 :
- in Machining Optimization aggiunta ottimizzazione mirata ai singoli gruppi.
2025-12-16 15:50:27 +01:00
Riccardo Elitropi e1c468a0df EgtExecutor :
- modifica prototipi per creazione SurfTmShell.
2025-12-15 11:39:51 +01:00
Riccardo Elitropi 740d3817de EgtExecutor 2.7l2 :
- Modificate le funzioni di Offset per superfici TriMesh aperte
- Aggiunta la funzione per la creazione di Shell per TriMesh.
2025-12-15 11:32:21 +01:00
Riccardo Elitropi ea4cc8a368 EgtExecutor :
- in Redis modifica nomi variabili statiche di modulo.
2025-12-15 08:31:11 +01:00
Riccardo Elitropi 37a4fce4ae EgtExecutor :
- in Redis piccola correzione nella ricerca dei messaggi.
2025-12-12 17:43:57 +01:00
Dario Sassi b68dd72cf6 EgtExecutor :
- migliorie nella funzione ExeGetImageEx per gestione errori e per modalità driver OpenGL 1.
2025-12-11 12:10:14 +01:00
Dario Sassi 57d01e7f4c EgtExecutor :
- aggiunta funzione exe/lua ExistsCurrSetup.
2025-12-11 08:49:42 +01:00
Riccardo Elitropi 9d64ca5d39 EgtExecutor :
- in Redis piccola correzione.
2025-12-11 08:10:30 +01:00
Riccardo Elitropi e177fd8ccd EgtExecutor :
- in Redis migliorata la gestione dei Messaggi per thread concorrenti.
2025-12-09 10:05:29 +01:00
Dario Sassi 50d92d366d EgtExecutor :
- aggiunte funzioni exe e lua per valori iniziali e finali degli assi in una lavorazione GetMachiningStartAxes e GetMachiningEndAxes
- aggiunta funzione di proiezione a minima distanza di curva su superficie ProjectCurveOnSurf
- rinominata funzione di proiezione lungo direzione di curva su superficie in ProjectCurveOnSurfDir.
2025-12-09 08:17:51 +01:00
Riccardo Elitropi f698451c4c EgtExecutor 2.7l1 :
- in Redis aggiunta lettura ultimo Messaggio.
2025-12-04 12:06:23 +01:00
Dario Sassi 0d0a99d91e EgtExecutor 2.7k4 :
- eliminato include inutile.
2025-12-01 09:17:22 +01:00
Daniele Bariletti cf95041887 EgtExecutor :
- aggiunto comando LUA per modificare la qualità di visualizzazione delle surf di Bezier.
2025-11-20 12:27:04 +01:00
Daniele Bariletti 6f8e37c9ee EgtExecutor :
- aggiunto funioni alla IntersCurveCurve per filtrare le intersezioni 3D.
2025-11-19 13:08:36 +01:00
Daniele Bariletti 2407fef277 Merge branch 'master' of https://gitlab.steamware.net/egaltech/EgtExecutor 2025-11-18 10:16:46 +01:00
Daniele Bariletti f0de82dd96 EgtExecutor :
- aggiunta funzione per l'overlap di bbox.
2025-11-18 10:16:42 +01:00
SaraP 1cf4310cd9 EgtExecutor :
- aggiunto valore di default a parametro opzionale in LuaRemoveCurveCompoCurve.
2025-11-17 12:38:32 +01:00
Dario Sassi 22b9c46fb4 Merge branch 'master' of https://gitlab.steamware.net/egaltech/EgtExecutor 2025-11-12 15:40:41 +01:00
Dario Sassi 8e79cda146 EgtExecutor 2.7k3 :
- corretta funzione exe/lua PlaneVolZmapInters per sistemi di riferimento.
2025-11-12 15:37:48 +01:00
Daniele Bariletti 8131fd64e0 Merge branch 'NewRuled' 2025-11-12 13:11:34 +01:00
Daniele Bariletti ee55f97b3a EgtExecutor :
- aggiunta funzione per la creazione della surf bezier ruled guided.
2025-11-12 09:40:48 +01:00
Dario Sassi d41edd344a EgtExecutor :
- aggiustamenti.
2025-11-05 11:29:21 +01:00
Riccardo Elitropi 5a998a5d13 EgtExecutor 2.7k2 :
- aggiunta funzione per il calcolo della Curvatura in un vertice per una Superficie TriMesh.
2025-11-04 15:52:48 +01:00
Dario Sassi 14f471bbf9 EgtExecutor :
- aggunta funzione lua EgtInitBeamMgr.
2025-11-03 19:58:00 +01:00
Dario Sassi 6ce68192a2 EgtExecutor :
- aggiunte funzioni exe e lua Base64Encode e Base64Decode.
2025-11-03 18:05:42 +01:00
Dario Sassi 8010d19c06 EgtExecutor :
- aggiunta funzione exe/lua GetImageEx (per fare bitmap di vista progetto in contesti senza Scene).
2025-11-03 15:17:04 +01:00
Dario Sassi 2b3574cefc EgtExecutor 2.7k1 :
- ricompilazione per passaggio a C++ 20
- modifiche a funzioni exe/lua SetLevel e SetMode per ricevere un vettore di Id.
2025-11-01 17:37:44 +01:00
Riccardo Elitropi 8fcf079126 EgtExecutor 2.7j4 :
- in Redis aggiunta gestione di connessioni multiple.
2025-10-31 10:32:38 +01:00
SaraP ffcd014ec3 EgtExecutor :
- correzioni in ExeSpiralizeCurveAlongGuide.
2025-10-30 14:54:07 +01:00
Dario Sassi 8b23085328 EgtExecutor :
- funzione exe/lua SaveObjToFile ora accetta un vettore di indici
- eliminata la forma semplicificata della funzione ExeSaveMachGroupToFile.
2025-10-29 19:31:23 +01:00
Daniele Bariletti 8901525ac8 EgtExecutor :
- aggiunta funzione per calcolare la distanza tra punto e superficie di Bezier.
2025-10-29 15:09:12 +01:00
Dario Sassi 4247a6893f EgtExecutor :
- a funzione exe/lua SurfTmGetFacetOutlineInfo aggiunto parametro vettore di punti iniziali.
2025-10-28 16:19:18 +01:00
Dario Sassi 36572eb1e4 EgtExecutor 2.7j3 :
- alla funzione exe/lua SaveMachGroupToFile aggiunto parametro opzionale per indicare oggetti aggiuntivi.
2025-10-28 15:20:46 +01:00
Daniele Bariletti 78ad752545 EgtExecutor :
- aggiornamento funzioni per restituire loop di una surf bezier.
2025-10-14 16:29:59 +02:00
Dario Sassi 0a5fd7262b EgtExecutor :
- aggiunte funzioni exe e lua BeamCalcAllSolids e BeamShowAllSolids.
2025-10-13 08:49:01 +02:00
Dario Sassi e450aea667 EgtExecutor 2.7j2 :
- ricompilazione.
2025-10-11 10:07:04 +02:00
Dario Sassi a85ef8fe2d Merge branch 'master' of https://gitlab.steamware.net/egaltech/EgtExecutor 2025-10-11 10:05:01 +02:00
Dario Sassi f2fa332cc1 EgtExecutor 2.7j2 :
- modifiche per nuova gestione assemblaggi da BTL.
2025-10-11 10:03:53 +02:00
Daniele Bariletti bb8ef04733 EgtExecutor :
- aggiunto un tipo di interpolazione con le bezier.
2025-10-10 12:13:02 +02:00
Riccardo Elitropi 4c7de36ba0 EgtExecutor :
- Correzione e miglioramento della funzione per uniformare un VolZMap.
2025-10-09 09:38:55 +02:00
Dario Sassi 16930e4c4e EgtExecutor :
- aggiunte funzioni exe e lua CopyEx e CopyGlobEx.
2025-10-08 18:32:36 +02:00
Dario Sassi 248aa6f948 EgtExecutor 2.7j1 :
- ricompilazione con cambio versione.
2025-10-08 08:36:34 +02:00
Dario Sassi ab5223c4f5 EgtExecutor :
- miglioria in inperpolazione curve per pezzi piani Stone.
2025-10-02 12:52:01 +02:00
SaraP a206a58ffe EgtExecutor 2.7i6 :
- aggiunte funzioni Exe e Lua ModifyArcAngCenter.
2025-10-02 11:17:35 +02:00
Riccardo Elitropi cd5a82324b EgtExecutor :
- in Redis aggiunta autenticazione con utente e password per modalità sincrona e asincrona.
2025-10-01 13:32:54 +02:00
Dario Sassi 0ce7384fcc EgtExecutor 2.7i5 :
- ricompilazione con cambio versione.
2025-09-30 19:55:54 +02:00
Riccardo Elitropi 85af19455b EgtExecutor :
- in Redis, piccola miglioria per evitare saturazione CPU
2025-09-30 11:45:48 +02:00
Riccardo Elitropi b1f606e821 EgtExecutor :
- in redis migliorato ciclo degli eventi e aggiunte funzioni per collegamento asincrono per nodo sentinalla e autenticazione (test).
2025-09-30 11:29:39 +02:00
Riccardo Elitropi 55aca40285 EgtExecutor :
- in hiredis aggiunta gestione nodi sentinella e Auth per connessione sincrona.
2025-09-26 15:29:04 +02:00
Riccardo Elitropi cc3aab12ec EgtExecutor :
- in hiredis aggiunto sleep nel thread degli eventi per non saturare la CPU.
2025-09-26 14:52:46 +02:00
Riccardo Elitropi 592056897b EgtExecutor :
- aggiunta funzione per ricavare i parametri da stringa di connessione per hiredis.
2025-09-26 12:00:59 +02:00
Daniele Bariletti dd423355da EgtExecutor :
- aggiornamento parametri per conversione a bezier.
2025-09-26 10:43:53 +02:00
Dario Sassi a4de699814 EgtExecutor :
- sistemazione nomi delle funzioni asincrone di Redis.
2025-09-25 16:48:28 +02:00
Riccardo Elitropi 32f18ca9f7 EgtExecutor :
- aggiunte funzioni hiredis.
2025-09-24 16:16:35 +02:00
Dario Sassi 98bc4fa40c EgtExecutor 2.7i4 :
- aumentata lunghezza massima di dropdown di combobox di EgtDialogBox di lua.
2025-09-23 19:14:20 +02:00
Dario Sassi bbe59a3d90 EgtExecutor :
- aggiunto parametro opzionale dExtraBox a funzione ExeCreateVolZmapFromSurfTm ed equivalente lua EgtVolZmapFromSurfTm.
2025-09-19 11:14:40 +02:00
Daniele Bariletti 3d3098ed0b EgtExecutor :
- aggiunta funzione per creare il loop di un triangolo di una trimesh.
2025-09-17 11:29:39 +02:00
Dario Sassi 6c762b1b8e EgtExecutor :
- tolto parametro nStat non usato dalle funzioni ExeGetCalcPositions.
2025-09-14 23:02:40 +02:00
Riccardo Elitropi e8e8dbbf8d EgtExecutor :
- Aggiunta funzione per Offset Fillet per VolZMap.
2025-09-12 17:02:46 +02:00
SaraP 4a98a0a25e EgtExecutor 2.7i3 :
- aggiunte funzioni Exe e Lua per calcolo shear sequence nei nesting a ghigliottina.
2025-09-12 10:27:47 +02:00
Dario Sassi 04d3af8d62 EgtExecutor :
- ora ExeSetFont se riceve sNfeFontDir vuoto imposta solo il font di default
- aggiunte funzioni lua EgtSetDefaultFont e EgtGetDefaultFont.
2025-09-11 15:23:40 +02:00
Dario Sassi 24d355f08a EgtExecutor 2.7i2 :
- aggiunta funzione Exe/lua GetRobotAngles.
2025-09-10 08:53:22 +02:00
SaraP c736496b6a EgtExecutor :
- in ExeSpiralizeCurveAlongGuide aggiunta gestione per associare gli spigoli.
2025-09-08 17:33:54 +02:00
Dario Sassi 953c9f956e EgtExecutor :
- alla funzione lua EgtPause aggiunto un secondo parametro opzionale per forzarne l'esecuzione in assenza di UI (user interface).
2025-09-05 19:37:32 +02:00
Dario Sassi 77bded7c68 EgtExecutor 2.7i1 :
- ricompilazione con cambio versione.
2025-09-04 19:49:27 +02:00
Dario Sassi cc75866f3e EgtExecutor :
- aggiunte funzioni ExeSetShowSurfBezierTol e ExeGetShowSurfBezierTol.
2025-08-24 19:14:39 +02:00
Dario Sassi b02a00ef6b EgtExecutor 2.7h1 :
- se si cambia il modo di visualizzare insiemi di triangoli con ExeSetShowTriaAdv si invalidano tutti gli oggetti grafici.
2025-08-22 11:51:00 +02:00
Dario Sassi 8d7fdeb0c2 EgtExecutor 2.7g3 :
- le funzioni lua EgtCurveCompoGetTempProp e EgtCurveCompoGetTempParam ora accettano l'indice del dato richiesto (0 o 1).
2025-07-28 08:41:57 +02:00
Dario Sassi 54c761d722 EgtExecutor 2.7g2 :
- correzioni e modifiche a ExeCreateSurfBzByExtrusion.
2025-07-22 08:31:52 +02:00
Dario Sassi 901d6f7107 EgtExecutor :
- ora ModifyCurveStartPoint e ModifyCurveEndPoint quando necessario trasformano archi in rette.
2025-07-18 10:39:55 +02:00
Riccardo Elitropi 0f039b809b EgtExecutor :
- modifica parametri per CalcPocketing in ExePocketing.
2025-07-14 10:15:58 +02:00
Dario Sassi c36ce0a26f EgtExecutor :
- prime sistemazioni per offset superfici trimesh tramite Zmap
- eliminate funzioni exe/lua CreateVolZmapFromSurfTmOffset e CreateVolZmapFromSurfTmThickeningOffset.
2025-07-07 14:59:59 +02:00
Riccardo Elitropi 92a6b54666 EgtExecutor :
- aggiunte funzioni per calcolo di Zmap e TriMesh di Offset Fillet Thickening.
2025-07-04 13:00:31 +02:00
Dario Sassi af170b7597 EgtExecutor 2.7g1 :
- ricompilazione con cambio versione.
2025-07-02 19:50:07 +02:00
Riccardo Elitropi 9c5f48be88 EgtExecutor :
- ricollocazione funzioni di Offset per superfici TriMesh chiuse.
2025-06-16 13:17:31 +02:00
Riccardo Elitropi 362c845ed3 EgtExecutor 2.7f2 :
- Aggiunte funzioni per Offset di SurfTriMesh chiuse
- Migliorata la creazione di una TriMesh a partire da uno ZMap (con SaraP).
2025-06-16 11:37:23 +02:00
Dario Sassi 092896750c EgtExecutor :
- aggiunta funzione e xe e lua SimEnableToolTipTrace.
2025-06-08 19:13:35 +02:00
Dario Sassi 3ce5ce7a6b EgtExecutor 2.7f1 :
- funzioni exe ExeEndPoint e lua EgtEP gestiscono anche entità geometrica punto.
2025-06-06 16:14:28 +02:00
Dario Sassi bc99212f79 EgtExecutor :
- anche a exe/lua AddCurveCompoArc2P aggiunta possibilità di partire da una entità GeoPoint3d per trasformarla in composita con un arco.
2025-06-01 10:04:33 +02:00
Dario Sassi 7279684119 EgtExecutor :
- a exe/lua AddCurveCompoLine aggiunta possibilità di partire da una entità GeoPoint3d per trasformarla in composita con un segmento di retta.
2025-06-01 09:09:40 +02:00
Dario Sassi 142091b113 EgtExecutor :
- funzioni exe e lua CreateCurveBezierForm rinominate CreateCurveBezierFromCurve.
2025-05-31 11:57:52 +02:00
Dario Sassi 553e2e980d EgtExecutor 2.7e3 :
- nella funzione lua EgtGetCalcTipFromPositions riso opzionale anche il parametro bottom
2025-05-30 17:23:19 +02:00
Riccardo Elitropi c9111ba2ff EgtExecutor :
- modifica parametri per CalcPocketing in ExePocketing.
2025-05-30 11:47:44 +02:00
Riccardo Elitropi c9f3051cd3 EgtExecutor :
- Modifica parametri in CalcPocketing per ExePocketing.
2025-05-15 16:21:25 +02:00
Dario Sassi fc8ee49c11 EgtExecutor 2.7e2 :
- modifiche per gestione lavorazioni con percorsi utensile vuoti.
2025-05-12 09:48:27 +02:00
Riccardo Elitropi 028e4af506 Merge branch 'master' of https://gitlab.steamware.net/egaltech/EgtExecutor 2025-05-09 16:14:01 +02:00
Riccardo Elitropi a3e7d7e372 EgtExecutor :
- Rimozione parametro in eccesso in ModifyRawPart.
2025-05-09 16:13:58 +02:00
Dario Sassi ab9eb54224 EgtExecutor 2.7e1 :
- ricompilazione con cambio versione.
2025-05-07 20:07:42 +02:00
Dario Sassi dbc2365a68 EgtExecutor :
- sistemazioni per proiezione curve su superfici
- semplificazione parametri di alcune funzioni MachOpt.
2025-04-23 12:19:21 +02:00
Dario Sassi 025af8a9aa Merge remote-tracking branch 'origin/master' 2025-04-23 10:59:52 +02:00
Riccardo Elitropi 2c1d4ee259 EgtExecutor :
- Aggiunte funzioni Lua per ottimizzazione ordine delle lavorazioni.
2025-04-23 10:10:38 +02:00
Dario Sassi cfedb7de7d EgtExecutor 2.7d3 :
- ricompilazione con cambio versione.
2025-04-21 11:19:17 +02:00
Dario Sassi 3a31abedce EgtExecutor :
- miglioria in ExeSetBtlAuxDir per evitare errori successivi nell'interprete lua per le feature Variant.
2025-04-16 15:58:14 +02:00
Dario Sassi 1901133b00 EgtExecutor 2.7d2 :
- ora la funzione Exe/Lua Generate se non è noto il nome del partprogram va a prendere l'estensione dall'ini di macchina (come EgtCAM5, Icarus e OmagCUT).
2025-04-15 19:42:23 +02:00
Dario Sassi 0f48db648a EgtExecutor :
- tolto include inutile.
2025-04-08 13:08:20 +02:00
Dario Sassi 6d02a2e6cf EgtExecutor 2.7d1 :
- ricompilazione con cambio versione.
2025-04-07 11:54:59 +02:00
Dario Sassi 9be9b80b8e EgtExecutor :
- al caricamento immagine per texture se non trovata si prova anche nel direttorio dell'eventuale macchina corrente.
2025-03-31 17:26:09 +02:00
Dario Sassi 55e34f9297 EgtExecutor :
- aggiunta funzione exe e lua CreateSurfTmByPolygonWithHoles.
2025-03-28 20:21:16 +01:00
Dario Sassi 784e53f580 EgtExecutor :
- aggiunta funzione exe e lua CreateSurfTmByPolygon.
2025-03-27 19:19:33 +01:00
Daniele Bariletti b0f819dc69 - piccola correzione. 2025-03-27 15:54:43 +01:00
Dario Sassi 034635ae1d EgtExecutor :
- aggiunte funzioni exe e lua CreateSurfTmPyramidFrustum e CreateSurfTmConeFrustum
- adattata funzione ExeCreateSurfTmPyramid a modifiche di GeomKernel per avere funzionamento da esterno inalterato
- piccole sistemazioni.
2025-03-27 15:30:27 +01:00
Daniele Bariletti 5f8961860a - cambio versione 2025-03-27 10:19:21 +01:00
Daniele Bariletti ff50f8a808 - aggiunte funzioni Lua per copiare una sottocurva di una compo e per la CopyParamRange di una curva generica. 2025-03-27 08:53:21 +01:00
Dario Sassi f75fc31c7e EgtExecutor 2.7c3 :
- adattamenti per modifiche a GeomKernel.
2025-03-26 11:28:11 +01:00
SaraP b1255891c0 EgtExecutor 2.7c2 :
- aggiunte funzioni Exe e Lua SetStipple.
2025-03-13 15:21:10 +01:00
Riccardo Elitropi d4366e214c EgtExecutor :
- aggiunto parametro a funzione CalcPocketing per ExePocketing.
2025-03-13 12:31:48 +01:00
Dario Sassi 483dae5c1b EgtExecutor 2.7c1 :
- ricompilazione con cambio versione.
2025-03-06 20:11:08 +01:00
Riccardo Elitropi 719564783e EgtExecutor :
- Aggiunto parametro in CalcPocketing (ExePocketing).
2025-03-04 17:41:45 +01:00
Dario Sassi 30e483cc05 EgtExecutor :
- aggiunta gestione ImportPly di EgtExchange
- aggiunta funzione Exe/Lua ImportPly.
2025-03-02 19:43:57 +01:00
Dario Sassi 1ecd5bb756 EgtExecutor :
- correzione ripristino stato EnableUI in Simulazione in cieco (anche in versione speciale 2.7a5).
2025-02-28 12:11:29 +01:00
Riccardo Elitropi dde9956064 EgtExecutor :
- In ExePocketing aggiunto parametro.
2025-02-21 11:05:49 +01:00
SaraP 397572fe4b EgtExecutor 2.7b3 :
- aggiornamento versione.
2025-02-20 16:32:53 +01:00
Daniele Bariletti 1dc2a65ff9 - aggiunta funzione per massimo offset di una curva chiusa. 2025-02-06 17:48:14 +01:00
Dario Sassi d31c72f4f5 EgtExecutor 2.7a4 :
- aggiunta funzione Exe/Lua SetFixtureLink.
2025-01-31 09:00:50 +01:00
Dario Sassi 17dcb43683 EgtExecutor 2.7a3 :
- il caricamento di EgtExch3dm.dll non avviene più all'avviamento, ma viene rinviato alla prima chiamata (import/export di file 3dm).
2025-01-27 18:18:00 +01:00
Dario Sassi 67fa0dd6f0 EgtExecutor :
- modifiche per impostazione dati interprete lua a Exchange
- aggiunta funzione Exe/Lua CreateSurfTmEmpty.
2025-01-23 12:08:06 +01:00
SaraP 6c410ecd95 EgtExecutor 2.7a2 :
- aggiunte funzioni Exe per gestione camera prospettica.
2025-01-23 10:10:33 +01:00
Dario Sassi af9ab7ce30 EgtExecutor :
- unificata proiezione di curve su superfici trimesh e bezier.
2025-01-15 15:21:56 +01:00
Dario Sassi 1b0e89fec9 EgtExecutor 2.7a1 :
- cambio annuale di versione
- compilazione 32bit senza più limiti per Windows XP.
2025-01-09 18:00:25 +01:00
Dario Sassi 5da9e0a1dd EgtExecutor :
- aggiunta funzione ExeGetNameInGroup, semplificata di conseguenza LuaGetNameInGroup
- piccole migliorie a exe/lua GetInfoInGroup.
2024-12-23 12:04:47 +01:00
SaraP 057e9b1169 EgtExecutor :
- aggiunte funzioni Exe e Lua GetInfoInGroup.
2024-12-19 10:50:44 +01:00
SaraP 81d86f99eb EgtExecutor 2.6l3 :
- in Import3MF aggiunto flag per conservare la gerarchia.
2024-12-16 10:53:31 +01:00
Dario Sassi a55fe51fde EgtExecutor 2.6l2 :
- aggiunta funzione Exe e Lua GetClEntAxesStatus.
2024-12-04 15:06:25 +01:00
Dario Sassi 0c70756a0f EgtExecutor :
- piccole migliorie per modalità senza interfaccia.
2024-12-02 09:52:12 +01:00
Dario Sassi 9d12c2bede EgtExecutor 2.6l1 :
- aggiunta gestione import formato OFF
- aggiunta funzione Exe/Lua ImportOff.
2024-11-29 18:54:54 +01:00
Dario Sassi d2ac67e03c EgtExecutor 2.6k2 :
- aggiunta funzione Exe e Lua GetMachiningSkippedGeometry.
2024-11-25 15:03:21 +01:00
Daniele Bariletti 2524c3d9a5 Merge branch 'master' of https://gitlab.steamware.net/egaltech/EgtExecutor 2024-11-12 10:31:43 +01:00
Daniele Bariletti c3a472473d EgtExecutor :
- correzione di un errore di input per la SurfTmByExtrusion.
2024-11-12 10:31:37 +01:00
Dario Sassi 315cedb3a2 EgtExecutor 2.6k1 :
- modifiche a ExeVerifyCutAsSplitting per restituire un risultato più preciso (taglia completamente se CAR_LI_LO_OK).
2024-11-04 08:35:07 +01:00
Dario Sassi 92935c762d EgtExecutor 2.6j4 :
- aggiunta funzione Exe/Lua SetFixtureMobile.
2024-10-31 18:32:35 +01:00
Dario Sassi d43be7f3c0 EgtExecutor :
- aggiunat funzione Exe/Lua KeepAllDispAxes.
2024-10-16 19:50:02 +02:00
Dario Sassi 5019148f9d EgtExecutor 2.6j3 :
- aggiunta funzione Exe e Lua GetAxisDir.
2024-10-15 17:35:53 +02:00
Dario Sassi ebefa77e84 EgtExecutor 2.6j2 :
- aggiunte funzioni Exe e Lua MoveDispAxis, RemoveDispAxis e GetDispositionToolData.
2024-10-10 15:47:49 +02:00
Daniele Bariletti 7b02f83880 Merge remote-tracking branch 'origin/MoreBezier' 2024-10-04 15:41:04 +02:00
Daniele Bariletti e9404b11cf EgtExecutor :
- correzione del merge.
2024-10-04 15:38:50 +02:00
Daniele Bariletti 0a645512f2 Merge remote-tracking branch 'origin/master' into MoreBezier 2024-10-04 15:34:54 +02:00
Dario Sassi 32565dbc3a EgtExecutor 2.6j1 :
- sistemazioni varie su funzioni per superfici di Bezier.
2024-10-02 17:30:53 +02:00
Daniele Bariletti f7a8981491 EgtExecutor :
- aggiunta della funzione SurfBzSwept.
2024-09-30 15:58:15 +02:00
SaraP 1b8b5266f2 EgtExecutor 2.6i2 :
- modificate le funzioni Exe e Lua per il calcolo del Voronoi e del medial axis per gestire più curve.
2024-09-19 16:29:36 +02:00
Daniele Bariletti 9a6482d4cf EgtExecutor :
- aggiunta la gestione del capping per le superfici di bezier create a partire da curve.
2024-09-09 17:33:11 +02:00
Daniele Bariletti da68acdc6d EgtExecutor :
- piccola correzione.
2024-09-05 17:40:54 +02:00
Dario Sassi 64b7e47d1c EgtExecutor 2.6i1 :
- ricompilazione con cambio versione.
2024-09-05 17:38:12 +02:00
Daniele Bariletti 4a2c0904fe Merge branch 'MoreBezier' 2024-09-05 15:04:01 +02:00
Daniele Bariletti a5d9ede6ee EgtExecutor :
- modifica agli argomenti della CalcRegionPolyLines.
2024-09-05 12:09:58 +02:00
Daniele Bariletti 829961033e EgtExecutor :
- aggiunta del capping alla SurfBzByScrewing.
2024-09-05 11:39:48 +02:00
Daniele Bariletti 1aec3526bf Merge branch 'master' into MoreBezier 2024-09-04 15:57:10 +02:00
Daniele Bariletti 9a62d76115 Merge branch 'MoreBezier' 2024-09-04 15:49:06 +02:00
Daniele Bariletti c602a4f2ac EgtExecutor :
- correzioni a CreateSurfBzByExtrusion
- aggiunta della CreateSurfBzByRegionExtrusion.
2024-09-04 15:48:44 +02:00
Daniele Bariletti 9a2a906c96 EgtExecutor 2.6h3 :
- cambio versione .
2024-08-30 16:20:07 +02:00
Daniele Bariletti a3f32536d0 Merge branch 'MoreBezier' 2024-08-30 16:17:24 +02:00
Daniele Bariletti b87d9ce4dd Merge commit 'e1b2f0caafaa59f1ae5913a07dced1dd07139770' into MoreBezier 2024-08-30 15:07:02 +02:00
Dario Sassi e1b2f0caaf EgtExecutor :
- piccola sistemazione stilistica.
2024-08-30 10:12:03 +02:00
Daniele Bariletti 8290f47a80 EgtExecutor :
- piccole correzioni stilistiche.
2024-08-29 10:27:26 +02:00
Daniele Bariletti e3213299aa Merge remote-tracking branch 'origin/master' into MoreBezier 2024-08-29 09:35:35 +02:00
Daniele Bariletti 6214ff5926 EgtExecutor :
- cambio della funzione CalcRegionPolyLines.
2024-08-29 09:17:39 +02:00
Daniele Bariletti ea83cb985d EgtExecutor :
- aggiunte funzioni per l'approssimaizone di curve di bezier
- aggiunta la possibilità di scegliere il grado nella conversione da curva generica a curva di bezier.
2024-08-26 16:52:12 +02:00
Riccardo Elitropi 7e9005a009 EgtExecutor :
- piccola modifica ai parametri di CalcPocketing.
2024-08-22 12:57:46 +02:00
Dario Sassi bcefcc65fd EgtExecutor :
- modifiche per permettere Mark di tipo 2.
2024-08-22 09:12:09 +02:00
Dario Sassi 7672783be9 EgtExecutor 2.6h2 :
- aggiunta funzione ExeSurfFrChunkCenter.
2024-08-21 14:40:20 +02:00
Dario Sassi bbc7a31157 EgtExecutor 2.6h1 :
- ricompilazione con cambio versione.
2024-08-06 14:42:53 +02:00
Daniele Bariletti 3faae6b3df Merge branch 'MoreBezier' 2024-08-05 10:08:39 +02:00
Daniele Bariletti e463ba5500 Merge branch 'master' into MoreBezier 2024-08-05 09:26:30 +02:00
Daniele Bariletti 5e8004ac4b EgtExecutor :
- pulizia codice.
2024-08-05 09:26:06 +02:00
Dario Sassi 6f118b80bf EgtExecutor 2.6g6 :
- ricompilazione con cambio versione.
2024-07-29 10:14:34 +02:00
Riccardo Elitropi a3bcc57f31 EgtExecutor :
- piccola modifica ai parametri di CalcPocketing.
2024-07-25 12:31:06 +02:00
Daniele Bariletti e8b664002e EgtExecutor :
- piccola correzione.
2024-07-24 12:44:50 +02:00
Daniele Bariletti 1cc3d4bdbb EgtExecutor :
- piccola correzione.
2024-07-24 12:44:21 +02:00
Daniele Bariletti 9135fe039f EgtExecutor :
- aggiunte le skinned con le Bezier.
2024-07-19 13:14:20 +02:00
Dario Sassi cd6258031f EgtExecutor 2.6g5 :
- aggiunta funzione exe e lua SurfFrEraseChunk
- migliorata ExeSurfFrTestExternal.
2024-07-18 20:23:14 +02:00
Daniele Bariletti b46d3449de Merge branch 'master' into MoreBezier 2024-07-17 16:21:56 +02:00
Daniele Bariletti d6cd16b860 EgtExecutor :
- cap come superfici separate per BezierByCurves.
2024-07-17 16:16:47 +02:00
Daniele Bariletti 2fc0e4994d EgtExecutor :
- aggiunta del cap alla funzione Bez by extrusion.
2024-07-17 09:14:03 +02:00
Daniele Bariletti 9bc89dfc35 EgtExecutor :
- piccole modifiche.
2024-07-16 12:00:59 +02:00
Daniele Bariletti ddbc2a81e6 EgtExecutor :
- piccole aggiunte alla chiamata delle funzioni per le bezier
- aggiunta della chiamata alla funzione SurfBzByPointCurve.
2024-07-16 11:22:58 +02:00
Daniele Bariletti 560d7af700 EgtExecutor 2.6g4 :
- aggiornamento versione.
2024-07-15 17:34:32 +02:00
Daniele Bariletti ee585114fd Merge branch 'MoreBezier' 2024-07-15 17:31:07 +02:00
Daniele Bariletti 94814adf67 Merge branch 'master' into MoreBezier 2024-07-15 17:26:18 +02:00
SaraP 387c10b72c EgtExecutor 2.6g3 :
- aggiunta funzione Exe e Lua SurfFrChunkMaxOffset.
2024-07-15 10:18:22 +02:00
Riccardo Elitropi fd5566fceb EgtExecutor :
- piccola modifica ai parametri di CalcPocketing.
2024-07-12 17:36:13 +02:00
Daniele Bariletti 450097fdca Merge branch 'master' into MoreBezier 2024-07-12 12:08:15 +02:00
Riccardo Elitropi 7f4b18567b EgtExecutor :
- adattamento chiamata Pocketing.
2024-07-10 12:34:02 +02:00
Daniele Bariletti f735b1ea46 Merge branch 'master' into MoreBezier 2024-07-10 08:54:48 +02:00
SaraP 5d7206528b EgtExecutor 2.6g2 :
- aggiunta funzione Exe e Lua CurveLengthAtParam.
2024-07-05 12:35:23 +02:00
Daniele Bariletti 9a61f93e7e Merge branch 'master' into MoreBezier 2024-07-03 10:36:25 +02:00
Dario Sassi 5420a212aa EgtExecutor 2.6g1 :
- aggiunta funzione Exe e Lua TdbIsCurrToolStandardDraw.
2024-07-01 12:46:25 +02:00
Dario Sassi c1dd1cfb53 EgtExecutor :
- piccola miglioria a GetSurfTmParSilhouettes.
2024-06-29 18:46:14 +02:00
Dario Sassi 6d619351e4 EgtExecutor 2.6f4 :
- ora ExplodeSurfTriMesh gestisce anche le shell.
2024-06-26 08:43:48 +02:00
Riccardo Elitropi 9023508027 EgtExecutor :
- adattamento chiamata Pocketing.
2024-06-25 13:26:38 +02:00
Daniele Bariletti b327853564 Merge branch 'master' into MoreBezier 2024-06-19 10:12:11 +02:00
Dario Sassi f7922678ec EgtExecutor :
- aggiunta funzione Exe/Lua SurfTmTriangleNormVersor.
2024-06-18 07:33:11 +02:00
Dario Sassi 9bc1f2d55c EgtExecutor :
- adattamenti per modifiche a calcolo silhouette con CollisionAvoid.
2024-06-17 07:11:44 +02:00
Dario Sassi 3de9f5c1c3 EgtExecutor 2.6f3 :
- ricompilazione con cambio versione.
2024-06-13 08:00:51 +02:00
Dario Sassi 40d784806b EgtExecutor :
- in ExeCAvToolPathStm disabilitando la tolleranza si disabilita anche il controllo massima lunghezza segmento
- eliminata funzione Exe/Lua GetSurfTmSilhouetteEx sostituita con GetSurfTmParSilhouettes.
2024-06-11 09:31:27 +02:00
Dario Sassi 3d6a6071a9 EgtExecutor 2.6f2 :
- in ExeCAvToolPathStm tolleranza negativa vuol dire non controllare i punti intermedi.
2024-06-07 13:04:07 +02:00
Daniele Bariletti 7d04a27151 EgtExecutor :
- correzione del merge.
2024-06-06 09:22:14 +02:00
Daniele Bariletti e138020432 EgtExecutor :
- correzione del merge.
2024-06-04 10:04:43 +02:00
Daniele Bariletti 99675027ac Merge branch 'master' into MoreBezier 2024-06-04 10:03:32 +02:00
Dario Sassi 517249b59d EgtExecutor :
- adattamento chiamata Pocketing.
2024-06-03 09:10:35 +02:00
Dario Sassi 0d9e35580e EgtExecutor 2.6f1 :
- aggiunte funzioni exe e lua CurveCompoSetTempProp, CurveCompoSetTempParam, CurveCompoGetTempProp e CurveCompoGetTempParam.
2024-06-03 08:10:13 +02:00
Dario Sassi b3aa7518f8 EgtExecutor :
- aggiunta funzione ExeGetPreviewMachiningToolStepCount
- nella funzione ExePreviewMachiningTool il secondo parametro non è più un flag, ma il numero di passi da (positivo in avanti, negativo indietro).
2024-05-30 15:23:39 +02:00
Dario Sassi 7a522541da EgtExecutor 2.6e6 :
- ricompilazione con cambio versione.
2024-05-29 18:57:46 +02:00
Daniele Bariletti b84940378c EgtExecutor :
- aggiunte le chiamate per creare rigate come superfici di Bezier.
2024-05-28 16:22:51 +02:00
Dario Sassi f680c20b18 EgtExecutor :
- aggiunte funzioni Exe e Lua GetSurfTmSilhouetteEx per limitare il calcolo sopra un piano.
2024-05-27 07:51:52 +02:00
Daniele Bariletti f95caff7d8 EgtExecutor :
- cambiato il nome ad una funzione.
2024-05-24 12:12:55 +02:00
Dario Sassi 8304298122 EgtExecutor 2.6e5 :
- ricompilazione con cambio versione.
2024-05-23 11:48:08 +02:00
Dario Sassi 7b7ca66c6a Merge commit '4be2039c00e1d708cfb9e471d1bf131de914aea3' 2024-05-23 11:37:18 +02:00
Daniele Bariletti 4be2039c00 EgtExecutor :
- formattazione testo.
2024-05-23 10:18:10 +02:00
Daniele Bariletti 717107cc2d EgtExecutor :
- tolto un header inutile.
2024-05-23 10:16:47 +02:00
Daniele Bariletti 00dcccfe24 EgtExecutor :
- formattazione testo.
2024-05-23 10:15:50 +02:00
Daniele Bariletti 217ce9b589 EgtExecutor :
- aggiunte alla funzione per mostrare i punti di controllo di una curva di Bezier.
2024-05-23 10:07:26 +02:00
Daniele Bariletti 8fba665c27 EgtExecutor :
- correzione al merge.
2024-05-23 10:00:02 +02:00
Daniele Bariletti dcae61ef24 Merge branch 'master' into MoreBezier 2024-05-23 09:54:30 +02:00
Daniele Bariletti 37c6e26a43 EgtExecutor :
- riaggiunte le funzioni per mostrare i punti di controllo di una curva Bezier.
2024-05-23 09:41:29 +02:00
Daniele Bariletti 7aeabafeb7 Merge branch 'SetSmoothAng' 2024-05-23 09:37:29 +02:00
Daniele Bariletti 16b7208962 EgtExecutor :
- corretto un commento.
2024-05-23 09:32:29 +02:00
Daniele Bariletti 7c6c48b8b8 EgtExecutor :
- tolti refusi da un altro ramo.
2024-05-22 16:41:05 +02:00
Daniele Bariletti 2f3d1a84ef EgtExecutor :
- aggiunta la funzione per modificare lo smooth angle delle surf trimesh.
2024-05-22 16:35:13 +02:00
Daniele Bariletti 2eeb25584c EgtExecutor :
- aggiunta la funzione per il revolve con superfici di Bezier.
2024-05-22 12:15:06 +02:00
Daniele Bariletti c65a29fc2b EgtExecutor :
- piccole modifiche.
2024-05-22 12:14:39 +02:00
Daniele Bariletti fb4b13c258 EgtExecutor :
- aggiunte funzioni per aumentare e ridurre di grado le curve di Bezier.
2024-05-22 12:14:00 +02:00
Daniele Bariletti f10cbcca39 Merge branch 'master' into MoreBezier 2024-05-21 15:50:48 +02:00
Daniele Bariletti 41929b4a8b EgtExecutor :
- aggiunte funzioni per ottenere una superficie di Bezier da Regione o da Screwing.
2024-05-21 15:45:30 +02:00
Daniele Bariletti d08de0dce8 EgtExecutor :
- aggiunta una funzione per mostrare i punti di controllo di una curva di Bezier.
2024-05-21 15:44:52 +02:00
Daniele Bariletti 13e9eea977 EgtExecutor :
- aggiunta una funzione per mostrare i punti di controllo di una superficie di Bezier.
2024-05-21 15:43:56 +02:00
Dario Sassi 2221934f3c Merge commit 'e4f45df79ad5c4fc5c8442557e5db129c0c7ce70' 2024-05-20 09:02:10 +02:00
Dario Sassi 0424900a2b EgtExecutor 2.6e4 :
- aggiunta funzione Exe e Lua VerifyKeyOption (nel parametro OptInd le centinaia indicano il numero di opzione, il resto indica il numero del bit).
2024-05-16 12:55:37 +02:00
Riccardo Elitropi e4f45df79a EgtExecutor :
- aggiunta funzione per aggiornare uno Zmap con una  Trimesh
- aggiunta funzione per uniformare uno Zmap.
2024-05-15 11:02:15 +02:00
Dario Sassi 868efb69f1 EgtExecutor :
- correzioni alla funzione Exe e Lua SurfTmGetFacetOutlineInfo.
2024-05-09 18:48:31 +02:00
Daniele Bariletti 7b991f4526 EgtExecutor :
- aggiunte le funzioni SurfBez da estrusione e da FlatContour ;
2024-05-09 15:12:38 +02:00
Dario Sassi 3d59a7ec24 EgtExecutor :
- migliorie alla funzione Exe e Lua SurfTmGetFacetOutlineInfo.
2024-05-09 11:18:51 +02:00
Dario Sassi 9219fe9792 EgtExecutor :
- modifiche estetiche.
2024-05-08 16:11:23 +02:00
Dario Sassi bf069c7f7a Merge commit '88904db10f8125e3478ebaf5708afd13e4bfc66d' 2024-05-08 15:53:46 +02:00
Dario Sassi f949e39d47 EgtExecutor :
- aggiunta funzione Exe e Lua SurfTmGetFacetOutlineInfo.
2024-05-08 15:53:02 +02:00
Daniele Bariletti 88904db10f EgtExecutor :
- aggiunte le funzioni per la proiezione di curve su una superficie di Bezier.
2024-05-07 14:50:56 +02:00
Daniele Bariletti 429b8d828c Merge branch 'master' into MoreBezier 2024-05-07 10:32:26 +02:00
Daniele Bariletti 1bf59acd00 EgtExecutor :
- cambio versione.
2024-05-07 10:18:45 +02:00
Daniele Bariletti a5a85a6723 EgtExecutor :
- cambio nome di una funzione.
2024-05-07 10:12:41 +02:00
Daniele Bariletti c523c46670 Merge branch 'MoreBezier' 2024-05-07 10:06:12 +02:00
Daniele Bariletti fb0b4f9621 EgtExecutor :
- tolto un commento.
2024-05-07 09:53:21 +02:00
Daniele Bariletti 7070032120 EgtExecutor :
- funzioni per la conversione di curve generiche in curve di Bezier.
- funzione per mostrare i punti di controllo di una curva di Bezier.
2024-05-06 15:34:25 +02:00
Dario Sassi 0b1461984c EgtExecutor 2.6e2 :
- correzione a ExeChangeClosedCurveStartPoint (si usava puntatore a curva anche se nullo).
2024-05-06 09:05:01 +02:00
Dario Sassi 4f7f5d97b2 EgtExecutor :
- aggiunta la funzione Lua EgtGetKeyPressed.
2024-05-03 12:01:41 +02:00
Dario Sassi 8cd72b2a4c EgtExecutor :
- aggiunte funzioni Exe e Lua SurfTmSetFaceColor, SurfTmGetTriaColor e SurfTmGetShowEdges.
2024-05-02 09:30:51 +02:00
Dario Sassi 7b3c24c2be EgtExecutor 2.6e1 :
- ricompilazione per modifiche a gestione chiave di rete.
2024-04-30 16:55:00 +02:00
Daniele Bariletti e5f296e712 Merge branch 'master' into MoreBezier 2024-04-30 15:21:17 +02:00
Dario Sassi 9e1f151bbc EgtExecutor :
- adattamenti per Zmap con virtual additive.
2024-04-26 11:33:16 +02:00
Dario Sassi ed6c8fb11d Merge commit '22774303af440f13f3db243c23798652b2fa7cc4' 2024-04-22 19:07:16 +02:00
Dario Sassi 9ef30272b4 EgtExecutor :
- aggiunta funzione Exe/Lua GetExitId.
2024-04-22 15:30:00 +02:00
Riccardo Elitropi 22774303af EgtExecutor :
- aggiunte funzioni per Vmill additivo.
2024-04-22 13:23:59 +02:00
Dario Sassi a3c905c33a EgtExecutor :
- adattamenti per Surf Bezier
- aggiunta funzione Exe/Lua CreateArc2PR.
2024-04-19 17:51:00 +02:00
Dario Sassi 66a72c92b2 EgtExecutor :
- nelle funzioni Lua EgtGetCalcTipFromPositions, EgtGetCalcToolDirFromAngles e EgtGetCalcAuxDirFromAngles ammessi sino a 6 assi rotanti (per robot).
2024-04-17 06:55:09 +02:00
Daniele Bariletti 8c0b0a97b8 EgtExecutor :
- corretto bug.
2024-04-15 12:35:17 +02:00
Daniele Bariletti f444c189d4 EgtExecutor :
- aggiunto anche alla funzione LUA dell' AdvancedImport il parametro nFlag.
2024-04-15 12:21:07 +02:00
Dario Sassi 4f79e4baf9 EgtExecutor 2.6d4 :
- aggiunta di alcune funzioni lua per i Quaternion.
2024-04-14 18:18:13 +02:00
Dario Sassi e66cfb74c0 EgtExecutor :
- eliminate funzioni Exe e Lua CreateSurfTmBySurfBezier perchè doppioni di ApproxSurface a cui è stato aggiunto il parametro dTriaMinSide.
2024-04-13 17:20:57 +02:00
Daniele Bariletti 2d2954f983 EgtExecutor :
- cambio versione.
2024-04-12 10:34:47 +02:00
Daniele Bariletti bea2a9f938 EgtExecutor :
- aggiunti i default per la chiamata della SurfTmByBezier.
2024-04-12 10:32:23 +02:00
Daniele Bariletti bcc44a5592 EgtExecutor :
- modificata l'importazione layer da file 3dm.
2024-04-12 10:31:55 +02:00
Daniele Bariletti e587f23dad EgtExecutor :
- aggiunti parametri per ottenere la trimesh di una Bezier con precisione richiesta.
2024-04-11 17:39:20 +02:00
Dario Sassi f4542dd7db Merge branch 'master' of https://gitlab.steamware.net/egaltech/EgtExecutor 2024-04-11 00:19:37 +02:00
Dario Sassi 1f66473764 EgtExecutor :
- aggiunto parametro Flag in AdvancedImport.
2024-04-11 00:18:34 +02:00
Daniele Bariletti b98e4ea359 EgtExecutor :
- errato commit precedente.
2024-04-10 18:34:16 +02:00
Daniele Bariletti 504e1d5472 EgtExecutor :
- modifica della funzione per l'estrazione dei loop aperti di una superficie di Bezier.
2024-04-10 18:08:54 +02:00
Dario Sassi f8bc7083a9 EgtExecutor 2.6d2 :
- estensione gestione chiave di rete per meglio identificare l'eventuale problema
- migliorie a proiezione di curva su superficie
- ricompilazione per modifiche a EgtLock.
2024-04-09 14:49:24 +02:00
Dario Sassi c4b4a12b9a EgtExecutor :
- aggiunta funzione Exe/Lua ProjectCurveOnSurfTmExt.
2024-04-08 09:42:02 +02:00
Dario Sassi 9473e5813d EgtExecutor :
aggiunta la funzione Lua EgtDirectoryDialog per la scelta di un direttorio.
2024-04-05 19:24:04 +02:00
Dario Sassi fd9e53711b EgtExecutor :
- modifiche a Exe e Lua CreateSurfTmSwept.
2024-04-05 16:56:41 +02:00
Dario Sassi 6c153c3db4 Merge commit '824e6e3ba1ff03936d2150d5660a8e1ff27b24e6' 2024-04-04 14:49:51 +02:00
Dario Sassi 841c0f6cfc EgtExecutor :
- aggiunta funzione Exe/Lua GetClEntAxesMask.
2024-04-03 08:12:19 +02:00
Dario Sassi 3990934446 EgtExecutor 2.6d1 :
- aggiunta funzione Exe e Lua GetAllAxesName.
2024-04-02 15:38:40 +02:00
Dario Sassi 399556a9a6 EgtExecutor 2.6c3 :
- cambio versione.
2024-03-27 16:43:26 +01:00
Daniele Bariletti 69f2c3d029 Merge branch 'CmdCreateSurfBezier' 2024-03-27 11:06:29 +01:00
Dario Sassi f1f23a3cf4 EgtExecutor :
- aggiunte funzioni Exe e Lua TestBoxSurface, TestRectPrismoidSurface, TestCylSurface, TestConeSurface, TestSpheSurface, TestSurfaceSurface.
2024-03-25 09:05:21 +01:00
Daniele Bariletti 73db521008 Merge branch 'master' into CmdCreateSurfBezier 2024-03-21 15:07:08 +01:00
Daniele Bariletti 82d1465ecd EgtExecutor :
- modificata la funzione per richiedere gli edge di una Bezier.
2024-03-21 15:01:35 +01:00
Riccardo Elitropi 824e6e3ba1 EgtExecutor :
- correzione codice.
2024-03-18 13:21:21 +01:00
Riccardo Elitropi 88fa7ef54c EgtExecutor :
- rimozione codici di test.
- modifiche parametri LuaCreateSurfTmSwept.
2024-03-15 13:18:48 +01:00
Dario Sassi 047bff2f11 EgtExecutor :
- aggiunta funzione exe e lua CreateAngularDimensionEx.
2024-03-14 20:02:39 +01:00
Dario Sassi 611c08bb4c EgtExecutor :
- aggiunta funzione Exe e Lua SurfTmMoveFacet.
2024-03-13 09:24:16 +01:00
Riccardo Elitropi 82633bf725 EgtExecutor :
- migliorie al codice.
2024-03-11 13:21:29 +01:00
Dario Sassi c69036ef2c EgtExecutor 2.6c2 :
- aggiunte funzioni Exe e Lua SurfTmSetShowEdges e VolZmapSetShowEdges.
2024-03-10 10:25:36 +01:00
Daniele Bariletti b0c1ba14e8 Merge branch 'master' into CmdCreateSurfBezier 2024-03-08 16:37:46 +01:00
Riccardo Elitropi a27dfd2b54 EgtExecutor :
- Codice di test per RMF aggiornato.
2024-03-07 10:52:39 +01:00
Riccardo Elitropi 2a106c4263 EgtExecutor :
- Codice di test per RMF.
2024-03-06 16:28:48 +01:00
Dario Sassi 66a232a6a0 EgtExecutor 2.6c1 :
- ricompilazione con cambio versione.
2024-03-05 08:56:19 +01:00
Daniele Bariletti 89e8b02316 EgtExecutor :
- spostato il filtro delle intersezioni line-SurfBz in GeomKernel.
2024-02-28 10:31:54 +01:00
Daniele Bariletti d1cb3d7de7 Merge branch 'master' into CmdCreateSurfBezier 2024-02-28 09:33:06 +01:00
Dario Sassi 6c640b902f EgtExecuter :
- aggiunta funzione Exe/Lua CreateSurfTmTransSwept.
2024-02-27 18:18:52 +01:00
Daniele Bariletti 49d2600cc7 EgtExecutor :
- correzione del merge.
2024-02-27 17:30:38 +01:00
Daniele Bariletti ce92c8f6c9 Merge branch 'master' into CmdCreateSurfBezier 2024-02-27 17:06:46 +01:00
Daniele Bariletti 303b7d8f0e EgtExecutor :
- aggiunta della funzione per disegnare i triangoli nello spazio parametrico di una superifcie Bezier
- aggiunto il calcolo dei punti di polo nelle funzioni che creano superfici di Bezier.
2024-02-27 16:36:08 +01:00
Dario Sassi 308e50549d EgtExecutor :
- aggiunta funzione Exe e Lua CurveSurfTmInters
- filtri su intersezioni portati in GeomKernel.
2024-02-26 15:09:35 +01:00
Daniele Bariletti 5f2c538ab8 EgtExecutor :
- correzione della chiamata di conversione da bezier a trimesh in caso di con bezier nulla.
2024-02-21 15:37:35 +01:00
SaraP 8e85070df1 EgtExecutor :
- modifiche a  AdjustLayerForSideAngle per gestire la creazione della regione anche nel caso di raccordi in tangenza.
2024-02-20 15:53:59 +01:00
Daniele Bariletti 95ec7a83ef EgtExecutor :
- aggiunta funzione per tagliare una superficie bezier con un piano.
2024-02-20 12:30:43 +01:00
Dario Sassi ed1ba0543b EgtExecutor 2.6b4 :
- aggiunta funzioni Exe e Lua Set/GetViewOrizzOffsStep
- aggiunte funzioni Lua EgtGetView e EgtGetGenericView.
2024-02-19 14:52:24 +01:00
Dario Sassi 26544984ad EgtExecutor 2.6b3 :
- adattamenti per modifiche a funzioni Collision Detection.
2024-02-16 08:46:02 +01:00
Daniele Bariletti e82c7417b6 Merge branch 'Dist-Inters_Bezier' into CmdCreateSurfBezier 2024-02-14 14:43:33 +01:00
Daniele Bariletti a3fa91244d EgtExecutor :
- aggiunta la funzione per creare una sfera come superficie bezier.
2024-02-14 14:42:16 +01:00
Dario Sassi e06dd65888 EgtExecutor 2.6b2 :
- a ApproxCurve e ProjectCurveOnSurfTm aggiunto parametro dMaxSegmLen.
2024-02-13 14:35:43 +01:00
Daniele Bariletti abbc5415ab Merge branch 'master' into Dist-Inters_Bezier 2024-02-12 13:00:08 +01:00
Daniele Bariletti 603cb083cc EgtExecutor :
- aggiunte le funzioni per l'intersezione tra linea e sup. Bezier.
2024-02-12 12:59:43 +01:00
Dario Sassi d9cfc375a9 Merge branch 'master' of https://gitlab.steamware.net/egaltech/EgtExecutor 2024-02-05 19:58:31 +01:00
Dario Sassi cce5e6ae76 EgtExecutor 2.6b1 :
- modifiche a ExePocketing per accettare percorso piano e chiuso oltre che regione piana.
2024-02-05 19:56:31 +01:00
Daniele Bariletti 407ca752ab Merge branch 'ExtDimension_angular' 2024-02-05 15:55:46 +01:00
Daniele Bariletti 41c50a776e Merge branch 'master' into ExtDimension_angular 2024-02-05 15:44:46 +01:00
SaraP f28da6d9e3 EgtExecutor 2.6a4 :
- aggiunte funzioni Exe e Lua SurfFrOffsetAdv per calcolare offset di una flat region creando una nuova superficie senza modificare quella di partenza.
2024-01-29 14:44:06 +01:00
Dario Sassi c5b2121bd5 EgtExecutor 2.6a3 :
- modifiche per Voronoi non più direttamente accessibile.
2024-01-29 09:30:19 +01:00
Dario Sassi 03785dcca3 EgtExecutor 2.6a2 :
- aggiunta ExeGetKeyAssLeftDays per avere il numero di giorni mancanti al termine dell'assistenza.
2024-01-25 18:20:31 +01:00
Dario Sassi b4eccf1f18 EgtExecutor :
- aggiunta funzione Exe e Lua LineCurveInters.
2024-01-17 13:22:34 +01:00
Dario Sassi c169329660 EgtExecutor :
- aggiunta funzione Exe e Lua ChangeMachGroupName.
2024-01-16 19:42:12 +01:00
Dario Sassi 94d76d3a68 EgtExecutor 2.6a1 :
- ricompilazione con cambio versione.
2024-01-16 15:14:05 +01:00
SaraP 511e74a4d9 EgtExecutor 2.5l7 :
- nelle funzioni Exe e Lua di OffsetCurveAdv e CreateSurfFatCurve aggiunto parametro opzionale di tolleranza lineare per gli offset.
2024-01-10 10:11:14 +01:00
Dario Sassi 24616b55b9 EgtExecutor 2.5l6 :
- aggiunta funzione ExeSetGridGeoAdv.
2024-01-09 18:30:50 +01:00
Dario Sassi 1a961a19af EgtExecutor 2.5l5 :
- aggiunta funzione Exe e Lua CAvToolPosBox
- agli import aggiunto log.
2024-01-02 15:58:34 +01:00
Dario Sassi 80a9b3a7bb EgtExecutor 2.5l4 :
- si scrive il log con le operazioni sui file di progetto (nuovo, apri, salva).
2023-12-29 13:04:57 +01:00
Dario Sassi b7bdbb41a7 EgtExecutor :
- aggiunta funzione lua EgtSurfTmFacetElevationInClosedSurfTm.
2023-12-18 09:30:27 +01:00
Dario Sassi 6fed5204ca EgtExecutor :
- funzione ExeDuploCountInRaw rinominata ExeDuploInRawCount
- aggiunta funzione lua EgtDuploInRawCount
- aggiunte funzioni Exe e Lua DuploWithoutRawList.
2023-12-14 20:25:24 +01:00
Dario Sassi 318529688d EgtExecutor 2.5l3 :
- aggiunta funzione Exe e Lua IsGhostPart
- aggiunta versione preliminare della funzione ExeDuploCountInRaw
- correzione su alcuni valori di ritorno di funzioni relative a MachMgr nel caso non ci sia il CurrMachMgr.
2023-12-14 12:00:30 +01:00
Dario Sassi d7711c3ec6 EgtExecutor :
- piccola miglioria a SurfTmGetEdges.
2023-12-11 14:58:40 +01:00
Dario Sassi 589a58e8db EgtExecutor 2.5l2 :
- aggiunta funzione Exe e Lua SurfTmGetEdges.
2023-12-11 10:24:34 +01:00
Dario Sassi 7a0e3ad388 EgtExecutor 2.5l1 :
- ricompilazione con cambio versione.
2023-12-01 16:49:54 +01:00
SaraP 55f695da98 EgtExecutor :
- piccola correzione nella gestione vettori di LuaSetInfo.
2023-11-30 16:00:24 +01:00
Riccardo Elitropi cac3224ff8 EgtExecutor :
- spostate le funzioni EgtPocketing e EgtGetSurfFrZigZagInfill in un documento a parte (EXE_GdbGetPocketing.cpp)
- aggiornati i parametri della funzione GetSurfFrZigZagInfill.
2023-11-29 12:00:25 +01:00
Dario Sassi 13bfd1a9ac Merge remote-tracking branch 'origin/master' 2023-11-28 10:58:52 +01:00
Dario Sassi b522f4cea2 EgtExecutor :
- a funzione ExeSurfTmFacetElevationInBBox aggiunto parametro bAcceptOutFacet (anche a corrispondente funzione lua come opzionale)
2023-11-28 10:57:40 +01:00
Riccardo Elitropi 7f2a8377bf EgtExecutor :
- modifica alla funzione EgtGetSurfFrZigZagInfill
- modificati i valori di ritorno per LuaPocketing.
2023-11-27 12:39:50 +01:00
Dario Sassi 68af08cf32 EgtExecutor :
- ExeCurveGetVoronoi e ExeCurveGetFatCurve spostate in Modify Curve
- aggiunta funzione ExeCurveGetMedialAxis usata da funzione Lua EgtCurveMedialAxisAdv.
2023-11-24 15:38:24 +01:00
Dario Sassi c200868c89 EgtExecutor :
- piccole sistemazioni post Vroni.
2023-11-24 12:52:56 +01:00
SaraP 688fc7ff89 EgtExecutor 2.5k6 :
- aggiunte funzioni Exe e Lua CurveGetVoronoi e CurveGetFatCurve.
2023-11-23 13:02:04 +01:00
Dario Sassi b82d9fa522 EgtExecutor 2.5k5 :
- aggiunta funzione ExeSetOnTerminateProcess per installare funzione di callback chiamata prima di terminare il processo con comando lua EgtCloseExe.
2023-11-23 10:49:13 +01:00
Dario Sassi 2a077e9102 EgtExecutor :
- in ExeProjectCurveOnSurfTm ai Vettori risultato aggiunta info Ind (indice di collegamento con gli estremi della curva risultato).
2023-11-22 20:26:51 +01:00
Riccardo Elitropi 7b3f8a02f9 EgtExecutor 2.5k4 :
- aggiunta funzione Exe e Lua Pocketing.
2023-11-20 11:57:28 +01:00
Dario Sassi de3cdb8a7f EgtExecutor :
- correzione alla funzione ExeSurfTmFacetElevationInBBox per il caso sia dato da un vertice.
2023-11-17 18:42:55 +01:00
Dario Sassi 16b8763c64 EgtExecutor :
- corretto commento.
2023-11-16 19:29:32 +01:00
Dario Sassi 5c4f32a6e8 EgtExecutor :
- aggiunta funzione Exe/Lua SurfTmFacetElevationInBBox.
2023-11-16 18:57:18 +01:00
Dario Sassi 15633ec6d7 EgtExecutor :
- modifiche per spostamento import/export da dll Exchange a dll Exch3dm.
2023-11-14 18:58:01 +01:00
SaraP e2c401cc4a EgtExecutor 2.5k3 :
- in CreateSurfFrFatCurve aggiunto parametro opzionale per distinguere squadratura cambi di direzione da squadratura estremi.
2023-11-14 15:08:04 +01:00
Dario Sassi 4f97c95a8d EgtExecutor :
- piccolo ritocco a scrittura funzione lua in log.
2023-11-14 09:36:59 +01:00
Daniele Bariletti 8723dab473 Merge branch 'master' of https://gitlab.steamware.net/egaltech/EgtExecutor 2023-11-13 17:13:04 +01:00
Daniele Bariletti af798840a5 EgtExecutor :
- correzione nella gestione dei layer nell'Import3dm.
2023-11-13 17:12:52 +01:00
Dario Sassi 51b388db06 EgtExecutor :
- piccole migliorie a Exe/Lua CreateSurfBezierLeaves.
2023-11-13 08:49:49 +01:00
Daniele Bariletti 246aa6e3ed EgtExecutor :
- rimosso l'argomento dScaleFactor da Import3dm.
2023-11-08 10:58:28 +01:00
Daniele Bariletti 26111453ee EgtExecutor 2.5k2 :
- cambio versione.
2023-11-08 08:49:06 +01:00
Daniele Bariletti 8dd2972a4b Merge branch '3dm_import+trim&mesh' 2023-11-08 08:48:41 +01:00
Dario Sassi ef75a2f912 EgtExecutor 2.5k1 :
- ricompilazione con cambio versione.
2023-11-03 17:24:07 +01:00
Dario Sassi 3d564e1be7 EgtExecutor 2.5j6 :
- aggiunte funzioni Exe/Lua GetClEntAxesVal e GetAllCurrAxesName
- modificate funzioni Exe/Lua FindToolInCurrSetup e GetClEntFlag.
2023-10-28 18:16:31 +02:00
Daniele Bariletti 91e3e1d370 EgtExecutor 2.5j5 :
- correzioni e aggiornamento dal master.
2023-10-25 09:58:28 +02:00
Dario Sassi bd1861ade0 EgtExecutor :
- sistemazione indentazione.
2023-10-24 14:43:13 +02:00
Dario Sassi 01c2b26a1e EgtExecutor :
- aggiornata ExeGetFileType per gestire estensione 3dm (file Rhino OpenNurbs).
2023-10-24 13:10:40 +02:00
SaraP 641566cd42 EgtExecutor :
- piccola correzione agli esportatori.
2023-10-24 11:31:45 +02:00
Daniele Bariletti 8c9544595d EgtExecutor 2.5j5 :
- aggiornamento versione.
2023-10-23 16:00:21 +02:00
Daniele Bariletti 84993c293a EgtExecutor :
- correzione minore.
2023-10-23 15:09:14 +02:00
Daniele Bariletti af2c3d0e7b EgtExecutor :
- formattazione del testo.
2023-10-23 15:01:41 +02:00
Daniele Bariletti f69116ea09 EgtExecutor :
- aggiunta dell'Export 3dm.
2023-10-23 14:32:57 +02:00
Daniele Bariletti 29a643e640 EgtExecutor :
- aggiunta la possibilità di mostrare la curva di trim sullo spazio
parametrico per una superficie di bezier.
2023-10-23 10:29:02 +02:00
Dario Sassi c0d456b6fb EgtExecutor 2.5j4 :
- aggiunta funzione lua EgtReplaceString.
2023-10-22 15:56:23 +02:00
SaraP 4d038461a1 EgtExecutor 2.5j3 :
- corretta gestione filtro in Export3MF.
2023-10-20 12:16:54 +02:00
SaraP 55184afcb5 EgtExecutor :
- corretto errore in CurveCurveInters nel caso di curva inesistente.
2023-10-17 14:39:26 +02:00
Daniele Bariletti 854d93eaec EgtExecutor :
- correzione minore a export 3dm.
2023-10-17 11:21:51 +02:00
Dario Sassi 8e11114e4f EgtExecutor 2.5j2 :
- modifica none EgtSurfTmSubtractProjectedFacesOnFace.
2023-10-11 08:31:56 +02:00
Riccardo Elitropi 06c5d68d8b EgtExecutor :
- rimozione parametro da ExeSurfTmSubtractProjectedFacesOnFace.
2023-10-10 13:36:28 +02:00
Dario Sassi 5ec4ed439f EgtExecutor 2.5j1 :
- riallineamento
- sistemazioni per chiave di rete esposta su Internet.
2023-10-09 13:07:33 +02:00
Riccardo Elitropi 206f3bdf61 EgtExecutor 2.5j1 :
- aggiunta funzione Exe e Lua SubtractProjectedFacesOnStmFace
- aggiunta di un parametro opzionale per Exe e Lua GetSilhouette.
2023-10-04 12:19:48 +02:00
Daniele Bariletti 8602b78f21 EgtExecutor :
- aggiunte funzioni per l'Export 3dm.
2023-10-02 09:33:44 +02:00
Daniele Bariletti 626e24e150 EgtExecutor :
- aggiunta del 3dm Export.
2023-09-21 17:05:04 +02:00
Dario Sassi 2b65121551 EgtExecutor 2.5i5 :
- ricompilazione a 64bit con Enable Enhanced Instruction Set = Not Set.
2023-09-21 15:24:31 +02:00
Daniele Bariletti 6b3ab7e9b0 EgtExecutor :
- introdotto l'uso della grafica di default per gli ExtDim
importati da 3dm.
2023-09-21 14:41:51 +02:00
Daniele Bariletti 9e725f3feb EgtExecutor :
- correzione minore.
2023-09-18 11:47:19 +02:00
Daniele Bariletti d7db0a2d45 Merge branch 'master' into ExtDimension_angular 2023-09-18 11:46:26 +02:00
Dario Sassi 2794f35805 EgtExecutor :
- aggiunte funzioni Exe e Lua CreateSurfTmTriangle e CreateSurfTmRectangle
- in Copy, CopyGlob, Relocate e RelocateGlob RefId ora accetta anche valori simbolici (layer corrente, ..).
2023-09-18 08:14:36 +02:00
Dario Sassi 1259955522 EgtExecutor 2.5i1 :
- aggiunta funzione Exe e Lua ProjectCurveOnSurfTm.
2023-09-11 10:44:47 +02:00
Daniele Bariletti 7eb557ad32 Merge branch 'Bezier_trim&mesh' into 3dm_import 2023-09-05 09:07:04 +02:00
Daniele Bariletti 4de367395a Merge remote-tracking branch 'origin/master' into 3dm_import 2023-08-29 13:00:21 +02:00
Dario Sassi d9cf624458 EgtExecutor 2.5h3 :
- aggiunte funzioni Exe e Lua CopyMachGroup.
2023-08-27 18:30:48 +02:00
Dario Sassi eedd2068fa EgtExecutor 2.5h2 :
- aggiunta funzione lua EgtPointCurveDistSide.
2023-08-11 11:29:21 +02:00
Dario Sassi cf2b1742a0 EgtExecutor 2.5h1 :
- aggiunta funzione ExeCreateArc2PB e Lua EgtArc2PB (per costruzione arco con 2 punti e bulge).
2023-08-04 13:22:23 +02:00
Daniele Bariletti 29462e9536 Merge branch 'master' into 3dm_import 2023-08-03 11:24:56 +02:00
Daniele Bariletti 7e7975c622 EgtExecutor :
- aggiunto l'import dei file 3dm.
2023-08-03 11:24:02 +02:00
DarioS 85c4af98ce EgtExecutor 2.5g3 :
- piccole sistemazioni varie.
2023-07-28 11:23:20 +02:00
DarioS 382138e6c5 EgtExecutor :
- piccola miglioria.
2023-07-19 09:53:40 +02:00
DarioS 749830aba9 EgtExecutor :
- aggiunto Dump di Stipple (quando presente).
2023-07-10 11:16:59 +02:00
DarioS 90449cad40 EgtExecutor 2.5g1 :
- aggiunte funzioni Exe e Lua SurfTmVertexCount, SurfTmGetVertex, SurfTmGetNearestVertex, SurfTmGetAllVertInFacet e SurfTmMoveVertex.
2023-07-07 17:07:16 +02:00
DarioS 3d3900b39a EgtExecutor 2.5f3 :
- dove possibile e sicuro sostituiti dynamic_cast con static_cast.
2023-06-30 11:55:16 +02:00
Daniele Bariletti e989b88dd4 Merge remote-tracking branch 'origin/HEAD' into Bezier_trim&mesh 2023-06-21 09:36:55 +02:00
Daniele Bariletti 4b58f4f522 EgtExecutor :
- aggiunta funzione per il trim delle superfici di Bezier
- aggiunta funzione per vedere la divione di in celle di una superficie
di Bezier durante la costruzione della trimesh (per debug).
2023-06-21 09:36:41 +02:00
DarioS 1620054970 EgtExecutor 2.5f2 :
- aggiunte funzioni Exe e Lua CDeSolidSolid.
2023-06-19 08:10:17 +02:00
DarioS 7d3bec9f44 EgtExecutor 2.6f1 :
- estesa gestione LockId
- passato nuovo parametro LockId a EgtConverter.
2023-06-05 08:11:36 +02:00
DarioS 150b35bb9e EgtExecutor :
- alla chiusura di Executor si rilascia eventuale chiave di rete.
2023-05-30 17:09:20 +02:00
DarioS 173728605d EgtExecutor 2.5e5 :
- migliorato controllo gestione chiave di rete.
2023-05-30 10:28:53 +02:00
DarioS d069b33424 EgtExecutor 2.5e3 :
- il SerialNumber della chiave è ricavato solo per chiavi USB.
2023-05-26 08:42:05 +02:00
DarioS 4642188fd6 EgtExecutor 2.5e2 :
- se disabilitato UI esco subito da ExeDraw (evito verificare esistenza scena che poi non uso).
2023-05-04 17:05:22 +02:00
DarioS e3530f6e90 EgtExecutor 2.5e1 :
- ricompilazione per aggiornamento lua.
2023-05-03 09:46:05 +02:00
Daniele Bariletti fb388799ea EgtExecutor :
- modifica minore alle quote angolari.
2023-04-19 17:21:53 +02:00
Daniele Bariletti f6915d80fa EgtExecutor :
- modifica minore alle quote angolari.
2023-04-14 10:06:08 +02:00
Daniele Bariletti d412ce65cd EgtExecutor :
- aggiustamenti alle quote angolari.
2023-04-14 09:46:03 +02:00
Daniele Bariletti 61824a24ab Merge remote-tracking branch 'origin/master' into ExtDimension_angular 2023-04-12 10:43:11 +02:00
DarioS 88fc7e6eee EgtExecutor 2.5d3 :
- sistemate quote radiali e anolari, rimangono da sistemare quelle angolari.
2023-04-11 19:37:42 +02:00
DarioS 964a02eae4 Merge remote-tracking branch 'origin/ExtDimension_angular' 2023-04-08 11:42:53 +02:00
Daniele Bariletti dd5c8ebdd1 EgtExecutor :
- aggiunte funzioni Exe e Lua per quotature angolari, radiali e diametrali.
2023-03-31 14:55:45 +02:00
Daniele Bariletti 34885e1f2a Merge remote-tracking branch 'origin/master' into ExtDimension_angular 2023-03-31 14:53:43 +02:00
DarioS 8000a9d3a5 EgtExecutor 2.5c2 :
- aggiunti file Icarus con estensione .icrs alla famiglia dei file Nge.
2023-03-30 10:38:40 +02:00
DarioS 7963b9befe EgtExecutor 2.5c1 :
- ricompilazione con cambio versione.
2023-03-23 10:04:07 +01:00
DarioS 2394dfc404 EgtExecutor :
- a ExeLuaExecFile aggiunto parametro opzionale bLogInfo = true.
2023-02-27 17:04:53 +01:00
DarioS 081c3fcb78 EgtExecutor 2.5b4 :
- ricompilazione con cambio versione.
2023-02-27 08:17:18 +01:00
DarioS 002e736ec4 EgtExecutor 2.5b3 :
- ricompilazione con cambio versione.
2023-02-20 09:16:18 +01:00
DarioS 415a761039 EgtExecutor 2.5b2 :
- aggiunta funzione Lua EgtCloseExe per terminare l'eseguibile.
2023-02-18 09:52:32 +01:00
DarioS 8f596cab5a EgtExecutor 2.5b1 :
- ricompilazione con cambio versione.
2023-02-10 11:27:04 +01:00
DarioS 37dc8b8a7b EgtExecutor 2.5a6 :
- aggiunte funzioni Lua EgtCreateMutex e EgtReleaseMutex.
2023-02-06 08:13:01 +01:00
SaraP 06e9f85a4b EgtExecutor :
- modifica funzione CurveCurveInters per renderla analoga alle altre funzioni di intersezione.
2023-02-01 09:36:20 +01:00
SaraP 4f42606cd3 EgtExecutor 2.5a5 :
- aggiunta funzione Exe e Lua CurveCurveInters.
2023-01-31 15:35:43 +01:00
DarioS baa8eb42b6 EgtExecutor 2.5a4 :
- aggiunta funzione Exe e Lua GetAllInfo.
2023-01-30 09:39:29 +01:00
DarioS b1a11c4eaf EgtExecutor 2.5a3 :
- aggiunta funzione ExeMessageBox.
2023-01-17 11:29:59 +01:00
DarioS 553efdec1b EgtExecutor 2.5a2 :
- aggiunto parametro nFilter a tutte le funzioni di esportazione.
2023-01-11 14:51:16 +01:00
DarioS bc8171c4ba EgtExecutor :
- aggiornamenti per lua 5.4.
2023-01-09 10:11:47 +01:00
DarioS 63b82fe556 EgtExecutor 2.5a1 :
- ricompilazione con cambio versione.
2023-01-03 08:53:11 +01:00
DarioS 9d4b181e1b EgtExecutor :
- modifiche per più utensili in virtual milling di Zmap.
2022-12-28 19:39:37 +01:00
SaraP 65cf39c56a EgtExecutor 2.4l3 :
- migliorie alla funzione SpiralizeCurveAlongGuide.
2022-12-28 14:19:33 +01:00
DarioS 2ba94e5dc1 EgtExecutor 2.4l2 :
- aggiunte funzioni Exe e Lua CurveCompoLength.
2022-12-12 14:42:45 +01:00
DarioS 617023edb6 EgtExecutor 2.4l1 :
- ricompilazione con cambio versione.
2022-12-05 08:13:44 +01:00
SaraP e2405d10c5 EgtExecutor 2.4k4 :
- aggiunte funzioni Exe e Lua SpiralizeCurveAlongGuide
- rinominate funzioni SpiralizeCurve in SpiralizeCurveAlongExtrusion.
2022-12-01 11:25:30 +01:00
DarioS 432810452c EgtExecutor 2.4k3 :
- in ExeApproxCurve aggiunta eliminazione difetti di tipo SmallZ.
2022-11-14 08:38:23 +01:00
DarioS 0a7369bfcc EgtExecutor :
- aggiunte funzioni ExeBeamShowFacesName e ExeBeamShowLoadingSide.
2022-11-08 16:42:07 +01:00
DarioS 3c0d89e3ab EgtExecutor :
- in ExeApproxSurface per semplificare la trimesh inserita DoCompacting (da migliorare con vere funzioni di semplificazione).
2022-11-06 20:08:56 +01:00
DarioS 00c0e216b7 EgtExecutor 2.4k2 :
- aggiunta funzione Exe e Lua ApproxSurface.
2022-11-04 19:21:17 +01:00
DarioS a200549542 EgtExecutor 2.4k1 :
- aggiunte funzioni Exe e Lua CreateSurfTmRectSwept.
2022-11-02 15:13:23 +01:00
DarioS d4cfe31b6f EgtExecutor :
- in ExeApplyAllMachiningsEx ora si forza sempre il ricalcolo di DispositionSpecialApply (equivalente di PostApply delle lavorazioni).
2022-10-27 11:02:26 +02:00
DarioS ad6673330d EgtExecutor 2.4j4 :
- aggiunte funzioni Exe e Lua SurfIsClosed e SurfTmPartCount.
2022-10-26 18:05:17 +02:00
DarioS 00f52ca6ab EgtExecutor 2.4j3 :
- modifiche per export ThreeJS.
2022-10-24 08:38:57 +02:00
Riccardo Elitropi 8dc6cce243 Merge commit '7f1861b2e979654f1a0cc4f35ca12c3fd04bd332' 2022-10-20 16:23:13 +02:00
DarioS 3309939aed EgtExecutor 2.4j2 :
- in ImportAdvanced si aggiorna FilePath solo se vuota (come con altri formati).
2022-10-14 19:00:24 +02:00
SaraP d646331746 EgtExecutor 2.4j1 :
- aggiunte funzioni Exe e Lua SpiralizeCurve.
2022-10-11 16:07:08 +02:00
DarioS 8192bd0feb EgtExecutor 2.4i7 :
- aggiunta funzione Exe e Lua SurfTmToTriangles.
2022-10-11 12:28:47 +02:00
92 changed files with 19221 additions and 2006 deletions
+90
View File
@@ -0,0 +1,90 @@
//----------------------------------------------------------------------------
// EgalTech 2026-2026
//----------------------------------------------------------------------------
// File : AuxDialogBox.cpp Data : 24.04.26 Versione : 3.1d4
// Contenuto : Funzioni DialogBox.
//
//
// Modifiche : 24.04.26 RE Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "EXE.h"
#include "EXE_Macro.h"
#include "AuxDialogBox.h"
#include "/EgtDev/Include/EGnStringUtils.h"
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EGkStringUtils3d.h"
#include "/EgtDev/Include/EgtStringConverter.h"
using namespace std ;
#pragma comment( lib, "Comctl32.lib")
HWND phDlgModeless = nullptr ;
int nDlgModelessItem = -1 ;
//-----------------------------------------------------------------------------
bool
UpdateIdsModelessDialog( HWND phDlgModeless, int nDlgModelessItem)
{
// se DialogBox Modeless non inizializzato, esco
if ( phDlgModeless == nullptr)
return false ;
// se Id del controllo da aggiornare non valido, esco
if ( nDlgModelessItem == -1)
return false ;
// recupero tutti gli elementi selezionati
string sIds ;
int nId = ExeGetFirstSelectedObj() ;
while ( nId != GDB_ID_NULL) {
sIds.append( ToString( nId) + string{","}) ;
nId = ExeGetNextSelectedObj() ;
}
if ( ! sIds.empty())
sIds.pop_back() ;
// aggiorno il contenuto nel dialogo
return ( SetDlgItemText( phDlgModeless, nDlgModelessItem, stringtoW( sIds))) ;
}
//-----------------------------------------------------------------------------
LRESULT CALLBACK UpdateSelectionModelessDialog( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData)
{
if ( msg == WM_GETDLGCODE)
return DLGC_WANTALLKEYS ;
if ( msg == WM_KEYDOWN && wParam == VK_RETURN) {
// dwRefData contiene l'ID dell'EDIT
int nEditId = int( dwRefData) ;
HWND hwndDlg = GetParent(hwnd);
if ( hwndDlg == nullptr)
return FALSE ;
// recupero il testo dell'EDIT corretto
string sIds ;
AtoWEX<128> wsEdit( "") ;
if ( GetDlgItemText( hwndDlg, nEditId, LPWSTR( wsEdit), 128) > 0)
sIds = wstrztoA( wsEdit) ;
// deseleziono tutto
ExeDeselectAll() ;
// seleziono gli ID contenuti
if ( ! sIds.empty()) {
STRVECTOR vsIds;
Tokenize( sIds, ",", vsIds) ;
for ( auto& s : vsIds) {
int nId = GDB_ID_NULL ;
if ( FromString( s, nId) && nId != GDB_ID_NULL)
ExeSelectObj( nId) ;
}
}
// aggiorno la grafica ed esco
ExeDraw() ;
return TRUE ;
}
return ( DefSubclassProc(hwnd, msg, wParam, lParam)) ;
}
+31
View File
@@ -0,0 +1,31 @@
//----------------------------------------------------------------------------
// EgalTech 2026-2026
//----------------------------------------------------------------------------
// File : AuxDialogBox.h Data : 24.04.2026 Versione : 3.1d4
// Contenuto : Prototipi funzioni DialogBox.
//
//
//
// Modifiche : 22.04.26 RE Creazione modulo.
//
//
//----------------------------------------------------------------------------
#pragma once
#include "stdafx.h"
#include "resource.h"
#include "/EgtDev/Include/ExeExecutor.h"
#include "/EgtDev/Include/EGkLuaAux.h"
#include <shlobj.h>
//----------------------------------------------------------------------------
// Identificativo della finestra ModeLess corrente ( nullptr se non esiste)
extern HWND phDlgModeless ;
extern int nDlgModelessItem ;
// Funzione per passaggi di parametri tra Selezione DB e dialogo non modale
bool UpdateIdsModelessDialog( HWND phDlgModeless, int UpdateIdsModelessDialog) ;
//Funzione per selezionare gli Id presenti all'interno dei un EditText
LRESULT CALLBACK UpdateSelectionModelessDialog( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData) ;
+181
View File
@@ -0,0 +1,181 @@
//----------------------------------------------------------------------------
// EgalTech 2023-2023
//----------------------------------------------------------------------------
// File : DllExch3dm.cpp Data : 14.11.23 Versione : 2.5k2
// Contenuto : Funzioni di gestione della libreria opzionale EgtExch3dme.
//
//
//
// Modifiche : 14.11.23 DS Creazione modulo.
//
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "EXE.h"
#include "DllExch3dm.h"
#include "/EgtDev/Include/EE3DllMain.h"
#define NOMINMAX
#include <windows.h>
using namespace std ;
//-----------------------------------------------------------------------------
// Nome della libreria
#if defined( _WIN64) && defined( _DEBUG)
static const wchar_t* EE3_NAME = L"EgtExch3dmD64.dll" ;
#elif defined( _WIN64)
static const wchar_t* EE3_NAME = L"EgtExch3dmR64.dll" ;
#elif defined( _WIN32) && defined( _DEBUG)
static const wchar_t* EE3_NAME = L"EgtExch3dmD32.dll" ;
#else
static const wchar_t* EE3_NAME = L"EgtExch3dmR32.dll" ;
#endif
// Nome delle funzioni caricate
static const char* EE3_SETEE3LOGGER = "SetEE3Logger" ;
static const char* EE3_GETEE3VERSION = "GetEE3Version" ;
static const char* EE3_SETEE3KEY = "SetEE3Key" ;
static const char* EE3_SETEE3NETHWKEY = "SetEE3NetHwKey" ;
static const char* EE3_CREATEIMPORT3DM = "CreateImport3dm" ;
static const char* EE3_CREATEEXPORT3DM = "CreateExport3dm" ;
//-----------------------------------------------------------------------------
HMODULE s_hEE3 = nullptr ;
//-----------------------------------------------------------------------------
bool
LoadExch3dmDll( ILogger* pLogger, const string& sKey, bool bNetHwKey)
{
// verifico la chiave
if ( ! TestKeyForEE3( sKey, 0, pLogger)) {
FreeExch3dmDll() ;
return false ;
}
// se già caricata
if ( s_hEE3 != nullptr)
return true ;
// carico la libreria EgtExch3dm
s_hEE3 = LoadLibrary( EE3_NAME) ;
if ( s_hEE3 == nullptr)
return false ;
// imposto logger
MySetEE3Logger( pLogger) ;
// imposto i codici della chiave
MySetEE3Key( sKey) ;
// imposto eventuale chiave di rete
MySetEE3NetHwKey( bNetHwKey) ;
return true ;
}
//-----------------------------------------------------------------------------
bool
FreeExch3dmDll( void)
{
// se non è già caricata
if ( s_hEE3 == nullptr)
return true ;
// libero la libreria EgtExch3dm
FreeLibrary( s_hEE3) ;
s_hEE3 = nullptr ;
return true ;
}
//-----------------------------------------------------------------------------
bool
IsLoadedExch3dmDll( void)
{
return ( s_hEE3 != nullptr) ;
}
//-----------------------------------------------------------------------------
void
MySetEE3Logger( ILogger* pLogger)
{
// verifico caricamento libreria EgtExch3dm
if ( s_hEE3 == nullptr)
return ;
// recupero funzione che imposta il logger
typedef void (* PF_SetEE3Logger) ( ILogger* pLogger) ;
PF_SetEE3Logger pFun = (PF_SetEE3Logger)GetProcAddress( s_hEE3, EE3_SETEE3LOGGER) ;
if ( pFun == nullptr)
return ;
pFun( pLogger) ;
}
//-----------------------------------------------------------------------------
const char*
MyGetEE3Version( void)
{
// verifico caricamento libreria EgtExch3dm
if ( s_hEE3 == nullptr)
return "" ;
// recupero funzione che restituisce la versione della libreria
typedef const char* (* PF_GetEE3Version) ( void) ;
PF_GetEE3Version pFun = (PF_GetEE3Version)GetProcAddress( s_hEE3, EE3_GETEE3VERSION) ;
if ( pFun == nullptr)
return "" ;
return pFun() ;
}
//-----------------------------------------------------------------------------
void
MySetEE3Key( const string& sKey)
{
// verifico caricamento libreria EgtExch3dm
if ( s_hEE3 == nullptr)
return ;
// recupero funzione che imposta i codici di protezione
typedef void (* PF_SetEE3Key) ( const string& sKey) ;
PF_SetEE3Key pFun = (PF_SetEE3Key)GetProcAddress( s_hEE3, EE3_SETEE3KEY) ;
if ( pFun == nullptr)
return ;
pFun( sKey) ;
}
//-----------------------------------------------------------------------------
void
MySetEE3NetHwKey( bool bNetHwKey)
{
// verifico caricamento libreria EgtExch3dm
if ( s_hEE3 == nullptr)
return ;
// recupero funzione che imposta il flag per chiave di rete
typedef void (* PF_SetEE3NetHwKey) ( bool bNetHwKey) ;
PF_SetEE3NetHwKey pFun = (PF_SetEE3NetHwKey)GetProcAddress( s_hEE3, EE3_SETEE3NETHWKEY) ;
if ( pFun == nullptr)
return ;
pFun( bNetHwKey) ;
}
//-----------------------------------------------------------------------------
IImport3dm*
MyCreateImport3dm( void)
{
// verifico caricamento libreria EgtExch3dm
if ( s_hEE3 == nullptr)
return nullptr ;
// recupero funzione creazione oggetto
typedef IImport3dm* (* PF_CreateImport3dm) ( void) ;
PF_CreateImport3dm pFun = (PF_CreateImport3dm)GetProcAddress( s_hEE3, EE3_CREATEIMPORT3DM) ;
if ( pFun == nullptr)
return nullptr ;
return pFun() ;
}
//-----------------------------------------------------------------------------
IExport3dm*
MyCreateExport3dm( void)
{
// verifico caricamento libreria EgtExch3dm
if ( s_hEE3 == nullptr)
return nullptr ;
// recupero funzione creazione oggetto
typedef IExport3dm* (* PF_CreateExport3dm) ( void) ;
PF_CreateExport3dm pFun = (PF_CreateExport3dm)GetProcAddress( s_hEE3, EE3_CREATEEXPORT3DM) ;
if ( pFun == nullptr)
return nullptr ;
return pFun() ;
}
+31
View File
@@ -0,0 +1,31 @@
//----------------------------------------------------------------------------
// EgalTech 2023-2023
//----------------------------------------------------------------------------
// File : DllExch3dm.h Data : 14.11.23 Versione : 2.5k3
// Contenuto : Dichiarazioni funzioni per libreria opzionale EgtExchange.
//
//
//
// Modifiche : 14.11.23 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
#pragma once
#include <string>
class ILogger ;
class IImport3dm ;
class IExport3dm ;
//----------------------------------------------------------------------------
bool LoadExch3dmDll( ILogger* pLogger, const std::string& sKey, bool bNetHwKey) ;
bool FreeExch3dmDll( void) ;
bool IsLoadedExch3dmDll( void) ;
void MySetEE3Logger( ILogger* pLogger) ;
void MySetEE3Key( const std::string& sKey) ;
void MySetEE3NetHwKey( bool bNetHwKey) ;
const char* MyGetEE3Version( void) ;
IImport3dm* MyCreateImport3dm( void) ;
IExport3dm* MyCreateExport3dm( void) ;
+73 -24
View File
@@ -10,6 +10,8 @@
// 03.07.18 DS Aggiunto ImportPnt. // 03.07.18 DS Aggiunto ImportPnt.
// 15.09.19 DS Aggiunto ExportSvg. // 15.09.19 DS Aggiunto ExportSvg.
// 14.12.20 DS Aggiunto ImportBtlx. // 14.12.20 DS Aggiunto ImportBtlx.
// 23.10.23 DB Aggiunto Export3dm.
// 07.11.23 DB Aggiunto Import3dm.
// //
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -40,7 +42,7 @@ static const char* EEX_GETEEXVERSION = "GetEExVersion" ;
static const char* EEX_SETEEXKEY = "SetEExKey" ; static const char* EEX_SETEEXKEY = "SetEExKey" ;
static const char* EEX_SETEEXNETHWKEY = "SetEExNetHwKey" ; static const char* EEX_SETEEXNETHWKEY = "SetEExNetHwKey" ;
static const char* EEX_SETBTLAUXDIR = "SetBtlAuxDir" ; static const char* EEX_SETBTLAUXDIR = "SetBtlAuxDir" ;
static const char* EEX_SETTHREEJSAUXDIR = "SetThreeJSAuxDir" ; static const char* EEX_SETBTLLUADATA = "SetBtlLuaData" ;
static const char* EEX_CREATEBEAMMGR = "CreateBeamMgr" ; static const char* EEX_CREATEBEAMMGR = "CreateBeamMgr" ;
static const char* EEX_CREATEIMPORTBTL = "CreateImportBtl" ; static const char* EEX_CREATEIMPORTBTL = "CreateImportBtl" ;
static const char* EEX_CREATEIMPORTBTLX = "CreateImportBtlx" ; static const char* EEX_CREATEIMPORTBTLX = "CreateImportBtlx" ;
@@ -49,12 +51,15 @@ static const char* EEX_CREATEIMPORTCSF = "CreateImportCsf" ;
static const char* EEX_CREATEIMPORTDXF = "CreateImportDxf" ; static const char* EEX_CREATEIMPORTDXF = "CreateImportDxf" ;
static const char* EEX_CREATEIMPORTPNT = "CreateImportPnt" ; static const char* EEX_CREATEIMPORTPNT = "CreateImportPnt" ;
static const char* EEX_CREATEIMPORTSTL = "CreateImportStl" ; static const char* EEX_CREATEIMPORTSTL = "CreateImportStl" ;
static const char* EEX_CREATEIMPORTOFF = "CreateImportOff" ;
static const char* EEX_CREATEIMPORTPLY = "CreateImportPly" ;
static const char* EEX_CREATEIMPORT3MF = "CreateImport3MF" ; static const char* EEX_CREATEIMPORT3MF = "CreateImport3MF" ;
static const char* EEX_CREATEEXPORTDXF = "CreateExportDxf" ; static const char* EEX_CREATEEXPORTDXF = "CreateExportDxf" ;
static const char* EEX_CREATEEXPORTSTL = "CreateExportStl" ; static const char* EEX_CREATEEXPORTSTL = "CreateExportStl" ;
static const char* EEX_CREATEEXPORT3MF = "CreateExport3MF" ; static const char* EEX_CREATEEXPORT3MF = "CreateExport3MF" ;
static const char* EEX_CREATEEXPORTTHREEJS = "CreateExportThreeJS" ;
static const char* EEX_CREATEEXPORTSVG = "CreateExportSvg" ; static const char* EEX_CREATEEXPORTSVG = "CreateExportSvg" ;
static const char* EEX_SETTHREEJSLIBDIR = "SetThreeJSLibDir" ;
static const char* EEX_CREATEEXPORTTHREEJS = "CreateExportThreeJS" ;
static const char* EEX_CREATEEEXEXECUTOR = "CreateExcExecutor" ; static const char* EEX_CREATEEEXEXECUTOR = "CreateExcExecutor" ;
@@ -70,7 +75,7 @@ LoadExchangeDll( ILogger* pLogger, const string& sKey, bool bNetHwKey)
FreeExchangeDll() ; FreeExchangeDll() ;
return false ; return false ;
} }
// se già caricata // se già caricata
if ( s_hEEx != nullptr) if ( s_hEEx != nullptr)
return true ; return true ;
// carico la libreria EgtExchange // carico la libreria EgtExchange
@@ -90,7 +95,7 @@ LoadExchangeDll( ILogger* pLogger, const string& sKey, bool bNetHwKey)
bool bool
FreeExchangeDll( void) FreeExchangeDll( void)
{ {
// se non è già caricata // se non è già caricata
if ( s_hEEx == nullptr) if ( s_hEEx == nullptr)
return true ; return true ;
// libero la libreria EgtExchange // libero la libreria EgtExchange
@@ -183,20 +188,19 @@ MySetBtlAuxDir( const string& sBtlAuxDir)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool bool
MySetThreeJSAuxDir( const string& sThreeJSAuxDir ) MySetBtlLuaData( const string& sLuaLibsDir, const string& sLuaLastRequire)
{ {
// verifico caricamento libreria EgtExchange // verifico caricamento libreria EgtExchange
if ( s_hEEx == nullptr) if ( s_hEEx == nullptr)
return false ; return false ;
// recupero funzione creazione oggetto // recupero funzione creazione oggetto
typedef bool ( *PF_SetThreeJSAuxDir)( const string& sThreeJSAuxDir) ; typedef bool (* PF_SetBtlLuaData) ( const string& sLuaLibsDir, const string& sLuaLastRequire) ;
PF_SetThreeJSAuxDir pFun = ( PF_SetThreeJSAuxDir) GetProcAddress( s_hEEx, EEX_SETTHREEJSAUXDIR) ; PF_SetBtlLuaData pFun = (PF_SetBtlLuaData)GetProcAddress( s_hEEx, EEX_SETBTLLUADATA) ;
if ( pFun == nullptr) if ( pFun == nullptr)
return false ; return false ;
return pFun( sThreeJSAuxDir) ; return pFun( sLuaLibsDir, sLuaLastRequire) ;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
IBeamMgr* IBeamMgr*
MyCreateBeamMgr( void) MyCreateBeamMgr( void)
@@ -317,6 +321,36 @@ MyCreateImportStl( void)
return pFun() ; return pFun() ;
} }
//-----------------------------------------------------------------------------
IImportOff*
MyCreateImportOff( void)
{
// verifico caricamento libreria EgtExchange
if ( s_hEEx == nullptr)
return nullptr ;
// recupero funzione creazione oggetto
typedef IImportOff* (* PF_CreateImportOff) ( void) ;
PF_CreateImportOff pFun = (PF_CreateImportOff)GetProcAddress( s_hEEx, EEX_CREATEIMPORTOFF) ;
if ( pFun == nullptr)
return nullptr ;
return pFun() ;
}
//-----------------------------------------------------------------------------
IImportPly*
MyCreateImportPly( void)
{
// verifico caricamento libreria EgtExchange
if ( s_hEEx == nullptr)
return nullptr ;
// recupero funzione creazione oggetto
typedef IImportPly* (* PF_CreateImportPly) ( void) ;
PF_CreateImportPly pFun = (PF_CreateImportPly)GetProcAddress( s_hEEx, EEX_CREATEIMPORTPLY) ;
if ( pFun == nullptr)
return nullptr ;
return pFun() ;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
IImport3MF* IImport3MF*
MyCreateImport3MF( void) MyCreateImport3MF( void)
@@ -377,21 +411,6 @@ MyCreateExport3MF( void)
return pFun() ; return pFun() ;
} }
//-----------------------------------------------------------------------------
IExportThreeJS*
MyCreateExportThreeJS( void)
{
// verifico caricamento libreria EgtExchange
if ( s_hEEx == nullptr)
return nullptr ;
// recupero funzione creazione oggetto
typedef IExportThreeJS* (* PF_CreateExportThreeJS) ( void) ;
PF_CreateExportThreeJS pFun = (PF_CreateExportThreeJS)GetProcAddress( s_hEEx, EEX_CREATEEXPORTTHREEJS) ;
if ( pFun == nullptr)
return nullptr ;
return pFun() ;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
IExportSvg* IExportSvg*
MyCreateExportSvg( void) MyCreateExportSvg( void)
@@ -407,6 +426,36 @@ MyCreateExportSvg( void)
return pFun() ; return pFun() ;
} }
//-----------------------------------------------------------------------------
bool
MySetThreeJSLibDir( const string& sThreeJSLibDir)
{
// verifico caricamento libreria EgtExchange
if ( s_hEEx == nullptr)
return false ;
// recupero funzione creazione oggetto
typedef bool ( *PF_SetThreeJSLibDir)( const string& sThreeJSLibDir) ;
PF_SetThreeJSLibDir pFun = ( PF_SetThreeJSLibDir) GetProcAddress( s_hEEx, EEX_SETTHREEJSLIBDIR) ;
if ( pFun == nullptr)
return false ;
return pFun( sThreeJSLibDir) ;
}
//-----------------------------------------------------------------------------
IExportThreeJS*
MyCreateExportThreeJS( void)
{
// verifico caricamento libreria EgtExchange
if ( s_hEEx == nullptr)
return nullptr ;
// recupero funzione creazione oggetto
typedef IExportThreeJS* (* PF_CreateExportThreeJS) ( void) ;
PF_CreateExportThreeJS pFun = (PF_CreateExportThreeJS)GetProcAddress( s_hEEx, EEX_CREATEEXPORTTHREEJS) ;
if ( pFun == nullptr)
return nullptr ;
return pFun() ;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
IExcExecutor* IExcExecutor*
MyCreateExcExecutor( void) MyCreateExcExecutor( void)
+8 -3
View File
@@ -1,7 +1,7 @@
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// EgalTech 2015-2021 // EgalTech 2015-2025
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// File : DllExchange.h Data : 27.08.21 Versione : 2.3h2 // File : DllExchange.h Data : 28.02.25 Versione : 2.7b2
// Contenuto : Dichiarazioni funzioni per libreria opzionale EgtExchange. // Contenuto : Dichiarazioni funzioni per libreria opzionale EgtExchange.
// //
// //
@@ -24,6 +24,8 @@ class IImportCsf ;
class IImportDxf ; class IImportDxf ;
class IImportPnt ; class IImportPnt ;
class IImportStl ; class IImportStl ;
class IImportOff ;
class IImportPly ;
class IImport3MF ; class IImport3MF ;
class IExportDxf ; class IExportDxf ;
class IExportStl ; class IExportStl ;
@@ -41,7 +43,7 @@ void MySetEExKey( const std::string& sKey) ;
void MySetEExNetHwKey( bool bNetHwKey) ; void MySetEExNetHwKey( bool bNetHwKey) ;
const char* MyGetEExVersion( void) ; const char* MyGetEExVersion( void) ;
bool MySetBtlAuxDir( const std::string& sBtlAuxDir) ; bool MySetBtlAuxDir( const std::string& sBtlAuxDir) ;
bool MySetThreeJSAuxDir( const std::string& sThreeJSAuxDir) ; bool MySetBtlLuaData( const std::string& sLuaLibsDir, const std::string& sLuaLastRequire) ;
IBeamMgr* MyCreateBeamMgr( void) ; IBeamMgr* MyCreateBeamMgr( void) ;
IImportBtl* MyCreateImportBtl( void) ; IImportBtl* MyCreateImportBtl( void) ;
IImportBtlx* MyCreateImportBtlx( void) ; IImportBtlx* MyCreateImportBtlx( void) ;
@@ -50,10 +52,13 @@ IImportCsf* MyCreateImportCsf( void) ;
IImportDxf* MyCreateImportDxf( void) ; IImportDxf* MyCreateImportDxf( void) ;
IImportPnt* MyCreateImportPnt( void) ; IImportPnt* MyCreateImportPnt( void) ;
IImportStl* MyCreateImportStl( void) ; IImportStl* MyCreateImportStl( void) ;
IImportOff* MyCreateImportOff( void) ;
IImportPly* MyCreateImportPly( void) ;
IImport3MF* MyCreateImport3MF( void) ; IImport3MF* MyCreateImport3MF( void) ;
IExportDxf* MyCreateExportDxf( void) ; IExportDxf* MyCreateExportDxf( void) ;
IExportStl* MyCreateExportStl( void) ; IExportStl* MyCreateExportStl( void) ;
IExport3MF* MyCreateExport3MF( void) ; IExport3MF* MyCreateExport3MF( void) ;
bool MySetThreeJSLibDir( const std::string& sThreeJSLibDir) ;
IExportThreeJS* MyCreateExportThreeJS( void) ; IExportThreeJS* MyCreateExportThreeJS( void) ;
IExportSvg* MyCreateExportSvg( void) ; IExportSvg* MyCreateExportSvg( void) ;
IExcExecutor* MyCreateExcExecutor(void) ; IExcExecutor* MyCreateExcExecutor(void) ;
+8 -1
View File
@@ -45,8 +45,15 @@ HMODULE s_hENs = nullptr ;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool bool
LoadNestingDll( ILogger* pLogger, const string& sKey, const string& sKey2) LoadNestingDll( ILogger* pLogger, const string& sKey, const string& sKey2, bool bNetHwKey)
{ {
// non ammessa con chiave di rete
if ( bNetHwKey) {
std::string sErr = "Warning on Key (ENS/NET)" ;
LOG_ERROR( pLogger, sErr.c_str()) ;
FreeNestingDll() ;
return false ;
}
// verifico la chiave // verifico la chiave
if ( ! TestKeyForENs( sKey, 0, pLogger)) { if ( ! TestKeyForENs( sKey, 0, pLogger)) {
FreeNestingDll() ; FreeNestingDll() ;
+1 -1
View File
@@ -19,7 +19,7 @@ class ILogger ;
class IAutoNester ; class IAutoNester ;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool LoadNestingDll( ILogger* pLogger, const std::string& sKey, const std::string& sKey2) ; bool LoadNestingDll( ILogger* pLogger, const std::string& sKey, const std::string& sKey2, bool bNetHwKey) ;
bool FreeNestingDll( void) ; bool FreeNestingDll( void) ;
bool IsLoadedNestingDll( void) ; bool IsLoadedNestingDll( void) ;
void MySetENsLogger( ILogger* pLogger) ; void MySetENsLogger( ILogger* pLogger) ;
+11 -2
View File
@@ -1,7 +1,7 @@
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// EgalTech 2014-2015 // EgalTech 2014-2024
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// File : EXE.h Data : 05.05.15 Versione : 1.6e2 // File : EXE.h Data : 15.05.24 Versione : 2.6e4
// Contenuto : Dichiarazioni locali per moduli EXE. // Contenuto : Dichiarazioni locali per moduli EXE.
// //
// //
@@ -25,6 +25,8 @@ const std::string& ExeGetIniFile( void) ;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
const std::string& ExeGetKey( void) ; const std::string& ExeGetKey( void) ;
const std::string& ExeGetNestKey( void) ; const std::string& ExeGetNestKey( void) ;
const std::string& ExeGetLockId( void) ;
bool ExeVerifyKeyOption( int nOptInd) ;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
ILogger* GetLogger( void) ; ILogger* GetLogger( void) ;
@@ -38,3 +40,10 @@ bool ExeInsertMachMgr( int nInsGrp) ;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool ExeIsDuploBase( IGeomDB* pGeomDB, int nId) ; bool ExeIsDuploBase( IGeomDB* pGeomDB, int nId) ;
bool ExeInsertDuplo( int nInsGrp) ; bool ExeInsertDuplo( int nInsGrp) ;
//----------------------------------------------------------------------------
bool ExeCreateMutex( const std::string& sMutexName) ;
bool ExeReleaseMutex( void) ;
//----------------------------------------------------------------------------
bool ExeSetModified( int nCtx) ;
+66
View File
@@ -0,0 +1,66 @@
//----------------------------------------------------------------------------
// EgalTech 2025-2025
//----------------------------------------------------------------------------
// File : EXE_Base64.cpp Data : 03.11.25 Versione : 2.7k1
// Contenuto : Funzioni per codificare/decodificare in Base64.
//
//
//
// Modifiche : 03.11.25 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EgtStringConverter.h"
#include "/EgtDev/Include/EgtBase64.h"
#include <fstream>
using namespace std ;
//----------------------------------------------------------------------------
bool
ExeBase64Encode( const string& sFile, string& sB64Dest)
{
// apro il file in modo binario
ifstream InFile( stringtoW( sFile), ios::in | ios::binary, _SH_DENYWR) ;
if ( InFile.fail()) {
if ( InFile.is_open())
InFile.close() ;
return false ;
}
// leggo il file
string sSou( istreambuf_iterator<char>( InFile), {}) ;
// lo chiudo
if ( InFile.is_open())
InFile.close() ;
// converto in Base64
return B64Encode( sSou, sB64Dest) ;
}
//----------------------------------------------------------------------------
bool
ExeBase64Decode( const string& sB64Sou, const string& sFile)
{
// converto da Base64
string sDest ;
if ( ! B64Decode( sB64Sou, sDest))
return false ;
// apro il file in modo binario
ofstream OutFile( stringtoW( sFile), ios::out | ios::binary, _SH_DENYWR) ;
if ( ! OutFile.good()) {
if ( OutFile.is_open())
OutFile.close() ;
return false ;
}
// scrivo sul file
OutFile.write( sDest.data(), sDest.size()) ;
// lo chiudo
if ( OutFile.is_open())
OutFile.close() ;
return true ;
}
+62 -4
View File
@@ -148,6 +148,26 @@ ExeBeamGetSideData( int nSide, Frame3d& frRef, double& dLength, double& dWidth,
return pBeamMgr->GetSideData( nSide, frRef, dLength, dWidth, dHeight) ; return pBeamMgr->GetSideData( nSide, frRef, dLength, dWidth, dHeight) ;
} }
//-----------------------------------------------------------------------------
bool
ExeBeamShowFacesName( bool bShow)
{
IBeamMgr* pBeamMgr = GetCurrBeamMgr() ;
VERIFY_BEAMMGR( pBeamMgr, false)
// imposto la visualizzazione delle facce sul pezzo corrente
return pBeamMgr->ShowFacesName( bShow) ;
}
//-----------------------------------------------------------------------------
bool
ExeBeamShowLoadingSide( bool bShow, bool bFromLeft)
{
IBeamMgr* pBeamMgr = GetCurrBeamMgr() ;
VERIFY_BEAMMGR( pBeamMgr, false)
// imposto la visualizzazione del lato di carico sotto il pezzo corrente
return pBeamMgr->ShowLoadingSide( bShow, bFromLeft) ;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
int int
ExeBeamAddProcess( int nGroup, int nProc, int nSide, const string& sDes, int nProcId, ExeBeamAddProcess( int nGroup, int nProc, int nSide, const string& sDes, int nProcId,
@@ -196,6 +216,44 @@ ExeBeamEnableProcess( int nGeomId, bool bEnable, bool bUpdate)
return pBeamMgr->EnableProcess( nGeomId, bEnable, bUpdate) ; return pBeamMgr->EnableProcess( nGeomId, bEnable, bUpdate) ;
} }
//-----------------------------------------------------------------------------
bool
ExeBeamCalcAllSolids( bool bShow, bool bRecalc)
{
IBeamMgr* pBeamMgr = GetCurrBeamMgr() ;
VERIFY_BEAMMGR( pBeamMgr, false)
// disabilito possibilità di alterare il flag di modifica
bool bOldEnabModif = ExeGetEnableModified() ;
if ( bOldEnabModif)
ExeDisableModified() ;
// calcolo i solidi di tutte le travi
bool bOk = pBeamMgr->CalcAllSolids( bShow, bRecalc, ExeProcessEvents) ;
// ripristino possibilità di alterare il flag di modifica
if ( bOldEnabModif)
ExeEnableModified() ;
// risultato
return bOk ;
}
//-----------------------------------------------------------------------------
bool
ExeBeamShowAllSolids( bool bShow)
{
IBeamMgr* pBeamMgr = GetCurrBeamMgr() ;
VERIFY_BEAMMGR( pBeamMgr, false)
// disabilito possibilità di alterare il flag di modifica
bool bOldEnabModif = ExeGetEnableModified() ;
if ( bOldEnabModif)
ExeDisableModified() ;
// aggiorno stato di visualizzazione dei solidi di tutte le travi
bool bOk = pBeamMgr->ShowAllSolids( bShow, ExeProcessEvents) ;
// ripristino possibilità di alterare il flag di modifica
if ( bOldEnabModif)
ExeEnableModified() ;
// risultato
return bOk ;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool bool
ExeBeamCalcSolid( int nPartId, bool bRecalc) ExeBeamCalcSolid( int nPartId, bool bRecalc)
@@ -246,17 +304,17 @@ ExeBeamShowSolid( int nPartId, bool bShow)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool bool
ExeBeamGetBuildingIsOn( void) ExeBeamGetBuildingIsOn( int nAssGrpId)
{ {
IBeamMgr* pBeamMgr = GetCurrBeamMgr() ; IBeamMgr* pBeamMgr = GetCurrBeamMgr() ;
VERIFY_BEAMMGR( pBeamMgr, false) VERIFY_BEAMMGR( pBeamMgr, false)
// verifico se assemblaggio attivato // verifico se assemblaggio attivato
return pBeamMgr->GetBuildingIsOn() ; return pBeamMgr->GetBuildingIsOn( nAssGrpId) ;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool bool
ExeBeamShowBuilding( bool bShow) ExeBeamShowBuilding( int nAssGrpId, bool bShow)
{ {
IBeamMgr* pBeamMgr = GetCurrBeamMgr() ; IBeamMgr* pBeamMgr = GetCurrBeamMgr() ;
VERIFY_BEAMMGR( pBeamMgr, false) VERIFY_BEAMMGR( pBeamMgr, false)
@@ -265,7 +323,7 @@ ExeBeamShowBuilding( bool bShow)
if ( bOldEnabModif) if ( bOldEnabModif)
ExeDisableModified() ; ExeDisableModified() ;
// attivo o disattivo la visualizzazione l'assemblaggio // attivo o disattivo la visualizzazione l'assemblaggio
bool bOk = pBeamMgr->ShowBuilding( bShow) ; bool bOk = pBeamMgr->ShowBuilding( nAssGrpId, bShow) ;
// ripristino possibilità di alterare il flag di modifica // ripristino possibilità di alterare il flag di modifica
if ( bOldEnabModif) if ( bOldEnabModif)
ExeEnableModified() ; ExeEnableModified() ;
+37 -6
View File
@@ -22,6 +22,7 @@
#include "/EgtDev/Include/EXeConst.h" #include "/EgtDev/Include/EXeConst.h"
#include "/EgtDev/Include/EGkCurve.h" #include "/EgtDev/Include/EGkCurve.h"
#include "/EgtDev/Include/EGkCurveComposite.h" #include "/EgtDev/Include/EGkCurveComposite.h"
#include "/EgtDev/Include/EGkStmStandard.h"
#include "/EgtDev/Include/EGkCAvToolSurfTm.h" #include "/EgtDev/Include/EGkCAvToolSurfTm.h"
#include "/EgtDev/Include/EgtNumUtils.h" #include "/EgtDev/Include/EgtNumUtils.h"
#include "/EgtDev/Include/EgtPointerOwner.h" #include "/EgtDev/Include/EgtPointerOwner.h"
@@ -98,6 +99,28 @@ ExeCAvGetToolOutline( int nDestGrpId, bool bApprox)
return nId ; return nId ;
} }
//----------------------------------------------------------------------------
double
ExeCAvToolPosBox( const Point3d& ptP, const Vector3d& vtAx, const BBox3d& b3Box, const Vector3d& vtMove)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// creo la superficie TriMesh
PtrOwner<ISurfTriMesh> pStm( GetSurfTriMeshBox( b3Box.GetDimX(), b3Box.GetDimY(), b3Box.GetDimZ())) ;
if ( IsNull( pStm))
return -1 ;
pStm->Translate( b3Box.GetMin() - ORIG) ;
// verifico oggetto per evitare collisioni
if ( IsNull( s_pCAvTlStm))
return -1 ;
// imposto dati
s_pCAvTlStm->SetSurfTm( *pStm) ;
double dMove ;
if ( ! s_pCAvTlStm->TestPosition( ptP, vtAx, vtMove, dMove))
return -1 ;
return dMove ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
double double
ExeCAvToolPosStm( const Point3d& ptP, const Vector3d& vtAx, int nSurfTmId, const Vector3d& vtMove, int nRefType) ExeCAvToolPosStm( const Point3d& ptP, const Vector3d& vtAx, int nSurfTmId, const Vector3d& vtMove, int nRefType)
@@ -152,16 +175,23 @@ ExeCAvToolPathStm( int nCrvId, const Vector3d& vtAx, int nSurfTmId, const Vector
// verifico oggetto per evitare collisioni // verifico oggetto per evitare collisioni
if ( IsNull( s_pCAvTlStm)) if ( IsNull( s_pCAvTlStm))
return false ; return false ;
// Controllo la tolleranza lineare (se negativa non vanno fatti controlli sui punti medi)
if ( dLinTol > -EPS_ZERO)
dLinTol = max( dLinTol, EPS_SMALL) ;
else
dLinTol = -1 ;
// approssimo la curva con una polilinea // approssimo la curva con una polilinea
PolyLine PL ; PolyLine PL ;
if ( ! pCrv->ApproxWithLines( dLinTol, ANG_TOL_STD_DEG, ICurve::APL_SPECIAL, PL)) if ( ! pCrv->ApproxWithLines( dLinTol, ANG_TOL_STD_DEG, ICurve::APL_SPECIAL, PL))
return false ; return false ;
// eventuale aggiunta di punti per garantire max distanza // eventuale aggiunta di punti per garantire max distanza
const double MIN_DIST = 1. ; if ( dLinTol > 0) {
const double MAX_DIST = 50. ; const double MIN_DIST = 1. ;
double dDist = Clamp( s_pCAvTlStm->GetToolRadius(), MIN_DIST, MAX_DIST) ; const double MAX_DIST = 50. ;
if ( ! PL.AdjustForMaxSegmentLen( dDist)) double dDist = Clamp( s_pCAvTlStm->GetToolRadius(), MIN_DIST, MAX_DIST) ;
return false ; if ( ! PL.AdjustForMaxSegmentLen( dDist))
return false ;
}
// porto nel riferimento della superficie // porto nel riferimento della superficie
PL.LocToLoc( frCrv, frSurf) ; PL.LocToLoc( frCrv, frSurf) ;
// porto i dati geometrici in locale alla superficie // porto i dati geometrici in locale alla superficie
@@ -175,7 +205,8 @@ ExeCAvToolPathStm( int nCrvId, const Vector3d& vtAx, int nSurfTmId, const Vector
// riporto la polilinea nel riferimento della curva // riporto la polilinea nel riferimento della curva
PL.LocToLoc( frSurf, frCrv) ; PL.LocToLoc( frSurf, frCrv) ;
// elimino i punti allineati // elimino i punti allineati
PL.RemoveAlignedPoints( 0.8 * dLinTol) ; if ( dLinTol > 0)
PL.RemoveAlignedPoints( 0.8 * dLinTol) ;
// creo una curva composita a partire dalla polilinea // creo una curva composita a partire dalla polilinea
PtrOwner< ICurveComposite> pCompo( CreateCurveComposite()) ; PtrOwner< ICurveComposite> pCompo( CreateCurveComposite()) ;
if ( IsNull( pCompo) || ! pCompo->FromPolyLine( PL)) if ( IsNull( pCompo) || ! pCompo->FromPolyLine( PL))
+86 -12
View File
@@ -1,9 +1,9 @@
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// EgalTech 2020-2020 // EgalTech 2020-2020
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// File : EXE_CDeObjClosedSurfTm.cpp Data : 09.01.20 Versione : 2.2a2 // File : EXE_CDeObjSolid.cpp Data : 09.01.20 Versione : 2.2a2
// Contenuto : Funzioni per verificare collisioni tra // Contenuto : Funzioni per verificare collisioni tra
// Objects e Closed SurftriMesh. // Objects e Solidi (Closed SurftriMesh e Zmap).
// //
// //
// Modifiche : 09.01.20 DS Creazione modulo. // Modifiche : 09.01.20 DS Creazione modulo.
@@ -25,7 +25,9 @@
#include "/EgtDev/Include/EGkCDeCylClosedSurfTm.h" #include "/EgtDev/Include/EGkCDeCylClosedSurfTm.h"
#include "/EgtDev/Include/EGkCDeConeFrustumClosedSurfTm.h" #include "/EgtDev/Include/EGkCDeConeFrustumClosedSurfTm.h"
#include "/EgtDev/Include/EGkCDeSpheClosedSurfTm.h" #include "/EgtDev/Include/EGkCDeSpheClosedSurfTm.h"
#include "/EgtDev/Include/EGkCDeClosedSurfTmClosedSurfTm.h"
#include "/EgtDev/Include/EGkVolZmap.h" #include "/EgtDev/Include/EGkVolZmap.h"
#include "/EgtDev/Include/EGkSurfLocal.h"
#include "/EgtDev/Include/EGkStringUtils3d.h" #include "/EgtDev/Include/EGkStringUtils3d.h"
using namespace std ; using namespace std ;
@@ -47,7 +49,7 @@ MyCDeBoxClosedSurfTm( const Frame3d& frBox, const Vector3d& vtDiag, int nSurfTmI
// porto in locale alla superficie il riferimento del box (il vettore è già in questo stesso riferimento) // porto in locale alla superficie il riferimento del box (il vettore è già in questo stesso riferimento)
Frame3d frBoxL = GetFrameLocal( pGeomDB, frBox, nRefType, frSurf) ; Frame3d frBoxL = GetFrameLocal( pGeomDB, frBox, nRefType, frSurf) ;
// verifico la collisione // verifico la collisione
return ( CDeBoxClosedSurfTm( frBoxL, vtDiag, dSafeDist, *pStm) ? 1 : 0) ; return ( CDeBoxClosedSurfTm( frBoxL, vtDiag, *pStm, dSafeDist) ? 1 : 0) ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -67,7 +69,7 @@ MyCDeBoxVolZmap( const Frame3d& frBox, const Vector3d& vtDiag, int nZmapId, doub
// porto in locale il riferimento (il vettore è già in locale a questo stesso riferimento) // porto in locale il riferimento (il vettore è già in locale a questo stesso riferimento)
Frame3d frBoxL = GetFrameLocal( pGeomDB, frBox, nRefType, frLoc) ; Frame3d frBoxL = GetFrameLocal( pGeomDB, frBox, nRefType, frLoc) ;
// verifico la collisione // verifico la collisione
return ( pVZM->AvoidBox( frBoxL, vtDiag, dSafeDist) ? 0 : 1) ; return ( pVZM->CDeBox( frBoxL, vtDiag, dSafeDist, false) ? 1 : 0) ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -116,7 +118,7 @@ MyCDeRectPrismoidClosedSurfTm( const Frame3d& frPrismoid, double dBaseLenX, doub
// porto in locale alla superficie il riferimento del prismoide rettangolare // porto in locale alla superficie il riferimento del prismoide rettangolare
Frame3d frPrismoidL = GetFrameLocal( pGeomDB, frPrismoid, nRefType, frSurf) ; Frame3d frPrismoidL = GetFrameLocal( pGeomDB, frPrismoid, nRefType, frSurf) ;
// verifico la collisione // verifico la collisione
return ( CDeRectPrismoidClosedSurfTm( frPrismoidL, dBaseLenX, dBaseLenY, dTopLenX, dTopLenY, dHeight, dSafeDist, *pStm) ? 1 : 0) ; return ( CDeRectPrismoidClosedSurfTm( frPrismoidL, dBaseLenX, dBaseLenY, dTopLenX, dTopLenY, dHeight, *pStm, dSafeDist) ? 1 : 0) ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -138,7 +140,7 @@ MyCDeRectPrismoidVolZmap( const Frame3d& frPrismoid, double dBaseLenX, double dB
// porto in locale il riferimento (il vettore è già in locale a questo stesso riferimento) // porto in locale il riferimento (il vettore è già in locale a questo stesso riferimento)
Frame3d frPrismoidL = GetFrameLocal( pGeomDB, frPrismoid, nRefType, frLoc) ; Frame3d frPrismoidL = GetFrameLocal( pGeomDB, frPrismoid, nRefType, frLoc) ;
// verifico la collisione // verifico la collisione
return ( pVZM->AvoidRectPrismoid( frPrismoidL, dBaseLenX, dBaseLenY, dTopLenX, dTopLenY, dHeight, dSafeDist) ? 0 : 1) ; return ( pVZM->CDeRectPrismoid( frPrismoidL, dBaseLenX, dBaseLenY, dTopLenX, dTopLenY, dHeight, dSafeDist, false) ? 1 : 0) ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -191,7 +193,7 @@ MyCDeCylClosedSurfTm( const Frame3d& frCyl, double dR, double dH, int nSurfTmId,
// porto in locale alla superficie il riferimento del cilindro // porto in locale alla superficie il riferimento del cilindro
Frame3d frCylL = GetFrameLocal( pGeomDB, frCyl, nRefType, frSurf) ; Frame3d frCylL = GetFrameLocal( pGeomDB, frCyl, nRefType, frSurf) ;
// verifico la collisione // verifico la collisione
return ( CDeCylClosedSurfTm( frCylL, dR, dH, dSafeDist, *pStm) ? 1 : 0) ; return ( CDeCylClosedSurfTm( frCylL, dR, dH, *pStm, dSafeDist) ? 1 : 0) ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -211,7 +213,7 @@ MyCDeCylVolZmap( const Frame3d& frCyl, double dR, double dH, int nZmapId, double
// porto in locale il riferimento // porto in locale il riferimento
Frame3d frCylL = GetFrameLocal( pGeomDB, frCyl, nRefType, frLoc) ; Frame3d frCylL = GetFrameLocal( pGeomDB, frCyl, nRefType, frLoc) ;
// verifico la collisione // verifico la collisione
return ( pVZM->AvoidCylinder( frCylL, dR, dH, dSafeDist) ? 0 : 1) ; return ( pVZM->CDeCylinder( frCylL, dR, dH, dSafeDist, false) ? 1 : 0) ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -259,7 +261,7 @@ MyCDeConeClosedSurfTm( const Frame3d& frCone, double dR1, double dR2, double dH,
// porto in locale alla superficie il riferimento del cilindro // porto in locale alla superficie il riferimento del cilindro
Frame3d frConeL = GetFrameLocal( pGeomDB, frCone, nRefType, frSurf) ; Frame3d frConeL = GetFrameLocal( pGeomDB, frCone, nRefType, frSurf) ;
// verifico la collisione // verifico la collisione
return ( CDeConeFrustumClosedSurfTm( frConeL, dR1, dR2, dH, dSafeDist, *pStm) ? 1 : 0) ; return ( CDeConeFrustumClosedSurfTm( frConeL, dR1, dR2, dH, *pStm, dSafeDist) ? 1 : 0) ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -279,7 +281,7 @@ MyCDeConeVolZmap( const Frame3d& frCone, double dR1, double dR2, double dH, int
// porto in locale il riferimento // porto in locale il riferimento
Frame3d frConeL = GetFrameLocal( pGeomDB, frCone, nRefType, frLoc) ; Frame3d frConeL = GetFrameLocal( pGeomDB, frCone, nRefType, frLoc) ;
// verifico la collisione // verifico la collisione
return ( pVZM->AvoidConeFrustum( frConeL, dR1, dR2, dH, dSafeDist) ? 0 : 1) ; return ( pVZM->CDeConeFrustum( frConeL, dR1, dR2, dH, dSafeDist, false) ? 1 : 0) ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -328,7 +330,7 @@ MyCDeSpheClosedSurfTm( const Point3d& ptCen, double dR, int nSurfTmId, double dS
// porto in locale alla superficie il centro della sfera // porto in locale alla superficie il centro della sfera
Point3d ptCenL = GetPointLocal( pGeomDB, ptCen, nRefType, frSurf) ; Point3d ptCenL = GetPointLocal( pGeomDB, ptCen, nRefType, frSurf) ;
// verifico la collisione // verifico la collisione
return ( CDeSpheClosedSurfTm( ptCenL, dR, dSafeDist, *pStm) ? 1 : 0) ; return ( CDeSpheClosedSurfTm( ptCenL, dR, *pStm, dSafeDist) ? 1 : 0) ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -348,7 +350,7 @@ MyCDeSpheVolZmap( const Point3d& ptCen, double dRad, int nZmapId, double dSafeDi
// porto in locale il centro della sfera // porto in locale il centro della sfera
Point3d ptCenL = GetPointLocal( pGeomDB, ptCen, nRefType, frLoc) ; Point3d ptCenL = GetPointLocal( pGeomDB, ptCen, nRefType, frLoc) ;
// verifico la collisione // verifico la collisione
return ( pVZM->AvoidSphere( ptCenL, dRad, dSafeDist) ? 0 : 1) ; return ( pVZM->CDeSphere( ptCenL, dRad, dSafeDist, false) ? 1 : 0) ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -374,3 +376,75 @@ ExeCDeSpheSolid( const Point3d& ptCen, double dR, int nSolidId, double dSafeDist
// restituisco risultato // restituisco risultato
return nRes ; return nRes ;
} }
//----------------------------------------------------------------------------
static int
MyCDeClosedSurfTmClosedSurfTm( int nSurfTm1Id, int nSurfTm2Id, double dSafeDist)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, -1)
// recupero il riferimento della seconda superficie
Frame3d frSurf2 ;
if ( ! pGeomDB->GetGlobFrame( nSurfTm2Id, frSurf2))
return -1 ;
// recupero la prima superficie in locale alla seconda
SurfLocal Surf1Loc( pGeomDB, nSurfTm1Id, frSurf2) ;
const ISurfTriMesh* pStm1 = GetSurfTriMesh( Surf1Loc) ;
if ( pStm1 == nullptr)
return -1 ;
// recupero la seconda superficie TriMesh
const ISurfTriMesh* pStm2 = GetSurfTriMesh( pGeomDB->GetGeoObj( nSurfTm2Id)) ;
if ( pStm2 == nullptr)
return -1 ;
// verifico la collisione
return ( CDeClosedSurfTmClosedSurfTm( *pStm1, *pStm2, dSafeDist) ? 1 : 0) ;
}
//----------------------------------------------------------------------------
static int
MyCDeClosedSurfTmVolZmap( int nSurfTmId, int nZmapId, double dSafeDist)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, -1)
// recupero il riferimento dello Zmap
Frame3d frZmap ;
if ( ! pGeomDB->GetGlobFrame( nZmapId, frZmap))
return -1 ;
// recupero la superficie in locale allo Zmap
SurfLocal SurfLoc( pGeomDB, nSurfTmId, frZmap) ;
const ISurfTriMesh* pStm = GetSurfTriMesh( SurfLoc) ;
if ( pStm == nullptr)
return -1 ;
// recupero lo Zmap
const IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nZmapId)) ;
if ( pVZM == nullptr)
return -1 ;
// verifico la collisione
return ( pVZM->CDeSurfTm( *pStm, dSafeDist, false) ? 1 : 0) ;
}
//----------------------------------------------------------------------------
int
ExeCDeSolidSolid( int nSolid1Id, int nSolid2Id, double dSafeDist)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
int nRes = -1 ;
if ( pGeomDB != nullptr) {
if ( pGeomDB->GetGeoType( nSolid1Id) == SRF_TRIMESH && pGeomDB->GetGeoType( nSolid2Id) == SRF_TRIMESH)
nRes = MyCDeClosedSurfTmClosedSurfTm( nSolid1Id, nSolid2Id, dSafeDist) ;
else if ( pGeomDB->GetGeoType( nSolid1Id) == SRF_TRIMESH && pGeomDB->GetGeoType( nSolid2Id) == VOL_ZMAP)
nRes = MyCDeClosedSurfTmVolZmap( nSolid1Id, nSolid2Id, dSafeDist) ;
else if ( pGeomDB->GetGeoType( nSolid1Id) == VOL_ZMAP && pGeomDB->GetGeoType( nSolid2Id) == SRF_TRIMESH)
nRes = MyCDeClosedSurfTmVolZmap( nSolid2Id, nSolid1Id, dSafeDist) ;
}
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtCDeSolidSolid({" + IdToString( nSolid1Id) + "," +
IdToString( nSolid2Id) + "," +
ToString( dSafeDist) + ")" +
" -- Res=" + ToString( nRes) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultato
return nRes ;
}
+1
View File
@@ -18,6 +18,7 @@
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// Costanti per tolleranze di appossimazione // Costanti per tolleranze di appossimazione
const double LIN_TOL_STD = 0.1 ; const double LIN_TOL_STD = 0.1 ;
const double LIN_TOL_SRF = 0.05 ;
const double LIN_TOL_FINE = 0.01 ; const double LIN_TOL_FINE = 0.01 ;
const double LIN_FEA_STD = 20 ; const double LIN_FEA_STD = 20 ;
const double LIN_FEA_MAX = 400 ; const double LIN_FEA_MAX = 400 ;
+251 -39
View File
@@ -15,24 +15,30 @@
#include "stdafx.h" #include "stdafx.h"
#include "EXE.h" #include "EXE.h"
#include "EXE_Macro.h" #include "EXE_Macro.h"
#include "LUA_Base.h"
#include "AuxTools.h" #include "AuxTools.h"
#include "DllExchange.h" #include "DllExchange.h"
#include "DllExch3dm.h"
#include "/EgtDev/Include/EXeExecutor.h" #include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EXeConst.h" #include "/EgtDev/Include/EXeConst.h"
#include "/EgtDev/Include/EXeCmdLogOff.h" #include "/EgtDev/Include/EXeCmdLogOff.h"
#include "/EgtDev/Include/EExImportDxf.h" #include "/EgtDev/Include/EExImportDxf.h"
#include "/EgtDev/Include/EExImportStl.h" #include "/EgtDev/Include/EExImportStl.h"
#include "/EgtDev/Include/EExImport3MF.h" #include "/EgtDev/Include/EExImport3MF.h"
#include "/EgtDev/Include/EExExportThreeJS.h"
#include "/EgtDev/Include/EExImportCnc.h" #include "/EgtDev/Include/EExImportCnc.h"
#include "/EgtDev/Include/EExImportCsf.h" #include "/EgtDev/Include/EExImportCsf.h"
#include "/EgtDev/Include/EExImportPnt.h" #include "/EgtDev/Include/EExImportPnt.h"
#include "/EgtDev/Include/EExImportBtl.h" #include "/EgtDev/Include/EExImportBtl.h"
#include "/EgtDev/Include/EExImportBtlx.h" #include "/EgtDev/Include/EExImportBtlx.h"
#include "/EgtDev/Include/EExImportOff.h"
#include "/EgtDev/Include/EExImportPly.h"
#include "/EgtDev/Include/EExExportDxf.h" #include "/EgtDev/Include/EExExportDxf.h"
#include "/EgtDev/Include/EExExportStl.h" #include "/EgtDev/Include/EExExportStl.h"
#include "/EgtDev/Include/EExExport3MF.h" #include "/EgtDev/Include/EExExport3MF.h"
#include "/EgtDev/Include/EExExportSvg.h" #include "/EgtDev/Include/EExExportSvg.h"
#include "/EgtDev/Include/EExExportThreeJS.h"
#include "/EgtDev/Include/EE3Import3dm.h"
#include "/EgtDev/Include/EE3Export3dm.h"
#include "/EgtDev/Include/EGnStringUtils.h" #include "/EgtDev/Include/EGnStringUtils.h"
#include "/EgtDev/Include/EGnFileUtils.h" #include "/EgtDev/Include/EGnFileUtils.h"
#include "/EgtDev/Include/EgtStringConverter.h" #include "/EgtDev/Include/EgtStringConverter.h"
@@ -60,7 +66,7 @@ ExeGetFileType( const string& sFilePath)
SplitLast( sFileName, ".", sFileTitle, sFileExt) ; SplitLast( sFileName, ".", sFileTitle, sFileExt) ;
ToUpper( sFileExt) ; ToUpper( sFileExt) ;
if ( sFileExt == "NGE" || sFileExt == "VME" || sFileExt == "NHE" || sFileExt == "BWE") if ( sFileExt == "NGE" || sFileExt == "VME" || sFileExt == "NHE" || sFileExt == "BWE" || sFileExt == "ICRS")
return FT_NGE ; return FT_NGE ;
else if ( sFileExt == "NFE") else if ( sFileExt == "NFE")
return FT_NFE ; return FT_NFE ;
@@ -70,8 +76,14 @@ ExeGetFileType( const string& sFilePath)
return FT_STL ; return FT_STL ;
else if ( sFileExt == "3MF") else if ( sFileExt == "3MF")
return FT_3MF ; return FT_3MF ;
else if ( sFileExt == "3DM")
return FT_3DM ;
else if ( sFileExt == "OBJ") else if ( sFileExt == "OBJ")
return FT_OBJ ; return FT_OBJ ;
else if ( sFileExt == "OFF")
return FT_OFF ;
else if ( sFileExt == "PLY")
return FT_PLY ;
else if ( sFileExt == "CNC" || sFileExt == "XPI" || sFileExt == "MPF" || sFileExt == "ISO" || sFileExt == "EIA") else if ( sFileExt == "CNC" || sFileExt == "XPI" || sFileExt == "MPF" || sFileExt == "ISO" || sFileExt == "EIA")
return FT_CNC ; return FT_CNC ;
else if ( sFileExt == "HED" || sFileExt == "ENT" || sFileExt == "ENS") else if ( sFileExt == "HED" || sFileExt == "ENT" || sFileExt == "ENS")
@@ -100,6 +112,8 @@ ExeGetFileType( const string& sFilePath)
return FT_VRML ; return FT_VRML ;
else if ( sFileExt == "C3D") else if ( sFileExt == "C3D")
return FT_C3D ; return FT_C3D ;
else if ( sFileExt == "HTML")
return FT_HTML ;
else if ( sFileExt == "TSC") else if ( sFileExt == "TSC")
return FT_TSC ; return FT_TSC ;
else if ( sFileExt == "LUA") else if ( sFileExt == "LUA")
@@ -116,17 +130,11 @@ ExeGetFileType( const string& sFilePath)
bool bool
ExeSetBtlAuxDir( const string& sBtlAuxDir) ExeSetBtlAuxDir( const string& sBtlAuxDir)
{ {
return MySetBtlAuxDir( sBtlAuxDir) ; bool bOk1 = MySetBtlAuxDir( sBtlAuxDir) ;
bool bOk2 = MySetBtlLuaData( LuaGetLuaLibsDir(), LuaGetLastRequire()) ;
return ( bOk1 && bOk2) ;
} }
//-----------------------------------------------------------------------------
bool
ExeSetThreeJSAuxDir( const string & sThreeJSAuxDir )
{
return MySetThreeJSAuxDir( sThreeJSAuxDir) ;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool bool
ExeImportBtl( const string& sFilePath, int nFlag) ExeImportBtl( const string& sFilePath, int nFlag)
@@ -151,6 +159,11 @@ ExeImportBtl( const string& sFilePath, int nFlag)
" -- Ok=" + ToString( bOk) ; " -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
// scrivo il log
if ( ! IsNull( pImpBtl)) {
string sLog = "Import File " + sFilePath ;
LOG_INFO( GetLogger(), sLog.c_str()) ;
}
// restituisco il risultato // restituisco il risultato
return bOk ; return bOk ;
} }
@@ -179,6 +192,11 @@ ExeImportBtlx( const string& sFilePath, int nFlag)
" -- Ok=" + ToString( bOk) ; " -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
// scrivo il log
if ( ! IsNull( pImpBtlx)) {
string sLog = "Import File " + sFilePath ;
LOG_INFO( GetLogger(), sLog.c_str()) ;
}
// restituisco il risultato // restituisco il risultato
return bOk ; return bOk ;
} }
@@ -209,6 +227,11 @@ ExeImportCnc( const string& sFilePath, int nFlag)
" -- Ok=" + ToString( bOk) ; " -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
// scrivo il log
if ( ! IsNull( pImpCnc)) {
string sLog = "Import File " + sFilePath ;
LOG_INFO( GetLogger(), sLog.c_str()) ;
}
// restituisco il risultato // restituisco il risultato
return bOk ; return bOk ;
} }
@@ -236,6 +259,11 @@ ExeImportCsf( const string& sFilePath)
" -- Ok=" + ToString( bOk) ; " -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
// scrivo il log
if ( ! IsNull( pImpCsf)) {
string sLog = "Import File " + sFilePath ;
LOG_INFO( GetLogger(), sLog.c_str()) ;
}
// restituisco il risultato // restituisco il risultato
return bOk ; return bOk ;
} }
@@ -266,6 +294,11 @@ ExeImportDxf( const string& sFilePath, double dScaleFactor)
" -- Ok=" + ToString( bOk) ; " -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
// scrivo il log
if ( ! IsNull( pImpDxf)) {
string sLog = "Import File " + sFilePath ;
LOG_INFO( GetLogger(), sLog.c_str()) ;
}
// restituisco il risultato // restituisco il risultato
return bOk ; return bOk ;
} }
@@ -296,6 +329,11 @@ ExeImportPnt( const string& sFilePath, int nFlag)
" -- Ok=" + ToString( bOk) ; " -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
// scrivo il log
if ( ! IsNull( pImpPnt)) {
string sLog = "Import File " + sFilePath ;
LOG_INFO( GetLogger(), sLog.c_str()) ;
}
// restituisco il risultato // restituisco il risultato
return bOk ; return bOk ;
} }
@@ -311,10 +349,10 @@ ExeImportStl( const string& sFilePath, double dScaleFactor)
// aggiungo un gruppo pezzo e un gruppo layer // aggiungo un gruppo pezzo e un gruppo layer
int nPartId = pGseCtx->m_pGeomDB->AddGroup( GDB_ID_NULL, GDB_ID_ROOT, Frame3d()) ; int nPartId = pGseCtx->m_pGeomDB->AddGroup( GDB_ID_NULL, GDB_ID_ROOT, Frame3d()) ;
int nLayerId = pGseCtx->m_pGeomDB->AddGroup( GDB_ID_NULL, nPartId, Frame3d()) ; int nLayerId = pGseCtx->m_pGeomDB->AddGroup( GDB_ID_NULL, nPartId, Frame3d()) ;
// preparo l'importatore // preparo l'importatore
PtrOwner<IImportStl> pImpStl( MyCreateImportStl()) ; PtrOwner<IImportStl> pImpStl( MyCreateImportStl()) ;
bOk = bOk && ! IsNull( pImpStl) ; bOk = bOk && ! IsNull( pImpStl) ;
// eseguo l'importazione // eseguo l'importazione
bOk = bOk && pImpStl->Import( sFilePath, pGseCtx->m_pGeomDB, nLayerId, dScaleFactor) ; bOk = bOk && pImpStl->Import( sFilePath, pGseCtx->m_pGeomDB, nLayerId, dScaleFactor) ;
// aggiorno stato file corrente // aggiorno stato file corrente
if ( pGseCtx->m_sFilePath.empty()) if ( pGseCtx->m_sFilePath.empty())
@@ -327,26 +365,106 @@ ExeImportStl( const string& sFilePath, double dScaleFactor)
" -- Ok=" + ToString( bOk) ; " -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
// scrivo il log
if ( ! IsNull( pImpStl)) {
string sLog = "Import File " + sFilePath ;
LOG_INFO( GetLogger(), sLog.c_str()) ;
}
// restituisco il risultato // restituisco il risultato
return bOk ; return bOk ;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool bool
ExeImport3MF( const string& sFilePath) ExeImportOff( const string& sFilePath, double dScaleFactor)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_GEOMDB( pGseCtx, false)
bool bOk = true ;
// importo il file OFF
// aggiungo un gruppo pezzo e un gruppo layer
int nPartId = pGseCtx->m_pGeomDB->AddGroup( GDB_ID_NULL, GDB_ID_ROOT, Frame3d()) ;
int nLayerId = pGseCtx->m_pGeomDB->AddGroup( GDB_ID_NULL, nPartId, Frame3d()) ;
// preparo l'importatore
PtrOwner<IImportOff> pImpOff( MyCreateImportOff()) ;
bOk = bOk && ! IsNull( pImpOff) ;
// eseguo l'importazione
bOk = bOk && pImpOff->Import( sFilePath, pGseCtx->m_pGeomDB, nLayerId, dScaleFactor) ;
// aggiorno stato file corrente
if ( pGseCtx->m_sFilePath.empty())
pGseCtx->m_sFilePath = sFilePath ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtImportOff('" + StringToLuaString( sFilePath) + "'," +
ToString( dScaleFactor) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// scrivo il log
if ( ! IsNull( pImpOff)) {
string sLog = "Import File " + sFilePath ;
LOG_INFO( GetLogger(), sLog.c_str()) ;
}
// restituisco il risultato
return bOk ;
}
//-----------------------------------------------------------------------------
bool
ExeImportPly( const string& sFilePath, double dScaleFactor)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_GEOMDB( pGseCtx, false)
bool bOk = true ;
// importo il file PLY
// aggiungo un gruppo pezzo e un gruppo layer
int nPartId = pGseCtx->m_pGeomDB->AddGroup( GDB_ID_NULL, GDB_ID_ROOT, Frame3d()) ;
int nLayerId = pGseCtx->m_pGeomDB->AddGroup( GDB_ID_NULL, nPartId, Frame3d()) ;
// preparo l'importatore
PtrOwner<IImportPly> pImpPly( MyCreateImportPly()) ;
bOk = bOk && ! IsNull( pImpPly) ;
// eseguo l'importazione
bOk = bOk && pImpPly->Import( sFilePath, pGseCtx->m_pGeomDB, nLayerId, dScaleFactor) ;
// aggiorno stato file corrente
if ( pGseCtx->m_sFilePath.empty())
pGseCtx->m_sFilePath = sFilePath ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtImportPly('" + StringToLuaString( sFilePath) + "'," +
ToString( dScaleFactor) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// scrivo il log
if ( ! IsNull( pImpPly)) {
string sLog = "Import File " + sFilePath ;
LOG_INFO( GetLogger(), sLog.c_str()) ;
}
// restituisco il risultato
return bOk ;
}
//-----------------------------------------------------------------------------
bool
ExeImport3MF( const string& sFilePath, int nFlag)
{ {
GseContext* pGseCtx = GetCurrGseContext() ; GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_GEOMDB( pGseCtx, false) VERIFY_CTX_GEOMDB( pGseCtx, false)
bool bOk = true ; bool bOk = true ;
// importo il file 3MF // importo il file 3MF
// aggiungo un gruppo pezzo e un gruppo layer int nLayerId = GDB_ID_ROOT ;
int nPartId = pGseCtx->m_pGeomDB->AddGroup( GDB_ID_NULL, GDB_ID_ROOT, Frame3d()) ; // aggiungo un gruppo pezzo e un gruppo layer se non devo conservare la gerarchia del file
int nLayerId = pGseCtx->m_pGeomDB->AddGroup( GDB_ID_NULL, nPartId, Frame3d()) ; if ( ( nFlag & EI3FLAG_KEEP_GROUPS) == 0) {
// preparo l'importatore int nPartId = pGseCtx->m_pGeomDB->AddGroup( GDB_ID_NULL, GDB_ID_ROOT, Frame3d()) ;
nLayerId = pGseCtx->m_pGeomDB->AddGroup( GDB_ID_NULL, nPartId, Frame3d()) ;
}
// preparo l'importatore
PtrOwner<IImport3MF> pImp3MF( MyCreateImport3MF()) ; PtrOwner<IImport3MF> pImp3MF( MyCreateImport3MF()) ;
bOk = bOk && ! IsNull( pImp3MF) ; bOk = bOk && ! IsNull( pImp3MF) ;
// eseguo l'importazione // eseguo l'importazione
bOk = bOk && pImp3MF->Import( sFilePath, pGseCtx->m_pGeomDB, nLayerId) ; bOk = bOk && pImp3MF->Import( sFilePath, pGseCtx->m_pGeomDB, nLayerId, nFlag) ;
// aggiorno stato file corrente // aggiorno stato file corrente
if ( pGseCtx->m_sFilePath.empty()) if ( pGseCtx->m_sFilePath.empty())
pGseCtx->m_sFilePath = sFilePath ; pGseCtx->m_sFilePath = sFilePath ;
@@ -357,6 +475,55 @@ ExeImport3MF( const string& sFilePath)
" -- Ok=" + ToString( bOk) ; " -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
// scrivo il log
if ( ! IsNull( pImp3MF)) {
string sLog = "Import File " + sFilePath ;
LOG_INFO( GetLogger(), sLog.c_str()) ;
}
// restituisco il risultato
return bOk ;
}
//-----------------------------------------------------------------------------
bool
ExeImport3dm( const string& sFilePath)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_GEOMDB( pGseCtx, false)
// se necessario, carico libreria exchange 3dm opzionale
if ( ! IsLoadedExch3dmDll() && LoadExch3dmDll( GetLogger(), ExeGetKey(), ExeGetNetHwKey()))
LOG_INFO( GetLogger(), MyGetEE3Version())
// importo il file 3dm
bool bOk = true ;
// preparo l'importatore
PtrOwner<IImport3dm> pImp3dm( MyCreateImport3dm()) ;
bOk = bOk && ! IsNull( pImp3dm) ;
// eseguo l'importazione
const DimensionStyle& DimSt = pGseCtx->m_dsCurr ;
double dExtLine = DimSt.dExtLineLen ;
double dArrLen = DimSt.dArrowLen ;
double dTextDist = DimSt.dTextDist ;
bool bLenIsMM = ( DimSt.nLenIsMM == 2 ? ExeUiUnitsAreMM() : ( DimSt.nLenIsMM != 0 )) ;
int nDecDig = DimSt.nDecDigit ;
string sFont = DimSt.sFont ;
double dTextHeight = DimSt.dTextHeight ;
bOk = bOk && pImp3dm->Import( sFilePath, pGseCtx->m_pGeomDB, GDB_ID_ROOT,
dTextHeight, dExtLine, dArrLen, dTextDist, bLenIsMM, nDecDig, sFont) ;
// aggiorno stato file corrente
if ( pGseCtx->m_sFilePath.empty())
pGseCtx->m_sFilePath = sFilePath ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtImport3dm('" + StringToLuaString( sFilePath) + "')" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// scrivo il log
if ( ! IsNull( pImp3dm)) {
string sLog = "Import File " + sFilePath ;
LOG_INFO( GetLogger(), sLog.c_str()) ;
}
// restituisco il risultato // restituisco il risultato
return bOk ; return bOk ;
} }
@@ -386,7 +553,7 @@ ExeAdvancedImportIsEnabled( void)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool bool
ExeAdvancedImport( const string& sFilePath, double dToler) ExeAdvancedImport( const string& sFilePath, double dToler, int nFlag)
{ {
GseContext* pGseCtx = GetCurrGseContext() ; GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_GEOMDB( pGseCtx, false) VERIFY_CTX_GEOMDB( pGseCtx, false)
@@ -419,7 +586,8 @@ ExeAdvancedImport( const string& sFilePath, double dToler)
sExec = "EgtConverterR32.exe" ; sExec = "EgtConverterR32.exe" ;
#endif #endif
string sCmdLine = "\"" + sExec + "\" \"" + sFilePath + "\" \"" + sFileOut + "\" \"" + string sCmdLine = "\"" + sExec + "\" \"" + sFilePath + "\" \"" + sFileOut + "\" \"" +
ToString( dToler, 3) + "\" \"" + ToString( ExeGetDebugLevel()) +"\" \"" + ExeGetKey() + "\"" ; ToString( dToler, 3) + "\" \"" + ToString( ExeGetDebugLevel()) + "\" \"" +
ExeGetKey() + "\" \"" + ExeGetLockId() + "\" \"" + ToString( nFlag) + "\"" ;
STARTUPINFO si ; STARTUPINFO si ;
PROCESS_INFORMATION pi ; PROCESS_INFORMATION pi ;
ZeroMemory( &si, sizeof( si)) ; ZeroMemory( &si, sizeof( si)) ;
@@ -453,7 +621,8 @@ ExeAdvancedImport( const string& sFilePath, double dToler)
if ( ExeGetDebugLevel() < 5) if ( ExeGetDebugLevel() < 5)
EraseFile( sFileOut) ; EraseFile( sFileOut) ;
// aggiorno stato file corrente // aggiorno stato file corrente
pGseCtx->m_sFilePath = sFilePath ; if ( pGseCtx->m_sFilePath.empty())
pGseCtx->m_sFilePath = sFilePath ;
ExeSetModified() ; ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente // se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) { if ( IsCmdLog()) {
@@ -462,23 +631,28 @@ ExeAdvancedImport( const string& sFilePath, double dToler)
" -- Ok=" + ToString( bOk) ; " -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
// scrivo il log
{
string sLog = "Advanced Import File " + sFilePath ;
LOG_INFO( GetLogger(), sLog.c_str()) ;
}
// restituisco il risultato // restituisco il risultato
return bOk ; return bOk ;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool bool
ExeExportDxf( int nId, const string& sFilePath, int nFlag) ExeExportDxf( int nId, const string& sFilePath, int nFlag, int nFilter)
{ {
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false) VERIFY_GEOMDB( pGeomDB, false)
bool bOk = true ; bool bOk = true ;
// esporto il file DXF // esporto il file DXF
// preparo l'esportatore // preparo l'esportatore
PtrOwner<IExportDxf> pExpDxf( MyCreateExportDxf()) ; PtrOwner<IExportDxf> pExpDxf( MyCreateExportDxf()) ;
bOk = bOk && ! IsNull( pExpDxf) ; bOk = bOk && ! IsNull( pExpDxf) ;
// eseguo l'esportazione // eseguo l'esportazione
pExpDxf->SetOptions( EEXFLT_DEFAULT, nFlag) ; bOk = bOk && pExpDxf->SetOptions( nFilter, nFlag) ;
bOk = bOk && pExpDxf->Export( pGeomDB, nId, sFilePath) ; bOk = bOk && pExpDxf->Export( pGeomDB, nId, sFilePath) ;
// se richiesto, salvo il comando Lua equivalente // se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) { if ( IsCmdLog()) {
@@ -494,16 +668,17 @@ ExeExportDxf( int nId, const string& sFilePath, int nFlag)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool bool
ExeExportStl( int nId, const string& sFilePath) ExeExportStl( int nId, const string& sFilePath, int nFilter)
{ {
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false) VERIFY_GEOMDB( pGeomDB, false)
bool bOk = true ; bool bOk = true ;
// esporto il file STL // esporto il file STL
// preparo l'esportatore // preparo l'esportatore
PtrOwner<IExportStl> pExpStl( MyCreateExportStl()) ; PtrOwner<IExportStl> pExpStl( MyCreateExportStl()) ;
bOk = bOk && ! IsNull( pExpStl) ; bOk = bOk && ! IsNull( pExpStl) ;
// eseguo l'esportazione // eseguo l'esportazione
bOk = bOk && pExpStl->SetOptions( nFilter) ;
bOk = bOk && pExpStl->Export( pGeomDB, nId, sFilePath) ; bOk = bOk && pExpStl->Export( pGeomDB, nId, sFilePath) ;
// se richiesto, salvo il comando Lua equivalente // se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) { if ( IsCmdLog()) {
@@ -518,16 +693,17 @@ ExeExportStl( int nId, const string& sFilePath)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool bool
ExeExport3MF( int nId, const string& sFilePath) ExeExport3MF( int nId, const string& sFilePath, int nFilter)
{ {
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false) VERIFY_GEOMDB( pGeomDB, false)
bool bOk = true ; bool bOk = true ;
// esporto il file STL // esporto il file 3MF
// preparo l'esportatore // preparo l'esportatore
PtrOwner<IExport3MF> pExp3MF( MyCreateExport3MF()) ; PtrOwner<IExport3MF> pExp3MF( MyCreateExport3MF()) ;
bOk = bOk && ! IsNull( pExp3MF) ; bOk = bOk && ! IsNull( pExp3MF) ;
// eseguo l'esportazione // eseguo l'esportazione
bOk = bOk && pExp3MF->SetOptions( nFilter) ;
bOk = bOk && pExp3MF->Export( pGeomDB, nId, sFilePath) ; bOk = bOk && pExp3MF->Export( pGeomDB, nId, sFilePath) ;
// se richiesto, salvo il comando Lua equivalente // se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) { if ( IsCmdLog()) {
@@ -540,6 +716,34 @@ ExeExport3MF( int nId, const string& sFilePath)
return bOk ; return bOk ;
} }
//-----------------------------------------------------------------------------
bool
ExeExport3dm( int nId, const string& sFilePath, int nFilter)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// se necessario, carico libreria exchange 3dm opzionale
if ( ! IsLoadedExch3dmDll() && LoadExch3dmDll( GetLogger(), ExeGetKey(), ExeGetNetHwKey()))
LOG_INFO( GetLogger(), MyGetEE3Version())
// esporto il file 3dm
bool bOk = true ;
// preparo l'esportatore
PtrOwner<IExport3dm> pExp3dm( MyCreateExport3dm()) ;
bOk = bOk && ! IsNull( pExp3dm) ;
// eseguo l'esportazione
bOk = bOk && pExp3dm->SetOptions( nFilter) ;
bOk = bOk && pExp3dm->Export( pGeomDB, nId, sFilePath) ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtExport3dm(" + ToString( nId) + ",'" +
StringToLuaString( sFilePath) + "')" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco il risultato
return bOk ;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool bool
ExeExportSvg( int nId, const string& sFilePath, int nFilter) ExeExportSvg( int nId, const string& sFilePath, int nFilter)
@@ -547,12 +751,12 @@ ExeExportSvg( int nId, const string& sFilePath, int nFilter)
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false) VERIFY_GEOMDB( pGeomDB, false)
bool bOk = true ; bool bOk = true ;
// esporto il file SVG // esporto il file SVG
// preparo l'esportatore // preparo l'esportatore
PtrOwner<IExportSvg> pExpSvg( MyCreateExportSvg()) ; PtrOwner<IExportSvg> pExpSvg( MyCreateExportSvg()) ;
bOk = bOk && ! IsNull( pExpSvg) ; bOk = bOk && ! IsNull( pExpSvg) ;
// eseguo l'esportazione // eseguo l'esportazione
pExpSvg->SetOptions( nFilter) ; bOk = bOk && pExpSvg->SetOptions( nFilter) ;
bOk = bOk && pExpSvg->Export( pGeomDB, nId, sFilePath) ; bOk = bOk && pExpSvg->Export( pGeomDB, nId, sFilePath) ;
// se richiesto, salvo il comando Lua equivalente // se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) { if ( IsCmdLog()) {
@@ -566,6 +770,13 @@ ExeExportSvg( int nId, const string& sFilePath, int nFilter)
return bOk ; return bOk ;
} }
//-----------------------------------------------------------------------------
bool
ExeSetThreeJSLibDir( const string& sThreeJSLibDir)
{
return MySetThreeJSLibDir( sThreeJSLibDir) ;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool bool
ExeExportThreeJS( int nId, const string& sFilePath, int nFilter) ExeExportThreeJS( int nId, const string& sFilePath, int nFilter)
@@ -582,12 +793,13 @@ ExeExportThreeJS( int nId, const string& sFilePath, int nFilter)
// eseguo l'esportazione // eseguo l'esportazione
bOk = bOk && pExpThreeJS->SetOptions( nFilter) ; bOk = bOk && pExpThreeJS->SetOptions( nFilter) ;
bOk = bOk && pExpThreeJS->Export( pGeomDB, nId, sFilePath, pScene, ExeUiUnitsAreMM()) ; bOk = bOk && pExpThreeJS->Export( pGeomDB, nId, pScene, ExeUiUnitsAreMM(), sFilePath) ;
// se richiesto, salvo il comando Lua equivalente // se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) { if ( IsCmdLog()) {
string sLua = "EgtExportThreeJS(" + ToString( nId) + ",'" + string sLua = "EgtExportThreeJS(" + ToString( nId) + ",'" +
StringToLuaString( sFilePath) + "')" + StringToLuaString( sFilePath) + "'," +
" -- Ok=" + ToString( bOk) ; ToString( nFilter) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
// restituisco il risultato // restituisco il risultato
+530 -42
View File
@@ -26,6 +26,11 @@
#include "/EgtDev/Include/EGkStringUtils3d.h" #include "/EgtDev/Include/EGkStringUtils3d.h"
#include "/EgtDev/Include/EgtStringConverter.h" #include "/EgtDev/Include/EgtStringConverter.h"
#include "/EgtDev/Include/EgtPointerOwner.h" #include "/EgtDev/Include/EgtPointerOwner.h"
#include "/EgtDev/Include/EGkIntersCurves.h"
#include "/EgtDev/Include/EGkCurveLine.h"
#include "/EgtDev/Include/EGkCurveArc.h"
#include "/EgtDev/Include/EGkDistPointCurve.h"
#include "/EgtDev/Include/EGkCurveComposite.h"
using namespace std ; using namespace std ;
@@ -35,11 +40,11 @@ ExeCreateGroup( int nParentId, const Frame3d& frFrame, int nRefType)
{ {
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ; nParentId = AdjustId( nParentId) ;
bool bOk = true ; bool bOk = true ;
// recupero il riferimento locale // recupero il riferimento locale
Frame3d frLoc ; Frame3d frLoc ;
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ; bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc ) ;
// porto in locale l'origine e i versori // porto in locale l'origine e i versori
Point3d ptOrigL = GetPointLocal( pGeomDB, frFrame.Orig(), nRefType, frLoc) ; Point3d ptOrigL = GetPointLocal( pGeomDB, frFrame.Orig(), nRefType, frLoc) ;
Vector3d vtXL = GetVectorLocal( pGeomDB, frFrame.VersX(), nRefType, frLoc) ; Vector3d vtXL = GetVectorLocal( pGeomDB, frFrame.VersX(), nRefType, frLoc) ;
@@ -73,7 +78,7 @@ ExeCreateGroup( int nParentId, const Frame3d& frFrame, int nRefType)
" -- Id=" + ToString( nId) ; " -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
// restituisco l'identificativo del nuovo gruppo // restituisco l'identificativo del nuovo gruppo
return nId ; return nId ;
} }
@@ -83,7 +88,7 @@ ExeCreateGeoPoint( int nParentId, const Point3d& ptP, int nRefType)
{ {
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ; nParentId = AdjustId( nParentId) ;
bool bOk = true ; bool bOk = true ;
// recupero il riferimento locale // recupero il riferimento locale
Frame3d frLoc ; Frame3d frLoc ;
@@ -92,9 +97,9 @@ ExeCreateGeoPoint( int nParentId, const Point3d& ptP, int nRefType)
Point3d ptPL = GetPointLocal( pGeomDB, ptP, nRefType, frLoc) ; Point3d ptPL = GetPointLocal( pGeomDB, ptP, nRefType, frLoc) ;
// creo il punto // creo il punto
PtrOwner<IGeoPoint3d> pGeoPnt( CreateGeoPoint3d()) ; PtrOwner<IGeoPoint3d> pGeoPnt( CreateGeoPoint3d()) ;
bOk = bOk && ! IsNull( pGeoPnt) ; bOk = bOk && !IsNull( pGeoPnt) ;
// setto il punto // setto il punto
bOk = bOk && pGeoPnt->Set( ptPL) ; bOk = bOk && pGeoPnt->Set( ptPL) ;
// inserisco il punto nel DB // inserisco il punto nel DB
int nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pGeoPnt)) : GDB_ID_NULL) ; int nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pGeoPnt)) : GDB_ID_NULL) ;
ExeSetModified() ; ExeSetModified() ;
@@ -106,7 +111,7 @@ ExeCreateGeoPoint( int nParentId, const Point3d& ptP, int nRefType)
" -- Id=" + ToString( nId) ; " -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
// restituisco l'identificativo della nuova entità // restituisco l'identificativo della nuova entit
return nId ; return nId ;
} }
@@ -116,7 +121,7 @@ ExeCreateGeoVector( int nParentId, const Vector3d& vtV, const Point3d& ptB, int
{ {
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ; nParentId = AdjustId( nParentId) ;
bool bOk = true ; bool bOk = true ;
// recupero il riferimento locale // recupero il riferimento locale
Frame3d frLoc ; Frame3d frLoc ;
@@ -128,7 +133,7 @@ ExeCreateGeoVector( int nParentId, const Vector3d& vtV, const Point3d& ptB, int
PtrOwner<IGeoVector3d> pGeoVct( CreateGeoVector3d()) ; PtrOwner<IGeoVector3d> pGeoVct( CreateGeoVector3d()) ;
bOk = bOk && ! IsNull( pGeoVct) ; bOk = bOk && ! IsNull( pGeoVct) ;
// setto il vettore (con il punto base) // setto il vettore (con il punto base)
bOk = bOk && pGeoVct->Set( vtVL, ptBL) ; bOk = bOk && pGeoVct->Set( vtVL, ptBL) ;
// inserisco il vettore nel DB // inserisco il vettore nel DB
int nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pGeoVct)) : GDB_ID_NULL) ; int nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pGeoVct)) : GDB_ID_NULL) ;
ExeSetModified() ; ExeSetModified() ;
@@ -148,7 +153,7 @@ ExeCreateGeoVector( int nParentId, const Vector3d& vtV, const Point3d& ptB, int
" -- Id=" + ToString( nId) ; " -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
// restituisco l'identificativo della nuova entità // restituisco l'identificativo della nuova entit
return nId ; return nId ;
} }
@@ -158,11 +163,11 @@ ExeCreateGeoFrame( int nParentId, const Frame3d& frFrame, int nRefType)
{ {
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ; nParentId = AdjustId( nParentId) ;
bool bOk = true ; bool bOk = true ;
// recupero il riferimento locale // recupero il riferimento locale
Frame3d frLoc ; Frame3d frLoc ;
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ; bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc ) ;
// porto in locale l'origine e i versori // porto in locale l'origine e i versori
Point3d ptOrigL = GetPointLocal( pGeomDB, frFrame.Orig(), nRefType, frLoc) ; Point3d ptOrigL = GetPointLocal( pGeomDB, frFrame.Orig(), nRefType, frLoc) ;
Vector3d vtXL = GetVectorLocal( pGeomDB, frFrame.VersX(), nRefType, frLoc) ; Vector3d vtXL = GetVectorLocal( pGeomDB, frFrame.VersX(), nRefType, frLoc) ;
@@ -170,8 +175,8 @@ ExeCreateGeoFrame( int nParentId, const Frame3d& frFrame, int nRefType)
Vector3d vtZL = GetVectorLocal( pGeomDB, frFrame.VersZ(), nRefType, frLoc) ; Vector3d vtZL = GetVectorLocal( pGeomDB, frFrame.VersZ(), nRefType, frLoc) ;
// creo e setto il riferimento // creo e setto il riferimento
PtrOwner<IGeoFrame3d> pGeoFrm( CreateGeoFrame3d()) ; PtrOwner<IGeoFrame3d> pGeoFrm( CreateGeoFrame3d()) ;
bOk = bOk && ! IsNull( pGeoFrm) ; bOk = bOk && !IsNull( pGeoFrm) ;
bOk = bOk && pGeoFrm->Set( ptOrigL, vtXL, vtYL, vtZL) ; bOk = bOk && pGeoFrm->Set( ptOrigL, vtXL, vtYL, vtZL) ;
// inserisco il riferimento nel DB // inserisco il riferimento nel DB
int nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pGeoFrm)) : GDB_ID_NULL) ; int nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pGeoFrm)) : GDB_ID_NULL) ;
ExeSetModified() ; ExeSetModified() ;
@@ -183,7 +188,7 @@ ExeCreateGeoFrame( int nParentId, const Frame3d& frFrame, int nRefType)
ToString( frFrame.VersY()) + "},{" + ToString( frFrame.VersY()) + "},{" +
ToString( frFrame.VersZ()) + "}}," + ToString( frFrame.VersZ()) + "}}," +
RefTypeToString( nRefType) + ")" + RefTypeToString( nRefType) + ")" +
" -- Id=" + ToString( nId) ; " -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
// restituisco l'identificativo del nuovo gruppo // restituisco l'identificativo del nuovo gruppo
@@ -197,7 +202,7 @@ ExeCreateText( int nParentId, const Point3d& ptP,
{ {
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ; nParentId = AdjustId( nParentId) ;
bool bOk = true ; bool bOk = true ;
// recupero il riferimento locale // recupero il riferimento locale
Frame3d frLoc ; Frame3d frLoc ;
@@ -208,7 +213,7 @@ ExeCreateText( int nParentId, const Point3d& ptP,
Vector3d vtDL = GetVectorLocal( pGeomDB, X_AX, nRefType, frLoc) ; Vector3d vtDL = GetVectorLocal( pGeomDB, X_AX, nRefType, frLoc) ;
// creo il testo e lo riempio // creo il testo e lo riempio
PtrOwner<IExtText> pTXT( CreateExtText()) ; PtrOwner<IExtText> pTXT( CreateExtText()) ;
bOk = bOk && ! IsNull( pTXT) ; bOk = bOk && !IsNull( pTXT) ;
bOk = bOk && pTXT->Set( ptPL, vtNL, vtDL, sText, "", false, dH) ; bOk = bOk && pTXT->Set( ptPL, vtNL, vtDL, sText, "", false, dH) ;
// inserisco il testo nel DB // inserisco il testo nel DB
int nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pTXT)) : GDB_ID_NULL) ; int nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pTXT)) : GDB_ID_NULL) ;
@@ -234,7 +239,7 @@ ExeCreateTextEx( int nParentId, const Point3d& ptP, double dAngRotDeg,
{ {
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ; nParentId = AdjustId( nParentId) ;
bool bOk = true ; bool bOk = true ;
// recupero il riferimento locale // recupero il riferimento locale
Frame3d frLoc ; Frame3d frLoc ;
@@ -242,10 +247,10 @@ ExeCreateTextEx( int nParentId, const Point3d& ptP, double dAngRotDeg,
// porto in locale l'origine e i versori // porto in locale l'origine e i versori
Point3d ptPL = GetPointLocal( pGeomDB, ptP, nRefType, frLoc) ; Point3d ptPL = GetPointLocal( pGeomDB, ptP, nRefType, frLoc) ;
Vector3d vtNL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ; Vector3d vtNL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ;
Vector3d vtDL = GetVectorLocal( pGeomDB, FromPolar(1, dAngRotDeg), nRefType, frLoc) ; Vector3d vtDL = GetVectorLocal( pGeomDB, FromPolar( 1, dAngRotDeg), nRefType, frLoc) ;
// creo il testo e lo riempio // creo il testo e lo riempio
PtrOwner<IExtText> pTXT( CreateExtText()) ; PtrOwner<IExtText> pTXT( CreateExtText()) ;
bOk = bOk && ! IsNull( pTXT) ; bOk = bOk && !IsNull( pTXT) ;
bOk = bOk && pTXT->Set( ptPL, vtNL, vtDL, sText, sFont, bItalic, dH) ; bOk = bOk && pTXT->Set( ptPL, vtNL, vtDL, sText, sFont, bItalic, dH) ;
// inserisco il testo nel DB // inserisco il testo nel DB
int nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pTXT)) : GDB_ID_NULL) ; int nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pTXT)) : GDB_ID_NULL) ;
@@ -263,7 +268,7 @@ ExeCreateTextEx( int nParentId, const Point3d& ptP, double dAngRotDeg,
" -- Id=" + ToString( nId) ; " -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
// restituisco l'identificativo del oggetto // restituisco l'identificativo del oggetto
return nId ; return nId ;
} }
@@ -275,7 +280,7 @@ ExeCreateTextAdv( int nParentId, const Point3d& ptP, double dAngRotDeg,
{ {
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ; nParentId = AdjustId( nParentId) ;
bool bOk = true ; bool bOk = true ;
// recupero il riferimento locale // recupero il riferimento locale
Frame3d frLoc ; Frame3d frLoc ;
@@ -283,10 +288,10 @@ ExeCreateTextAdv( int nParentId, const Point3d& ptP, double dAngRotDeg,
// porto in locale l'origine e i versori // porto in locale l'origine e i versori
Point3d ptPL = GetPointLocal( pGeomDB, ptP, nRefType, frLoc) ; Point3d ptPL = GetPointLocal( pGeomDB, ptP, nRefType, frLoc) ;
Vector3d vtNL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ; Vector3d vtNL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ;
Vector3d vtDL = GetVectorLocal( pGeomDB, FromPolar(1, dAngRotDeg), nRefType, frLoc) ; Vector3d vtDL = GetVectorLocal( pGeomDB, FromPolar( 1, dAngRotDeg), nRefType, frLoc) ;
// creo il testo e lo imposto // creo il testo e lo imposto
PtrOwner<IExtText> pTXT( CreateExtText()) ; PtrOwner<IExtText> pTXT( CreateExtText()) ;
bOk = bOk && ! IsNull( pTXT) ; bOk = bOk && !IsNull( pTXT) ;
bOk = bOk && pTXT->Set( ptPL, vtNL, vtDL, sText, sFont, nW, bItalic, dH, dRat, dAddAdv, nInsPos) ; bOk = bOk && pTXT->Set( ptPL, vtNL, vtDL, sText, sFont, nW, bItalic, dH, dRat, dAddAdv, nInsPos) ;
// inserisco il testo nel DB // inserisco il testo nel DB
int nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pTXT)) : GDB_ID_NULL) ; int nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pTXT)) : GDB_ID_NULL) ;
@@ -315,12 +320,12 @@ ExeCreateTextAdv( int nParentId, const Point3d& ptP, double dAngRotDeg,
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
bool bool
ExeSetCurrDimensionStyle( double dExtLineLen, double dArrowLen, double dTextDist, ExeSetCurrDimensionStyle( double dExtLineLen, double dArrowLen, double dTextDist,
int nLenIsMM, int nDecDigit, const string& sFont, double dTextHeight) int nLenIsMM, int nDecDigit, const string& sFont, double dTextHeight)
{ {
GseContext* pGseCtx = GetCurrGseContext() ; GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX( pGseCtx, false) VERIFY_CTX( pGseCtx, false)
// aggiorno lo stile di quotatura corrente // aggiorno lo stile di quotatura corrente
pGseCtx->m_dsCurr.Set( dExtLineLen, dArrowLen, dTextDist, nLenIsMM, nDecDigit, sFont, dTextHeight) ; pGseCtx->m_dsCurr.Set( dExtLineLen, dArrowLen, dTextDist, nLenIsMM, nDecDigit, sFont, dTextHeight) ;
return true ; return true ;
} }
@@ -330,8 +335,8 @@ ExeResetCurrDimensionStyle( void)
{ {
GseContext* pGseCtx = GetCurrGseContext() ; GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX( pGseCtx, false) VERIFY_CTX( pGseCtx, false)
// aggiorno lo stile di quotatura corrente // aggiorno lo stile di quotatura corrente
pGseCtx->m_dsCurr.Reset() ; pGseCtx->m_dsCurr.Reset() ;
return true ; return true ;
} }
@@ -341,16 +346,16 @@ MySetDimensionStyle( IExtDimension* pDim)
{ {
GseContext* pGseCtx = GetCurrGseContext() ; GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX( pGseCtx, false) VERIFY_CTX( pGseCtx, false)
// verifico validità quotatura // verifico validit quotatura
if ( pDim == nullptr) if ( pDim == nullptr)
return false ; return false ;
// recupero lo stile di quotatura // recupero lo stile di quotatura
const DimensionStyle& DimSt = pGseCtx->m_dsCurr ; const DimensionStyle& DimSt = pGseCtx->m_dsCurr ;
// recupero l'unità di misura lineare per la quotatura // recupero l'unit di misura lineare per la quotatura
bool bLenIsMM = ( DimSt.nLenIsMM == 2 ? ExeUiUnitsAreMM() : ( DimSt.nLenIsMM != 0)) ; bool bLenIsMM = ( DimSt.nLenIsMM == 2 ? ExeUiUnitsAreMM() : ( DimSt.nLenIsMM != 0 )) ;
// imposto lo stile // imposto lo stile
return pDim->SetStyle( DimSt.dExtLineLen, DimSt.dArrowLen, DimSt.dTextDist, return pDim->SetStyle( DimSt.dExtLineLen, DimSt.dArrowLen, DimSt.dTextDist,
bLenIsMM, DimSt.nDecDigit, DimSt.sFont, DimSt.dTextHeight) ; bLenIsMM, DimSt.nDecDigit, DimSt.sFont, DimSt.dTextHeight) ;
} }
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
@@ -360,10 +365,10 @@ MyCreateLinearDimension( int nParentId, const Point3d& ptP1, const Point3d& ptP2
{ {
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ; nParentId = AdjustId( nParentId) ;
// recupero il riferimento locale // recupero il riferimento locale
Frame3d frLoc ; Frame3d frLoc ;
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc)) if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc ))
return GDB_ID_NULL ; return GDB_ID_NULL ;
// porto in locale i punti e assegno i versori // porto in locale i punti e assegno i versori
Point3d ptP1L = GetPointLocal( pGeomDB, ptP1, nRefType, frLoc) ; Point3d ptP1L = GetPointLocal( pGeomDB, ptP1, nRefType, frLoc) ;
@@ -373,9 +378,9 @@ MyCreateLinearDimension( int nParentId, const Point3d& ptP1, const Point3d& ptP2
Vector3d vtDL = GetVectorLocal( pGeomDB, vtDir, nRefType, frLoc) ; Vector3d vtDL = GetVectorLocal( pGeomDB, vtDir, nRefType, frLoc) ;
// creo la quota // creo la quota
PtrOwner<IExtDimension> pDim( CreateExtDimension()) ; PtrOwner<IExtDimension> pDim( CreateExtDimension()) ;
if ( IsNull( pDim) || if ( IsNull( pDim ) ||
! MySetDimensionStyle( pDim) || ! MySetDimensionStyle( pDim ) ||
! pDim->SetLinear( ptP1L, ptP2L, ptDimL, vtNL, vtDL, sText)) ! pDim->SetLinear( ptP1L, ptP2L, ptDimL, vtNL, vtDL, sText ))
return GDB_ID_NULL ; return GDB_ID_NULL ;
// inserisco la quota nel DB // inserisco la quota nel DB
return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pDim)) ; return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pDim)) ;
@@ -414,7 +419,7 @@ ExeCreateVerticalDimension( int nParentId, const Point3d& ptP1, const Point3d& p
ExeSetModified() ; ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente // se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) { if ( IsCmdLog()) {
string sLua = "EgtVerticalDimension(" + IdToString( nParentId) + ",{" + string sLua = "EgtVerticalDimension(" + IdToString( nParentId ) + ",{" +
ToString( ptP1) + "},{" + ToString( ptP1) + "},{" +
ToString( ptP2) + "},{" + ToString( ptP2) + "},{" +
ToString( ptDim) + "},'" + ToString( ptDim) + "},'" +
@@ -449,3 +454,486 @@ ExeCreateAlignedDimension( int nParentId, const Point3d& ptP1, const Point3d& pt
// restituisco l'identificativo del oggetto // restituisco l'identificativo del oggetto
return nId ; return nId ;
} }
//-------------------------------------------------------------------------------
static int
MyCreateRadialDimension( int nParentId, int nCrvId, const Point3d& ptDim,
const string& sText, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
// recupero il riferimento locale
Frame3d frLoc ;
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
return GDB_ID_NULL ;
// recupero l'arco di circonferenza e il suo frame
ICurveArc* pArc = GetCurveArc( pGeomDB->GetGeoObj( nCrvId)) ;
if ( pArc == nullptr)
return GDB_ID_NULL ;
Frame3d frArc ;
if ( ! pGeomDB->GetGlobFrame( nCrvId, frArc))
return GDB_ID_NULL ;
// porto il punto nel riferimento locale
Point3d ptDimL = GetPointLocal( pGeomDB, ptDim, nRefType, frLoc) ;
// recupero il centro e la normale e li porto nel riferimento locale
Point3d ptCenL = pArc->GetCenter() ;
ptCenL.LocToLoc( frArc, frLoc) ;
Vector3d vtNL = pArc->GetNormVersor() ;
vtNL.LocToLoc( frArc, frLoc) ;
// porto ptDimL sulla circonferenza cui appartiene l'arco
Vector3d vtDir = ptDimL - ptCenL ;
if ( ! vtDir.Normalize())
return GDB_ID_NULL ;
ptDimL = ptCenL + pArc->GetRadius() * vtDir ;
// creo la quota
PtrOwner<IExtDimension> pDim( CreateExtDimension()) ;
if ( IsNull( pDim) ||
! MySetDimensionStyle( pDim) ||
! pDim->SetRadial( ptCenL, ptDimL, vtNL, sText))
return GDB_ID_NULL ;
// inserisco la quota nel DB
return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pDim)) ;
}
//-------------------------------------------------------------------------------
int
ExeCreateRadialDimension( int nParentId, int nCrvId, const Point3d& ptDim,
const string& sText, int nRefType)
{
// eseguo
int nId = MyCreateRadialDimension( nParentId, nCrvId, ptDim, sText, nRefType) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtRadialDimension(" + IdToString( nParentId) + "," +
IdToString( nCrvId) + ",{" +
ToString( ptDim) + "},'" +
StringToLuaString( sText) + "'," +
RefTypeToString( nRefType) + ")" +
" -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo del oggetto
return nId ;
}
//-------------------------------------------------------------------------------
static int
MyCreateDiametralDimension( int nParentId, int nCrvId, const Point3d& ptDim,
const string& sText, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
// recupero il riferimento locale
Frame3d frLoc ;
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
return GDB_ID_NULL ;
// recupero l'arco e il suo frame
ICurveArc* pArc = GetCurveArc( pGeomDB->GetGeoObj( nCrvId)) ;
if ( pArc == nullptr)
return GDB_ID_NULL ;
Frame3d frArc ;
if ( ! pGeomDB->GetGlobFrame( nCrvId, frArc))
return GDB_ID_NULL ;
// porto il punto nel riferimento locale
Point3d ptDimL = GetPointLocal( pGeomDB, ptDim, nRefType, frLoc) ;
// recupero il centro e la normale e li porto nel riferimento locale
Point3d ptCenL = pArc->GetCenter() ;
ptCenL.LocToLoc( frArc, frLoc) ;
Vector3d vtNL = pArc->GetNormVersor() ;
vtNL.LocToLoc( frArc, frLoc) ;
// porto ptDimL sulla circonferenza
Vector3d vtDir = ptDimL - ptCenL ;
if ( ! vtDir.Normalize())
return GDB_ID_NULL ;
ptDimL = ptCenL + pArc->GetRadius() * vtDir ;
// creo la quota
PtrOwner<IExtDimension> pDim( CreateExtDimension()) ;
if ( IsNull( pDim) ||
! MySetDimensionStyle( pDim) ||
! pDim->SetDiametral( ptCenL, ptDimL, vtNL, sText))
return GDB_ID_NULL ;
// inserisco la quota nel DB
return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pDim)) ;
}
//-------------------------------------------------------------------------------
int
ExeCreateDiametralDimension( int nParentId, int nCrvId, const Point3d& ptDim,
const string& sText, int nRefType)
{
// eseguo
int nId = MyCreateDiametralDimension( nParentId, nCrvId, ptDim, sText, nRefType) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtDiametralDimension(" + IdToString( nParentId) + "," +
IdToString( nCrvId) + ",{" +
ToString( ptDim) + "},'" +
StringToLuaString( sText) + "'," +
RefTypeToString( nRefType) + ")" +
" -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo del oggetto
return nId ;
}
//-------------------------------------------------------------------------------
static int
MyCreateAngularDimension( int nParentId, const Point3d& ptV, const Point3d& ptP1, const Point3d& ptP2,
const Point3d& ptDim, const string& sText, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
// recupero il riferimento locale
Frame3d frLoc ;
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
return GDB_ID_NULL ;
// porto in locale i punti e assegno i versori
Point3d ptVL = GetPointLocal( pGeomDB, ptV, nRefType, frLoc) ;
Point3d ptP1L = GetPointLocal( pGeomDB, ptP1, nRefType, frLoc) ;
Point3d ptP2L = GetPointLocal( pGeomDB, ptP2, nRefType, frLoc) ;
Point3d ptDimL = GetPointLocal( pGeomDB, ptDim, nRefType, frLoc) ;
Vector3d vtNL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ;
// creo la quota
PtrOwner<IExtDimension> pDim( CreateExtDimension()) ;
if ( IsNull( pDim) ||
! MySetDimensionStyle( pDim ) ||
! pDim->SetAngular( ptVL, ptP1L, ptP2L, ptDimL, vtNL, sText))
return GDB_ID_NULL ;
// inserisco la quota nel DB
return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pDim)) ;
}
//-------------------------------------------------------------------------------
int
ExeCreateAngularDimension( int nParentId, const Point3d& ptV, const Point3d& ptP1, const Point3d& ptP2,
const Point3d& ptDim, const string& sText, int nRefType)
{
// eseguo
int nId = MyCreateAngularDimension( nParentId, ptV, ptP1, ptP2, ptDim, sText, nRefType) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtAngularDimension(" + IdToString( nParentId) + ",{" +
ToString( ptV) + "},{" +
ToString( ptP1) + "},{" +
ToString( ptP2) + "},{" +
ToString( ptDim) + "},'" +
StringToLuaString( sText) + "'," +
RefTypeToString( nRefType) + ")" +
" -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo del oggetto
return nId ;
}
//-------------------------------------------------------------------------------
static int
MyCreateAngularDimensionEx( int nParentId, const Point3d& ptV1, const Point3d& ptP1,
const Point3d& ptV2,const Point3d& ptP2, const Point3d& ptDim,
const string& sText, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
// recupero il riferimento locale
Frame3d frLoc ;
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
return GDB_ID_NULL ;
// porto in locale i punti e assegno i versori
Point3d ptV1L = GetPointLocal( pGeomDB, ptV1, nRefType, frLoc) ;
Point3d ptP1L = GetPointLocal( pGeomDB, ptP1, nRefType, frLoc) ;
Point3d ptV2L = GetPointLocal( pGeomDB, ptV2, nRefType, frLoc) ;
Point3d ptP2L = GetPointLocal( pGeomDB, ptP2, nRefType, frLoc) ;
Point3d ptDimL = GetPointLocal( pGeomDB, ptDim, nRefType, frLoc) ;
Vector3d vtNL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ;
// creo la quota
PtrOwner<IExtDimension> pDim( CreateExtDimension()) ;
if ( IsNull( pDim) ||
! MySetDimensionStyle( pDim ) ||
! pDim->SetAngularEx( ptV1L, ptP1L, ptV2L, ptP2L, ptDimL, vtNL, sText))
return GDB_ID_NULL ;
// inserisco la quota nel DB
return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pDim)) ;
}
//-------------------------------------------------------------------------------
int
ExeCreateAngularDimensionEx( int nParentId, const Point3d& ptV1, const Point3d& ptP1,
const Point3d& ptV2, const Point3d& ptP2, const Point3d& ptDim,
const string& sText, int nRefType)
{
// eseguo
int nId = MyCreateAngularDimensionEx( nParentId, ptV1, ptP1, ptV2, ptP2, ptDim, sText, nRefType) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtAngularDimensionEx(" + IdToString( nParentId) + ",{" +
ToString( ptV1) + "},{" +
ToString( ptP1) + "},{" +
ToString( ptV2) + "},{" +
ToString( ptP2) + "},{" +
ToString( ptDim) + "},'" +
StringToLuaString( sText) + "'," +
RefTypeToString( nRefType) + ")" +
" -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo del oggetto
return nId ;
}
//-------------------------------------------------------------------------------
static int
MyCreateAngularDimensionFromLines( int nParentId, INTVECTOR vLineIds, const Point3d& ptDim,
const string& sText, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
// recupero il riferimento locale
Frame3d frLoc ;
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
return GDB_ID_NULL ;
// recupero le linee
ICurveLine* pCrv1 = GetCurveLine( pGeomDB->GetGeoObj( vLineIds[0])) ;
ICurveLine* pCrv2 = GetCurveLine( pGeomDB->GetGeoObj( vLineIds[1])) ;
if ( pCrv1 == nullptr || pCrv2 == nullptr)
return GDB_ID_NULL ;
PtrOwner<ICurveLine> pL1( pCrv1->Clone()) ;
PtrOwner<ICurveLine> pL2( pCrv2->Clone()) ;
if ( IsNull( pL1 ) || ! pL1->IsValid() || IsNull( pL2) || ! pL2->IsValid())
return GDB_ID_NULL ;
// porto tutto nel frLoc
Frame3d frL1, frL2 ;
if ( ! pGeomDB->GetGlobFrame( vLineIds[0], frL1) || ! pGeomDB->GetGlobFrame( vLineIds[1], frL2))
return GDB_ID_NULL ;
pL1->LocToLoc( frL1, frLoc) ;
pL2->LocToLoc( frL2, frLoc) ;
// recupero il punto lo porto nel riferimento locale
Point3d ptDimL = GetPointLocal( pGeomDB, ptDim, nRefType, frLoc) ;
// recupero i punti e le direzioni
Point3d ptP1L, ptP2L, ptP3L, ptP4L ;
Vector3d vtL1, vtL2 ;
pL1->GetStartPoint( ptP1L) ;
pL1->GetEndPoint( ptP2L) ;
pL2->GetStartPoint( ptP3L) ;
pL2->GetEndPoint( ptP4L) ;
pL1->GetStartDir( vtL1) ;
pL2->GetStartDir( vtL2) ;
// controllo se le rette sono coincidenti o parallele
if ( AreSameOrOppositeVectorApprox( vtL1, vtL2))
return GDB_ID_NULL ;
// verifico se le rette si intersecano già
Point3d ptCenL ;
IntersCurveCurve pInters( *pL1, *pL2) ;
int nNumeroInters = pInters.GetIntersCount() ;
// se non ho intersezioni estendo
if ( nNumeroInters == 0) {
double dLen = pow( 10, 5) ;
pL1->ExtendStartByLen( dLen) ;
pL2->ExtendStartByLen( dLen) ;
pL1->ExtendEndByLen( dLen) ;
pL2->ExtendEndByLen( dLen) ;
// faccio intersezione
IntersCurveCurve pIntersExt( *pL1, *pL2) ;
nNumeroInters = pIntersExt.GetIntersCount() ;
// le linee estese non si intersecano, quindi vuol dire che sono quasi parallele e lontanissime
if ( nNumeroInters == 0 )
return GDB_ID_NULL ;
else {
IntCrvCrvInfo Info ;
pIntersExt.GetIntCrvCrvInfo( 0, Info) ;
// controllo che non siano coincidenti
if ( Info.bOverlap)
return false ;
else
ptCenL = Info.IciA->ptI ;
}
// seleziono i punti necessari
// se ptDimL è più vicino a ptCenL rispetto agli estremi esterni delle linee, allora tengo gli estremi interni
double dP1Cen = ( ptP1L - ptCenL).Len() ;
double dP2Cen = ( ptP2L - ptCenL).Len() ;
double dDimCen = ( ptDimL - ptCenL).Len() ;
if ( ( dDimCen < dP1Cen || dDimCen < dP2Cen))
// se uno dei due punti è più vicino a ptCenL rispetto a ptDimL, allora tengo il punto più vicino a ptDimL
ptP1L = ( ( ptDimL - ptP1L ).Len() < ( ptDimL - ptP2L ).Len() ? ptP1L : ptP2L) ;
else
ptP1L = ( dP1Cen < dP2Cen ? ptP2L : ptP1L ) ;
// rifaccio anche per l'altro lato
double dP3Cen = ( ptP3L - ptCenL).Len() ;
double dP4Cen = ( ptP4L - ptCenL).Len() ;
if ( dDimCen < dP3Cen || dDimCen < dP4Cen)
ptP3L = ( ( ptDimL - ptP3L).Len() < ( ptDimL - ptP4L).Len() ? ptP3L : ptP4L) ;
else
ptP3L = ( dP3Cen < dP4Cen ? ptP4L : ptP3L) ;
}
// se ho già intesezioni devo capire in quale quadrante si trova ptDim
else {
// recupero l'intersezione
IntCrvCrvInfo Info ;
pInters.GetIntCrvCrvInfo( 0, Info) ;
// controllo che non siano coincidenti
if ( Info.bOverlap)
return false ;
// se non coincidono restituisco l'intersezione
else
ptCenL = Info.IciA->ptI ;
// se le due linee hanno un estremo in comune, estendo le linee da quel lato
if ( ( AreSamePointApprox( ptCenL, ptP1L) || AreSamePointApprox( ptCenL, ptP2L)) &&
( AreSamePointApprox( ptCenL, ptP3L) || AreSamePointApprox( ptCenL, ptP4L))) {
if ( AreSamePointApprox( ptCenL, ptP1L)) {
pL1->ExtendStartByLen(Dist( ptP1L, ptP2L) / 2) ;
pL1->GetStartPoint( ptP1L) ;
}
else {
pL1->ExtendEndByLen(Dist( ptP1L, ptP2L) / 2) ;
pL1->GetEndPoint( ptP2L) ;
}
if ( AreSamePointApprox( ptCenL, ptP3L)) {
pL2->ExtendStartByLen( Dist( ptP3L, ptP4L) / 2);
pL2->GetStartPoint( ptP3L) ;
}
else {
pL2->ExtendEndByLen(Dist( ptP3L, ptP4L) / 2);
pL2->GetEndPoint( ptP4L) ;
}
}
// seleziono i punti necessari
// proietto pdDim su vtLine1 e su vtLine2
Point3d ptDim1, ptDim2 ;
DistPointCurve distPL1( ptDimL, *pL1, true) ;
DistPointCurve distPL2( ptDimL, *pL2, true) ;
int nFlag1, nFlag2 ;
if ( ! distPL1.GetMinDistPoint( 0, ptDim1, nFlag1) || ! distPL2.GetMinDistPoint( 0, ptDim2, nFlag2) )
return false ;
if ( abs(( ptDim1 - ptP1L).Len() + ( ptCenL - ptDim1).Len() - ( ptCenL - ptP1L).Len()) < EPS_SMALL ||
abs(( ptDim1 - ptP1L).Len() + ( ptCenL - ptP1L ).Len() - ( ptDim1 - ptCenL).Len()) < EPS_SMALL)
// ptDim è dal lato di ptP1L, quindi tengo ptP1L
;
else
// ptDim è dal lato di ptP2L
ptP1L = ptP2L ;
if ( abs(( ptDim2 - ptP3L).Len() + ( ptCenL - ptDim2).Len() - ( ptCenL - ptP3L).Len()) < EPS_SMALL ||
abs(( ptDim2 - ptP3L).Len() + ( ptCenL - ptP3L).Len() - ( ptDim2 - ptCenL).Len()) < EPS_SMALL)
// ptDim è dal lato di ptP1L
;
else
// ptDim è dal lato di ptP2L
ptP3L = ptP4L ;
}
// recupero la normale al piano dell'angolo da quotare
Frame3d frArc;
frArc.Set(ptCenL, ptP1L, ptP3L);
Vector3d vtNL = frArc.VersZ() ;
if ( vtNL * Z_AX < - EPS_SMALL) {
frArc.Set(ptCenL, ptP3L, ptP1L);
vtNL = frArc.VersZ() ;
}
// creo la quota
PtrOwner<IExtDimension> pDim( CreateExtDimension()) ;
if ( IsNull( pDim ) ||
! MySetDimensionStyle( pDim ) ||
! pDim->SetAngular( ptP1L, ptCenL, ptP3L, ptDimL, vtNL, sText))
return GDB_ID_NULL ;
// inserisco la quota nel DB
return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pDim)) ;
}
//-------------------------------------------------------------------------------
int
ExeCreateAngularDimensionFromLines( int nParentId, const INTVECTOR vLineIds, const Point3d& ptDim,
const string& sText, int nRefType)
{
// eseguo
int nId = MyCreateAngularDimensionFromLines( nParentId, vLineIds, ptDim, sText, nRefType) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtAngularDimensionFromLines(" + IdToString( nParentId) + "," +
ToString( vLineIds[0]) + "," +
ToString( vLineIds[1]) + ",{" +
ToString( ptDim) + "},'" +
StringToLuaString( sText) + "'," +
RefTypeToString( nRefType) + ")" +
" -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo del oggetto
return nId ;
}
//-------------------------------------------------------------------------------
static int
MyCreateAngularDimensionFromArc( int nParentId, int nCrvId, const Point3d& ptDim,
const string& sText, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
// recupero il riferimento locale
Frame3d frLoc ;
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
return GDB_ID_NULL ;
// recupero l'arco e il suo frame
ICurveArc* pArc = GetCurveArc( pGeomDB->GetGeoObj( nCrvId)) ;
if ( pArc == nullptr)
return GDB_ID_NULL ;
Frame3d frArc ;
if ( ! pGeomDB->GetGlobFrame( nCrvId, frArc))
return GDB_ID_NULL ;
// recupero i punti e la normale e li porto nel frame locale
Point3d ptDimL = GetPointLocal( pGeomDB, ptDim, nRefType, frLoc) ;
Vector3d vtNL = pArc->GetNormVersor() ;
vtNL.LocToLoc( frArc, frLoc) ;
Point3d ptCenL, ptP1L, ptP2L ;
pArc->GetStartPoint( ptP1L) ;
ptP1L.LocToLoc( frArc, frLoc) ;
pArc->GetEndPoint( ptP2L) ;
ptP2L.LocToLoc( frArc, frLoc) ;
pArc->GetCenterPoint( ptCenL) ;
ptCenL.LocToLoc( frArc, frLoc) ;
// porto ptDimL nell'area di influenza dell'arco
Point3d ptMid ;
pArc->GetMidPoint( ptMid) ;
Vector3d vtDir = ( ptMid - ptCenL) ;
if ( ! vtDir.Normalize())
return GDB_ID_NULL ;
ptDimL = ptCenL + Dist( ptDimL, ptCenL) * vtDir ;
// creo la quota
PtrOwner<IExtDimension> pDim( CreateExtDimension()) ;
if ( IsNull( pDim ) ||
! MySetDimensionStyle( pDim) ||
! pDim->SetAngular( ptP1L, ptCenL, ptP2L, ptDimL, vtNL, sText))
return GDB_ID_NULL ;
// inserisco la quota nel DB
return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pDim)) ;
}
//-------------------------------------------------------------------------------
int
ExeCreateAngularDimensionFromArc( int nParentId, int nCrvId, const Point3d& ptDim,
const string& sText, int nRefType)
{
// eseguo
int nId = MyCreateAngularDimensionFromArc( nParentId, nCrvId, ptDim, sText, nRefType) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtAngularDimensionFromArc(" + IdToString( nParentId) + "," +
IdToString( nCrvId) + ",{" +
ToString( ptDim) + "},'" +
StringToLuaString( sText) + "'," +
RefTypeToString( nRefType) + ")" +
" -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo del oggetto
return nId ;
}
+137 -16
View File
@@ -40,11 +40,12 @@
#include "/EgtDev/Include/EGkChainCurves.h" #include "/EgtDev/Include/EGkChainCurves.h"
#include "/EgtDev/Include/EGkCurveByInterp.h" #include "/EgtDev/Include/EGkCurveByInterp.h"
#include "/EgtDev/Include/EGkCurveByApprox.h" #include "/EgtDev/Include/EGkCurveByApprox.h"
#include "/EgtDev/Include/EGkCurveAux.h"
#include "/EgtDev/Include/EGkOffsetCurve.h" #include "/EgtDev/Include/EGkOffsetCurve.h"
#include "/EgtDev/Include/EGkCurveLocal.h"
#include "/EgtDev/Include/EGkSurfTriMesh.h" #include "/EgtDev/Include/EGkSurfTriMesh.h"
#include "/EgtDev/Include/EGkDistPointCurve.h" #include "/EgtDev/Include/EGkDistPointCurve.h"
#include "/EgtDev/Include/EGkStringUtils3d.h" #include "/EgtDev/Include/EGkStringUtils3d.h"
#include "/EgtDev/Include/EGkCurveLocal.h"
#include "/EgtDev/Include/EgtPointerOwner.h" #include "/EgtDev/Include/EgtPointerOwner.h"
using namespace std ; using namespace std ;
@@ -362,16 +363,13 @@ CreateLineTgTwoCurves( IGeomDB* pGeomDB, int nParentId,
if ( pCrv2 == nullptr) if ( pCrv2 == nullptr)
return nullptr ; return nullptr ;
// porto la seconda curva nel riferimento della prima // porto la seconda curva nel riferimento della prima
PtrOwner<ICurve> pCrv2Loc( pCrv2->Clone()) ; CurveLocal Crv2Loc( pGeomDB, nIdF, frCrv1) ;
if ( IsNull( pCrv2Loc))
return nullptr ;
pCrv2Loc->LocToLoc( frCrv2, frCrv1) ;
// porto il punto vicino al finale nel riferimento della prima curva // porto il punto vicino al finale nel riferimento della prima curva
Point3d ptN2loc( ptFin) ; Point3d ptN2loc( ptFin) ;
ptN2loc.LocToLoc( frDest, frCrv1) ; ptN2loc.LocToLoc( frDest, frCrv1) ;
// calcolo la retta tangente alle due curve // calcolo la retta tangente alle due curve
PtrOwner<ICurveLine> pCrvLine ; PtrOwner<ICurveLine> pCrvLine ;
pCrvLine.Set( GetLineTgTwoCurves( *pCrv1, ptN1loc, *pCrv2Loc, ptN2loc)) ; pCrvLine.Set( GetLineTgTwoCurves( *pCrv1, ptN1loc, *Crv2Loc, ptN2loc)) ;
if ( IsNull( pCrvLine)) if ( IsNull( pCrvLine))
return nullptr ; return nullptr ;
// porto la linea nel riferimento del gruppo destinazione // porto la linea nel riferimento del gruppo destinazione
@@ -1091,6 +1089,83 @@ ExeCreateArc3P( int nParentId, const Point3d& ptP1,
return nId ; return nId ;
} }
//-------------------------------------------------------------------------------
int
ExeCreateArc2PR( int nParentId, const Point3d& ptStart, const Point3d& ptEnd,
double dRad, bool bCCW, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
// recupero il riferimento locale
Frame3d frLoc ;
bool bOk = pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
// porto in locale i punti, il versore normale e quelloe estrusione
Point3d ptStartL = GetPointLocal( pGeomDB, ptStart, nRefType, frLoc) ;
Point3d ptEndL = GetPointLocal( pGeomDB, ptEnd, nRefType, frLoc) ;
Vector3d vtNormL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ;
Vector3d vtExtrL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ;
// creo l'arco
PtrOwner<ICurveArc> pCrvArc( CreateCurveArc()) ;
bOk = bOk && ( ! IsNull( pCrvArc) &&
pCrvArc->Set2PNRS( ptStartL, ptEndL, vtNormL, dRad, bCCW)) ;
// assegno il versore estrusione
bOk = bOk && pCrvArc->SetExtrusion( vtExtrL) ;
// inserisco l'arco nel DB
int nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pCrvArc)) : GDB_ID_NULL) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtArc2PR(" + IdToString( nParentId) + ",{" +
ToString( ptStart) + "},{" +
ToString( ptEnd) + "}," +
ToString( dRad) + "," +
RefTypeToString( nRefType) + ")" +
" -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
return nId ;
}
//-------------------------------------------------------------------------------
int
ExeCreateArc2PB( int nParentId, const Point3d& ptStart, const Point3d& ptEnd,
double dBulge, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
// recupero il riferimento locale
Frame3d frLoc ;
bool bOk = pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
// porto in locale i punti, il versore normale e quelloe estrusione
Point3d ptStartL = GetPointLocal( pGeomDB, ptStart, nRefType, frLoc) ;
Point3d ptEndL = GetPointLocal( pGeomDB, ptEnd, nRefType, frLoc) ;
Vector3d vtNormL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ;
Vector3d vtExtrL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ;
// creo l'arco (in casi particolari retta)
PtrOwner<ICurve> pCrv( bOk ? GetArc2PNB( ptStartL, ptEndL, vtNormL, dBulge) : nullptr) ;
bOk = bOk && ! IsNull( pCrv) ;
// assegno il versore estrusione
bOk = bOk && pCrv->SetExtrusion( vtExtrL) ;
// inserisco l'arco nel DB
int nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pCrv)) : GDB_ID_NULL) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtArc2PB(" + IdToString( nParentId) + ",{" +
ToString( ptStart) + "},{" +
ToString( ptEnd) + "}," +
ToString( dBulge) + "," +
RefTypeToString( nRefType) + ")" +
" -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
return nId ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
int int
ExeCreateArc2PD( int nParentId, const Point3d& ptStart, const Point3d& ptEnd, ExeCreateArc2PD( int nParentId, const Point3d& ptStart, const Point3d& ptEnd,
@@ -1099,20 +1174,17 @@ ExeCreateArc2PD( int nParentId, const Point3d& ptStart, const Point3d& ptEnd,
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ; nParentId = AdjustId( nParentId) ;
// creo l'arco (in casi particolari retta)
PtrOwner<ICurve> pCrv ;
bool bOk = true ;
// recupero il riferimento locale // recupero il riferimento locale
Frame3d frLoc ; Frame3d frLoc ;
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ; bool bOk = pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
// porto in locale i punti, il versore iniziale, quello normale e il versore estrusione // porto in locale i punti, il versore iniziale, quello normale e il versore estrusione
Point3d ptStartL = GetPointLocal( pGeomDB, ptStart, nRefType, frLoc) ; Point3d ptStartL = GetPointLocal( pGeomDB, ptStart, nRefType, frLoc) ;
Point3d ptEndL = GetPointLocal( pGeomDB, ptEnd, nRefType, frLoc) ; Point3d ptEndL = GetPointLocal( pGeomDB, ptEnd, nRefType, frLoc) ;
Vector3d vtDirSL = GetVectorLocal( pGeomDB, FromPolar( 1, dDirSDeg), nRefType, frLoc) ; Vector3d vtDirSL = GetVectorLocal( pGeomDB, FromPolar( 1, dDirSDeg), nRefType, frLoc) ;
Vector3d vtNormL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ; Vector3d vtNormL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ;
Vector3d vtExtrL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ; Vector3d vtExtrL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ;
// setto l'arco // creo l'arco (in casi particolari retta)
pCrv.Set( GetArc2PVN( ptStartL, ptEndL, vtDirSL, vtNormL)) ; PtrOwner<ICurve> pCrv( bOk ? GetArc2PVN( ptStartL, ptEndL, vtDirSL, vtNormL) : nullptr) ;
bOk = bOk && ! IsNull( pCrv) ; bOk = bOk && ! IsNull( pCrv) ;
// assegno il versore estrusione // assegno il versore estrusione
bOk = bOk && pCrv->SetExtrusion( vtExtrL) ; bOk = bOk && pCrv->SetExtrusion( vtExtrL) ;
@@ -1593,6 +1665,55 @@ ExeCreateCurveBezierFromArc( int nParentId, int nArcId, bool bErase)
return nId ; return nId ;
} }
//-------------------------------------------------------------------------------
static int
MyCreateCurveBezierFromCurve( int nParentId, int nCrvId, bool bRational)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
// recupero il riferimento della curva
Frame3d frCrv ;
if ( ! pGeomDB->GetGlobFrame( nCrvId, frCrv))
return GDB_ID_NULL ;
// recupero il riferimento di destinazione
Frame3d frLoc ;
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
return GDB_ID_NULL ;
// recupero la curva
const ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nCrvId)) ;
if ( pCurve == nullptr || ! pCurve->IsValid())
return GDB_ID_NULL ;
// recupero il vettore estrusione della curva e lo porto in locale al gruppo destinazione
Vector3d vtExtr ;
pCurve->GetExtrusion( vtExtr) ;
vtExtr.LocToLoc( frCrv, frLoc) ;
PtrOwner<ICurve> pCrvBez ( CurveToBezierCurve( pCurve, bRational)) ;
// setto l'estrusione
pCrvBez->SetExtrusion( vtExtr) ;
// aggiungo la curva in forma di Bezier al DB
int nId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pCrvBez)) ;
return nId ;
}
//-------------------------------------------------------------------------------
int
ExeCreateCurveBezierFromCurve( int nParentId, int nCrvId, bool bRational)
{
// eseguo
int nId = MyCreateCurveBezierFromCurve( nParentId, nCrvId, bRational) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtCurveBezierFromCurve(" + IdToString( nParentId) + "," +
IdToString( nCrvId) + ")"
" -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
return nId ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
int int
MyCreateCurveCompo( int nParentId, const INTVECTOR& vIds, bool bErase) MyCreateCurveCompo( int nParentId, const INTVECTOR& vIds, bool bErase)
@@ -1941,14 +2062,14 @@ ExeCreateCurveCompoByInterpolation( int nParentId, const PolyLine& PL, int nType
nMethod = CurveByInterp::BESSEL ; nMethod = CurveByInterp::BESSEL ;
nCrvType = CurveByInterp::CUBIC_BEZIERS ; nCrvType = CurveByInterp::CUBIC_BEZIERS ;
} }
else if ( nType == ITT_CUBICS_LONG)
nCrvType = CurveByInterp::CUBIC_BEZIERS_LONG ;
// oggetto interpolatore // oggetto interpolatore
CurveByInterp crvByInterp ; CurveByInterp crvByInterp ;
Point3d ptP ; Point3d ptP ;
for ( bool bFound = PL.GetFirstPoint( ptP) ; for ( bool bFound = PL.GetFirstPoint( ptP) ; bFound ; bFound = PL.GetNextPoint( ptP))
bFound ;
bFound = PL.GetNextPoint( ptP))
crvByInterp.AddPoint( ptP) ; crvByInterp.AddPoint( ptP) ;
PtrOwner<ICurve> pCrvCompo( crvByInterp.GetCurve( nMethod, nType)) ; PtrOwner<ICurve> pCrvCompo( crvByInterp.GetCurve( nMethod, nCrvType)) ;
bOk = bOk && ! IsNull( pCrvCompo) ; bOk = bOk && ! IsNull( pCrvCompo) ;
// assegno il versore estrusione // assegno il versore estrusione
bOk = bOk && pCrvCompo->SetExtrusion( Z_AX) ; bOk = bOk && pCrvCompo->SetExtrusion( Z_AX) ;
+1541 -106
View File
File diff suppressed because it is too large Load Diff
+92 -12
View File
@@ -1,4 +1,4 @@
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// EgalTech 2016-2016 // EgalTech 2016-2016
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// File : EXE_GdbCreateVol.cpp Data : 27.10.16 Versione : 1.6v7 // File : EXE_GdbCreateVol.cpp Data : 27.10.16 Versione : 1.6v7
@@ -45,7 +45,16 @@ ExeCreateVolZmap( int nParentId, const Point3d& ptIni, double dDimX, double dDim
// creo lo Zmap nel suo riferimento intrinseco // creo lo Zmap nel suo riferimento intrinseco
PtrOwner<IVolZmap> pVZM( CreateVolZmap()) ; PtrOwner<IVolZmap> pVZM( CreateVolZmap()) ;
bOk = bOk && ! IsNull( pVZM) ; bOk = bOk && ! IsNull( pVZM) ;
bOk = bOk && pVZM->Create( ORIG, dDimX, dDimY, dDimZ, dPrec, bTriDex) ; if ( bOk) {
int nError = 0 ;
bOk = pVZM->Create( ORIG, dDimX, dDimY, dDimZ, dPrec, bTriDex, &nError) ;
if ( ! bOk) {
if ( nError == 1)
ExeOutLog( "EgtVolZmapBox too big for a 32-bit system") ;
else
ExeOutLog( "EgtVolZmapBox error number : " + ToString( nError)) ;
}
}
// lo porto nel riferimento locale // lo porto nel riferimento locale
bOk = bOk && pVZM->ToGlob( frBox) ; bOk = bOk && pVZM->ToGlob( frBox) ;
// inserisco lo Zmap nel DB // inserisco lo Zmap nel DB
@@ -64,7 +73,59 @@ ExeCreateVolZmap( int nParentId, const Point3d& ptIni, double dDimX, double dDim
" -- Id=" + ToString( nNewId) ; " -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
// restituisco l'identificativo della nuova entità // restituisco l'identificativo della nuova entità
return nNewId ;
}
//-------------------------------------------------------------------------------
int ExeCreateVolZmapEmpty( int nParentId, const Point3d& ptIni, double dDimX, double dDimY, double dDimZ,
double dPrec, bool bTriDex, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
// recupero il riferimento locale
Frame3d frLoc ;
bool bOk = pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
// porto in locale i punti
Point3d ptIniL = GetPointLocal( pGeomDB, ptIni, nRefType, frLoc) ;
Point3d ptOnXL = GetPointLocal( pGeomDB, ptIni + X_AX, nRefType, frLoc) ;
Point3d ptOnYL = GetPointLocal( pGeomDB, ptIni + Y_AX, nRefType, frLoc) ;
// ne ricavo un riferimento intrinseco
Frame3d frBox ;
bOk = bOk && frBox.Set( ptIniL, ptOnXL, ptOnYL) ;
// creo lo Zmap nel suo riferimento intrinseco
PtrOwner<IVolZmap> pVZM( CreateVolZmap()) ;
bOk = bOk && ! IsNull( pVZM) ;
if ( bOk) {
int nError = 0 ;
bOk = pVZM->CreateEmpty( ORIG, dDimX, dDimY, dDimZ, dPrec, bTriDex, &nError) ;
if ( ! bOk) {
if ( nError == 1)
ExeOutLog( "EgtVolZmapEmpty too big for a 32-bit system") ;
else
ExeOutLog( "EgtVolZmapEmpty error number : " + ToString( nError)) ;
}
}
// lo porto nel riferimento locale
bOk = bOk && pVZM->ToGlob( frBox) ;
// inserisco lo Zmap nel DB
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pVZM)) : GDB_ID_NULL) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtVolZmapEmpty(" + IdToString( nParentId) + ",{" +
ToString( ptIni) + "}," +
ToString( dDimX) + "," +
ToString( dDimY) + "," +
ToString( dDimZ) + "," +
ToString( dPrec) + "," +
( bTriDex ? "true" : "false") + "," +
RefTypeToString( nRefType) + ")" +
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
return nNewId ; return nNewId ;
} }
@@ -87,7 +148,16 @@ ExeCreateVolZmapByRegionExtrusion( int nParentId, int nSfrId, double dDimZ, doub
// creo lo Zmap nel suo riferimento intrinseco // creo lo Zmap nel suo riferimento intrinseco
PtrOwner<IVolZmap> pVZM( CreateVolZmap()) ; PtrOwner<IVolZmap> pVZM( CreateVolZmap()) ;
bOk = bOk && ! IsNull( pVZM) ; bOk = bOk && ! IsNull( pVZM) ;
bOk = bOk && pVZM->CreateFromFlatRegion( *pSfr, dDimZ, dPrec, bTriDex) ; if ( bOk) {
int nError = 0 ;
bOk = pVZM->CreateFromFlatRegion( *pSfr, dDimZ, dPrec, bTriDex, &nError) ;
if ( ! bOk) {
if ( nError == 1)
ExeOutLog( "EgtVolZmapByRegionExtrusion too big for a 32-bit system") ;
else
ExeOutLog( "EgtVolZmapByRegionExtrusion error number : " + ToString( nError)) ;
}
}
// lo porto nel riferimento di destinazione // lo porto nel riferimento di destinazione
bOk = bOk && pVZM->LocToLoc( frSfr, frDest) ; bOk = bOk && pVZM->LocToLoc( frSfr, frDest) ;
// inserisco lo Zmap nel DB // inserisco lo Zmap nel DB
@@ -103,13 +173,13 @@ ExeCreateVolZmapByRegionExtrusion( int nParentId, int nSfrId, double dDimZ, doub
" -- Id=" + ToString( nNewId) ; " -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
// restituisco l'identificativo della nuova entità // restituisco l'identificativo della nuova entità
return nNewId ; return nNewId ;
} }
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
int int
ExeCreateVolZmapFromSurfTm( int nParentId, int nStmId, double dPrec, bool bTriDex) ExeCreateVolZmapFromSurfTm( int nParentId, int nStmId, double dPrec, bool bTriDex, double dExtraBox)
{ {
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
@@ -126,7 +196,16 @@ ExeCreateVolZmapFromSurfTm( int nParentId, int nStmId, double dPrec, bool bTriDe
// creo lo Zmap nel suo riferimento intrinseco // creo lo Zmap nel suo riferimento intrinseco
PtrOwner<IVolZmap> pVZM( CreateVolZmap()) ; PtrOwner<IVolZmap> pVZM( CreateVolZmap()) ;
bOk = bOk && ! IsNull( pVZM) ; bOk = bOk && ! IsNull( pVZM) ;
bOk = bOk && pVZM->CreateFromTriMesh( *pStm, dPrec, bTriDex) ; if ( bOk) {
int nError = 0 ;
bOk = pVZM->CreateFromTriMesh( *pStm, dPrec, bTriDex, dExtraBox, &nError) ;
if ( ! bOk) {
if ( nError == 1)
ExeOutLog( "EgtVolZmapFromSurfTm too big for a 32-bit system") ;
else
ExeOutLog( "EgtVolZmapFromSurfTm error number : " + ToString( nError)) ;
}
}
// lo porto nel riferimento di destinazione // lo porto nel riferimento di destinazione
bOk = bOk && pVZM->LocToLoc( frStm, frDest) ; bOk = bOk && pVZM->LocToLoc( frStm, frDest) ;
// inserisco lo Zmap nel DB // inserisco lo Zmap nel DB
@@ -134,13 +213,14 @@ ExeCreateVolZmapFromSurfTm( int nParentId, int nStmId, double dPrec, bool bTriDe
ExeSetModified() ; ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente // se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) { if ( IsCmdLog()) {
string sLua = "EgtVolZmapFromTriMesh(" + IdToString( nParentId) + "," + string sLua = "EgtVolZmapFromSurfTm(" + IdToString( nParentId) + "," +
ToString( nStmId) + "," + ToString( nStmId) + "," +
ToString( dPrec) + "," + ToString( dPrec) + "," +
( bTriDex ? "true" : "false") + ")" + ( bTriDex ? "true" : "false") + "," +
ToString( dExtraBox) + ")" +
" -- Id=" + ToString( nNewId) ; " -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
// restituisco l'identificativo della nuova entità // restituisco l'identificativo della nuova entità
return nNewId ; return nNewId ;
} }
+271 -3
View File
@@ -16,17 +16,24 @@
#include "EXE.h" #include "EXE.h"
#include "EXE_Const.h" #include "EXE_Const.h"
#include "EXE_Macro.h" #include "EXE_Macro.h"
#include "AuxTools.h"
#include "GeoTools.h" #include "GeoTools.h"
#include "/EgtDev/Include/EgtNumUtils.h"
#include "/EgtDev/Include/EXeExecutor.h" #include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EXeConst.h" #include "/EgtDev/Include/EXeConst.h"
#include "/EgtDev/Include/EGkGeoPoint3d.h"
#include "/EgtDev/Include/EGkGeoPoint3d.h"
#include "/EgtDev/Include/EGkCurve.h" #include "/EgtDev/Include/EGkCurve.h"
#include "/EgtDev/Include/EGkCurveArc.h" #include "/EgtDev/Include/EGkCurveArc.h"
#include "/EgtDev/Include/EGkCurveBezier.h" #include "/EgtDev/Include/EGkCurveBezier.h"
#include "/EgtDev/Include/EGkCurveComposite.h" #include "/EgtDev/Include/EGkCurveComposite.h"
#include "/EgtDev/Include/EGkCurveAux.h"
#include "/EgtDev/Include/EGkDistPointCurve.h" #include "/EgtDev/Include/EGkDistPointCurve.h"
#include "/EgtDev/Include/EGkIntersCurves.h" #include "/EgtDev/Include/EGkIntersCurves.h"
#include "/EgtDev/Include/EGkSurfFlatRegion.h" #include "/EgtDev/Include/EGkSurfFlatRegion.h"
using namespace std ;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
ExeCurveDomain( int nId, double* pdStart, double* pdEnd) ExeCurveDomain( int nId, double* pdStart, double* pdEnd)
@@ -57,6 +64,21 @@ ExeCurveLength( int nId, double* pdLen)
return ( pCurve != nullptr && pCurve->GetLength( *pdLen)) ; return ( pCurve != nullptr && pCurve->GetLength( *pdLen)) ;
} }
//----------------------------------------------------------------------------
bool
ExeCurveLengthAtParam( int nId, double dPar, double* pdLen)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// verifico il parametro
if ( pdLen == nullptr)
return false ;
// recupero la curva
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
// recupero la lunghezza
return ( pCurve != nullptr && pCurve->GetLengthAtParam( dPar, *pdLen)) ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
ExeCurveParamAtLength( int nId, double dLen, double* pdPar) ExeCurveParamAtLength( int nId, double dLen, double* pdPar)
@@ -160,7 +182,7 @@ ExeCurveIsFlat( int nId, Plane3d& Plane, bool bUseExtrusion, double dToler)
return false ; return false ;
// recupero la curva // recupero la curva
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ; ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
// ne verifico la planarità // ne verifico la planarit
return ( pCurve != nullptr && pCurve->IsFlat( Plane, bUseExtrusion, dToler)) ; return ( pCurve != nullptr && pCurve->IsFlat( Plane, bUseExtrusion, dToler)) ;
} }
@@ -188,6 +210,8 @@ ExeCurveIsACircle( int nId, Point3d& ptCen, Vector3d& vtN, double& dRad, bool& b
bCCW = ( pArc->GetAngCenter() > 0) ; bCCW = ( pArc->GetAngCenter() > 0) ;
return true ; return true ;
} }
else
return false ;
} }
case CRV_COMPO : case CRV_COMPO :
{ ICurveComposite* pCompo = GetCurveComposite( pGObj) ; { ICurveComposite* pCompo = GetCurveComposite( pGObj) ;
@@ -203,6 +227,8 @@ ExeCurveIsACircle( int nId, Point3d& ptCen, Vector3d& vtN, double& dRad, bool& b
return false ; return false ;
return pCompo->IsACircle( dToler, ptCen, vtN, dRad, bCCW) ; return pCompo->IsACircle( dToler, ptCen, vtN, dRad, bCCW) ;
} }
default :
return false ;
} }
return false ; return false ;
@@ -288,7 +314,7 @@ ExeCurveNearestExtremityToPoint( int nId, const Point3d& ptP, bool& bStart)
VERIFY_GEOMDB( pGeomDB, false) VERIFY_GEOMDB( pGeomDB, false)
// recupero la curva // recupero la curva
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ; ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
// recupero quale estremo è più vicino al punto // recupero quale estremo pi vicino al punto
return ( pCurve != nullptr && pCurve->GetNearestExtremityToPoint( ptP, bStart)) ; return ( pCurve != nullptr && pCurve->GetNearestExtremityToPoint( ptP, bStart)) ;
} }
@@ -364,7 +390,7 @@ ExeCurveMinAreaRectangleXY( int nId, int nRefId, Frame3d& frRect, double& dDimX,
PL.LocToLoc( frCrv, pGeomDB->GetGridFrame()) ; PL.LocToLoc( frCrv, pGeomDB->GetGridFrame()) ;
else if ( bOk && nRefId != nId) { else if ( bOk && nRefId != nId) {
Frame3d frDest ; Frame3d frDest ;
// nRefId può essere un gruppo o una entità // nRefId pu essere un gruppo o una entit
if ( pGeomDB->GetGroupGlobFrame( nRefId, frDest) || if ( pGeomDB->GetGroupGlobFrame( nRefId, frDest) ||
pGeomDB->GetGlobFrame( nRefId, frDest)) pGeomDB->GetGlobFrame( nRefId, frDest))
PL.LocToLoc( frCrv, frDest) ; PL.LocToLoc( frCrv, frDest) ;
@@ -548,6 +574,24 @@ ExeArcNormVersor( int nId, int nRefId, Vector3d& vtNorm)
return TransformVector( pGeomDB, nId, nRefId, vtNorm) ; return TransformVector( pGeomDB, nId, nRefId, vtNorm) ;
} }
//----------------------------------------------------------------------------
bool
ExeCurveCompoLength( int nId, int nSimpCrv, double& dLen)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la curva composita
const ICurveComposite* pCompoCrv = GetCurveComposite( pGeomDB->GetGeoObj( nId)) ;
if ( pCompoCrv == nullptr)
return false ;
// recupero la curva semplice di indice richiesto
const ICurve* pSimpCrv = pCompoCrv->GetCurve( nSimpCrv) ;
if ( pSimpCrv == nullptr)
return false ;
// recupero la sua lunghezza
return pSimpCrv->GetLength( dLen) ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
ExeCurveCompoCenter( int nId, int nSimpCrv, int nRefId, Point3d& ptCen) ExeCurveCompoCenter( int nId, int nSimpCrv, int nRefId, Point3d& ptCen)
@@ -594,6 +638,9 @@ ExeCurveCompoRadius( int nId, int nSimpCrv, double& dRad)
case CRV_BEZIER : case CRV_BEZIER :
dRad = -2 ; dRad = -2 ;
break ; break ;
default :
dRad = -3 ;
break ;
} }
return true ; return true ;
} }
@@ -623,6 +670,9 @@ ExeCurveCompoAngCenter( int nId, int nSimpCrv, double& dAngCen)
case CRV_BEZIER : case CRV_BEZIER :
dAngCen = 0 ; dAngCen = 0 ;
break ; break ;
default :
dAngCen = 0 ;
break ;
} }
return true ; return true ;
} }
@@ -652,7 +702,225 @@ ExeCurveCompoNormVersor( int nId, int nSimpCrv, int nRefId, Vector3d& vtNorm)
case CRV_BEZIER : case CRV_BEZIER :
vtNorm = V_NULL ; vtNorm = V_NULL ;
break ; break ;
default :
vtNorm = V_NULL ;
break ;
} }
// gestione trasformazione ( eventuale) // gestione trasformazione ( eventuale)
return TransformVector( pGeomDB, nId, nRefId, vtNorm) ; return TransformVector( pGeomDB, nId, nRefId, vtNorm) ;
} }
//----------------------------------------------------------------------------
bool
ExeCurveCompoGetTempProp( int nId, INTVECTOR& vProp, int nPropInd)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la curva composita
const ICurveComposite* pCompo = GetCurveComposite( pGeomDB->GetGeoObj( nId)) ;
if ( pCompo == nullptr)
return false ;
// recupero i valori
vProp.clear() ;
vProp.reserve( pCompo->GetCurveCount()) ;
const ICurve* pSmplCrv = pCompo->GetFirstCurve() ;
while ( pSmplCrv != nullptr) {
vProp.push_back( pSmplCrv->GetTempProp( nPropInd)) ;
pSmplCrv = pCompo->GetNextCurve() ;
}
return true ;
}
//----------------------------------------------------------------------------
bool
ExeCurveCompoGetTempParam( int nId, DBLVECTOR& vParam, int nParamInd)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la curva composita
const ICurveComposite* pCompo = GetCurveComposite( pGeomDB->GetGeoObj( nId)) ;
if ( pCompo == nullptr)
return false ;
// recupero i valori
vParam.clear() ;
vParam.reserve( pCompo->GetCurveCount()) ;
const ICurve* pSmplCrv = pCompo->GetFirstCurve() ;
while ( pSmplCrv != nullptr) {
vParam.push_back( pSmplCrv->GetTempParam( nParamInd)) ;
pSmplCrv = pCompo->GetNextCurve() ;
}
return true ;
}
//----------------------------------------------------------------------------
int
ExeShowCurveBezierControlPoints( int nCrvId, int nDestGrpId, int* pnCount)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la curva di Bezier
IGeoObj* pGeoObj = pGeomDB->GetGeoObj( nCrvId) ;
if ( pGeoObj == nullptr || ( pGeoObj->GetType() != CRV_BEZIER && pGeoObj->GetType() != CRV_COMPO))
return GDB_ID_NULL ;
// recupero il riferimento della curva
Frame3d frCrv ;
bool bOk = true ;
bOk = bOk && pGeomDB->GetGlobFrame( nCrvId, frCrv) ;
// recupero il riferimento di destinazione
Frame3d frDest ;
bOk = bOk && pGeomDB->GetGroupGlobFrame( nDestGrpId, frDest) ;
if ( ! bOk)
return GDB_ID_NULL ;
int nType = pGeoObj->GetType() ;
if ( nType == CRV_COMPO) {
const ICurveComposite* pCrvCompo = GetCurveComposite( pGeoObj) ;
if ( pCrvCompo == nullptr)
return false ;
int nFirstId = -1 ;
int nCount = 0 ;
for ( int i = 0 ; i < pCrvCompo->GetCurveCount() ; ++i) {
const ICurveBezier* pCrvBezier = GetCurveBezier( pCrvCompo->GetCurve(i)) ;
if ( pCrvBezier == nullptr) {
if ( pnCount != nullptr)
*pnCount = nCount ;
return nFirstId ;
}
int nDeg = pCrvBezier->GetDegree() ;
//bool bRat = pCrvBezier->IsRational() ;
for ( int i = 0 ; i < nDeg + 1 ; ++i) {
IGeoPoint3d* pGeoPt( CreateGeoPoint3d()) ;
//if ( ! bRat)
// pGeoPt->Set( pCrvBezier->GetControlPoint( i)) ;
//else
// pGeoPt->Set( pCrvBezier->GetControlPoint( i) * pCrvBezier->GetControlWeight( i)) ;
pGeoPt->Set( pCrvBezier->GetControlPoint( i)) ;
pGeoPt->LocToLoc( frCrv, frDest) ;
int nId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, pGeoPt) ;
if ( nFirstId == GDB_ID_NULL)
nFirstId = nId ;
if ( nId != GDB_ID_NULL)
++nCount ;
}
}
// restituisco i risultati
if ( pnCount != nullptr)
*pnCount = nCount ;
return nFirstId ;
}
else if ( nType == CRV_BEZIER) {
const ICurveBezier* pCrvBezier = GetCurveBezier( pGeoObj) ;
if ( pCrvBezier == nullptr)
return false ;
int nDeg = pCrvBezier->GetDegree() ;
//bool bRat = pCrvBezier->IsRational() ;
int nFirstId = -1 ;
int nCount = 0 ;
for ( int i = 0 ; i < nDeg + 1 ; ++i) {
IGeoPoint3d* pGeoPt( CreateGeoPoint3d()) ;
//if ( ! bRat)
// pGeoPt->Set( pCrvBezier->GetControlPoint( i)) ;
//else
// pGeoPt->Set( pCrvBezier->GetControlPoint( i) * pCrvBezier->GetControlWeight( i)) ;
pGeoPt->Set( pCrvBezier->GetControlPoint( i)) ;
pGeoPt->LocToLoc( frCrv, frDest) ;
int nId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, pGeoPt) ;
if ( nFirstId == GDB_ID_NULL)
nFirstId = nId ;
if ( nId != GDB_ID_NULL)
++nCount ;
}
// restituisco i risultati
if ( pnCount != nullptr)
*pnCount = nCount ;
return nFirstId ;
}
else
return GDB_ID_NULL ;
}
//----------------------------------------------------------------------------
bool
ExeCurveMaxOffset( int nId, double& dMaxOffset)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// verifico il parametro
if ( &dMaxOffset == nullptr)
return false ;
// recupero la curva
const ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nId)) ;
if ( pCrv == nullptr)
return false ;
return CalcCurveLimitOffset( *pCrv, dMaxOffset) ;
}
//----------------------------------------------------------------------------
int
ExeCopyCompoSubCurve( int nCrvId, int nSubCrvToCopy, int nDestGrpId)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la curva compo
const ICurveComposite* pCompo = GetCurveComposite( pGeomDB->GetGeoObj( nCrvId)) ;
if ( pCompo == nullptr)
return GDB_ID_NULL ;
// recupero il riferimento della curva
Frame3d frCrv ;
bool bOk = true ;
bOk = bOk && pGeomDB->GetGlobFrame( nCrvId, frCrv) ;
// recupero il riferimento di destinazione
Frame3d frDest ;
bOk = bOk && pGeomDB->GetGroupGlobFrame( nDestGrpId, frDest) ;
if ( ! bOk)
return GDB_ID_NULL ;
// creo una copia e la porto nel frame della destinazione
const ICurve* pSubCrv = pCompo->GetCurve( nSubCrvToCopy) ;
if ( pSubCrv == nullptr)
return GDB_ID_NULL ;
ICurve* pSubCrvCopy = pSubCrv->Clone() ;
if ( pSubCrvCopy == nullptr)
return GDB_ID_NULL ;
pSubCrvCopy->LocToLoc( frCrv, frDest) ;
int nSubCrvId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, pSubCrvCopy) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtCopyCompoSubCurve(" + IdToString( nCrvId) + "," +
ToString( nSubCrvToCopy) + "," +
IdToString( nDestGrpId) + ")" +
" -- Id=" + ToString( nSubCrvId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
return nSubCrvId ;
}
//----------------------------------------------------------------------------
int
ExeCopyParamRange( int nCrvId, double dUStart, double dUEnd, int nDestGrpId)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la curva
const ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nCrvId)) ;
// recupero il riferimento della curva
Frame3d frCrv ;
bool bOk = true ;
bOk = bOk && pGeomDB->GetGlobFrame( nCrvId, frCrv) ;
// recupero il riferimento di destinazione
Frame3d frDest ;
bOk = bOk && pGeomDB->GetGroupGlobFrame( nDestGrpId, frDest) ;
if ( ! bOk)
return GDB_ID_NULL ;
// creo una copia e la porto nel frame della destinazione
ICurve* pSubCrvCopy = pCrv->CopyParamRange( dUStart, dUEnd) ;
if ( pSubCrvCopy == nullptr)
return GDB_ID_NULL ;
pSubCrvCopy->LocToLoc( frCrv, frDest) ;
int nSubCrvId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, pSubCrvCopy) ;
ExeSetModified() ;
return nSubCrvId ;
}
+162
View File
@@ -0,0 +1,162 @@
//----------------------------------------------------------------------------
// EgalTech 2023-2024
//----------------------------------------------------------------------------
// File : Exe_GdbGetPocketing.cpp Data : 02.02.24 Versione : 2.6b1
// Contenuto : Funzioni di interrogazione di regioni piane del DBG per EXE.
//
//
//
// Modifiche : 29.11.23 RE Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "EXE.h"
#include "EXE_Macro.h"
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EGkSfrCreate.h"
#include "/EgtDev/Include/EGkCalcPocketing.h"
using namespace std ;
//----------------------------------------------------------------------------
bool
ExePocketing( int nId, double dRad, double dStep, double dAngle, int nType, bool bSmooth, int nDestGrpId,
int& nFirstId, int& nCrvCount)
{
// database geometrico
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false) ;
// recupero la FlatRegion da svuotare
PtrOwner<ISurfFlatRegion> pMySfr ;
const ISurfFlatRegion* pSfr = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId)) ;
if ( pSfr == nullptr) {
// verifico se è una curva chiusa e piana che permette di definire una regione
const ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nId)) ;
Plane3d plPlane ;
if ( pCrv == nullptr || ! pCrv->IsFlat( plPlane, true, 10 * EPS_SMALL))
return false ;
SurfFlatRegionByContours SfrCntr ;
SfrCntr.AddCurve( pCrv->Clone()) ;
pMySfr.Set( SfrCntr.GetSurf()) ;
if ( IsNull( pMySfr))
return false ;
pSfr = pMySfr ;
}
// recupero il suo frame
Frame3d frSfr ;
if ( ! pGeomDB->GetGlobFrame( nId, frSfr))
return false ;
// recupero il riferimento del gruppo di destinazione
Frame3d frDest ;
if ( ! pGeomDB->GetGroupGlobFrame( nDestGrpId, frDest))
return false ;
// eseguo Pocketing
ICRVCOMPOPOVECTOR vCrvCompoRes ;
bool bOk = CalcPocketing( pSfr, dRad, 0, dStep, dAngle, 5., nType, bSmooth, true, false, false, false, true, P_INVALID, nullptr, false,
dStep, 0, INFINITO, 0, 0, INFINITO, false, 0., 0., vCrvCompoRes) ;
nFirstId = GDB_ID_NULL ;
nCrvCount = int( vCrvCompoRes.size()) ;
if ( bOk && nCrvCount > 0) {
// scorro le curve di Pocketing ottenute
for ( int nI = 0 ; nI < nCrvCount ; ++ nI) {
vCrvCompoRes[nI]->LocToLoc( frSfr, frDest) ;
// inserisco la curva nel DB Geometrico
int nCurrId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( vCrvCompoRes[nI])) ;
if ( nCurrId == GDB_ID_NULL)
return false ;
if ( nI == 0)
nFirstId = nCurrId ;
}
ExeSetModified() ;
}
if ( IsCmdLog()) {
string sLua = "EgtPocketing(" + ToString( nId) + "," +
ToString( dRad) + "," +
ToString( dStep) + "," +
ToString( dAngle) + "," +
ToString( nType) + "," +
ToString( bSmooth) + "," +
ToString( nDestGrpId) + ")" +
" FirstId=" + ToString( nFirstId) + " CurveCount=" + ToString( nCrvCount) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
//----------------------------------------------------------------------------
int
ExeSurfFrGetZigZagInfill( int nId, int nDestGrpId, double dStep, double dAng, bool bSmooth, bool bRemoveOverlapLink,
int* pnCount)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// recupero la superficie FlatRegion
ISurfFlatRegion* pOrigSrf = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId)) ;
if ( pOrigSrf == nullptr)
return GDB_ID_NULL ;
PtrOwner<ISurfFlatRegion> pSfr( pOrigSrf->Clone()) ;
bool bOk = ( ! IsNull( pSfr)) ;
// recupero il riferimento della superficie
Frame3d frSurf ;
bOk = bOk && pGeomDB->GetGlobFrame( nId, frSurf) ;
// recupero il riferimento di destinazione
Frame3d frDest ;
bOk = bOk && pGeomDB->GetGroupGlobFrame( nDestGrpId, frDest) ;
// creo il riferimento per il calcolo del percorso a zigzag
Vector3d vtN ;
if ( bOk)
vtN = pSfr->GetNormVersor() ;
bOk = bOk && vtN.ToGlob( frSurf) ;
Frame3d frRef ;
bOk = bOk && frRef.Set( ORIG, vtN) ;
bOk = bOk && frRef.Rotate( ORIG, vtN, dAng) ;
// calcolo il percorso a zigzag
bOk = bOk && pSfr->LocToLoc( frSurf, frRef) ;
ICRVCOMPOPOVECTOR vpCrvs ;
bOk = bOk && CalcZigZagInfill( pSfr, dStep, bSmooth, bRemoveOverlapLink, vpCrvs) ;
// inserisco le curve risultanti nel DB
int nFirstId = GDB_ID_NULL ;
int nCount = 0 ;
for ( int i = 0 ; bOk && i < ( int) vpCrvs.size() ; i ++) {
// porto la curva nel riferimento di destinazione
bOk = bOk && vpCrvs[i]->LocToLoc( frRef, frDest) ;
// la inserisco nel DB geometrico
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( vpCrvs[i])) : GDB_ID_NULL) ;
bOk = bOk && ( nNewId != GDB_ID_NULL) ;
// aggiorno contatori
if ( bOk && nFirstId == GDB_ID_NULL)
nFirstId = nNewId ;
if ( bOk)
++ nCount ;
}
ExeSetModified() ;
// restituisco risultati
if ( pnCount != nullptr)
*pnCount = nCount ;
if ( IsCmdLog()) {
string sLua = "EgtGetSurfFrZigZagInfill(" + ToString( nId) + "," +
ToString( dStep) + "," +
ToString( dAng) + "," +
ToString( bSmooth) + "," +
ToString( bRemoveOverlapLink) + "," +
" -- Ok=" + ToString( bOk) + " FirstId=" + ToString( nFirstId) + " CurveCount=" + ToString( nCount) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return nFirstId ;
}
+751 -132
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -250,8 +250,8 @@ ExeVolZmapGetEdges( int nId, int nDestGrpId, int* pnCount)
ExeSetModified() ; ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente // se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) { if ( IsCmdLog()) {
string sLua = "EgtGetSurfTmSilhouette(" + ToString( nId) + ",{" + string sLua = "EgtVolZmapGetEdges(" + ToString( nId) + ",{" +
ToString( nDestGrpId) + ")" + ToString( nDestGrpId) + ")" +
" -- Id1=" + ToString( nFirstId) + ",Nbr=" + ToString( nCount) ; " -- Id1=" + ToString( nFirstId) + ",Nbr=" + ToString( nCount) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
+1178 -52
View File
File diff suppressed because it is too large Load Diff
+680 -49
View File
@@ -23,13 +23,16 @@
#include "/EgtDev/Include/EGkCurveComposite.h" #include "/EgtDev/Include/EGkCurveComposite.h"
#include "/EgtDev/Include/EGkCurveLocal.h" #include "/EgtDev/Include/EGkCurveLocal.h"
#include "/EgtDev/Include/EGkSurfFlatRegion.h" #include "/EgtDev/Include/EGkSurfFlatRegion.h"
#include "/EgtDev/Include/EGkSurfTriMesh.h" #include "/EgtDev/Include/EGkSurfTriMeshAux.h"
#include "/EgtDev/Include/EGkSurfBezier.h"
#include "/EgtDev/Include/EGkSurfLocal.h" #include "/EgtDev/Include/EGkSurfLocal.h"
#include "/EgtDev/Include/EGkStmFromTriangleSoup.h" #include "/EgtDev/Include/EGkStmFromTriangleSoup.h"
#include "/EgtDev/Include/EGkCAvSimpleSurfFrMove.h" #include "/EgtDev/Include/EGkCAvSimpleSurfFrMove.h"
#include "/EgtDev/Include/EGkStringUtils3d.h" #include "/EgtDev/Include/EGkStringUtils3d.h"
#include "/EgtDev/Include/EGkSubtractProjectedFacesOnStmFace.h"
#include "/EgtDev/Include/EgtPointerOwner.h" #include "/EgtDev/Include/EgtPointerOwner.h"
using namespace std ; using namespace std ;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -74,7 +77,7 @@ MyExplodeSurfTriMesh( int nId, int& nCount)
return GDB_ID_NULL ; return GDB_ID_NULL ;
// recupero il numero di componenti connesse // recupero il numero di componenti connesse
int nParts = pStm->GetPartCount() ; int nParts = pStm->GetPartCount() ;
// se ci sono più parti, separo queste // se ci sono più parti, separo queste
if ( nParts > 1) { if ( nParts > 1) {
int nFirstId = GDB_ID_NULL ; int nFirstId = GDB_ID_NULL ;
nCount = 0 ; nCount = 0 ;
@@ -99,9 +102,36 @@ MyExplodeSurfTriMesh( int nId, int& nCount)
// restituisco risultati // restituisco risultati
return nFirstId ; return nFirstId ;
} }
// recupero il numero di gusci
int nShells = pStm->GetShellCount() ;
// se ci sono più gusci, separo questi
if ( nShells > 1) {
int nFirstId = GDB_ID_NULL ;
nCount = 0 ;
for ( int i = 0 ; i < nShells ; ++ i) {
ISurfTriMesh* pFac = pStm->CloneShell( i) ;
if ( pFac == nullptr)
continue ;
// inserisco la superficie nello stesso gruppo e nello stesso posto del GeomDB
int nNewId = pGeomDB->InsertGeoObj( GDB_ID_NULL, nId, GDB_BEFORE, pFac) ;
if ( nNewId == GDB_ID_NULL)
return GDB_ID_NULL ;
// copio gli attributi
if ( ! pGeomDB->CopyAttributes( nId, nNewId))
return GDB_ID_NULL ;
// aggiorno contatori
if ( nFirstId == GDB_ID_NULL)
nFirstId = nNewId ;
++ nCount ;
}
// elimino la superficie originale
pGeomDB->Erase( nId) ;
// restituisco risultati
return nFirstId ;
}
// recupero il numero di facce // recupero il numero di facce
int nFacets = pStm->GetFacetCount() ; int nFacets = pStm->GetFacetCount() ;
// se ci sono più facce, separo queste // se ci sono più facce, separo queste
if ( nFacets > 1) { if ( nFacets > 1) {
// copio tutte le facce // copio tutte le facce
int nFirstId = GDB_ID_NULL ; int nFirstId = GDB_ID_NULL ;
@@ -127,7 +157,7 @@ MyExplodeSurfTriMesh( int nId, int& nCount)
// restituisco risultati // restituisco risultati
return nFirstId ; return nFirstId ;
} }
// non devo fare alcunché // non devo fare alcunché
nCount = 1 ; nCount = 1 ;
return nId ; return nId ;
} }
@@ -144,7 +174,7 @@ MyExplodeSurfFlatRegion( int nId, int& nCount)
return GDB_ID_NULL ; return GDB_ID_NULL ;
// recupero il numero di componenti connessi (chunk) // recupero il numero di componenti connessi (chunk)
int nChunk = pSfr->GetChunkCount() ; int nChunk = pSfr->GetChunkCount() ;
// se c'è un solo componente, non devo fare alcunché // se c'è un solo componente, non devo fare alcunché
if ( nChunk == 1) { if ( nChunk == 1) {
nCount = 1 ; nCount = 1 ;
return nId ; return nId ;
@@ -204,12 +234,54 @@ ExeExplodeSurface( int nId, int* pnCount)
return nFirstId ; return nFirstId ;
} }
//-------------------------------------------------------------------------------
bool
ExeApproxSurface( int nId, double dLinTol, double dTriaMinSide)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// opero secondo il tipo di superficie
PtrOwner<ISurfTriMesh> pStm ;
int nType = pGeomDB->GetGeoType( nId) ;
if ( nType == SRF_TRIMESH) {
// copio la superficie
const ISurfTriMesh* pStri = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
pStm.Set( pStri != nullptr ? pStri->Clone() : nullptr) ;
}
else if ( nType == SRF_FLATRGN) {
// recupero la superficie ausiliaria della regione
const ISurfFlatRegion* pSfr = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId)) ;
const ISurfTriMesh* pAuxSurf = ( pSfr != nullptr ? pSfr->GetAuxSurf() : nullptr) ;
pStm.Set( pAuxSurf != nullptr ? pAuxSurf->Clone() : nullptr) ;
}
else if ( nType == SRF_BEZIER) {
// recupero la superficie ausiliaria della Bezier
const ISurfBezier* pSbez = GetSurfBezier( pGeomDB->GetGeoObj( nId)) ;
pStm.Set( ( pSbez != nullptr ? pSbez->GetApproxSurf( dLinTol, dTriaMinSide) : nullptr)) ;
}
bool bOk = ( ! IsNull( pStm)) ;
// semplificazione della trimesh
bOk = bOk && pStm->DoCompacting( dLinTol) ;
// sostituisco la vecchia superficie con la nuova
bOk = bOk && pGeomDB->ReplaceGeoObj( nId, Release( pStm)) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtApproxSurf(" + ToString( nId) + "," +
ToString( dLinTol) + "," +
ToString( dTriaMinSide) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
ExeSurfFrAdd( int nId1, int nId2) ExeSurfFrAdd( int nId1, int nId2)
{ {
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) VERIFY_GEOMDB( pGeomDB, false)
// recupero la prima superficie FlatRegion // recupero la prima superficie FlatRegion
ISurfFlatRegion* pSfr1 = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId1)) ; ISurfFlatRegion* pSfr1 = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId1)) ;
bool bOk = ( pSfr1 != nullptr) ; bool bOk = ( pSfr1 != nullptr) ;
@@ -238,7 +310,7 @@ bool
ExeSurfFrSubtract( int nId1, int nId2) ExeSurfFrSubtract( int nId1, int nId2)
{ {
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) VERIFY_GEOMDB( pGeomDB, false)
// recupero la prima superficie FlatRegion // recupero la prima superficie FlatRegion
ISurfFlatRegion* pSfr1 = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId1)) ; ISurfFlatRegion* pSfr1 = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId1)) ;
bool bOk = ( pSfr1 != nullptr) ; bool bOk = ( pSfr1 != nullptr) ;
@@ -251,8 +323,8 @@ ExeSurfFrSubtract( int nId1, int nId2)
bOk = bOk && ( pSfr2L != nullptr) ; bOk = bOk && ( pSfr2L != nullptr) ;
// eseguo la sottrazione della seconda superficie dalla prima // eseguo la sottrazione della seconda superficie dalla prima
bOk = bOk && pSfr1->Subtract( *pSfr2L) ; bOk = bOk && pSfr1->Subtract( *pSfr2L) ;
// se il risultato è vuoto, cancello la FlatRegion // se il risultato è vuoto, cancello la FlatRegion
if ( bOk && ! pSfr1->IsValid()) if ( bOk && ! pSfr1->IsValid())
pGeomDB->Erase( nId1) ; pGeomDB->Erase( nId1) ;
ExeSetModified() ; ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente // se richiesto, salvo il comando Lua equivalente
@@ -270,7 +342,7 @@ bool
ExeSurfFrIntersect( int nId1, int nId2) ExeSurfFrIntersect( int nId1, int nId2)
{ {
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) VERIFY_GEOMDB( pGeomDB, false)
// recupero la prima superficie FlatRegion // recupero la prima superficie FlatRegion
ISurfFlatRegion* pSfr1 = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId1)) ; ISurfFlatRegion* pSfr1 = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId1)) ;
bool bOk = ( pSfr1 != nullptr) ; bool bOk = ( pSfr1 != nullptr) ;
@@ -283,8 +355,8 @@ ExeSurfFrIntersect( int nId1, int nId2)
bOk = bOk && ( pSfr2L != nullptr) ; bOk = bOk && ( pSfr2L != nullptr) ;
// eseguo l'intersezione tra le due superfici // eseguo l'intersezione tra le due superfici
bOk = bOk && pSfr1->Intersect( *pSfr2L) ; bOk = bOk && pSfr1->Intersect( *pSfr2L) ;
// se il risultato è vuoto, cancello la FlatRegion // se il risultato è vuoto, cancello la FlatRegion
if ( bOk && ! pSfr1->IsValid()) if ( bOk && ! pSfr1->IsValid())
pGeomDB->Erase( nId1) ; pGeomDB->Erase( nId1) ;
ExeSetModified() ; ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente // se richiesto, salvo il comando Lua equivalente
@@ -302,14 +374,14 @@ bool
ExeSurfFrOffset( int nId, double dDist, int nType) ExeSurfFrOffset( int nId, double dDist, int nType)
{ {
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie FlatRegion // recupero la superficie FlatRegion
ISurfFlatRegion* pSfr = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId)) ; ISurfFlatRegion* pSfr = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pSfr != nullptr) ; bool bOk = ( pSfr != nullptr) ;
// eseguo l'offset // eseguo l'offset
bOk = bOk && pSfr->Offset( dDist, nType) ; bOk = bOk && pSfr->Offset( dDist, nType) ;
// se il risultato è vuoto, cancello la FlatRegion // se il risultato è vuoto, cancello la FlatRegion
if ( bOk && ! pSfr->IsValid()) if ( bOk && ! pSfr->IsValid())
pGeomDB->Erase( nId) ; pGeomDB->Erase( nId) ;
ExeSetModified() ; ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente // se richiesto, salvo il comando Lua equivalente
@@ -323,12 +395,64 @@ ExeSurfFrOffset( int nId, double dDist, int nType)
return bOk ; return bOk ;
} }
//----------------------------------------------------------------------------
bool
ExeSurfFrOffsetAdv( int nId, double dDist, int nType, int& nNewId)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie FlatRegion
ISurfFlatRegion* pSfr = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId)) ;
if ( pSfr == nullptr)
return false ;
// eseguo l'offset
PtrOwner<ISurfFlatRegion> pSfrOffs( pSfr->CreateOffsetSurf( dDist, nType)) ;
if ( IsNull( pSfrOffs))
return false ;
// salvo la superficie di offset
nNewId = GDB_ID_NULL ;
if ( pSfr->GetChunkCount() > 0) {
// inserisco nel DB geometrico
nNewId = pGeomDB->InsertGeoObj( GDB_ID_NULL, nId, GDB_AFTER, Release( pSfrOffs)) ;
// copio gli attributi
pGeomDB->CopyAttributes( nId, nNewId) ;
ExeSetModified() ;
}
return true ;
}
//----------------------------------------------------------------------------
bool
ExeSurfFrEraseChunk( int nId, int nChunk)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie FlatRegion
ISurfFlatRegion* pSfr = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId)) ;
if ( pSfr == nullptr)
return false ;
// elimino il chunk indicato
bool bOk = pSfr->EraseChunk( nChunk) ;
// se il risultato è vuoto, cancello la FlatRegion
if ( bOk && ! pSfr->IsValid())
pGeomDB->Erase( nId) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfFrEraseChunk(" + ToString( nId) + "," +
ToString( nChunk) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
ExeSurfFrMoveSimpleNoCollision( int nId1, int nId2, const Vector3d& vtDir, double& dLen, int nRefType) ExeSurfFrMoveSimpleNoCollision( int nId1, int nId2, const Vector3d& vtDir, double& dLen, int nRefType)
{ {
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) VERIFY_GEOMDB( pGeomDB, false)
// recupero la prima superficie FlatRegion // recupero la prima superficie FlatRegion
ISurfFlatRegion* pSfr1 = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId1)) ; ISurfFlatRegion* pSfr1 = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId1)) ;
bool bOk = ( pSfr1 != nullptr) ; bool bOk = ( pSfr1 != nullptr) ;
@@ -350,7 +474,7 @@ bool
ExeSurfFrRotateSimpleNoCollision( int nId1, int nId2, const Point3d& ptCen, double& dAngDeg, int nRefType) ExeSurfFrRotateSimpleNoCollision( int nId1, int nId2, const Point3d& ptCen, double& dAngDeg, int nRefType)
{ {
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) VERIFY_GEOMDB( pGeomDB, false)
// recupero la prima superficie FlatRegion // recupero la prima superficie FlatRegion
ISurfFlatRegion* pSfr1 = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId1)) ; ISurfFlatRegion* pSfr1 = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId1)) ;
bool bOk = ( pSfr1 != nullptr) ; bool bOk = ( pSfr1 != nullptr) ;
@@ -367,6 +491,155 @@ ExeSurfFrRotateSimpleNoCollision( int nId1, int nId2, const Point3d& ptCen, doub
return ( bOk && CAvSimpleSurfFrMove( *pSfr1, *pSfr2L).Rotate(ptCenL, dAngDeg)) ; return ( bOk && CAvSimpleSurfFrMove( *pSfr1, *pSfr2L).Rotate(ptCenL, dAngDeg)) ;
} }
//-------------------------------------------------------------------------------
bool
ExeSurfTmMoveVertex( int nId, int nVert, const Point3d& ptNewVert, int nRefType, bool bUpdate)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie
ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pStm != nullptr) ;
// recupero il riferimento in cui è immersa la superficie
Frame3d frStm ;
bOk = bOk && pGeomDB->GetGlobFrame( nId, frStm) ;
// eseguo la modifica
if ( bOk) {
// porto il nuovo vertice nel riferimento della superficie
Point3d ptNewVertL = GetPointLocal( pGeomDB, ptNewVert, nRefType, frStm) ;
// eseguo la modifica
bOk = pStm->MoveVertex( nVert, ptNewVertL) ;
// se richiesto, semplificazione della trimesh
if ( bUpdate)
bOk = bOk && pStm->DoCompacting() ;
}
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfTmMoveVertex(" + IdToString( nId) + "," +
ToString( nVert) + ",{" +
ToString( ptNewVert) + "}," +
RefTypeToString( nRefType) + "," +
( bUpdate ? "true" : "false") + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultato
return bOk ;
}
//-------------------------------------------------------------------------------
bool
ExeSurfTmMoveFacet( int nId, int nFacet, const Vector3d& vtMove, int nRefType, bool bUpdate)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie
ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pStm != nullptr) ;
// recupero il riferimento in cui è immersa la superficie
Frame3d frStm ;
bOk = bOk && pGeomDB->GetGlobFrame( nId, frStm) ;
// porto in locale il movimento
Vector3d vtMoveL = GetVectorLocal( pGeomDB, vtMove, nRefType, frStm) ;
// recupero tutti i vertici della faccia
INTVECTOR vVert ;
bOk = bOk && pStm->GetAllVertInFacet( nFacet, vVert) ;
// sposto tutti i vertici della faccia della quantità desiderata
if ( bOk) {
for ( const auto nVert : vVert) {
// recupero la posizione originale del vertice
Point3d ptV ;
if ( pStm->GetVertex( nVert, ptV))
pStm->MoveVertex( nVert, ptV + vtMoveL) ;
}
}
// se richiesto, semplificazione della trimesh
if ( bUpdate)
bOk = bOk && pStm->DoCompacting() ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfTmMoveFacet(" + IdToString( nId) + "," +
ToString( nFacet) + ",{" +
ToString( vtMove) + "}," +
RefTypeToString( nRefType) + "," +
( bUpdate ? "true" : "false") + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultato
return bOk ;
}
//-------------------------------------------------------------------------------
static int
MySurfTmToTriangles( int nId, int& nCount)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// recupero la superficie TriMesh
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
if ( pStm == nullptr)
return GDB_ID_NULL ;
// recupero il numero di triangoli
int nTria = pStm->GetTriangleCount() ;
// se ci sono più triangoli, li separo
if ( nTria > 1) {
// copio tutti triangoli
int nFirstId = GDB_ID_NULL ;
nCount = 0 ;
for ( int i = 0 ; i < pStm->GetTriangleSize() ; ++ i) {
ISurfTriMesh* pFac = pStm->CloneTriangle( i) ;
if ( pFac == nullptr)
continue ;
// inserisco la superficie nello stesso gruppo e nello stesso posto del GeomDB
int nNewId = pGeomDB->InsertGeoObj( GDB_ID_NULL, nId, GDB_BEFORE, pFac) ;
if ( nNewId == GDB_ID_NULL)
return GDB_ID_NULL ;
// copio gli attributi
if ( ! pGeomDB->CopyAttributes( nId, nNewId))
return GDB_ID_NULL ;
// aggiorno contatori
if ( nFirstId == GDB_ID_NULL)
nFirstId = nNewId ;
++ nCount ;
}
// elimino la superficie originale
pGeomDB->Erase( nId) ;
// restituisco risultati
return nFirstId ;
}
// non devo fare alcunché
nCount = 1 ;
return nId ;
}
//-------------------------------------------------------------------------------
int
ExeSurfTmToTriangles( int nId, int* pnCount)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// verifico sia una superficie trimesh
int nFirstId = GDB_ID_NULL ;
int nCount = 0 ;
if ( pGeomDB->GetGeoType( nId) == SRF_TRIMESH) {
nFirstId = MySurfTmToTriangles( nId, nCount) ;
}
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfTmToTriangles(" + IdToString( nId) + ")" +
" -- Id1=" + ToString( nFirstId) + ",Nbr=" + ToString( nCount) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultati
if ( pnCount != nullptr)
*pnCount = nCount ;
return nFirstId ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
bool bool
ExeSurfTmRemoveFacet( int nId, int nFacet) ExeSurfTmRemoveFacet( int nId, int nFacet)
@@ -381,7 +654,7 @@ ExeSurfTmRemoveFacet( int nId, int nFacet)
ExeSetModified() ; ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente // se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) { if ( IsCmdLog()) {
string sLua = "EgtSurfTmRemoveFacet(" + ToString( nId) + "," + string sLua = "EgtSurfTmRemoveFacet(" + IdToString( nId) + "," +
ToString( nFacet) + ")" + ToString( nFacet) + ")" +
" -- Ok=" + ToString( bOk) ; " -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
@@ -404,7 +677,7 @@ ExeSurfTmSwapFacets( int nId, int nFacet1, int nFacet2)
ExeSetModified() ; ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente // se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) { if ( IsCmdLog()) {
string sLua = "EgtSurfTmSwapFacets(" + ToString( nId) + "," + string sLua = "EgtSurfTmSwapFacets(" + IdToString( nId) + "," +
ToString( nFacet1) + "," + ToString( nFacet1) + "," +
ToString( nFacet2) + ")" + ToString( nFacet2) + ")" +
" -- Ok=" + ToString( bOk) ; " -- Ok=" + ToString( bOk) ;
@@ -428,7 +701,7 @@ ExeSurfTmRemovePart( int nId, int nPart)
ExeSetModified() ; ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente // se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) { if ( IsCmdLog()) {
string sLua = "EgtSurfTmRemovePart(" + ToString( nId) + "," + string sLua = "EgtSurfTmRemovePart(" + IdToString( nId) + "," +
ToString( nPart) + ")" + ToString( nPart) + ")" +
" -- Ok=" + ToString( bOk) ; " -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
@@ -442,7 +715,7 @@ bool
ExeCutSurfTmPlane( int nId, const Point3d& ptOn, const Vector3d& vtN, bool bSaveOnEq, int nRefType) ExeCutSurfTmPlane( int nId, const Point3d& ptOn, const Vector3d& vtN, bool bSaveOnEq, int nRefType)
{ {
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie TriMesh // recupero la superficie TriMesh
ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ; ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pStm != nullptr) ; bool bOk = ( pStm != nullptr) ;
@@ -460,7 +733,7 @@ ExeCutSurfTmPlane( int nId, const Point3d& ptOn, const Vector3d& vtN, bool bSave
ExeSetModified() ; ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente // se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) { if ( IsCmdLog()) {
string sLua = "EgtCutSurfTmPlane(" + ToString( nId) + ",{" + string sLua = "EgtCutSurfTmPlane(" + IdToString( nId) + ",{" +
ToString( ptOn) + "},{" + ToString( ptOn) + "},{" +
ToString( vtN) + "}," + ToString( vtN) + "}," +
( bSaveOnEq ? "true" : "false") + "," + ( bSaveOnEq ? "true" : "false") + "," +
@@ -477,7 +750,7 @@ bool
ExeCutSurfTmClosedCurve( int nSurfId, int nCurveId, bool bSaveOnEq) ExeCutSurfTmClosedCurve( int nSurfId, int nCurveId, bool bSaveOnEq)
{ {
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie TriMesh // recupero la superficie TriMesh
ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nSurfId)) ; ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nSurfId)) ;
bool bOk = ( pStm != nullptr) ; bool bOk = ( pStm != nullptr) ;
@@ -507,7 +780,7 @@ bool
ExeSurfTmAdd( int nId1, int nId2, bool bTwoColors) ExeSurfTmAdd( int nId1, int nId2, bool bTwoColors)
{ {
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) VERIFY_GEOMDB( pGeomDB, false)
// recupero la prima superficie TriMesh // recupero la prima superficie TriMesh
ISurfTriMesh* pStm1 = GetSurfTriMesh( pGeomDB->GetGeoObj( nId1)) ; ISurfTriMesh* pStm1 = GetSurfTriMesh( pGeomDB->GetGeoObj( nId1)) ;
bool bOk = ( pStm1 != nullptr) ; bool bOk = ( pStm1 != nullptr) ;
@@ -539,7 +812,7 @@ bool
ExeSurfTmSubtract( int nId1, int nId2, bool bTwoColors) ExeSurfTmSubtract( int nId1, int nId2, bool bTwoColors)
{ {
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) VERIFY_GEOMDB( pGeomDB, false)
// recupero la prima superficie TriMesh // recupero la prima superficie TriMesh
ISurfTriMesh* pStm1 = GetSurfTriMesh( pGeomDB->GetGeoObj( nId1)) ; ISurfTriMesh* pStm1 = GetSurfTriMesh( pGeomDB->GetGeoObj( nId1)) ;
bool bOk = ( pStm1 != nullptr) ; bool bOk = ( pStm1 != nullptr) ;
@@ -552,7 +825,7 @@ ExeSurfTmSubtract( int nId1, int nId2, bool bTwoColors)
bOk = bOk && ( pStm2L != nullptr) ; bOk = bOk && ( pStm2L != nullptr) ;
// eseguo la sottrazione tra le due superfici // eseguo la sottrazione tra le due superfici
bOk = bOk && pStm1->Subtract( *pStm2L) ; bOk = bOk && pStm1->Subtract( *pStm2L) ;
// se il risultato è vuoto, cancello la superficie // se il risultato vuoto, cancello la superficie
if ( bOk && ! pStm1->IsValid()) { if ( bOk && ! pStm1->IsValid()) {
pGeomDB->Erase( nId1) ; pGeomDB->Erase( nId1) ;
pStm1 = nullptr ; pStm1 = nullptr ;
@@ -576,7 +849,7 @@ bool
ExeSurfTmIntersect( int nId1, int nId2, bool bTwoColors) ExeSurfTmIntersect( int nId1, int nId2, bool bTwoColors)
{ {
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) VERIFY_GEOMDB( pGeomDB, false)
// recupero la prima superficie TriMesh // recupero la prima superficie TriMesh
ISurfTriMesh* pStm1 = GetSurfTriMesh( pGeomDB->GetGeoObj( nId1)) ; ISurfTriMesh* pStm1 = GetSurfTriMesh( pGeomDB->GetGeoObj( nId1)) ;
bool bOk = ( pStm1 != nullptr) ; bool bOk = ( pStm1 != nullptr) ;
@@ -589,7 +862,7 @@ ExeSurfTmIntersect( int nId1, int nId2, bool bTwoColors)
bOk = bOk && ( pStm2L != nullptr) ; bOk = bOk && ( pStm2L != nullptr) ;
// eseguo l'intersezione tra le due superfici // eseguo l'intersezione tra le due superfici
bOk = bOk && pStm1->Intersect( *pStm2L) ; bOk = bOk && pStm1->Intersect( *pStm2L) ;
// se il risultato è vuoto, cancello la superficie // se il risultato vuoto, cancello la superficie
if ( bOk && ! pStm1->IsValid()) { if ( bOk && ! pStm1->IsValid()) {
pGeomDB->Erase( nId1) ; pGeomDB->Erase( nId1) ;
pStm1 = nullptr ; pStm1 = nullptr ;
@@ -608,27 +881,6 @@ ExeSurfTmIntersect( int nId1, int nId2, bool bTwoColors)
return bOk ; return bOk ;
} }
//----------------------------------------------------------------------------
bool
ExeSurfTmResetTwoColors( int nId)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// recupero la superficie TriMesh
ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pStm != nullptr) ;
// reset dei flag sui triangoli per i due colori
bOk = bOk && pStm->ResetTFlags() ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfTmResetTwoColors(" + ToString( nId) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static ISurfTriMesh* static ISurfTriMesh*
MyCreateSubSurfTm( const ISurfTriMesh* pStm, const INTVECTOR& vTria, const INTVECTOR& vTria2) MyCreateSubSurfTm( const ISurfTriMesh* pStm, const INTVECTOR& vTria, const INTVECTOR& vTria2)
@@ -776,3 +1028,382 @@ ExeSurfTmCut( int nId, int nCutterId, bool bInVsOut, bool bSaveOnEq)
} }
return bOk ; return bOk ;
} }
//----------------------------------------------------------------------------
bool
ExeSurfTmSubtractProjectedFacesOnFace( int nSurfId, int nFaceInd, int nDestGrpId,
INTVECTOR vSurfsId, bool bOCFlag,
bool& bExistProjection, int& nNewId, int& nNewFaceNbr)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie TriMesh su cui proiettare
ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nSurfId)) ;
if ( pStm == nullptr)
return false ;
// recupero il riferimento della superficie
Frame3d frSurf ;
if ( ! pGeomDB->GetGlobFrame( nSurfId, frSurf))
return false ;
// recupero il riferimento del gruppo di destinazione
Frame3d frDest ;
if ( ! pGeomDB->GetGroupGlobFrame( nDestGrpId, frDest))
return false ;
// costruzione vettori di superfici e indici delle facce per proiezione
ISURFTMPOVECTOR vpStmOthers ;
vector<SurfLocal> vSurfCLoc ;
// recupero le altre superfici e le porto nel sistema di riferimento della prima
for ( int i = 0 ; i < int( vSurfsId.size()) ; ++ i) {
if ( pGeomDB->GetGeoType( vSurfsId[i]) != SRF_TRIMESH)
return false ;
vSurfCLoc.emplace_back( pGeomDB, vSurfsId[i], frSurf) ;
const ISurfTriMesh* pStmCurr = GetSurfTriMesh( vSurfCLoc.back().Get()) ;
vpStmOthers.emplace_back( pStmCurr->Clone()) ;
}
// eseguo la proiezione
ISurfTriMesh* pStmRes = nullptr ;
bool bOk = SubtractProjectedFacesOnStmFace( *pStm, nFaceInd, vpStmOthers, bOCFlag,
bExistProjection, pStmRes, nNewFaceNbr) ;
if ( ! bOk) {
delete( pStmRes) ;
pStmRes = nullptr ;
}
nNewId = GDB_ID_NULL ;
if ( bOk && pStmRes != nullptr) {
// porto nel sistema di riferimento destinazione
pStmRes->LocToLoc( frSurf, frDest) ;
// la inserisco nel DB geometrico
nNewId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, pStmRes) ;
if ( nNewId == GDB_ID_NULL)
return false ;
ExeSetModified() ;
}
if ( IsCmdLog()) {
string sLua = "EgtSubtractProjectedFacesOnStmFace(" + ToString( nSurfId) + "," +
ToString( nFaceInd) + "," +
ToString( nDestGrpId) + "," +
ToString( vSurfsId) + "," +
ToString( bOCFlag) + ")" +
" -- Ok=" + ToString( bOk) + " Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
//----------------------------------------------------------------------------
bool
ExeSurfTmSetFaceColor( int nId, int nFacet, int nColor)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie TriMesh
ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pStm != nullptr) ;
// recupero tutti i triangoli della faccia e imposto il flag opportuno per il colore
INTVECTOR vTria ;
bOk = bOk && pStm->GetAllTriaInFacet( nFacet, vTria) ;
for ( const auto nT : vTria)
pStm->SetTFlag( nT, nColor) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfTmSetFaceColor(" + ToString( nId) + "," +
ToString( nFacet) + "," +
ToString( nColor) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
//----------------------------------------------------------------------------
bool
ExeSurfTmGetTriaColor( int nId, int nTria, int& nColor)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie TriMesh
ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pStm != nullptr) ;
// recupero il colore del triangolo
return ( bOk && pStm->GetTFlag( nTria, nColor)) ;
}
//----------------------------------------------------------------------------
bool
ExeSurfTmResetTwoColors( int nId)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie TriMesh
ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pStm != nullptr) ;
// reset dei flag sui triangoli per i due colori
bOk = bOk && pStm->ResetTFlags() ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfTmResetTwoColors(" + ToString( nId) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
//----------------------------------------------------------------------------
bool
ExeSurfTmSetShowEdges( int nId, bool bShow)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie trimesh
ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pStm != nullptr) ;
// imposto lo stato di visualizzazione degli spigoli vivi
if ( bOk)
pStm->SetShowEdges( bShow) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfTmSetShowEdges(" + ToString( nId) + "," +
ToString( bShow) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
//----------------------------------------------------------------------------
bool
ExeSurfTmGetShowEdges( int nId, bool& bShow)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie trimesh
ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pStm != nullptr) ;
// recupero lo stato di visualizzazione degli spigoli vivi
if ( bOk)
bShow = pStm->GetShowEdges() ;
else
bShow = false ;
return bOk ;
}
//----------------------------------------------------------------------------
bool
ExeSurfTmSetSmoothAng( int nId, double dAngDeg)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie trimseh da trimmare
ISurfTriMesh* pSrfTm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
if ( pSrfTm == nullptr)
return false ;
// imposto l'angolo discriminante degli spigoli vivi
pSrfTm->SetSmoothAngle( dAngDeg) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfTmSetSmoothAng(" + ToString( nId) + "," +
ToString( dAngDeg) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return true ;
}
//----------------------------------------------------------------------------
bool
ExeSurfTmGetSmoothAng( int nId, double& dAngDeg)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie trimesh
ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pStm != nullptr) ;
// recupero l'angolo discriminante degli spigoli vivi
if ( bOk)
dAngDeg = pStm->GetSmoothAngle() ;
else
dAngDeg = 0 ;
return bOk ;
}
//----------------------------------------------------------------------------
static double
GetStmOffsPrec( double dOffs, double dLinTol)
{
return max( min( abs( dOffs) / 4., 10. * max( dLinTol, EPS_SMALL)), 0.5) ;
}
//----------------------------------------------------------------------------
int
ExeSurfTmOffset( int nParentId, const INTVECTOR& vStmIds, double dOffs, double dLinTol, int nType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
// se non ci sono superfici non c'è niente da calcolare
if ( vStmIds.empty())
return GDB_ID_NULL ;
// recupero il riferimento del gruppo di inserimento
Frame3d frLoc ;
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
return GDB_ID_NULL ;
// recupero le superfici TriMesh e le porto tutte in locale
SURFLOCALVECTOR vSurfL ; vSurfL.reserve( vStmIds.size()) ;
CISURFTMPVECTOR vpStm ; vpStm.reserve( vStmIds.size()) ;
for ( int i = 0 ; i < int( vStmIds.size()) ; ++ i) {
vSurfL.emplace_back( pGeomDB, vStmIds[i], frLoc) ;
if ( vSurfL[i].Get() == nullptr)
return GDB_ID_NULL ;
vpStm.emplace_back( GetSurfTriMesh( vSurfL[i].Get())) ;
}
// precisione per Tridexel in funzione dell'offset e della tolleranza lineare
double dPrec = GetStmOffsPrec( dOffs, dLinTol) ;
// recupero la superficie risultante
PtrOwner<ISurfTriMesh> pStmOffs( CreateSurfTriMeshesOffset( vpStm, dOffs, dPrec, nType)) ;
bool bOk = ( ! IsNull( pStmOffs) && pStmOffs->IsValid()) ;
int nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pStmOffs)) : GDB_ID_NULL) ;
// copio gli attributi
pGeomDB->CopyAttributes( vStmIds[0], nId) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfTmOffset(" + ToString( nParentId) + ")" +
ToString( vStmIds) + "," +
ToString( dOffs) + "," +
ToString( dLinTol) + "," +
ToString( nType) + ")" +
" -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco il risultato
return nId ;
}
//-------------------------------------------------------------------------------
int
ExeSurfTmThickeningOffset( int nParentId, const INTVECTOR& vStmIds, double dOffs, double dLinTol, int nType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
// se non ci sono superfici non c'è niente da calcolare
if ( vStmIds.empty())
return GDB_ID_NULL ;
// recupero il riferimento del gruppo di inserimento
Frame3d frLoc ;
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
return GDB_ID_NULL ;
// recupero le superfici TriMesh e le porto tutte in locale
SURFLOCALVECTOR vSurfL ; vSurfL.reserve( vStmIds.size()) ;
CISURFTMPVECTOR vpStm ; vpStm.reserve( vStmIds.size()) ;
for ( int i = 0 ; i < int( vStmIds.size()) ; ++ i) {
vSurfL.emplace_back( pGeomDB, vStmIds[i], frLoc) ;
if ( vSurfL[i].Get() == nullptr)
return GDB_ID_NULL ;
vpStm.emplace_back( GetSurfTriMesh( vSurfL[i].Get())) ;
}
// precisione per Tridexel in funzione dell'offset e della tolleranza lineare
double dPrec = GetStmOffsPrec( dOffs, dLinTol) ;
// recupero la superficie risultante
PtrOwner<ISurfTriMesh> pStmOffs( CreateSurfTriMeshesThickeningOffset( vpStm, dOffs, dPrec, nType)) ;
bool bOk = ( ! IsNull( pStmOffs) && pStmOffs->IsValid()) ;
int nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pStmOffs)) : GDB_ID_NULL) ;
// copio gli attributi
pGeomDB->CopyAttributes( vStmIds[0], nId) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfTmThickeningOffset(" + ToString( nParentId) + ")" +
ToString( vStmIds) + "," +
ToString( dOffs) + "," +
ToString( dLinTol) + "," +
ToString( nType) + ")" +
" -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return nId ;
}
//-------------------------------------------------------------------------------
bool
ExeCutSurfBzPlane( int nId, const Point3d& ptOn, const Vector3d& vtN, bool bSaveOnEq, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie TriMesh
ISurfBezier* pSbz = GetSurfBezier( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pSbz != nullptr) ;
// recupero il riferimento locale
Frame3d frLoc ;
bOk = bOk && pGeomDB->GetGlobFrame( nId, frLoc) ;
// porto in locale il punto e la normale del piano
Point3d ptOnL = GetPointLocal( pGeomDB, ptOn, nRefType, frLoc) ;
Vector3d vtNL = GetVectorLocal( pGeomDB, vtN, nRefType, frLoc) ;
// calcolo il piano di taglio
Plane3d plPlane ;
bOk = bOk && plPlane.Set( ptOnL, vtNL) ;
// eseguo il taglio
bOk = bOk && pSbz->Cut( plPlane, bSaveOnEq) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtCutSurfBzPlane(" + IdToString( nId) + ",{" +
ToString( ptOn) + "},{" +
ToString( vtN) + "}," +
( bSaveOnEq ? "true" : "false") + "," +
RefTypeToString( nRefType) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultato
return bOk ;
}
//----------------------------------------------------------------------------
static bool
MySurfBzTrim( int nId, int nTrimmerId)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie Bezier da trimmare
ISurfBezier* pSrfBz = GetSurfBezier( pGeomDB->GetGeoObj( nId)) ;
if ( pSrfBz == nullptr)
return false ;
// recupero il riferimento della superficie
Frame3d frSurf ;
if ( ! pGeomDB->GetGlobFrame( nId, frSurf))
return false ;
// recupero la superficie TriMesh divisore in locale alla prima
SurfLocal SurfCLoc( pGeomDB, nTrimmerId, frSurf) ;
//const ISurfTriMesh* pStmCLoc = GetSurfTriMesh( SurfCLoc) ;
const ISurfFlatRegion* pSrfFr = GetSurfFlatRegion( SurfCLoc) ;
if ( pSrfFr == nullptr)
return false ;
PtrOwner<ISurfFlatRegion> pSrfFrCopy( pSrfFr->Clone()) ;
if ( ! pSrfFr->GetNormVersor().IsZplus())
pSrfFrCopy->Invert() ;
// eseguo il taglio
return pSrfBz->SetTrimRegion( *pSrfFrCopy) ;
}
//----------------------------------------------------------------------------
bool
ExeSurfBzTrim( int nId, int nCutterId)
{
bool bOk = MySurfBzTrim( nId, nCutterId) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfBzCut(" + ToString( nId) + "," +
ToString( nCutterId) + "," +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
+196 -19
View File
@@ -104,10 +104,9 @@ ExeVolZmapChangeResolution( int nId, int nNewRes)
VERIFY_GEOMDB( pGeomDB, false) VERIFY_GEOMDB( pGeomDB, false)
// recupero lo Zmap // recupero lo Zmap
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nId)) ; IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nId)) ;
if ( pVZM == nullptr) bool bOk = ( pVZM != nullptr) ;
return false ;
// cambio la risoluzione (rapporto Voxel/Dexel, valori ammessi 1 e 2) // cambio la risoluzione (rapporto Voxel/Dexel, valori ammessi 1 e 2)
bool bOk = pVZM->ChangeResolution( nNewRes) ; bOk = bOk && pVZM->ChangeResolution( nNewRes) ;
ExeSetModified() ; ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente // se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) { if ( IsCmdLog()) {
@@ -120,6 +119,46 @@ ExeVolZmapChangeResolution( int nId, int nNewRes)
return bOk ; return bOk ;
} }
//----------------------------------------------------------------------------
bool
ExeVolZmapSetShowEdges( int nId, bool bShow)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero lo Zmap
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pVZM != nullptr) ;
// imposto lo stato di visualizzazione degli spigoli vivi
if ( bOk)
pVZM->SetShowEdges( bShow) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtVolZmapSetShowEdges(" + ToString( nId) + "," +
ToString( bShow) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
//----------------------------------------------------------------------------
bool
ExeVolZmapGetShowEdges( int nId, bool& bShow)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero lo Zmap
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pVZM != nullptr) ;
// leggo lo stato di visualizzazione degli spigoli vivi
if ( bOk)
bShow = pVZM->GetShowEdges() ;
else
bShow = false ;
return bOk ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
bool bool
ExeRemoveVolZmapPart( int nId, int nPart) ExeRemoveVolZmapPart( int nId, int nPart)
@@ -144,7 +183,7 @@ ExeRemoveVolZmapPart( int nId, int nPart)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
ExeVolZmapSetStdTool( const INTVECTOR& vIds, const string& sToolName, ExeVolZmapSetStdTool( const INTVECTOR& vIds, const string& sToolName,
double dLen, double dDiam, double dCornR, double dCutterH, int nFlag) double dLen, double dDiam, double dCornR, double dCutterH, int nFlag, bool bFirst)
{ {
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false) VERIFY_GEOMDB( pGeomDB, false)
@@ -152,7 +191,7 @@ ExeVolZmapSetStdTool( const INTVECTOR& vIds, const string& sToolName,
bool bOk = true ; bool bOk = true ;
for ( int i = 0 ; i < int( vIds.size()) ; ++ i) { for ( int i = 0 ; i < int( vIds.size()) ; ++ i) {
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( vIds[i])) ; IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( vIds[i])) ;
bOk = ( pVZM != nullptr && pVZM->SetStdTool( sToolName, dLen, 0.5 * dDiam, dCornR, dCutterH, nFlag)) && bOk ; bOk = ( pVZM != nullptr && pVZM->SetStdTool( sToolName, dLen, 0.5 * dDiam, dCornR, dCutterH, nFlag, bFirst)) && bOk ;
} }
// se richiesto, salvo il comando Lua equivalente // se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) { if ( IsCmdLog()) {
@@ -173,7 +212,7 @@ ExeVolZmapSetStdTool( const INTVECTOR& vIds, const string& sToolName,
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
ExeVolZmapSetAdvTool( const INTVECTOR& vIds, const string& sToolName, ExeVolZmapSetAdvTool( const INTVECTOR& vIds, const string& sToolName,
double dLen, double dDiam, double dTipLen, double dTipDiam, double dCornR, double dCutterH, int nFlag) double dLen, double dDiam, double dTipLen, double dTipDiam, double dCornR, double dCutterH, int nFlag, bool bFirst)
{ {
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false) VERIFY_GEOMDB( pGeomDB, false)
@@ -181,7 +220,7 @@ ExeVolZmapSetAdvTool( const INTVECTOR& vIds, const string& sToolName,
bool bOk = true ; bool bOk = true ;
for ( int i = 0 ; i < int( vIds.size()) ; ++ i) { for ( int i = 0 ; i < int( vIds.size()) ; ++ i) {
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( vIds[i])) ; IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( vIds[i])) ;
bOk = ( pVZM != nullptr && pVZM->SetAdvTool( sToolName, dLen, dDiam / 2, dTipLen, dTipDiam / 2, dCornR, dCutterH, nFlag)) && bOk ; bOk = ( pVZM != nullptr && pVZM->SetAdvTool( sToolName, dLen, dDiam / 2, dTipLen, dTipDiam / 2, dCornR, dCutterH, nFlag, bFirst)) && bOk ;
} }
// se richiesto, salvo il comando Lua equivalente // se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) { if ( IsCmdLog()) {
@@ -204,7 +243,7 @@ ExeVolZmapSetAdvTool( const INTVECTOR& vIds, const string& sToolName,
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
ExeVolZmapSetSawTool( const INTVECTOR& vIds, const string& sToolName, ExeVolZmapSetSawTool( const INTVECTOR& vIds, const string& sToolName,
double dLen, double dDiam, double dThick, double dStemDiam, double dCornR, int nFlag) double dLen, double dDiam, double dThick, double dStemDiam, double dCornR, int nFlag, bool bFirst)
{ {
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false) VERIFY_GEOMDB( pGeomDB, false)
@@ -212,7 +251,7 @@ ExeVolZmapSetSawTool( const INTVECTOR& vIds, const string& sToolName,
bool bOk = true ; bool bOk = true ;
for ( int i = 0 ; i < int( vIds.size()) ; ++ i) { for ( int i = 0 ; i < int( vIds.size()) ; ++ i) {
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( vIds[i])) ; IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( vIds[i])) ;
bOk = ( pVZM != nullptr && pVZM->SetSawTool( sToolName, dLen, dDiam / 2, dThick, dStemDiam / 2, dCornR, nFlag)) && bOk ; bOk = ( pVZM != nullptr && pVZM->SetSawTool( sToolName, dLen, dDiam / 2, dThick, dStemDiam / 2, dCornR, nFlag, bFirst)) && bOk ;
} }
// se richiesto, salvo il comando Lua equivalente // se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) { if ( IsCmdLog()) {
@@ -233,7 +272,7 @@ ExeVolZmapSetSawTool( const INTVECTOR& vIds, const string& sToolName,
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
ExeVolZmapSetGenTool( const INTVECTOR& vIds, const string& sToolName, int nToolSectId, int nFlag) ExeVolZmapSetGenTool( const INTVECTOR& vIds, const string& sToolName, int nToolSectId, int nFlag, bool bFirst)
{ {
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false) VERIFY_GEOMDB( pGeomDB, false)
@@ -243,7 +282,7 @@ ExeVolZmapSetGenTool( const INTVECTOR& vIds, const string& sToolName, int nToolS
// recupero gli Zmap e assegno i dati dell'utensile // recupero gli Zmap e assegno i dati dell'utensile
for ( int i = 0 ; i < int( vIds.size()) ; ++ i) { for ( int i = 0 ; i < int( vIds.size()) ; ++ i) {
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( vIds[i])) ; IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( vIds[i])) ;
bOk = ( pVZM != nullptr && pVZM->SetGenTool( sToolName, pCC, nFlag) && bOk) ; bOk = ( pVZM != nullptr && pVZM->SetGenTool( sToolName, pCC, nFlag, bFirst) && bOk) ;
} }
// se richiesto, salvo il comando Lua equivalente // se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) { if ( IsCmdLog()) {
@@ -261,7 +300,7 @@ ExeVolZmapSetGenTool( const INTVECTOR& vIds, const string& sToolName, int nToolS
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
ExeVolZmapSetMortiserTool( const INTVECTOR& vIds, const string& sToolName, ExeVolZmapSetMortiserTool( const INTVECTOR& vIds, const string& sToolName,
double dLen, double dWidth, double dThick, double dCornR, int nFlag) double dLen, double dWidth, double dThick, double dCornR, int nFlag, bool bFirst)
{ {
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false) VERIFY_GEOMDB( pGeomDB, false)
@@ -269,7 +308,7 @@ ExeVolZmapSetMortiserTool( const INTVECTOR& vIds, const string& sToolName,
bool bOk = true ; bool bOk = true ;
for ( int i = 0 ; i < int( vIds.size()) ; ++ i) { for ( int i = 0 ; i < int( vIds.size()) ; ++ i) {
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( vIds[i])) ; IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( vIds[i])) ;
bOk = ( pVZM != nullptr && pVZM->SetMortiserTool( sToolName, dLen, dWidth, dThick, dCornR, nFlag) && bOk) ; bOk = ( pVZM != nullptr && pVZM->SetMortiserTool( sToolName, dLen, dWidth, dThick, dCornR, nFlag, bFirst) && bOk) ;
} }
// se richiesto, salvo il comando Lua equivalente // se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) { if ( IsCmdLog()) {
@@ -290,7 +329,7 @@ ExeVolZmapSetMortiserTool( const INTVECTOR& vIds, const string& sToolName,
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
ExeVolZmapSetChiselTool( const INTVECTOR& vIds, const string& sToolName, ExeVolZmapSetChiselTool( const INTVECTOR& vIds, const string& sToolName,
double dLen, double dWidth, double dThick, int nFlag) double dLen, double dWidth, double dThick, int nFlag, bool bFirst)
{ {
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false) VERIFY_GEOMDB( pGeomDB, false)
@@ -298,7 +337,7 @@ ExeVolZmapSetChiselTool( const INTVECTOR& vIds, const string& sToolName,
bool bOk = true ; bool bOk = true ;
for ( int i = 0 ; i < int( vIds.size()) ; ++ i) { for ( int i = 0 ; i < int( vIds.size()) ; ++ i) {
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( vIds[i])) ; IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( vIds[i])) ;
bOk = ( pVZM != nullptr && pVZM->SetChiselTool( sToolName, dLen, dWidth, dThick, nFlag) && bOk) ; bOk = ( pVZM != nullptr && pVZM->SetChiselTool( sToolName, dLen, dWidth, dThick, nFlag, bFirst) && bOk) ;
} }
// se richiesto, salvo il comando Lua equivalente // se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) { if ( IsCmdLog()) {
@@ -317,7 +356,8 @@ ExeVolZmapSetChiselTool( const INTVECTOR& vIds, const string& sToolName,
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
ExeVolZmapResetTool( const INTVECTOR& vIds) ExeVolZmapSetAdditiveTool( const INTVECTOR& vIds, const string& sToolName,
double dLen, double dDiam, double dCornR, int nFlag, bool bFirst)
{ {
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false) VERIFY_GEOMDB( pGeomDB, false)
@@ -325,7 +365,34 @@ ExeVolZmapResetTool( const INTVECTOR& vIds)
bool bOk = true ; bool bOk = true ;
for ( int i = 0 ; i < int( vIds.size()) ; ++ i) { for ( int i = 0 ; i < int( vIds.size()) ; ++ i) {
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( vIds[i])) ; IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( vIds[i])) ;
bOk = ( pVZM != nullptr && pVZM->ResetTool() && bOk) ; bOk = ( bOk && pVZM != nullptr && pVZM->SetAdditiveTool( sToolName, dLen, dDiam / 2, dCornR, nFlag, bFirst)) ;
}
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtVolZmapSetAdditiveTool({" + IdListToString( vIds) + "}," +
sToolName + "," +
ToString( dLen) + "," +
ToString( dDiam) + "," +
ToString( dCornR) + "," +
ToString( nFlag) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultato
return bOk ;
}
//----------------------------------------------------------------------------
bool
ExeVolZmapResetTools( const INTVECTOR& vIds)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero gli Zmap e assegno i dati dell'utensile
bool bOk = true ;
for ( int i = 0 ; i < int( vIds.size()) ; ++ i) {
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( vIds[i])) ;
bOk = ( pVZM != nullptr && pVZM->ResetTools() && bOk) ;
} }
// se richiesto, salvo il comando Lua equivalente // se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) { if ( IsCmdLog()) {
@@ -397,7 +464,7 @@ ExeVolZmapMillingStep( int nId, const Point3d& ptPs, const Vector3d& vtDs,
Vector3d vtDeL = GetVectorLocal( pGeomDB, vtDe, nRefType, frLoc) ; Vector3d vtDeL = GetVectorLocal( pGeomDB, vtDe, nRefType, frLoc) ;
// recupero lo Zmap e eseguo movimento di fresatura con l'utensile già associato // recupero lo Zmap e eseguo movimento di fresatura con l'utensile già associato
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nId)) ; IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nId)) ;
bOk = bOk && ( pVZM != nullptr && pVZM->MillingStep( ptPsL, vtDsL, ptPeL, vtDeL)) ; bOk = bOk && ( pVZM != nullptr && pVZM->MillingStep( 0, ptPsL, vtDsL, ptPeL, vtDeL)) ;
ExeSetModified() ; ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente // se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) { if ( IsCmdLog()) {
@@ -433,7 +500,7 @@ ExeVolZmapMillingStep( int nId, const Point3d& ptPs, const Vector3d& vtDs, const
Vector3d vtAeL = GetVectorLocal( pGeomDB, vtAe, nRefType, frLoc) ; Vector3d vtAeL = GetVectorLocal( pGeomDB, vtAe, nRefType, frLoc) ;
// recupero lo Zmap e eseguo movimento di fresatura con l'utensile già associato // recupero lo Zmap e eseguo movimento di fresatura con l'utensile già associato
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nId)) ; IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nId)) ;
bOk = bOk && ( pVZM != nullptr && pVZM->MillingStep( ptPsL, vtDsL, vtAsL, ptPeL, vtDeL, vtAeL)) ; bOk = bOk && ( pVZM != nullptr && pVZM->MillingStep( 0, ptPsL, vtDsL, vtAsL, ptPeL, vtDeL, vtAeL)) ;
ExeSetModified() ; ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente // se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) { if ( IsCmdLog()) {
@@ -485,3 +552,113 @@ ExeCutVolZmapPlane( int nId, const Point3d& ptOn, const Vector3d& vtN, int nRefT
// restituisco risultato // restituisco risultato
return bOk ; return bOk ;
} }
//----------------------------------------------------------------------------
bool
ExeVolZMapOffset( int nId, double dDist, int nType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero lo Zmap
IVolZmap* pVolZmap = GetVolZmap( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pVolZmap != nullptr) ;
// eseguo l'offset
bOk = bOk && pVolZmap->Offset( dDist, nType) ;
// se il risultato è vuoto, cancello lo Zmap
if ( bOk && ! pVolZmap->IsValid())
pGeomDB->Erase( nId) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtVolZmapOffset(" + ToString( nId) + "," +
ToString( dDist) + "," +
ToString( nType) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
//-------------------------------------------------------------------------------
bool
ExeUpdateVolZmapByAddingSurfTm( int nVolZmapId, int nStmId)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero lo Zmap
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nVolZmapId)) ;
bool bOk = ( pVZM != nullptr) ;
// recupero la trimesh
PtrOwner<ISurfTriMesh> pStm( CloneSurfTriMesh( pGeomDB->GetGeoObj( nStmId))) ;
bOk = bOk && !IsNull( pStm) ;
// recupero il frame dello Zmap e della Trimesh
Frame3d frZmap, frStm ;
bOk = bOk && pGeomDB->GetGlobFrame( nVolZmapId, frZmap) &&
pGeomDB->GetGlobFrame( nStmId, frStm) ;
// porto la Stm nel frame dello Zmap
bOk = bOk && pStm->LocToLoc( frStm, frZmap) ;
// aggiorno lo Zmap con la nuova superficie
bOk = bOk && pVZM->AddSurfTm( pStm) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtUpdateVolZmapByAddingSurfTm(" + ToString( nVolZmapId) + "," +
ToString( nStmId) + ")"
" -- bOk =" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
//-------------------------------------------------------------------------------
bool
ExeVolZmapMakeUniform( int nVolZmapId, double dToler, bool bExtensionFirst, int nToolNum)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero lo Zmap
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nVolZmapId)) ;
bool bOk = ( pVZM != nullptr) ;
// aggiorno lo Zmap
dToler = max( dToler, EPS_SMALL) ;
bOk = bOk && pVZM->MakeUniform( dToler, bExtensionFirst, nToolNum) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtVolZmapMakeUniform(" + ToString( nVolZmapId) + "," +
ToString( dToler) + "," +
( bExtensionFirst ? "true" : "false") +
ToString( nToolNum) + ")"
" -- bOk =" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
//--------------------------------------------------------------------------------
bool
ExeVolZMapRemoveFins( int nVolZMapId, const Vector3d& vtDir, double dThick, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false) ;
// Recupero lo ZMap
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nVolZMapId)) ;
bool bOk = ( pVZM != nullptr) ;
// recupero il riferimento locale
Frame3d frLoc ;
bOk = bOk && pGeomDB->GetGlobFrame( nVolZMapId, frLoc) ;
// porto in locale la normale al piano
Vector3d vtDirL = GetVectorLocal( pGeomDB, vtDir, nRefType, frLoc) ;
// Aggiorno lo ZMap mediante rimozione delle alette
bOk = bOk && pVZM->RemoveFins( vtDirL, dThick) ;
// Se richiesto salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtVolZMapRemoveFins(" + ToString( nVolZMapId) + "," +
ToString( vtDir) + "," +
ToString( dThick) + "," +
RefTypeToString( nRefType) + ")" +
" -- bOk =" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
+116 -10
View File
@@ -38,13 +38,56 @@ ExeCopyAttributes( int nSouId, int nDestId)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool bool
ExeSetLevel( int nId, int nLevel) ExeSetLevel( const INTVECTOR& vIds, int nLevel)
{ {
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false) VERIFY_GEOMDB( pGeomDB, false)
// imposto il livello // recupero pezzo e layer correnti
bool bOk = pGeomDB->SetLevel( nId, nLevel) ; bool bCurrPartOff = false ;
bool bCurrLayerOff = false ;
int nCurrPartId = ExeGetCurrPart() ;
int nCurrLayerId = ExeGetCurrLayer() ;
// ciclo sul vettore degli identificativi
bool bOk = true ;
for ( int i = 0 ; i < ssize( vIds) && bOk ; ++ i) {
// impostazione livello
int nId = (( vIds[i] != GDB_ID_SEL) ? vIds[i] : pGeomDB->GetFirstSelectedObj()) ;
while ( nId != GDB_ID_NULL) {
// imposto il livello
if ( ! pGeomDB->SetLevel( nId, nLevel))
bOk = false ;
// se nascosto pezzo corrente o layer corrente
if ( nLevel != GDB_LV_USER) {
if ( nId == nCurrPartId)
bCurrPartOff = true ;
else if ( nId == nCurrLayerId)
bCurrLayerOff = true ;
}
// passo al successivo
nId = (( vIds[i] != GDB_ID_SEL) ? GDB_ID_NULL : pGeomDB->GetNextSelectedObj()) ;
}
}
// se pezzo o layer correnti da rideterminare
bool bPrevCmdLog = SetCmdLog( false) ;
if ( bCurrPartOff)
ExeResetCurrPartLayer() ;
else if ( bCurrLayerOff)
ExeSetCurrPartLayer( nCurrPartId, ExeGetFirstLayer( nCurrPartId, true)) ;
SetCmdLog( bPrevCmdLog) ;
// dichiaro progetto modificato
ExeSetModified() ; ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLevel = "GDB_LV.USER" ;
if ( nLevel == GDB_LV_SYSTEM)
sLevel = "GDB_LV.SYSTEM" ;
else if ( nLevel == GDB_LV_TEMP)
sLevel = "GDB_LV.TEMP" ;
string sLua = "EgtSetLevel({" + IdListToString( vIds) + "}," +
sLevel + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ; return bOk ;
} }
@@ -88,13 +131,56 @@ ExeGetCalcLevel( int nId, int* pnLevel)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool bool
ExeSetMode( int nId, int nMode) ExeSetMode( const INTVECTOR& vIds, int nMode)
{ {
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false) VERIFY_GEOMDB( pGeomDB, false)
// imposto il modo // recupero pezzo e layer correnti
bool bOk = pGeomDB->SetMode( nId, nMode) ; bool bCurrPartOff = false ;
bool bCurrLayerOff = false ;
int nCurrPartId = ExeGetCurrPart() ;
int nCurrLayerId = ExeGetCurrLayer() ;
// ciclo sul vettore degli identificativi
bool bOk = true ;
for ( int i = 0 ; i < ssize( vIds) && bOk ; ++ i) {
// impostazione livello
int nId = (( vIds[i] != GDB_ID_SEL) ? vIds[i] : pGeomDB->GetFirstSelectedObj()) ;
while ( nId != GDB_ID_NULL) {
// imposto il modo
if ( ! pGeomDB->SetMode( nId, nMode))
bOk = false ;
// se nascosto pezzo corrente o layer corrente
if ( nMode != GDB_MD_STD) {
if ( nId == nCurrPartId)
bCurrPartOff = true ;
else if ( nId == nCurrLayerId)
bCurrLayerOff = true ;
}
// passo al successivo
nId = (( vIds[i] != GDB_ID_SEL) ? GDB_ID_NULL : pGeomDB->GetNextSelectedObj()) ;
}
}
// se pezzo o layer correnti da rideterminare
bool bPrevCmdLog = SetCmdLog( false) ;
if ( bCurrPartOff)
ExeResetCurrPartLayer() ;
else if ( bCurrLayerOff)
ExeSetCurrPartLayer( nCurrPartId, ExeGetFirstLayer( nCurrPartId, true)) ;
SetCmdLog( bPrevCmdLog) ;
// dichiaro progetto modificato
ExeSetModified() ; ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sMode = "GDB_MD.STD" ;
if ( nMode == GDB_MD_LOCKED)
sMode = "GDB_MD.LOCKED" ;
else if ( nMode == GDB_MD_HIDDEN)
sMode = "GDB_MD.HIDDEN" ;
string sLua = "EgtSetMode({" + IdListToString( vIds) + "}," +
sMode + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ; return bOk ;
} }
@@ -149,11 +235,11 @@ ExeSetStatus( const INTVECTOR& vIds, int nStat)
int nCurrLayerId = ExeGetCurrLayer() ; int nCurrLayerId = ExeGetCurrLayer() ;
// ciclo sul vettore degli identificativi // ciclo sul vettore degli identificativi
bool bOk = true ; bool bOk = true ;
for ( size_t i = 0 ; i < vIds.size() && bOk ; ++ i) { for ( int i = 0 ; i < ssize( vIds) && bOk ; ++ i) {
// impostazione stato // impostazione stato
int nId = (( vIds[i] != GDB_ID_SEL) ? vIds[i] : pGeomDB->GetFirstSelectedObj()) ; int nId = (( vIds[i] != GDB_ID_SEL) ? vIds[i] : pGeomDB->GetFirstSelectedObj()) ;
while ( nId != GDB_ID_NULL) { while ( nId != GDB_ID_NULL) {
// imposto il modo // imposto lo stato
if ( ! pGeomDB->SetStatus( nId, nStat)) if ( ! pGeomDB->SetStatus( nId, nStat))
bOk = false ; bOk = false ;
// se nascosto pezzo corrente o layer corrente // se nascosto pezzo corrente o layer corrente
@@ -232,12 +318,12 @@ ExeGetCalcStatus( int nId, int* pnStat)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool bool
ExeSetMark( int nId) ExeSetMark( int nId, int nMark)
{ {
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false) VERIFY_GEOMDB( pGeomDB, false)
// imposto l'evidenziazione // imposto l'evidenziazione
bool bOk = pGeomDB->SetMark( nId) ; bool bOk = pGeomDB->SetMark( nId, nMark) ;
// non produce modifica perchè mark ignorato in salvataggio // non produce modifica perchè mark ignorato in salvataggio
return bOk ; return bOk ;
} }
@@ -746,6 +832,16 @@ ExeRemoveInfo( int nId, const string& sKey)
return bOk ; return bOk ;
} }
//-----------------------------------------------------------------------------
bool
ExeGetAllInfo( int nId, STRVECTOR& vsInfo)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero tutte le info
return pGeomDB->GetAllInfo( nId, vsInfo) ;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool bool
ExeSetTextureName( int nId, const string& sTxrName) ExeSetTextureName( int nId, const string& sTxrName)
@@ -816,3 +912,13 @@ ExeGetTextureFrame( int nId, int nRefId, Frame3d& frTxrRef)
// gestione trasformazione ( eventuale) // gestione trasformazione ( eventuale)
return TransformFrame( pGeomDB, nId, nRefId, frTxrRef) ; return TransformFrame( pGeomDB, nId, nRefId, frTxrRef) ;
} }
//-----------------------------------------------------------------------------
bool
ExeSetStipple( int nId, int nFactor, int nPattern)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// setto stipple
return pGeomDB->SetStipple( nId, nFactor, nPattern) ;
}
+19
View File
@@ -15,6 +15,7 @@
#include "stdafx.h" #include "stdafx.h"
#include "EXE.h" #include "EXE.h"
#include "EXE_Macro.h" #include "EXE_Macro.h"
#include "AuxDialogBox.h"
#include "/EgtDev/Include/EXeExecutor.h" #include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EGkStringUtils3d.h" #include "/EgtDev/Include/EGkStringUtils3d.h"
#include "/EgtDev/Include/EgtStringConverter.h" #include "/EgtDev/Include/EgtStringConverter.h"
@@ -76,6 +77,9 @@ ExeSelectObj( int nId)
" -- Ok=" + ToString( bOk) ; " -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
// verifico se presente un dialogo modeless per aggiornare i valori
if ( bOk && phDlgModeless != nullptr && nDlgModelessItem != -1)
UpdateIdsModelessDialog( phDlgModeless, nDlgModelessItem) ;
// restituisco risultato // restituisco risultato
return bOk ; return bOk ;
} }
@@ -100,6 +104,9 @@ ExeDeselectObj( int nId)
" -- Ok=" + ToString( bOk) ; " -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
// verifico se presente un dialogo modeless per aggiornare i valori
if ( bOk && phDlgModeless != nullptr && nDlgModelessItem != -1)
UpdateIdsModelessDialog( phDlgModeless, nDlgModelessItem) ;
// restituisco risultato // restituisco risultato
return bOk ; return bOk ;
} }
@@ -139,6 +146,9 @@ ExeSelectAll( bool bOnlyIfVisible)
" -- bOk=1" ; " -- bOk=1" ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
// verifico se presente un dialogo modeless per aggiornare i valori
if ( phDlgModeless != nullptr && nDlgModelessItem != -1)
UpdateIdsModelessDialog( phDlgModeless, nDlgModelessItem) ;
// restituisco risultato // restituisco risultato
return true ; return true ;
} }
@@ -160,6 +170,9 @@ ExeDeselectAll( void)
" -- Ok=" + ToString( bOk) ; " -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
// verifico se presente un dialogo modeless per aggiornare i valori
if ( bOk && phDlgModeless != nullptr && nDlgModelessItem != -1)
UpdateIdsModelessDialog( phDlgModeless, nDlgModelessItem) ;
// restituisco risultato // restituisco risultato
return bOk ; return bOk ;
} }
@@ -186,6 +199,9 @@ ExeSelectGroupObjs( int nGroupId)
" -- Ok=" + ToString( bOk) ; " -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
// verifico se presente un dialogo modeless per aggiornare i valori
if ( bOk && phDlgModeless != nullptr && nDlgModelessItem != -1)
UpdateIdsModelessDialog( phDlgModeless, nDlgModelessItem) ;
// restituisco risultato // restituisco risultato
return bOk ; return bOk ;
} }
@@ -209,6 +225,9 @@ ExeDeselectGroupObjs( int nGroupId)
" -- Ok=" + ToString( bOk) ; " -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
// verifico se presente un dialogo modeless per aggiornare i valori
if ( bOk && phDlgModeless != nullptr && nDlgModelessItem != -1)
UpdateIdsModelessDialog( phDlgModeless, nDlgModelessItem) ;
// restituisco risultato // restituisco risultato
return bOk ; return bOk ;
} }
+142 -40
View File
@@ -15,8 +15,10 @@
#include "stdafx.h" #include "stdafx.h"
#include "EXE.h" #include "EXE.h"
#include "EXE_Macro.h" #include "EXE_Macro.h"
#include "GeoTools.h"
#include "AuxTools.h" #include "AuxTools.h"
#include "/EgtDev/Include/EXeExecutor.h" #include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EGkMultiGeomDB.h"
#include "/EgtDev/Include/EGkStringUtils3d.h" #include "/EgtDev/Include/EGkStringUtils3d.h"
#include "/EgtDev/Include/EGkUiUnits.h" #include "/EgtDev/Include/EGkUiUnits.h"
#include "/EgtDev/Include/EgtStringConverter.h" #include "/EgtDev/Include/EgtStringConverter.h"
@@ -218,6 +220,43 @@ ExeGetPrevName( int nId, const string& sName)
return pGeomDB->GetPrevName( nId, sName) ; return pGeomDB->GetPrevName( nId, sName) ;
} }
//-----------------------------------------------------------------------------
bool
ExeGetNameInGroup( int nGroupId, const string& sName, INTVECTOR& vIds)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
if ( ! pGeomDB->ExistsObj( nGroupId))
return false ;
// recupero gli oggetti con il nome desiderato
vIds.clear() ;
int nId = pGeomDB->GetFirstNameInGroup( nGroupId, sName) ;
while ( nId != GDB_ID_NULL) {
vIds.push_back( nId) ;
nId = pGeomDB->GetNextName( nId, sName) ;
}
return true ;
}
//-----------------------------------------------------------------------------
bool
ExeGetInfoInGroup( int nGroupId, const string& sKey, INTVECTOR& vIds)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
if ( ! pGeomDB->ExistsObj( nGroupId))
return false ;
// recupero gli oggetti con l'info desiderata
vIds.clear() ;
int nId = pGeomDB->GetFirstInGroup( nGroupId) ;
while ( nId != GDB_ID_NULL) {
if ( pGeomDB->ExistsInfo( nId, sKey))
vIds.push_back( nId) ;
nId = pGeomDB->GetNext( nId) ;
}
return true ;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool bool
ExeGetBBox( int nId, int nFlag, BBox3d& b3Box) ExeGetBBox( int nId, int nFlag, BBox3d& b3Box)
@@ -254,6 +293,7 @@ ExeCopy( int nSouId, int nRefId, int nSonBeforeAfter)
{ {
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nRefId = AdjustId( nRefId) ;
// eseguo la copia // eseguo la copia
int nNewId = pGeomDB->Copy( nSouId, GDB_ID_NULL, nRefId, nSonBeforeAfter) ; int nNewId = pGeomDB->Copy( nSouId, GDB_ID_NULL, nRefId, nSonBeforeAfter) ;
pGeomDB->RemoveInfo( nNewId, GDB_SI_LIST) ; pGeomDB->RemoveInfo( nNewId, GDB_SI_LIST) ;
@@ -261,16 +301,39 @@ ExeCopy( int nSouId, int nRefId, int nSonBeforeAfter)
ExeSetModified() ; ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente // se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) { if ( IsCmdLog()) {
string sLua ; string sLua = "EgtCopy(" + ToString( nSouId) + "," +
if ( nSonBeforeAfter == GDB_LAST_SON) IdToString( nRefId) + "," +
sLua = "EgtCopy(" + ToString( nSouId) + "," + InsToString( nSonBeforeAfter) + ")" +
ToString( nRefId) + ")" + " -- Id=" + ToString( nNewId) ;
" -- Id=" + ToString( nNewId) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
else }
sLua = "EgtCopy(" + ToString( nSouId) + "," + // restituisco risultato
ToString( nRefId) + "," + return nNewId ;
InsToString( nSonBeforeAfter) + ")" + }
" -- Id=" + ToString( nNewId) ;
//-----------------------------------------------------------------------------
int
ExeCopyEx( int nSouCtx, int nSouId, int nDestCtx, int nRefId, int nSonBeforeAfter)
{
// recupero i due GeomDB
IGeomDB* pSouGeomDB = GetGeomDB( nSouCtx) ;
VERIFY_GEOMDB( pSouGeomDB, GDB_ID_NULL)
IGeomDB* pDstGeomDB = GetGeomDB( nDestCtx) ;
VERIFY_GEOMDB( pDstGeomDB, GDB_ID_NULL)
// risolvo l'Id di riferimento per destinazione
nRefId = AdjustId( nRefId, nDestCtx) ;
// eseguo la copia
int nNewId = Copy( pSouGeomDB, nSouId, pDstGeomDB, GDB_ID_NULL, nRefId, nSonBeforeAfter) ;
pDstGeomDB->RemoveInfo( nNewId, GDB_SI_LIST) ;
pDstGeomDB->RemoveInfo( nNewId, GDB_SI_DUPLIST) ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtCopyEx(" + ToString( nSouCtx) + "," +
ToString( nSouId) + "," +
ToString( nDestCtx) + "," +
IdToString( nRefId) + "," +
InsToString( nSonBeforeAfter) + ")" +
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
// restituisco risultato // restituisco risultato
@@ -283,6 +346,7 @@ ExeCopyGlob( int nSouId, int nRefId, int nSonBeforeAfter)
{ {
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nRefId = AdjustId( nRefId) ;
// eseguo la copia mantenendo la posizione in globale // eseguo la copia mantenendo la posizione in globale
int nNewId = pGeomDB->CopyGlob( nSouId, GDB_ID_NULL, nRefId, nSonBeforeAfter) ; int nNewId = pGeomDB->CopyGlob( nSouId, GDB_ID_NULL, nRefId, nSonBeforeAfter) ;
pGeomDB->RemoveInfo( nNewId, GDB_SI_LIST) ; pGeomDB->RemoveInfo( nNewId, GDB_SI_LIST) ;
@@ -290,43 +354,84 @@ ExeCopyGlob( int nSouId, int nRefId, int nSonBeforeAfter)
ExeSetModified() ; ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente // se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) { if ( IsCmdLog()) {
string sLua ; string sLua = "EgtCopyGlob(" + ToString( nSouId) + "," +
if ( nSonBeforeAfter == GDB_LAST_SON) IdToString( nRefId) + "," +
sLua = "EgtCopyGlob(" + ToString( nSouId) + "," + InsToString( nSonBeforeAfter) + ")" +
ToString( nRefId) + ")" + " -- Id=" + ToString( nNewId) ;
" -- Id=" + ToString( nNewId) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
else }
sLua = "EgtCopyGlob(" + ToString( nSouId) + "," + // restituisco risultato
ToString( nRefId) + "," + return nNewId ;
InsToString( nSonBeforeAfter) + ")" + }
" -- Id=" + ToString( nNewId) ;
//-----------------------------------------------------------------------------
int
ExeCopyGlobEx( int nSouCtx, int nSouId, int nDestCtx, int nRefId, int nSonBeforeAfter)
{
// recupero i due GeomDB
IGeomDB* pSouGeomDB = GetGeomDB( nSouCtx) ;
VERIFY_GEOMDB( pSouGeomDB, GDB_ID_NULL)
IGeomDB* pDstGeomDB = GetGeomDB( nDestCtx) ;
VERIFY_GEOMDB( pDstGeomDB, GDB_ID_NULL)
// risolvo l'Id di riferimento per destinazione
nRefId = AdjustId( nRefId, nDestCtx) ;
// eseguo la copia
int nNewId = CopyGlob( pSouGeomDB, nSouId, pDstGeomDB, GDB_ID_NULL, nRefId, nSonBeforeAfter) ;
pDstGeomDB->RemoveInfo( nNewId, GDB_SI_LIST) ;
pDstGeomDB->RemoveInfo( nNewId, GDB_SI_DUPLIST) ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtCopyGlobEx(" + ToString( nSouCtx) + "," +
ToString( nSouId) + "," +
ToString( nDestCtx) + "," +
IdToString( nRefId) + "," +
InsToString( nSonBeforeAfter) + ")" +
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
// restituisco risultato // restituisco risultato
return nNewId ; return nNewId ;
} }
//-----------------------------------------------------------------------------
bool
ExeDuplicateGeomDB( int nSouCtx, int nDestCtx, bool bSkipTemp)
{
// recupero i due GeomDB
IGeomDB* pSouGeomDB = GetGeomDB( nSouCtx) ;
VERIFY_GEOMDB( pSouGeomDB, GDB_ID_NULL)
IGeomDB* pDstGeomDB = GetGeomDB( nDestCtx) ;
VERIFY_GEOMDB( pDstGeomDB, GDB_ID_NULL)
// eseguo la duplicazione del primo GeomDB nel secondo
bool bOk = DuplicateGeomDB( pSouGeomDB, pDstGeomDB, bSkipTemp) ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtDuplicateGeomDB(" + ToString( nSouCtx) + "," +
ToString( nDestCtx) + "," +
( bSkipTemp ? "true" : "false") + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultato
return bOk ;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool bool
ExeRelocate( int nSouId, int nRefId, int nSonBeforeAfter) ExeRelocate( int nSouId, int nRefId, int nSonBeforeAfter)
{ {
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false) VERIFY_GEOMDB( pGeomDB, false)
nRefId = AdjustId( nRefId) ;
// eseguo la rilocazione // eseguo la rilocazione
bool bOk = pGeomDB->Relocate( nSouId, nRefId, nSonBeforeAfter) ; bool bOk = pGeomDB->Relocate( nSouId, nRefId, nSonBeforeAfter) ;
ExeSetModified() ; ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente // se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) { if ( IsCmdLog()) {
string sLua ; string sLua = "EgtRelocate(" + ToString( nSouId) + "," +
if ( nSonBeforeAfter == GDB_LAST_SON) IdToString( nRefId) + "," +
sLua = "EgtRelocate(" + ToString( nSouId) + "," + InsToString( nSonBeforeAfter) + ")" +
ToString( nRefId) + ")" + " -- Ok=" + ToString( bOk) ;
" -- Ok=" + ToString( bOk) ;
else
sLua = "EgtRelocate(" + ToString( nSouId) + "," +
ToString( nRefId) + "," +
InsToString( nSonBeforeAfter) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
// restituisco risultato // restituisco risultato
@@ -339,21 +444,16 @@ ExeRelocateGlob( int nSouId, int nRefId, int nSonBeforeAfter)
{ {
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false) VERIFY_GEOMDB( pGeomDB, false)
nRefId = AdjustId( nRefId) ;
// eseguo la rilocazione mantenendo la posizione in globale // eseguo la rilocazione mantenendo la posizione in globale
bool bOk = pGeomDB->RelocateGlob( nSouId, nRefId, nSonBeforeAfter) ; bool bOk = pGeomDB->RelocateGlob( nSouId, nRefId, nSonBeforeAfter) ;
ExeSetModified() ; ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente // se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) { if ( IsCmdLog()) {
string sLua ; string sLua = "EgtRelocateGlob(" + ToString( nSouId) + "," +
if ( nSonBeforeAfter == GDB_LAST_SON) IdToString( nRefId) + "," +
sLua = "EgtRelocateGlob(" + ToString( nSouId) + "," + InsToString( nSonBeforeAfter) + ")" +
ToString( nRefId) + ")" + " -- Ok=" + ToString( bOk) ;
" -- Ok=" + ToString( bOk) ;
else
sLua = "EgtRelocateGlob(" + ToString( nSouId) + "," +
ToString( nRefId) + "," +
InsToString( nSonBeforeAfter) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
// restituisco risultato // restituisco risultato
@@ -594,6 +694,8 @@ ExeGeoObjDump( int nId, string& sDump)
sDump = pGeoObj->GetTitle() + " " + ToString( nId) + "\r\n" ; sDump = pGeoObj->GetTitle() + " " + ToString( nId) + "\r\n" ;
// preparo gli attributi // preparo gli attributi
pGeomDB->DumpAttributes( nId, sDump, bMM, "\r\n") ; pGeomDB->DumpAttributes( nId, sDump, bMM, "\r\n") ;
// preparo stipple
pGeomDB->DumpStipple( nId, sDump, bMM, "\r\n") ;
// preparo TextureData // preparo TextureData
pGeomDB->DumpTextureData( nId, sDump, bMM, "\r\n") ; pGeomDB->DumpTextureData( nId, sDump, bMM, "\r\n") ;
// preparo UserObj // preparo UserObj
+150 -14
View File
@@ -344,6 +344,26 @@ ExeGetPrevLayer( int nId, bool bOnlyVisible)
return ExeVerifyOrPrev( pGeomDB, nLayerId, bOnlyVisible) ; return ExeVerifyOrPrev( pGeomDB, nLayerId, bOnlyVisible) ;
} }
//-------------------------------------------------------------------------------
bool
ExeIsGhostPart( int nGhostId)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// verifico sia il segnaposto di un pezzo (Ghost)
if ( pGeomDB->GetGdbType( nGhostId) == GDB_TY_GROUP &&
pGeomDB->GetParentId( nGhostId) == GDB_ID_ROOT &&
ExeIsSystemObj( pGeomDB, nGhostId) &&
pGeomDB->ExistsInfo( nGhostId, GDB_SI_SOURCE)) {
int nPartId = GDB_ID_NULL ;
pGeomDB->GetInfo( nGhostId, GDB_SI_SOURCE, nPartId) ;
int nRawId = pGeomDB->GetParentId( nPartId) ;
if ( ExeIsRawPart( nRawId))
return true ;
}
return false ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
int int
ExeGetFirstGhostPart( void) ExeGetFirstGhostPart( void)
@@ -677,6 +697,32 @@ IsPartForDuplo( IGeomDB* pGeomDB, int nPartId)
return false ; return false ;
} }
//-----------------------------------------------------------------------------
static bool
IsDuplo( IGeomDB* pGeomDB, int nDupId, bool& bInDuploGroup)
{
// verifica collegamento a DB geometrico
if ( pGeomDB == nullptr)
return false ;
// Recupero il gruppo base dei duplicati
int nDuploBaseId = GetDuploBase( pGeomDB) ;
if ( nDuploBaseId == GDB_ID_NULL)
return false ;
// Verifico sia un duplicato (gruppo sotto quello dei duplicati con riferimento a originale)
int nBaseId ;
if ( pGeomDB->GetGdbType( nDupId) == GDB_TY_GROUP && pGeomDB->ExistsInfo( nDupId, GDB_SI_DUPSOU)) {
if ( pGeomDB->GetParentId( nDupId) == nDuploBaseId) {
bInDuploGroup = true ;
return true ;
}
else if ( pGeomDB->GetInfo( nDupId, GDB_SI_BASE, nBaseId) && pGeomDB->GetParentId( nBaseId) == nDuploBaseId) {
bInDuploGroup = false ;
return true ;
}
}
return false ;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
int int
ExeDuploNew( int nSouId) ExeDuploNew( int nSouId)
@@ -729,7 +775,8 @@ ExeDuploCount( int nSouId, int& nCount)
// Conto i reali duplo // Conto i reali duplo
nCount = 0 ; nCount = 0 ;
for ( int i = 0 ; i < int( vnRef.size()) ; ++ i) { for ( int i = 0 ; i < int( vnRef.size()) ; ++ i) {
if ( ExeIsDuplo( vnRef[i])) bool bInDuploGroup ;
if ( IsDuplo( pGeomDB, vnRef[i], bInDuploGroup))
++ nCount ; ++ nCount ;
} }
return true ; return true ;
@@ -754,6 +801,105 @@ ExeDuploList( int nSouId, INTVECTOR& vnRef)
return true ; return true ;
} }
//-----------------------------------------------------------------------------
bool
ExeDuploInRawCount( int nSouId, int& nCount)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// Verifico sia un pezzo
if ( ! IsPartForDuplo( pGeomDB, nSouId))
return false ;
// Recupero info del sorgente
INTVECTOR vnRef ;
pGeomDB->GetInfo( nSouId, GDB_SI_DUPLIST, vnRef) ;
// Conto i reali duplo che sono riferiti o che stanno in un grezzo
nCount = 0 ;
for ( int i = 0 ; i < int( vnRef.size()) ; ++ i) {
// verifico sia un duplo
int nDupId = vnRef[i] ;
bool bInDuploGroup ;
if ( ! IsDuplo( pGeomDB, nDupId, bInDuploGroup))
continue ;
// se nel gruppo dei duplo
if ( bInDuploGroup) {
// verifico sia incluso in un grezzo di un gruppo di lavoro
INTVECTOR vnRef ;
if ( ! pGeomDB->GetInfo( nDupId, GDB_SI_LIST, vnRef))
continue ;
for ( auto& nId : vnRef) {
// verifico esista
if ( ! pGeomDB->ExistsObj( nId))
continue ;
// verifico sia in un grezzo (previsto solo in uno come massimo)
int nMachGrpId = pGeomDB->GetParentId( pGeomDB->GetParentId( pGeomDB->GetParentId( nId))) ;
string sMachGrpName ;
if ( ExeGetMachGroupName( nMachGrpId, sMachGrpName)) {
++ nCount ;
break ;
}
}
}
// se in altro gruppo
else {
// verifico se incluso nel grezzo del gruppo di lavoro corrente (previsto solo in un gruppo)
if ( ExeIsRawPart( pGeomDB->GetParentId( nDupId)))
++ nCount ;
}
}
return true ;
}
//-----------------------------------------------------------------------------
bool
ExeDuploWithoutRawList( INTVECTOR& vnDup)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// Reset del risultato
vnDup.clear() ;
// Recupero gruppo dei duplo
int nDuploBaseId = GetDuploBase( pGeomDB) ;
if ( nDuploBaseId == GDB_ID_NULL)
return true ;
// Ciclo sui duplo
for ( int nDuploId = pGeomDB->GetFirstGroupInGroup( nDuploBaseId) ;
nDuploId != GDB_ID_NULL ;
nDuploId = pGeomDB->GetNextGroup( nDuploId)) {
// se marcatore
if ( pGeomDB->ExistsInfo( nDuploId, GDB_SI_SOURCE)) {
int nPartId = GDB_ID_NULL ;
pGeomDB->GetInfo( nDuploId, GDB_SI_SOURCE, nPartId) ;
int nMachGrpId = pGeomDB->GetParentId( pGeomDB->GetParentId( pGeomDB->GetParentId( nPartId))) ;
string sMachGrpName ;
if ( pGeomDB->ExistsInfo( nPartId, GDB_SI_DUPSOU) && ExeGetMachGroupName( nMachGrpId, sMachGrpName))
continue ;
}
// se vero duplo
else if ( pGeomDB->ExistsInfo( nDuploId, GDB_SI_DUPSOU) && pGeomDB->ExistsInfo( nDuploId, GDB_SI_LIST)) {
// verifico sia incluso in un grezzo di un gruppo di lavoro
bool bFound = false ;
INTVECTOR vnRef ;
pGeomDB->GetInfo( nDuploId, GDB_SI_LIST, vnRef) ;
for ( auto& nId : vnRef) {
// verifico sia in un grezzo (previsto solo in uno come massimo)
int nMachGrpId = pGeomDB->GetParentId( pGeomDB->GetParentId( pGeomDB->GetParentId( nId))) ;
string sMachGrpName ;
if ( ExeGetMachGroupName( nMachGrpId, sMachGrpName)) {
bFound = true ;
break ;
}
}
if ( bFound)
continue ;
}
// inserisco nella lista dei duplo senza grezzo
vnDup.emplace_back( nDuploId) ;
}
return true ;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool bool
ExeDuploSetModified( int nSouId) ExeDuploSetModified( int nSouId)
@@ -955,19 +1101,9 @@ ExeIsDuplo( int nDupId)
{ {
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false) VERIFY_GEOMDB( pGeomDB, false)
// Recupero il gruppo base dei duplicati // Verifico sia un duplicato
int nDuploBaseId = GetDuploBase( pGeomDB) ; bool bPartVsGhost ;
if ( nDuploBaseId == GDB_ID_NULL) return IsDuplo( pGeomDB, nDupId, bPartVsGhost) ;
return false ;
// Verifico sia un duplicato (gruppo sotto quello dei duplicati con riferimento a originale)
int nBaseId ;
if ( pGeomDB->GetGdbType( nDupId) == GDB_TY_GROUP &&
( pGeomDB->GetParentId( nDupId) == nDuploBaseId ||
( pGeomDB->GetInfo( nDupId, GDB_SI_BASE, nBaseId) && pGeomDB->GetParentId( nBaseId) == nDuploBaseId)) &&
pGeomDB->ExistsInfo( nDupId, GDB_SI_DUPSOU))
return true ;
else
return false ;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
+167 -16
View File
@@ -1,13 +1,14 @@
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// EgalTech 2014-2015 // EgalTech 2014-2023
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// File : EXE_General.cpp Data : 01.09.14 Versione : 1.5i1 // File : EXE_General.cpp Data : 14.11.23 Versione : 2.5k2
// Contenuto : Funzioni generali per EXE. // Contenuto : Funzioni generali per EXE.
// //
// //
// //
// Modifiche : 01.09.14 DS Creazione modulo. // Modifiche : 01.09.14 DS Creazione modulo.
// 28.11.19 DS Aggiunto caricamento opzionale del Nesting. // 28.11.19 DS Aggiunto caricamento opzionale di Nesting.
// 14.11.23 DS Aggiunto caricamento opzionale di Exchange 3dm.
// //
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -17,6 +18,7 @@
#include "LUA_Base.h" #include "LUA_Base.h"
#include "DllGraphics.h" #include "DllGraphics.h"
#include "DllExchange.h" #include "DllExchange.h"
#include "DllExch3dm.h"
#include "DllMachKernel.h" #include "DllMachKernel.h"
#include "DllNesting.h" #include "DllNesting.h"
#include "/EgtDev/Include/EXeExecutor.h" #include "/EgtDev/Include/EXeExecutor.h"
@@ -29,9 +31,11 @@
#include "/EgtDev/Include/EGnFileUtils.h" #include "/EgtDev/Include/EGnFileUtils.h"
#include "/EgtDev/Include/EGnGetModuleVer.h" #include "/EgtDev/Include/EGnGetModuleVer.h"
#include "/EgtDev/Include/EGnPcInfo.h" #include "/EgtDev/Include/EGnPcInfo.h"
#include "/EgtDev/Include/EGnGetKeyData.h"
#include "/EgtDev/Include/EgtIniFile.h" #include "/EgtDev/Include/EgtIniFile.h"
#include "/EgtDev/Include/EgtLogger.h" #include "/EgtDev/Include/EgtLogger.h"
#include "/EgtDev/Include/EgtStringConverter.h" #include "/EgtDev/Include/EgtStringConverter.h"
#include "/EgtDev/Include/EgtKeyCodes.h"
#include "/EgtDev/Include/SELkLockId.h" #include "/EgtDev/Include/SELkLockId.h"
#include "/EgtDev/Include/SELkKeyProc.h" #include "/EgtDev/Include/SELkKeyProc.h"
#include <fstream> #include <fstream>
@@ -49,12 +53,15 @@ static string s_sKey ;
static int s_nKeyType = KEY_LOCK_TYPE_ANY ; static int s_nKeyType = KEY_LOCK_TYPE_ANY ;
static bool s_bNetHwKey = false ; static bool s_bNetHwKey = false ;
static int s_nKeyExpDays = 0 ; static int s_nKeyExpDays = 0 ;
static int s_nKeyAssExpDays = 0 ;
static int s_nKeyOptExpDays = 0 ; static int s_nKeyOptExpDays = 0 ;
static string s_sNestKey ; static string s_sNestKey ;
static string s_sLockId ;
static string s_sIniFile ; static string s_sIniFile ;
static bool s_bEnableUI = true ; static bool s_bEnableUI = true ;
static pfProcEvents s_pFunProcEvents = nullptr ; static psfOnTerminateProcess s_pFunOnTerminateProcess = nullptr ;
static pfOutText s_pFunOutText = nullptr ; static psfProcEvents s_pFunProcEvents = nullptr ;
static psfOutText s_pFunOutText = nullptr ;
static HWND s_hMainWnd = nullptr ; static HWND s_hMainWnd = nullptr ;
static string s_sTempDir ; static string s_sTempDir ;
@@ -68,6 +75,7 @@ ExeInit( int nDebug, const string& sLogFile, const string& sLogMsg)
if ( s_pGenLog != nullptr) if ( s_pGenLog != nullptr)
delete s_pGenLog ; delete s_pGenLog ;
// cancello riferimenti a funzioni installate // cancello riferimenti a funzioni installate
s_pFunOnTerminateProcess = nullptr ;
s_pFunProcEvents = nullptr ; s_pFunProcEvents = nullptr ;
s_pFunOutText = nullptr ; s_pFunOutText = nullptr ;
s_bEnableUI = true ; s_bEnableUI = true ;
@@ -110,12 +118,15 @@ ExeInit( int nDebug, const string& sLogFile, const string& sLogMsg)
if ( LoadExchangeDll( s_pGenLog, s_sKey, s_bNetHwKey)) if ( LoadExchangeDll( s_pGenLog, s_sKey, s_bNetHwKey))
LOG_INFO( s_pGenLog, MyGetEExVersion()) LOG_INFO( s_pGenLog, MyGetEExVersion())
// la libreria exchange 3dm opzionale viene caricata solo al momento del bisogno
// (è molto lento il caricamento di OpenNurbs)
// carico libreria di lavorazione opzionale // carico libreria di lavorazione opzionale
if ( LoadMachKernelDll( s_pGenLog, s_sKey, s_bNetHwKey)) if ( LoadMachKernelDll( s_pGenLog, s_sKey, s_bNetHwKey))
LOG_INFO( s_pGenLog, MyGetEMkVersion()) LOG_INFO( s_pGenLog, MyGetEMkVersion())
// carico libreria nesting opzionale (non può usare la chiave di rete) // carico libreria nesting opzionale (non può usare la chiave di rete)
if ( LoadNestingDll( s_pGenLog, s_sKey, s_sNestKey)) if ( LoadNestingDll( s_pGenLog, s_sKey, s_sNestKey, s_bNetHwKey))
LOG_INFO( s_pGenLog, MyGetENsVersion()) LOG_INFO( s_pGenLog, MyGetENsVersion())
// Info sulla protezione e sul sistema // Info sulla protezione e sul sistema
@@ -166,9 +177,11 @@ ExeExit( void)
// libero le librerie opzionali // libero le librerie opzionali
FreeMachKernelDll() ; FreeMachKernelDll() ;
FreeExchangeDll() ; FreeExchangeDll() ;
FreeExch3dmDll() ;
FreeGraphicsDll() ; FreeGraphicsDll() ;
// cancello riferimenti a funzioni installate // cancello riferimenti a funzioni installate
s_pFunOnTerminateProcess = nullptr ;
s_pFunProcEvents = nullptr ; s_pFunProcEvents = nullptr ;
s_pFunOutText = nullptr ; s_pFunOutText = nullptr ;
s_bEnableUI = true ; s_bEnableUI = true ;
@@ -188,9 +201,37 @@ ExeExit( void)
s_pGenLog = nullptr ; s_pGenLog = nullptr ;
} }
// libero eventuale chiave di rete
if ( s_bNetHwKey)
CloseNetHwKey() ;
return true ; return true ;
} }
//-----------------------------------------------------------------------------
bool
ExeSetOnTerminateProcess( psfOnTerminateProcess pFun)
{
s_pFunOnTerminateProcess = pFun ;
return ( pFun != nullptr) ;
}
//-----------------------------------------------------------------------------
bool
ExeOnTerminateProcess( int nExitCode)
{
// lancio eventuale callback
bool bTerminate = true ;
if ( s_pFunOnTerminateProcess != nullptr)
bTerminate = s_pFunOnTerminateProcess( nExitCode) ;
// se confermata chiusura, libero eventuale chiave di rete
if ( bTerminate && s_bNetHwKey)
CloseNetHwKey() ;
return bTerminate ;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
int int
ExeGetDebugLevel( void) ExeGetDebugLevel( void)
@@ -218,6 +259,7 @@ bool
ExeSetKey( const string& sKey) ExeSetKey( const string& sKey)
{ {
s_sKey = sKey ; s_sKey = sKey ;
SetEGnKey( s_sKey) ;
return true ; return true ;
} }
@@ -248,23 +290,106 @@ bool
ExeSetLockType( int nType) ExeSetLockType( int nType)
{ {
s_nKeyType = nType ; s_nKeyType = nType ;
SetEGnKeyType( s_nKeyType) ;
return SetLockType( nType) ; return SetLockType( nType) ;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool bool
ExeSetNetHwKey( bool bNetHwKey) ExeSetLockId( const string& sLockId)
{
int nKeyType ;
bool bNetKey ;
int nUserId ;
GetLockIdStringInfo( sLockId, nKeyType, bNetKey, nUserId) ;
bool bOk ;
switch ( nKeyType) {
default :
ExeSetNetHwKey( false) ;
bOk = false ;
break ;
case KEY_LOCK_TYPE_SW :
ExeSetNetHwKey( false) ;
bOk = ( s_nKeyType != KEY_LOCK_TYPE_HW) ;
break ;
case KEY_LOCK_TYPE_HW :
{ string sAddrPort ;
GetLockIdStringNetData( sLockId, sAddrPort) ;
ExeSetNetHwKey( bNetKey, nUserId, sAddrPort) ;
bOk = true ;
break ;
}
}
if ( bOk)
s_sLockId = sLockId ;
else
s_sLockId = "" ;
return bOk ;
}
//-----------------------------------------------------------------------------
const string&
ExeGetLockId( void)
{
if ( s_sLockId.empty())
GetLockId( s_sLockId) ;
return s_sLockId ;
}
//-----------------------------------------------------------------------------
bool
ExeSetNetHwKey( bool bNetHwKey, int nUserId, const string& sAddrPort)
{ {
s_bNetHwKey = bNetHwKey ; s_bNetHwKey = bNetHwKey ;
return SetNetHwKey( bNetHwKey) ; SetEGnNetHwKey( s_bNetHwKey) ;
return SetNetHwKey( s_bNetHwKey, nUserId, sAddrPort) ;
}
//-----------------------------------------------------------------------------
bool
ExeGetNetHwKey( void)
{
return s_bNetHwKey ;
}
//-----------------------------------------------------------------------------
bool
ExeVerifyKeyOption( int nOptInd)
{
// recupero le opzioni abilitate
unsigned int nOpt1, nOpt2 ;
int nOptExpDays ;
int nRet = GetEGnKeyOptions( KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV,
nOpt1, nOpt2, nOptExpDays) ;
if ( ! ExeGetNetHwKey())
nRet = GetKeyOptions( ExeGetKey(), KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV,
nOpt1, nOpt2, nOptExpDays) ;
// verifico validità chiave con licenza
if ( nRet != KEY_OK || nOptExpDays < GetCurrDay())
return false ;
// verifico le opzioni (nOptInd = 100 -> bit 0 di Opt1 ... = 200 -> bit 0 di Opt2 ... = 231 -> bit 31 di Opt2)
if ( nOptInd >= 100 && nOptInd <= 131) {
unsigned int nOptVal = ( 1 << ( nOptInd - 100)) ;
return ( ( nOpt1 & nOptVal) != 0) ;
}
else if ( nOptInd >= 200 && nOptInd <= 231) {
unsigned int nOptVal = ( 1 << ( nOptInd - 200)) ;
return ( ( nOpt2 & nOptVal) != 0) ;
}
else
return false ;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool bool
ExeSetFont( const string& sNfeFontDir, const string& sDefaultFont) ExeSetFont( const string& sNfeFontDir, const string& sDefaultFont)
{ {
// inizializzazioni gestore font Nfe // se definito anche direttorio font Nfe, inizializzazione gestore font
InitFontManager( sNfeFontDir, sDefaultFont) ; if ( ! sNfeFontDir.empty())
InitFontManager( sNfeFontDir, sDefaultFont) ;
// altrimenti impostazione del solo font di default
else
SetDefaultFont( sDefaultFont) ;
return true ; return true ;
} }
@@ -387,6 +512,10 @@ ExeGetVersionInfo( string& sVer, const char* szNewLine)
sVer += szNewLine ; sVer += szNewLine ;
sVer += MyGetEExVersion() ; sVer += MyGetEExVersion() ;
} }
if ( IsLoadedExch3dmDll()) {
sVer += szNewLine ;
sVer += MyGetEE3Version() ;
}
if ( IsLoadedMachKernelDll()) { if ( IsLoadedMachKernelDll()) {
sVer += szNewLine ; sVer += szNewLine ;
sVer += MyGetEMkVersion() ; sVer += MyGetEMkVersion() ;
@@ -411,7 +540,7 @@ ExeGetKeyInfo( string& sKey)
sLockId = sLockId.substr( 7, 6) ; sLockId = sLockId.substr( 7, 6) ;
if ( sLockId.empty()) if ( sLockId.empty())
return false ; return false ;
int nLockSN ; int nLockSN = 0 ;
if ( GetLockSN( nLockSN)) if ( GetLockSN( nLockSN))
sLockId += " (" + ToString( nLockSN) + ")" ; sLockId += " (" + ToString( nLockSN) + ")" ;
} }
@@ -430,14 +559,14 @@ bool
ExeGetKeyLevel( int nProd, int nVer, int nLev, int& nKLev) ExeGetKeyLevel( int nProd, int nVer, int nLev, int& nKLev)
{ {
// verifico la chiave e il livello // verifico la chiave e il livello
int nRet = GetKeyLevel( s_sKey, nProd, nVer, nLev, nKLev, s_nKeyExpDays) ; int nRet = GetKeyLevelEx( s_sKey, nProd, nVer, nLev, nKLev, s_nKeyExpDays, s_nKeyAssExpDays) ;
SetEGnKeyLevel( nRet, nKLev, s_nKeyExpDays) ;
if ( nRet != KEY_OK) { if ( nRet != KEY_OK) {
string sErr = "Error on Key (EGKL/" + ToString( nRet) + ")" ; string sErr = "Error on Key (EGKL/" + ToString( nRet) + ")" ;
LOG_ERROR( s_pGenLog, sErr.c_str()) ; LOG_ERROR( s_pGenLog, sErr.c_str()) ;
nKLev = - nRet ; nKLev = - nRet ;
return false ; return false ;
} }
return true ; return true ;
} }
@@ -448,6 +577,7 @@ ExeGetKeyOptions( int nProd, int nVer, int nLev, unsigned int& nOpt2)
// verifico la chiave e le opzioni // verifico la chiave e le opzioni
unsigned int nOpt1 ; unsigned int nOpt1 ;
int nRet = GetKeyOptions( s_sKey, nProd, nVer, nLev, nOpt1, nOpt2, s_nKeyOptExpDays) ; int nRet = GetKeyOptions( s_sKey, nProd, nVer, nLev, nOpt1, nOpt2, s_nKeyOptExpDays) ;
SetEGnKeyOptions( nRet, nOpt1, nOpt2, s_nKeyOptExpDays) ;
if ( nRet != KEY_OK) { if ( nRet != KEY_OK) {
nOpt2 = 0 ; nOpt2 = 0 ;
string sErr = "Error on Key (EGKO/" + ToString( nRet) + ")" ; string sErr = "Error on Key (EGKO/" + ToString( nRet) + ")" ;
@@ -460,7 +590,6 @@ ExeGetKeyOptions( int nProd, int nVer, int nLev, unsigned int& nOpt2)
LOG_ERROR( s_pGenLog, sErr.c_str()) ; LOG_ERROR( s_pGenLog, sErr.c_str()) ;
return true ; return true ;
} }
return true ; return true ;
} }
@@ -474,6 +603,16 @@ ExeGetKeyLeftDays( int& nLeftDays)
return true ; return true ;
} }
//-----------------------------------------------------------------------------
bool
ExeGetKeyAssLeftDays( int& nAssLeftDays)
{
if ( s_nKeyAssExpDays == 0)
return false ;
nAssLeftDays = s_nKeyAssExpDays - GetCurrDay() ;
return true ;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool bool
ExeGetKeyOptLeftDays( int& nOptLeftDays) ExeGetKeyOptLeftDays( int& nOptLeftDays)
@@ -536,9 +675,21 @@ ExeGetEnableUI( void)
return s_bEnableUI ; return s_bEnableUI ;
} }
//-----------------------------------------------------------------------------
int
ExeMessageBox( const string& sText, const string& sTitle, int nType)
{
int nRes = 0 ;
if ( ExeGetEnableUI()) {
HWND hTopWnd = ExeGetMainWindowHandle() ;
nRes = MessageBox( hTopWnd, stringtoW( sText), stringtoW( sTitle), nType | MB_TASKMODAL) ;
}
return nRes ;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool bool
ExeSetProcessEvents( pfProcEvents pFun) ExeSetProcessEvents( psfProcEvents pFun)
{ {
s_pFunProcEvents = pFun ; s_pFunProcEvents = pFun ;
SetEGkProcessEvents( pFun) ; SetEGkProcessEvents( pFun) ;
@@ -557,7 +708,7 @@ ExeProcessEvents( int nProg, int nPause)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool bool
ExeSetOutText( pfOutText pFun) ExeSetOutText( psfOutText pFun)
{ {
s_pFunOutText = pFun ; s_pFunOutText = pFun ;
return ( pFun != nullptr) ; return ( pFun != nullptr) ;
+36
View File
@@ -21,6 +21,7 @@
#include "/EgtDev/Include/EXeExecutor.h" #include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EGkDistPointCurve.h" #include "/EgtDev/Include/EGkDistPointCurve.h"
#include "/EgtDev/Include/EGkDistPointSurfTm.h" #include "/EgtDev/Include/EGkDistPointSurfTm.h"
#include "/EgtDev/Include/EGkDistPointSurfBz.h"
using namespace std ; using namespace std ;
@@ -122,3 +123,38 @@ ExePointSurfTmDist( const Point3d& ptP, int nStmId, int nRefType,
ptMin = GetPointInRef( pGeomDB, ptMinL, frStm, nRefType) ; ptMin = GetPointInRef( pGeomDB, ptMinL, frStm, nRefType) ;
return distPS.GetMinDistTriaIndex( *pnTria) ; return distPS.GetMinDistTriaIndex( *pnTria) ;
} }
//----------------------------------------------------------------------------
bool
ExePointSurfBzDist( const Point3d& ptP, int nSbzId, int nRefType,
double* pdDist, Point3d& ptMin, Vector3d& vtN)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// verifico il primo parametro di ritorno obbligatorio
if ( pdDist == nullptr)
return false ;
// recupero la superficie bezier
ISurfBezier* pSbz = GetSurfBezier( pGeomDB->GetGeoObj( nSbzId)) ;
if ( pSbz == nullptr)
return false ;
// recupero il suo riferimento globale
Frame3d frSbz ;
if ( ! pGeomDB->GetGlobFrame( nSbzId, frSbz))
return false ;
// porto il punto nel riferimento della superficie
Point3d ptPL = GetPointLocal( pGeomDB, ptP, nRefType, frSbz) ;
// recupero i risultati
DistPointSurfBz distPS( ptPL, *pSbz) ;
if ( ! distPS.GetDist( *pdDist))
return false ;
Point3d ptMinL ;
if ( ! distPS.GetMinDistPoint( ptMinL))
return false ;
ptMin = GetPointInRef( pGeomDB, ptMinL, frSbz, nRefType) ;
Vector3d vtNL ;
if ( ! distPS.GetNorm( vtNL))
return false ;
vtN = GetVectorInRef( pGeomDB, vtNL, frSbz, nRefType) ;
return true ;
}
+868 -541
View File
File diff suppressed because it is too large Load Diff
+28 -21
View File
@@ -32,7 +32,7 @@ ExeStartPoint( int nId, int nRefId, Point3d& ptP)
{ {
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false) VERIFY_GEOMDB( pGeomDB, false)
// se non è entità geometrica // se non è entità geometrica
const IGeoObj* pGObj ; const IGeoObj* pGObj ;
if ( ( pGObj = pGeomDB->GetGeoObj( nId)) == nullptr) if ( ( pGObj = pGeomDB->GetGeoObj( nId)) == nullptr)
return false ; return false ;
@@ -85,12 +85,19 @@ ExeEndPoint( int nId, int nRefId, Point3d& ptP)
{ {
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false) VERIFY_GEOMDB( pGeomDB, false)
// se non è entità geometrica // se non è entità geometrica
const IGeoObj* pGObj ; const IGeoObj* pGObj ;
if ( ( pGObj = pGeomDB->GetGeoObj( nId)) == nullptr) if ( ( pGObj = pGeomDB->GetGeoObj( nId)) == nullptr)
return false ; return false ;
// se punto
if ( pGObj->GetType() == GEO_PNT3D) {
// recupero il geo-punto
const IGeoPoint3d* pGP = GetGeoPoint3d( pGObj) ;
// assegno il punto
ptP = pGP->GetPoint() ;
}
// se vettore // se vettore
if ( pGObj->GetType() == GEO_VECT3D) { else if ( pGObj->GetType() == GEO_VECT3D) {
// recupero il geo-vettore // recupero il geo-vettore
const IGeoVector3d* pGV = GetGeoVector3d( pGObj) ; const IGeoVector3d* pGV = GetGeoVector3d( pGObj) ;
// assegno il punto // assegno il punto
@@ -122,7 +129,7 @@ ExeMidPoint( int nId, int nRefId, Point3d& ptP)
{ {
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false) VERIFY_GEOMDB( pGeomDB, false)
// se non è entità geometrica // se non è entità geometrica
const IGeoObj* pGObj ; const IGeoObj* pGObj ;
if ( ( pGObj = pGeomDB->GetGeoObj( nId)) == nullptr) if ( ( pGObj = pGeomDB->GetGeoObj( nId)) == nullptr)
return false ; return false ;
@@ -154,7 +161,7 @@ ExeCenterPoint( int nId, int nRefId, Point3d& ptP)
{ {
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false) VERIFY_GEOMDB( pGeomDB, false)
// se non è entità geometrica // se non è entità geometrica
const IGeoObj* pGObj ; const IGeoObj* pGObj ;
if ( ( pGObj = pGeomDB->GetGeoObj( nId)) == nullptr) if ( ( pGObj = pGeomDB->GetGeoObj( nId)) == nullptr)
return false ; return false ;
@@ -194,7 +201,7 @@ ExeCentroid( int nId, int nRefId, Point3d& ptP)
{ {
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false) VERIFY_GEOMDB( pGeomDB, false)
// se non è entità geometrica // se non è entità geometrica
const IGeoObj* pGObj ; const IGeoObj* pGObj ;
if ( ( pGObj = pGeomDB->GetGeoObj( nId)) == nullptr) if ( ( pGObj = pGeomDB->GetGeoObj( nId)) == nullptr)
return false ; return false ;
@@ -234,7 +241,7 @@ ExeAtParamPoint( int nId, double dU, int nRefId, Point3d& ptP)
{ {
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false) VERIFY_GEOMDB( pGeomDB, false)
// se non è entità geometrica // se non è entità geometrica
const IGeoObj* pGObj ; const IGeoObj* pGObj ;
if ( ( pGObj = pGeomDB->GetGeoObj( nId)) == nullptr) if ( ( pGObj = pGeomDB->GetGeoObj( nId)) == nullptr)
return false ; return false ;
@@ -257,11 +264,11 @@ ExeNearPoint( int nId, const Point3d& ptNear, int nRefId, Point3d& ptP)
{ {
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false) VERIFY_GEOMDB( pGeomDB, false)
// se non è entità geometrica // se non è entità geometrica
const IGeoObj* pGObj = pGeomDB->GetGeoObj( nId) ; const IGeoObj* pGObj = pGeomDB->GetGeoObj( nId) ;
if ( pGObj == nullptr) if ( pGObj == nullptr)
return false ; return false ;
// porto il punto near nel riferimento dell'entità // porto il punto near nel riferimento dell'entità
Point3d ptNearL = ptNear ; Point3d ptNearL = ptNear ;
if ( ! InvTransformPoint( pGeomDB, nId, nRefId, ptNearL)) if ( ! InvTransformPoint( pGeomDB, nId, nRefId, ptNearL))
return false ; return false ;
@@ -269,7 +276,7 @@ ExeNearPoint( int nId, const Point3d& ptNear, int nRefId, Point3d& ptP)
if ( ( pGObj->GetType() & GEO_CURVE) != 0) { if ( ( pGObj->GetType() & GEO_CURVE) != 0) {
// recupero la curva // recupero la curva
const ICurve* pCrv = GetCurve( pGObj) ; const ICurve* pCrv = GetCurve( pGObj) ;
// calcolo il punto della curva più vicino al punto di riferimento // calcolo il punto della curva più vicino al punto di riferimento
DistPointCurve dstPC( ptNearL, *pCrv) ; DistPointCurve dstPC( ptNearL, *pCrv) ;
int nFlag ; int nFlag ;
if ( ! dstPC.GetMinDistPoint( 0, ptP, nFlag)) if ( ! dstPC.GetMinDistPoint( 0, ptP, nFlag))
@@ -290,7 +297,7 @@ ExeIntersectionPoint( int nId1, int nId2, const Point3d& ptNear, int nRefId, Poi
// se auto-intersezione // se auto-intersezione
if ( nId1 == nId2) { if ( nId1 == nId2) {
// deve essere entità geometriche // deve essere entità geometriche
const IGeoObj* pGObj1 ; const IGeoObj* pGObj1 ;
if ( ( pGObj1 = pGeomDB->GetGeoObj( nId1)) == nullptr) if ( ( pGObj1 = pGeomDB->GetGeoObj( nId1)) == nullptr)
return false ; return false ;
@@ -298,11 +305,11 @@ ExeIntersectionPoint( int nId1, int nId2, const Point3d& ptNear, int nRefId, Poi
if ( ( pGObj1->GetType() & GEO_CURVE) != 0) { if ( ( pGObj1->GetType() & GEO_CURVE) != 0) {
// recupero la curva // recupero la curva
const ICurve* pCrv1 = GetCurve( pGObj1) ; const ICurve* pCrv1 = GetCurve( pGObj1) ;
// porto il punto Near nel riferimento dell'entità // porto il punto Near nel riferimento dell'entità
Point3d ptNearL = ptNear ; Point3d ptNearL = ptNear ;
if ( ! InvTransformPoint( pGeomDB, nId1, nRefId, ptNearL)) if ( ! InvTransformPoint( pGeomDB, nId1, nRefId, ptNearL))
return false ; return false ;
// calcolo il punto di auto-intersezione sulla curva più vicino al punto di riferimento // calcolo il punto di auto-intersezione sulla curva più vicino al punto di riferimento
SelfIntersCurve sintC( *pCrv1) ; SelfIntersCurve sintC( *pCrv1) ;
if ( ! sintC.GetIntersPointNearTo( ptNearL, ptP)) if ( ! sintC.GetIntersPointNearTo( ptNearL, ptP))
return false ; return false ;
@@ -313,7 +320,7 @@ ExeIntersectionPoint( int nId1, int nId2, const Point3d& ptNear, int nRefId, Poi
return TransformPoint( pGeomDB, nId1, nRefId, ptP) ; return TransformPoint( pGeomDB, nId1, nRefId, ptP) ;
} }
// devono essere entità geometriche // devono essere entità geometriche
const IGeoObj* pGObj1 ; const IGeoObj* pGObj1 ;
if ( ( pGObj1 = pGeomDB->GetGeoObj( nId1)) == nullptr) if ( ( pGObj1 = pGeomDB->GetGeoObj( nId1)) == nullptr)
return false ; return false ;
@@ -332,7 +339,7 @@ ExeIntersectionPoint( int nId1, int nId2, const Point3d& ptNear, int nRefId, Poi
Frame3d frEnt2 ; Frame3d frEnt2 ;
if ( ! pGeomDB->GetGlobFrame( nId2, frEnt2)) if ( ! pGeomDB->GetGlobFrame( nId2, frEnt2))
return false ; return false ;
// se il riferimento della seconda curva è diverso da quello della prima entità, devo trasformarla // se il riferimento della seconda curva è diverso da quello della prima entità, devo trasformarla
PtrOwner<ICurve> pcrvTrans ; PtrOwner<ICurve> pcrvTrans ;
if ( ! AreSameFrame( frEnt1, frEnt2)) { if ( ! AreSameFrame( frEnt1, frEnt2)) {
pcrvTrans.Set( pCrv2->Clone()) ; pcrvTrans.Set( pCrv2->Clone()) ;
@@ -341,11 +348,11 @@ ExeIntersectionPoint( int nId1, int nId2, const Point3d& ptNear, int nRefId, Poi
pcrvTrans->LocToLoc( frEnt2, frEnt1) ; pcrvTrans->LocToLoc( frEnt2, frEnt1) ;
pCrv2 = pcrvTrans ; pCrv2 = pcrvTrans ;
} }
// porto il punto Near nel riferimento della prima entità // porto il punto Near nel riferimento della prima entità
Point3d ptNearL = ptNear ; Point3d ptNearL = ptNear ;
if ( ! InvTransformPoint( pGeomDB, nId1, nRefId, ptNearL)) if ( ! InvTransformPoint( pGeomDB, nId1, nRefId, ptNearL))
return false ; return false ;
// calcolo il punto di intersezione sulla prima curva più vicino al punto di riferimento // calcolo il punto di intersezione sulla prima curva più vicino al punto di riferimento
IntersCurveCurve intCC( *pCrv1, *pCrv2, true) ; IntersCurveCurve intCC( *pCrv1, *pCrv2, true) ;
if ( ! intCC.GetIntersPointNearTo( 0, ptNearL, ptP)) if ( ! intCC.GetIntersPointNearTo( 0, ptNearL, ptP))
return false ; return false ;
@@ -362,7 +369,7 @@ ExeStartVector( int nId, int nRefId, Vector3d& vtV)
{ {
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false) VERIFY_GEOMDB( pGeomDB, false)
// se non è entità geometrica // se non è entità geometrica
const IGeoObj* pGObj = pGeomDB->GetGeoObj( nId) ; const IGeoObj* pGObj = pGeomDB->GetGeoObj( nId) ;
if ( pGObj == nullptr) if ( pGObj == nullptr)
return false ; return false ;
@@ -400,7 +407,7 @@ ExeEndVector( int nId, int nRefId, Vector3d& vtV)
{ {
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false) VERIFY_GEOMDB( pGeomDB, false)
// se non è entità geometrica // se non è entità geometrica
const IGeoObj* pGObj = pGeomDB->GetGeoObj( nId) ; const IGeoObj* pGObj = pGeomDB->GetGeoObj( nId) ;
if ( pGObj == nullptr) if ( pGObj == nullptr)
return false ; return false ;
@@ -424,7 +431,7 @@ ExeMidVector( int nId, int nRefId, Vector3d& vtV)
{ {
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false) VERIFY_GEOMDB( pGeomDB, false)
// se non è entità geometrica // se non è entità geometrica
const IGeoObj* pGObj ; const IGeoObj* pGObj ;
if ( ( pGObj = pGeomDB->GetGeoObj( nId)) == nullptr) if ( ( pGObj = pGeomDB->GetGeoObj( nId)) == nullptr)
return false ; return false ;
@@ -448,7 +455,7 @@ ExeAtParamVector( int nId, double dU, int nSide, int nRefId, Vector3d& vtV)
{ {
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false) VERIFY_GEOMDB( pGeomDB, false)
// se non è entità geometrica // se non è entità geometrica
const IGeoObj* pGObj ; const IGeoObj* pGObj ;
if ( ( pGObj = pGeomDB->GetGeoObj( nId)) == nullptr) if ( ( pGObj = pGeomDB->GetGeoObj( nId)) == nullptr)
return false ; return false ;
+95 -25
View File
@@ -226,6 +226,18 @@ ExeSetModified( void)
return true ; return true ;
} }
//-----------------------------------------------------------------------------
bool
ExeSetModified( int nCtx)
{
GseContext* pGseCtx = GetGseContext( nCtx) ;
VERIFY_CTX_GEOMDB( pGseCtx, false)
// se consentito, imposto il flag
if ( pGseCtx->m_bEnableModified)
pGseCtx->m_bModified = true ;
return true ;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool bool
ExeResetModified( void) ExeResetModified( void)
@@ -277,6 +289,8 @@ ExeNewFile( void)
" -- Ok=" + ToString( bOk) ; " -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
// scrivo il log
LOG_INFO( GetLogger(), "New File") ;
// restituisco il risultato // restituisco il risultato
return bOk ; return bOk ;
} }
@@ -316,6 +330,11 @@ ExeOpenFile( const string& sFilePath)
" -- Ok=" + ToString( bOk) ; " -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
// scrivo il log
{
string sLog = "Open File " + sFilePath ;
LOG_INFO( GetLogger(), sLog.c_str()) ;
}
// restituisco il risultato // restituisco il risultato
return bOk ; return bOk ;
} }
@@ -380,7 +399,7 @@ ExeInsertFile( const string& sFilePath)
class CamStatus class CamStatus
{ {
public : public :
CamStatus( void) : m_nCurrMachGroup( GDB_ID_NULL), m_nCurrPhase( 0) { CamStatus( void) : m_nCurrMachGroup( GDB_ID_NULL), m_nCurrPhase( 0), m_nCurrMachining( GDB_ID_NULL) {
IMachMgr* pMachMgr = GetCurrMachMgr() ; IMachMgr* pMachMgr = GetCurrMachMgr() ;
if ( pMachMgr == nullptr) if ( pMachMgr == nullptr)
return ; return ;
@@ -398,14 +417,19 @@ class CamStatus
m_vIdStat.push_back( ( bShow ? nId : - nId)) ; m_vIdStat.push_back( ( bShow ? nId : - nId)) ;
nId = pMachMgr->GetNextOperation( nId) ; nId = pMachMgr->GetNextOperation( nId) ;
} }
pMachMgr->ResetCurrMachGroup() ;
}
~CamStatus( void) {
Restore() ;
} }
void Restore( void) { void Restore( void) {
if ( m_nCurrMachGroup == GDB_ID_NULL)
return ;
IMachMgr* pMachMgr = GetCurrMachMgr() ; IMachMgr* pMachMgr = GetCurrMachMgr() ;
if ( pMachMgr == nullptr) if ( pMachMgr == nullptr)
return ; return ;
if ( m_nCurrMachGroup == GDB_ID_NULL)
return ;
pMachMgr->SetCurrMachGroup( m_nCurrMachGroup) ; pMachMgr->SetCurrMachGroup( m_nCurrMachGroup) ;
m_nCurrMachGroup = GDB_ID_NULL ;
if ( m_nCurrPhase == 0) if ( m_nCurrPhase == 0)
return ; return ;
pMachMgr->SetCurrPhase( m_nCurrPhase, true) ; pMachMgr->SetCurrPhase( m_nCurrPhase, true) ;
@@ -430,7 +454,6 @@ ExeSaveFile( const string& sFilePath, int nFlag)
VERIFY_CTX_GEOMDB( pGseCtx, false) VERIFY_CTX_GEOMDB( pGseCtx, false)
// se ero in CAM, esco dopo averne salvato lo stato // se ero in CAM, esco dopo averne salvato lo stato
CamStatus CurrCamStatus ; CamStatus CurrCamStatus ;
ExeResetCurrMachGroup() ;
// imposto path corrente del file // imposto path corrente del file
pGseCtx->m_sFilePath = sFilePath ; pGseCtx->m_sFilePath = sFilePath ;
// salvo il file // salvo il file
@@ -447,37 +470,71 @@ ExeSaveFile( const string& sFilePath, int nFlag)
" -- Ok=" + ToString( bOk) ; " -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
// scrivo il log
{
string sLog = "Saved File " + sFilePath ;
LOG_INFO( GetLogger(), sLog.c_str()) ;
}
// restituisco il risultato // restituisco il risultato
return bOk ; return bOk ;
} }
//-----------------------------------------------------------------------------
static bool
IsMachGroupOrWithin( int nId, const IGeomDB* pGeomDB, const IMachMgr* pMachMgr, int& nMachGroupId)
{
// default non definito
nMachGroupId = GDB_ID_NULL ;
// verifico validità puntatori
if ( pGeomDB == nullptr || pMachMgr == nullptr)
return false ;
// eseguo ricerca
int nParentId = pGeomDB->GetParentId( nId) ;
int nPrevParId = nId ;
while ( nParentId != GDB_ID_NULL && nParentId != GDB_ID_ROOT) {
if ( pMachMgr->IsMachBase( nParentId)) {
nMachGroupId = nPrevParId ;
return true ;
}
nPrevParId = nParentId ;
nParentId = pGeomDB->GetParentId( nParentId) ;
}
return false ;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool bool
ExeSaveObjToFile( int nId, const string& sFilePath, int nFlag) ExeSaveObjToFile( const INTVECTOR& vId, const string& sFilePath, int nFlag)
{ {
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false) VERIFY_GEOMDB( pGeomDB, false)
IMachMgr* pMachMgr = GetCurrMachMgr() ; IMachMgr* pMachMgr = GetCurrMachMgr() ;
// se l'oggetto è la base dei gruppi di lavoro, chiamo la funzione di salvataggio di tutto // se uno degli oggetti è la base dei gruppi di lavoro, chiamo la funzione di salvataggio di tutto
if ( pMachMgr != nullptr && pMachMgr->IsMachBase( nId)) for ( int nId : vId) {
return ExeSaveFile( sFilePath, nFlag) ; if ( pMachMgr != nullptr && pMachMgr->IsMachBase( nId))
// se l'oggetto è un gruppo di lavoro o una sua parte, chiamo la appropriata funzione di salvataggio return ExeSaveFile( sFilePath, nFlag) ;
int nParentId = pGeomDB->GetParentId( nId) ; }
int nPrevParId = nId ; // se uno degli oggetti è un gruppo di lavoro o una sua parte, chiamo la appropriata funzione di salvataggio
while ( pMachMgr != nullptr && nParentId != GDB_ID_NULL && nParentId != GDB_ID_ROOT) { for ( int nId : vId) {
if ( pMachMgr->IsMachBase( nParentId)) int nMachGroupId ;
return ExeSaveMachGroupToFile( nPrevParId, sFilePath, nFlag) ; if ( IsMachGroupOrWithin( nId, pGeomDB, pMachMgr, nMachGroupId)) {
nPrevParId = nParentId ; INTVECTOR vOthId ;
nParentId = pGeomDB->GetParentId( nParentId) ; vOthId.reserve( vId.size()) ;
for ( int nSouId : vId) {
if ( nSouId != nId)
vOthId.push_back( nSouId) ;
}
return ExeSaveMachGroupToFile( nMachGroupId, vOthId, sFilePath, nFlag) ;
}
} }
// se ero in CAM, non esco <--- // se ero in CAM, non esco <---
// copio l'oggetto nel file // copio l'oggetto nel file
bool bOk = pGeomDB->Save( nId, sFilePath, nFlag) ; bool bOk = pGeomDB->Save( vId, sFilePath, nFlag) ;
// se richiesto, salvo il comando Lua equivalente // se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) { if ( IsCmdLog()) {
string sLua = "EgtSaveObjToFile(" + ToString( nId) + ",'" + string sLua = "EgtSaveObjToFile({" + ToString( vId) + "},'" +
StringToLuaString( sFilePath) + "'," + StringToLuaString( sFilePath) + "'," +
NgeTypeToString( nFlag) + ")" + NgeTypeToString( nFlag) + ")" +
" -- Ok=" + ToString( bOk) ; " -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
@@ -487,7 +544,7 @@ ExeSaveObjToFile( int nId, const string& sFilePath, int nFlag)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool bool
ExeSaveMachGroupToFile( int nMGroupId, const string& sFilePath, int nFlag) ExeSaveMachGroupToFile( int nMGroupId, const INTVECTOR& vPlusId, const string& sFilePath, int nFlag)
{ {
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false) VERIFY_GEOMDB( pGeomDB, false)
@@ -501,12 +558,21 @@ ExeSaveMachGroupToFile( int nMGroupId, const string& sFilePath, int nFlag)
ExeDisableModified() ; ExeDisableModified() ;
// se ero in CAM, esco dopo averne salvato lo stato // se ero in CAM, esco dopo averne salvato lo stato
CamStatus CurrCamStatus ; CamStatus CurrCamStatus ;
ExeResetCurrMachGroup() ; // verifico che gli oggetti Plus non siano gruppi di lavoro o una loro parte
bool bOk = true ;
for ( int nPlusId : vPlusId) {
int nMGrpPlusId ;
if ( IsMachGroupOrWithin( nPlusId, pGeomDB, pMachMgr, nMGrpPlusId)) {
bOk = false ;
break ;
}
}
// recupero eventuali pezzi e foto del gruppo di lavoro // recupero eventuali pezzi e foto del gruppo di lavoro
INTVECTOR vId ; INTVECTOR vId ;
int nPhotoId = GDB_ID_NULL ; int nPhotoId = GDB_ID_NULL ;
string sPhotoOriPath = "" ; string sPhotoOriPath = "" ;
if ( pMachMgr->SetCurrMachGroup( nMGroupId)) { bOk = bOk && pMachMgr->SetCurrMachGroup( nMGroupId) ;
if ( bOk) {
// aggiungo gruppo di lavoro // aggiungo gruppo di lavoro
vId.emplace_back( nMGroupId) ; vId.emplace_back( nMGroupId) ;
// aggiungo pezzi // aggiungo pezzi
@@ -540,8 +606,11 @@ ExeSaveMachGroupToFile( int nMGroupId, const string& sFilePath, int nFlag)
// disattivo gruppo di lavoro // disattivo gruppo di lavoro
pMachMgr->ResetCurrMachGroup() ; pMachMgr->ResetCurrMachGroup() ;
} }
// aggiungo gli oggetti plus
if ( bOk)
vId.insert( vId.end(), vPlusId.begin(), vPlusId.end()) ;
// salvo gli oggetti appena identificati // salvo gli oggetti appena identificati
bool bOk = pGeomDB->Save( vId, sFilePath, nFlag) ; bOk = bOk && pGeomDB->Save( vId, sFilePath, nFlag) ;
// eventuale ripristino dati fotografia // eventuale ripristino dati fotografia
if ( nPhotoId != GDB_ID_NULL) if ( nPhotoId != GDB_ID_NULL)
ExeChangePhotoPath( nPhotoId, sPhotoOriPath) ; ExeChangePhotoPath( nPhotoId, sPhotoOriPath) ;
@@ -554,7 +623,8 @@ ExeSaveMachGroupToFile( int nMGroupId, const string& sFilePath, int nFlag)
SetCmdLog( bPrevCmdLog) ; SetCmdLog( bPrevCmdLog) ;
// se richiesto, salvo il comando Lua equivalente // se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) { if ( IsCmdLog()) {
string sLua = "EgtSaveMachGroupToFile(" + ToString( nMGroupId) + ",'" + string sLua = "EgtSaveMachGroupToFile(" + ToString( nMGroupId) + ",{" +
ToString( vPlusId) + "},'" +
StringToLuaString( sFilePath) + "'," + StringToLuaString( sFilePath) + "'," +
NgeTypeToString( nFlag) + ")" + NgeTypeToString( nFlag) + ")" +
" -- Ok=" + ToString( bOk) ; " -- Ok=" + ToString( bOk) ;
+5 -3
View File
@@ -262,11 +262,13 @@ ExeLuaExecLine( const string& sLine)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool bool
ExeLuaExecFile( const string& sFilePath) ExeLuaExecFile( const string& sFilePath, bool LogInfo)
{ {
// emetto info // emetto info
string sInfo = "Exec File = " + sFilePath ; if ( LogInfo) {
LOG_INFO( GetLogger(), sInfo.c_str()) string sInfo = "Exec File = " + sFilePath ;
LOG_INFO( GetLogger(), sInfo.c_str())
}
// disabilito il log dei comandi // disabilito il log dei comandi
CmdLogOff cmdLogOff ; CmdLogOff cmdLogOff ;
// esecuzione script // esecuzione script
+465 -46
View File
@@ -21,10 +21,13 @@
#include "/EgtDev/Include/EXeExecutor.h" #include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EXeConst.h" #include "/EgtDev/Include/EXeConst.h"
#include "/EgtDev/Include/EGkStringUtils3d.h" #include "/EgtDev/Include/EGkStringUtils3d.h"
#include "/EgtDev/Include/EMkToolConst.h"
#include "/EgtDev/Include/EMkOperationConst.h" #include "/EgtDev/Include/EMkOperationConst.h"
#include "/EgtDev/Include/EMkSimuGenConst.h" #include "/EgtDev/Include/EMkSimuGenConst.h"
#include "/EgtDev/Include/EGnFileUtils.h" #include "/EgtDev/Include/EGnFileUtils.h"
#include "/EgtDev/Include/EGnEgtUUID.h"
#include "/EgtDev/Include/EgtStringConverter.h" #include "/EgtDev/Include/EgtStringConverter.h"
#include "/EgtDev/Include/EgtIniFile.h"
#include "/EgtDev/Include/EgtPointerOwner.h" #include "/EgtDev/Include/EgtPointerOwner.h"
using namespace std ; using namespace std ;
@@ -245,6 +248,26 @@ ExeAddMachGroup( const string& sName, const string& sMachineName)
return nId ; return nId ;
} }
//-----------------------------------------------------------------------------
int
ExeCopyMachGroup( const string& sSouName, const string& sName)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL)
// copio la macchinata (gruppo di lavorazione)
int nId = pMachMgr->CopyMachGroup( sSouName, sName) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtCopyMachGroup('" + sSouName + "','" +
sName + "')" +
" -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco il risultato
return nId ;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool bool
ExeRemoveMachGroup( int nMGroupId) ExeRemoveMachGroup( int nMGroupId)
@@ -264,6 +287,26 @@ ExeRemoveMachGroup( int nMGroupId)
return bOk ; return bOk ;
} }
//-----------------------------------------------------------------------------
bool
ExeChangeMachGroupName( int nId, const string& sNewName)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// cambia il nome della macchinata
bool bOk = pMachMgr->ChangeMachGroupName( nId, sNewName) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtChangeMachGroupName(" + ToString( nId) + ",'" +
sNewName + "')" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco il risultato
return bOk ;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool bool
ExeGetMachGroupName( int nId, string& sName) ExeGetMachGroupName( int nId, string& sName)
@@ -291,8 +334,8 @@ int
ExeGetMachGroupId( const string& sName) ExeGetMachGroupId( const string& sName)
{ {
IMachMgr* pMachMgr = GetCurrMachMgr() ; IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false) VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL)
// recupero l'indice della macchinata // recupero l'identificativo della macchinata
return pMachMgr->GetMachGroupId( sName) ; return pMachMgr->GetMachGroupId( sName) ;
} }
@@ -353,16 +396,16 @@ ExeAddPhase( void)
IMachMgr* pMachMgr = GetCurrMachMgr() ; IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, 0) VERIFY_MACHMGR( pMachMgr, 0)
// aggiungo una nuova fase di lavorazione alla macchinata corrente // aggiungo una nuova fase di lavorazione alla macchinata corrente
int nId = pMachMgr->AddPhase() ; int nInd = pMachMgr->AddPhase() ;
ExeSetModified() ; ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente // se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) { if ( IsCmdLog()) {
string sLua = "EgtAddPhase()" string sLua = "EgtAddPhase()"
" -- Id=" + ToString( nId) ; " -- Ind=" + ToString( nInd) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
// restituisco il risultato // restituisco il risultato
return nId ; return nInd ;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -451,7 +494,7 @@ bool
ExeIsRawPart( int nRawId) ExeIsRawPart( int nRawId)
{ {
IMachMgr* pMachMgr = GetCurrMachMgr() ; IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL) VERIFY_MACHMGR( pMachMgr, false)
// verifico se è un grezzo della macchinata corrente // verifico se è un grezzo della macchinata corrente
return pMachMgr->IsRawPart( nRawId) ; return pMachMgr->IsRawPart( nRawId) ;
} }
@@ -516,12 +559,12 @@ ExeModifyRawPart( int nRawId, Point3d ptOrig, double dLength, double dWidth, dou
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool bool
ExeModifyRawPart( int nRawId, int nCrvId, double dOverMat, double dZmin, double dHeight, Color cCol) ExeModifyRawPart( int nRawId, int nCrvId, double dOverMat, double dHeight, Color cCol)
{ {
IMachMgr* pMachMgr = GetCurrMachMgr() ; IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false) VERIFY_MACHMGR( pMachMgr, false)
// modifico grezzo indicato nella macchinata corrente // modifico grezzo indicato nella macchinata corrente
bool bOk = pMachMgr->ModifyRawPart( nRawId, nCrvId, dOverMat, dZmin, dHeight, cCol) ; bool bOk = pMachMgr->ModifyRawPart( nRawId, nCrvId, dOverMat, dHeight, cCol) ;
ExeSetModified() ; ExeSetModified() ;
// restituisco il risultato // restituisco il risultato
return bOk ; return bOk ;
@@ -955,7 +998,7 @@ ExeGetTableAreaOffset( int nInd, BBox3d& b3AreaOffs)
{ {
IMachMgr* pMachMgr = GetCurrMachMgr() ; IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false) VERIFY_MACHMGR( pMachMgr, false)
// recupero l'estensione dell'area utile con offset della tavola corrente della macchinata corrente // recupero l'estensione dell'area utile con offset della fase corrente della tavola corrente della macchinata corrente
return pMachMgr->GetTableAreaOffset( nInd, b3AreaOffs) ; return pMachMgr->GetTableAreaOffset( nInd, b3AreaOffs) ;
} }
@@ -979,6 +1022,64 @@ ExeShowOnlyTable( bool bVal)
return pMachMgr->ShowOnlyTable( bVal) ; return pMachMgr->ShowOnlyTable( bVal) ;
} }
//-----------------------------------------------------------------------------
bool
ExeMoveDispAxis( const string& sName, double dPos)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL)
// eseguo e registro il movimento dell'asse
bool bOk = pMachMgr->MoveDispAxis( sName, dPos) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtMoveDispAxis('" + StringToLuaString( sName) + "'," +
ToString( dPos) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco il risultato
return bOk ;
}
//-----------------------------------------------------------------------------
bool
ExeRemoveDispAxis( const string& sName)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL)
// eseguo e registro la rimozione del movimento dell'asse
bool bOk = pMachMgr->RemoveDispAxis( sName) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtRemoveDispAxis('" + StringToLuaString( sName) + "')" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco il risultato
return bOk ;
}
//-----------------------------------------------------------------------------
bool
ExeKeepAllDispAxes( int nSouPhase)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// confermo i movimenti degli assi di disposizione nella fase corrente della macchinata corrente
bool bOk = pMachMgr->KeepAllDispAxes( nSouPhase) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtKeepAllDispAxes(" + ToString( nSouPhase) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco il risultato
return bOk ;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
int int
ExeAddFixture( const string& sName, const Point3d& ptPos, double dAngRotDeg, double dMov) ExeAddFixture( const string& sName, const Point3d& ptPos, double dAngRotDeg, double dMov)
@@ -990,10 +1091,10 @@ ExeAddFixture( const string& sName, const Point3d& ptPos, double dAngRotDeg, dou
ExeSetModified() ; ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente // se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) { if ( IsCmdLog()) {
string sLua = "EgtAddFixture(" + sName + ",{" + string sLua = "EgtAddFixture('" + StringToLuaString( sName) + "',{" +
ToString( ptPos) + "}," + ToString( ptPos) + "}," +
ToString( dAngRotDeg) + "," + ToString( dAngRotDeg) + "," +
ToString( dMov) + ")" + ToString( dMov) + ")" +
" -- Id=" + ToString( nId) ; " -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
@@ -1096,13 +1197,33 @@ ExeRotateFixture( int nFxtId, double dDeltaAngDeg)
{ {
IMachMgr* pMachMgr = GetCurrMachMgr() ; IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false) VERIFY_MACHMGR( pMachMgr, false)
// ruoto il dispositivo di presa dell'angolo indicato // vario la rotazione del dispositivo di presa dell'angolo indicato
bool bOk = pMachMgr->RotateFixture( nFxtId, dDeltaAngDeg) ; bool bOk = pMachMgr->RotateFixture( nFxtId, dDeltaAngDeg) ;
ExeSetModified() ; ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente // se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) { if ( IsCmdLog()) {
string sLua = "EgtRotateFixture(" + ToString( nFxtId) + ",{" + string sLua = "EgtRotateFixture(" + ToString( nFxtId) + "," +
ToString( dDeltaAngDeg) + "})" + ToString( dDeltaAngDeg) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco il risultato
return bOk ;
}
//-----------------------------------------------------------------------------
bool
ExeSetFixtureLink( int nFxtId, const string& sTaLink)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// imposto il collegamento all'asse di tavola indicato
bool bOk = pMachMgr->SetFixtureLink( nFxtId, sTaLink) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSetFixtureLink(" + ToString( nFxtId) + ",'" +
StringToLuaString( sTaLink) + "')" +
" -- Ok=" + ToString( bOk) ; " -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
@@ -1116,7 +1237,7 @@ ExeMoveFixtureMobile( int nFxtId, double dDeltaMove)
{ {
IMachMgr* pMachMgr = GetCurrMachMgr() ; IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false) VERIFY_MACHMGR( pMachMgr, false)
// ruoto il dispositivo di presa dell'angolo indicato // varia il movimento della parte mobile della morsa della quantità indicata
bool bOk = pMachMgr->MoveFixtureMobile( nFxtId, dDeltaMove) ; bool bOk = pMachMgr->MoveFixtureMobile( nFxtId, dDeltaMove) ;
ExeSetModified() ; ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente // se richiesto, salvo il comando Lua equivalente
@@ -1130,6 +1251,26 @@ ExeMoveFixtureMobile( int nFxtId, double dDeltaMove)
return bOk ; return bOk ;
} }
//-----------------------------------------------------------------------------
bool
ExeSetFixtureMobile( int nFxtId, double dMove)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// imposta il movimento della parte mobile della morsa alla quantità indicata
bool bOk = pMachMgr->SetFixtureMobile( nFxtId, dMove) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSetFixtureMobile(" + ToString( nFxtId) + "," +
ToString( dMove) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco il risultato
return bOk ;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// DB utensili // DB utensili
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -1432,6 +1573,21 @@ ExeTdbGetCurrToolThLength( double& dThLen)
return pMachMgr->TdbGetCurrToolThLength( dThLen) ; return pMachMgr->TdbGetCurrToolThLength( dThLen) ;
} }
//-----------------------------------------------------------------------------
bool
ExeTdbCurrToolIsStandardDraw( bool& bStandard)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// recupero il nome del disegno dell'utensile
string sDraw ;
if ( ! pMachMgr->TdbGetCurrToolParam( TPA_DRAW, sDraw))
return false ;
// verifico il tipo
bStandard = IsUUID( GetFileTitleEgt( sDraw)) ;
return true ;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
int int
ExeTdbCurrToolDraw( int nGenCtx, int nToolCtx) ExeTdbCurrToolDraw( int nGenCtx, int nToolCtx)
@@ -1545,6 +1701,16 @@ ExeImportSetup( const string& sName)
return pMachMgr->ImportSetup( sName) ; return pMachMgr->ImportSetup( sName) ;
} }
//-----------------------------------------------------------------------------
bool
ExeExistsCurrSetup( void)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// eseguo la verifica
return pMachMgr->ExistsCurrSetup() ;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool bool
ExeVerifyCurrSetup( STRVECTOR& vsErrors) ExeVerifyCurrSetup( STRVECTOR& vsErrors)
@@ -1565,6 +1731,16 @@ ExeFindToolInCurrSetup( const string& sTool)
return pMachMgr->FindToolInCurrSetup( sTool) ; return pMachMgr->FindToolInCurrSetup( sTool) ;
} }
//-----------------------------------------------------------------------------
bool
ExeGetToolSetupPosInCurrSetup( const string& sTool, string& sTcPos)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// eseguo la verifica
return pMachMgr->GetToolSetupPosInCurrSetup( sTool, sTcPos) ;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool bool
ExeGetToolsInCurrSetupPos( const string& sTcPos, STRVECTOR& vsTools) ExeGetToolsInCurrSetupPos( const string& sTcPos, STRVECTOR& vsTools)
@@ -1940,42 +2116,42 @@ ExeGetPrevOperation( int nId)
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
int int
ExeGetFirstActiveOperation( void) ExeGetFirstActiveOperation( bool bNeedMachNotEmpty)
{ {
IMachMgr* pMachMgr = GetCurrMachMgr() ; IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL) VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL)
// recupero la prima operazione attiva della macchinata corrente // recupero la prima operazione attiva della macchinata corrente
return pMachMgr->GetFirstActiveOperation() ; return pMachMgr->GetFirstActiveOperation( bNeedMachNotEmpty) ;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
int int
ExeGetNextActiveOperation( int nId) ExeGetNextActiveOperation( int nId, bool bNeedMachNotEmpty)
{ {
IMachMgr* pMachMgr = GetCurrMachMgr() ; IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL) VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL)
// recupero la successiva operazione attiva della macchinata corrente // recupero la successiva operazione attiva della macchinata corrente
return pMachMgr->GetNextActiveOperation( nId) ; return pMachMgr->GetNextActiveOperation( nId, bNeedMachNotEmpty) ;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
int int
ExeGetLastActiveOperation( void) ExeGetLastActiveOperation( bool bNeedMachNotEmpty)
{ {
IMachMgr* pMachMgr = GetCurrMachMgr() ; IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false) VERIFY_MACHMGR( pMachMgr, false)
// recupero l'ultima operazione attiva della macchinata corrente // recupero l'ultima operazione attiva della macchinata corrente
return pMachMgr->GetLastActiveOperation() ; return pMachMgr->GetLastActiveOperation( bNeedMachNotEmpty) ;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
int int
ExeGetPrevActiveOperation( int nId) ExeGetPrevActiveOperation( int nId, bool bNeedMachNotEmpty)
{ {
IMachMgr* pMachMgr = GetCurrMachMgr() ; IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL) VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL)
// recupero la precedente operazione attiva della macchinata corrente // recupero la precedente operazione attiva della macchinata corrente
return pMachMgr->GetPrevActiveOperation( nId) ; return pMachMgr->GetPrevActiveOperation( nId, bNeedMachNotEmpty) ;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -2040,12 +2216,12 @@ ExeGetOperationId( const string& sName)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool bool
ExeIsOperationEmpty( int nId) ExeIsOperationEmpty( int nId, int nEmptyType)
{ {
IMachMgr* pMachMgr = GetCurrMachMgr() ; IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false) VERIFY_MACHMGR( pMachMgr, false)
// recupero lo stato dell'operazione indicata della macchinata corrente // recupero lo stato dell'operazione indicata della macchinata corrente
return pMachMgr->IsOperationEmpty( nId) ; return pMachMgr->IsOperationEmpty( nId, nEmptyType) ;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -2301,6 +2477,16 @@ ExeSpecialUpdateDisposition( int nId)
return bOk ; return bOk ;
} }
//-----------------------------------------------------------------------------
bool
ExeGetDispositionToolData( int nId, string& sName, string& sHead, int& nExit, string& sTcPos)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// aggiorno assi macchina e collegamento con precedente della disposizione indicata
return pMachMgr->GetDispositionToolData( nId, sName, sHead, nExit, sTcPos) ;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Lavorazioni // Lavorazioni
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -2562,6 +2748,16 @@ ExeUpdateMachining( bool bPostApply)
return bOk ; return bOk ;
} }
//-----------------------------------------------------------------------------
bool
ExeChangePreviewMachiningToolShow( int nLookFlag)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// impostazione tipo visualizzazione anteprima utensile su lavorazione
return pMachMgr->ChangePreviewMachiningToolShow( nLookFlag) ;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool bool
ExePreparePreviewMachiningTool( void) ExePreparePreviewMachiningTool( void)
@@ -2584,12 +2780,22 @@ ExeRemovePreviewMachiningTool( void)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
int int
ExePreviewMachiningTool( int nEntId, int nFlag) ExeGetPreviewMachiningToolStepCount( void)
{ {
IMachMgr* pMachMgr = GetCurrMachMgr() ; IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false) VERIFY_MACHMGR( pMachMgr, -1)
// restituisce il numero di passi per anteprima utensile presenti nella lavorazione
return pMachMgr->GetPreviewMachiningToolStepCount() ;
}
//-----------------------------------------------------------------------------
int
ExePreviewMachiningTool( int nEntId, int nStep)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL)
// visualizzazione anteprima utensile su lavorazione // visualizzazione anteprima utensile su lavorazione
return pMachMgr->PreviewMachiningTool( nEntId, nFlag) ; return pMachMgr->PreviewMachiningTool( nEntId, nStep) ;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -2644,12 +2850,22 @@ ExeGetMachiningGeometry( SELVECTOR& vIds)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool bool
ExeIsMachiningEmpty( void) ExeGetMachiningSkippedGeometry( SELVECTOR& vIds)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// recupero la geometria non lavorata della lavorazione corrente
return pMachMgr->GetMachiningSkippedGeometry( vIds) ;
}
//-----------------------------------------------------------------------------
bool
ExeIsMachiningEmpty( int nEmptyType)
{ {
IMachMgr* pMachMgr = GetCurrMachMgr() ; IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false) VERIFY_MACHMGR( pMachMgr, false)
// restituisco lo stato della lavorazione corrente // restituisco lo stato della lavorazione corrente
return pMachMgr->IsMachiningEmpty() ; return pMachMgr->IsMachiningEmpty( nEmptyType) ;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -2672,6 +2888,26 @@ ExeGetMachiningEndPoint( Point3d& ptEnd)
return pMachMgr->GetMachiningEndPoint( ptEnd) ; return pMachMgr->GetMachiningEndPoint( ptEnd) ;
} }
//-----------------------------------------------------------------------------
bool
ExeGetMachiningStartAxes( bool bSkipClimb, DBLVECTOR& vAxVal)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// restituisco quanto cercato
return pMachMgr->GetMachiningStartAxes( bSkipClimb, vAxVal) ;
}
//-----------------------------------------------------------------------------
bool
ExeGetMachiningEndAxes( bool bSkipRise, DBLVECTOR& vAxVal)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// restituisco quanto cercato
return pMachMgr->GetMachiningEndAxes( bSkipRise, vAxVal) ;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool bool
ExeApplyAllMachinings( bool bRecalc, bool bStopOnFirstErr, string& sErrList) ExeApplyAllMachinings( bool bRecalc, bool bStopOnFirstErr, string& sErrList)
@@ -2700,7 +2936,7 @@ ExeApplyAllMachiningsEx( bool bRecalc, bool bStopOnFirstErr, string& sErrList, s
while ( nOperId != GDB_ID_NULL) { while ( nOperId != GDB_ID_NULL) {
if ( pMachMgr->GetOperationType( nOperId) == OPER_DISP) { if ( pMachMgr->GetOperationType( nOperId) == OPER_DISP) {
pMachMgr->SetCurrPhase( pMachMgr->GetOperationPhase( nOperId)) ; pMachMgr->SetCurrPhase( pMachMgr->GetOperationPhase( nOperId)) ;
if ( ! pMachMgr->DispositionSpecialApply( nOperId, bRecalc)) { if ( ! pMachMgr->DispositionSpecialApply( nOperId, true)) {
bOk = false ; bOk = false ;
if ( pMachMgr->GetLastErrorId() != 0) if ( pMachMgr->GetLastErrorId() != 0)
sErrList += pMachMgr->GetOperationName( nOperId) + " -> " + pMachMgr->GetLastErrorString() + "\r\n" ; sErrList += pMachMgr->GetOperationName( nOperId) + " -> " + pMachMgr->GetLastErrorString() + "\r\n" ;
@@ -2846,12 +3082,12 @@ ExeGetClEntMove( int nEntId, int& nMove)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool bool
ExeGetClEntFlag( int nEntId, int& nFlag) ExeGetClEntFlag( int nEntId, int& nFlag, int& nFlag2)
{ {
IMachMgr* pMachMgr = GetCurrMachMgr() ; IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false) VERIFY_MACHMGR( pMachMgr, false)
// recupero il flag // recupero i flag
return pMachMgr->GetClEntFlag( nEntId, nFlag) ; return pMachMgr->GetClEntFlag( nEntId, nFlag, nFlag2) ;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -2864,6 +3100,76 @@ ExeGetClEntIndex( int nEntId, int& nIndex)
return pMachMgr->GetClEntIndex( nEntId, nIndex) ; return pMachMgr->GetClEntIndex( nEntId, nIndex) ;
} }
//-----------------------------------------------------------------------------
bool
ExeGetClEntFeed( int nEntId, double& dFeed)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// recupero la feed
return pMachMgr->GetClEntFeed( nEntId, dFeed) ;
}
//-----------------------------------------------------------------------------
bool
ExeGetClEntAxesStatus( int nEntId, int& nStatus)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// recupero lo stato del movimento assi
return pMachMgr->GetClEntAxesStatus( nEntId, nStatus) ;
}
//-----------------------------------------------------------------------------
bool
ExeGetClEntAxesMask( int nEntId, int& nMask)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// recupero la mascheratura del movimento assi (valida solo in rapido)
return pMachMgr->GetClEntAxesMask( nEntId, nMask) ;
}
//-----------------------------------------------------------------------------
bool
ExeGetClEntAxesVal( int nEntId, DBLVECTOR& vAxes)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// recupero il valore degli assi
return pMachMgr->GetClEntAxesVal( nEntId, vAxes) ;
}
//-----------------------------------------------------------------------------
bool
ExeGetClEntTDir( int nEntId, Vector3d& vtTDir)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false) ;
// recupero TDir
return pMachMgr->GetClEntTDir( nEntId, vtTDir) ;
}
//-----------------------------------------------------------------------------
bool
ExeGetClEntCDir( int nEntId, Vector3d& vtCDir)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false) ;
// recupero CDir
return pMachMgr->GetClEntCDir( nEntId, vtCDir) ;
}
//-----------------------------------------------------------------------------
bool
ExeGetClEntADir( int nEntId, Vector3d& vtADir)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false) ;
// recupero ADir
return pMachMgr->GetClEntADir( nEntId, vtADir) ;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Simulazione // Simulazione
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -2926,6 +3232,16 @@ ExeSimSetUiStatus( int nUiStatus)
return pMachMgr->SimSetUiStatus( nUiStatus) ; return pMachMgr->SimSetUiStatus( nUiStatus) ;
} }
//-----------------------------------------------------------------------------
bool
ExeSimEnableToolTipTrace( bool bEnable)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// imposto abilitazione disegno traccia della punta utensile
return pMachMgr->SimEnableToolTipTrace( bEnable) ;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool bool
ExeSimGetAxisInfoPos( int nI, string& sName, string& sToken, bool& bLinear, double& dVal) ExeSimGetAxisInfoPos( int nI, string& sName, string& sToken, bool& bLinear, double& dVal)
@@ -2996,8 +3312,15 @@ ExeGenerate( const string& sCncFile, const string& sInfo)
ReplaceString( sDir, "/", "\\") ; ReplaceString( sDir, "/", "\\") ;
// recupero il nome // recupero il nome
string sNcName ; string sNcName ;
if ( ! ExeGetInfo( ExeGetCurrMachGroup(), GDL_NC_NAME, sNcName)) if ( ExeGetInfo( ExeGetCurrMachGroup(), GDL_NC_NAME, sNcName))
sNcName = GetFileTitleEgt( sProjPath) + ".cnc" ; sNcName = GetFileName( sNcName) ;
else {
string sCurrMachDir ; pMachMgr->GetCurrMachineDir( sCurrMachDir) ;
string sCurrMachName ; pMachMgr->GetCurrMachineName( sCurrMachName) ;
string sCurrMachIni = sCurrMachDir + "\\" + sCurrMachName + ".ini" ;
string sExt = GetPrivateProfileStringUtf8( "PartProgram", "Extension", ".cnc", sCurrMachIni.c_str()) ;
sNcName = ChangeFileExtension( GetFileName( sProjPath), sExt) ;
}
// creo la path completa // creo la path completa
sMyCncFile = sDir + "\\" + sNcName ; sMyCncFile = sDir + "\\" + sNcName ;
} }
@@ -3023,8 +3346,10 @@ ExeEstimate( const string& sEstFile, const string& sInfo)
ReplaceString( sDir, "/", "\\") ; ReplaceString( sDir, "/", "\\") ;
// recupero il nome // recupero il nome
string sEstName ; string sEstName ;
if ( ! ExeGetInfo( ExeGetCurrMachGroup(), GDL_NC_NAME, sEstName)) if ( ExeGetInfo( ExeGetCurrMachGroup(), GDL_NC_NAME, sEstName))
sEstName = GetFileTitleEgt( sProjPath) ; sEstName = GetFileName( sEstName) ;
else
sEstName = GetFileName( sProjPath) ;
sEstName = ChangeFileExtension( sEstName, ".html") ; sEstName = ChangeFileExtension( sEstName, ".html") ;
// creo la path completa // creo la path completa
sMyEstFile = sDir + "\\" + sEstName ; sMyEstFile = sDir + "\\" + sEstName ;
@@ -3054,7 +3379,9 @@ ExeSimulate( int& nErr, string& sError)
nErr = SHE_NONE ; nErr = SHE_NONE ;
sError = "" ; sError = "" ;
// disabilito UI // disabilito UI
ExeSetEnableUI( false) ; bool bPrevEnableUI = ExeGetEnableUI() ;
if ( bPrevEnableUI)
ExeSetEnableUI( false) ;
// avvio simulazione // avvio simulazione
if ( ! pMachMgr->SimInit() || ! pMachMgr->SimStart( true) || ! pMachMgr->SimStart( false)) { if ( ! pMachMgr->SimInit() || ! pMachMgr->SimStart( true) || ! pMachMgr->SimStart( false)) {
// inutile continuare con simulazione se avvio non riuscito // inutile continuare con simulazione se avvio non riuscito
@@ -3116,7 +3443,8 @@ ExeSimulate( int& nErr, string& sError)
// terminazione simulazione // terminazione simulazione
pMachMgr->SimExit() ; pMachMgr->SimExit() ;
// riabilito UI // riabilito UI
ExeSetEnableUI( true) ; if ( bPrevEnableUI)
ExeSetEnableUI( true) ;
return ( nErr == 0) ; return ( nErr == 0) ;
} }
@@ -3142,6 +3470,16 @@ ExeSetCalcTool( const string& sTool, const string& sHead, int nExit)
return pMachMgr->SetCalcTool( sTool, sHead, nExit) ; return pMachMgr->SetCalcTool( sTool, sHead, nExit) ;
} }
//----------------------------------------------------------------------------
bool
ExeSetCalcSolCh( int nScc, bool bExact)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// imposto il criterio di scelta della soluzione e se deve essere rispettato esattamente
return pMachMgr->SetCalcSolCh( nScc, bExact) ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
ExeSetRotAxisBlock( const string& sAxis, double dVal) ExeSetRotAxisBlock( const string& sAxis, double dVal)
@@ -3152,6 +3490,16 @@ ExeSetRotAxisBlock( const string& sAxis, double dVal)
return pMachMgr->SetRotAxisBlock( sAxis, dVal) ; return pMachMgr->SetRotAxisBlock( sAxis, dVal) ;
} }
//-----------------------------------------------------------------------------
bool
ExeGetCalcTable( string& sTable)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// restituisco la tavola corrente per il calcolo sulla macchina della macchinata corrente
return pMachMgr->GetCalcTable( sTable) ;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool bool
ExeGetCalcTool( string& sTool, string& sHead, int& nExit) ExeGetCalcTool( string& sTool, string& sHead, int& nExit)
@@ -3162,6 +3510,26 @@ ExeGetCalcTool( string& sTool, string& sHead, int& nExit)
return ( pMachMgr->GetCalcTool( sTool) && pMachMgr->GetCalcHead( sHead) && pMachMgr->GetCalcExit( nExit)) ; return ( pMachMgr->GetCalcTool( sTool) && pMachMgr->GetCalcHead( sHead) && pMachMgr->GetCalcExit( nExit)) ;
} }
//----------------------------------------------------------------------------
bool
ExeGetCalcSolCh( int& nScc, bool& bExact)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// recupero il criterio di scelta della soluzione e se deve essere rispettato esattamente
return pMachMgr->GetCalcSolCh( nScc, bExact) ;
}
//-----------------------------------------------------------------------------
bool
ExeGetAllCurrAxesNames( STRVECTOR& vAxName)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// recupero gli assi correnti derivanti dalla scelta di tavola e utensile
return pMachMgr->GetAllCurrAxesNames( vAxName) ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
ExeGetRotAxisBlocked( int nInd, string& sAxis, double& dVal) ExeGetRotAxisBlocked( int nInd, string& sAxis, double& dVal)
@@ -3197,23 +3565,34 @@ ExeGetCalcAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool bool
ExeGetCalcPositions( const Point3d& ptP, double dAngA, double dAngB, ExeGetCalcPositions( const Point3d& ptP, double dAngA, double dAngB,
int& nStat, double& dX, double& dY, double& dZ) double& dX, double& dY, double& dZ)
{ {
IMachMgr* pMachMgr = GetCurrMachMgr() ; IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false) VERIFY_MACHMGR( pMachMgr, false)
// calcolo gli assi lineari macchina dalla posizione e dagli assi rotanti // calcolo gli assi lineari macchina dalla posizione e dagli assi rotanti
return pMachMgr->GetCalcPositions( ptP, dAngA, dAngB, nStat, dX, dY, dZ) ; return pMachMgr->GetCalcPositions( ptP, dAngA, dAngB, dX, dY, dZ) ;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool bool
ExeGetCalcPositions( const Point3d& ptP, const DBLVECTOR& vAng, ExeGetCalcPositions( const Point3d& ptP, const DBLVECTOR& vAng,
int& nStat, double& dX, double& dY, double& dZ) double& dX, double& dY, double& dZ)
{ {
IMachMgr* pMachMgr = GetCurrMachMgr() ; IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false) VERIFY_MACHMGR( pMachMgr, false)
// calcolo gli assi lineari macchina dalla posizione e dagli assi rotanti // calcolo gli assi lineari macchina dalla posizione e dagli assi rotanti
return pMachMgr->GetCalcPositions( ptP, vAng, nStat, dX, dY, dZ) ; return pMachMgr->GetCalcPositions( ptP, vAng, dX, dY, dZ) ;
}
//-----------------------------------------------------------------------------
bool
ExeGetRobotAngles( const Point3d& ptP, const Vector3d& vtDirT, const Vector3d& vtDirA,
DBLVECTOR& vAng1, DBLVECTOR& vAng2)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// calcolo gli angoli macchina dalle direzioni fresa e ausiliaria passate
return pMachMgr->GetRobotAngles( ptP, vtDirT, vtDirA, vAng1, vAng2) ;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -3268,6 +3647,16 @@ ExeVerifyOutstroke( double dX, double dY, double dZ, double dAngA, double dAngB,
return pMachMgr->VerifyOutstroke( dX, dY, dZ, dAngA, dAngB, nStat) ; return pMachMgr->VerifyOutstroke( dX, dY, dZ, dAngA, dAngB, nStat) ;
} }
//-----------------------------------------------------------------------------
bool
ExeVerifyOutstroke( double dX, double dY, double dZ, const DBLVECTOR& vAng, int& nStat)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// verifica l'extracorsa degli assi
return pMachMgr->VerifyOutstroke( dX, dY, dZ, vAng, true, nStat) ;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool bool
ExeGetOutstrokeInfo( string& sInfo) ExeGetOutstrokeInfo( string& sInfo)
@@ -3331,6 +3720,16 @@ ExeGetHeadExitCount( const string& sHead)
return pMachMgr->GetHeadExitCount( sHead) ; return pMachMgr->GetHeadExitCount( sHead) ;
} }
//-----------------------------------------------------------------------------
int
ExeGetExitId( const string& sHead, int nExit)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL)
// restituisco identificativo dell'uscita della testa indicata nella macchina della macchinata corrente
return pMachMgr->GetExitId( sHead, nExit) ;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
int int
ExeGetTcPosId( const string& sTcPos) ExeGetTcPosId( const string& sTcPos)
@@ -3361,6 +3760,16 @@ ExeGetAxisType( const string& sAxis, bool& bLinear)
return pMachMgr->GetAxisType( sAxis, bLinear) ; return pMachMgr->GetAxisType( sAxis, bLinear) ;
} }
//-----------------------------------------------------------------------------
bool
ExeGetAxisDir( const string& sAxis, Vector3d& vtDir)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// recupero la direzione dell'asse
return pMachMgr->GetAxisDir( sAxis, vtDir) ;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool bool
ExeGetAxisInvert( const string& sAxis, bool& bInvert) ExeGetAxisInvert( const string& sAxis, bool& bInvert)
@@ -3391,6 +3800,16 @@ ExeGetAllTablesNames( STRVECTOR& vNames)
return pMachMgr->GetAllTablesNames( vNames) ; return pMachMgr->GetAllTablesNames( vNames) ;
} }
//-----------------------------------------------------------------------------
bool
ExeGetAllAxesNames( STRVECTOR& vNames)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// recupero l'elenco degli assi
return pMachMgr->GetAllAxesNames( vNames) ;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool bool
ExeGetAllHeadsNames( STRVECTOR& vNames) ExeGetAllHeadsNames( STRVECTOR& vNames)
+191
View File
@@ -0,0 +1,191 @@
//----------------------------------------------------------------------------
// EgalTech 2025-2025
//----------------------------------------------------------------------------
// File : EXE_MachOpt.cpp Data : 02.04.2025 Versione : 2.7c1
// Contenuto : Funzioni per Ottimizzare i tempi tra le lavorazioni.
//
//
//
// Modifiche : 02.04.25 RE Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "EXE.h"
#include "EXE_Macro.h"
#include "EXE_Const.h"
#include "DllNesting.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
#include "/EgtDev/Include/ENkMachOptimization.h"
using namespace std ;
//----------------------------------------------------------------------------
// Static LuaMgr per EgtExecutor
//----------------------------------------------------------------------------
static PtrOwner<IMachOptimization> s_pMO ;
//----------------------------------------------------------------------------
bool
ExeOptMachInit( void)
{
// Creo l'oggetto per il calcolo del percorso minimo (ShortestPath)
s_pMO.Set( CreateMachOptimization()) ;
return ( ! IsNull( s_pMO)) ;
}
//----------------------------------------------------------------------------
bool
ExeOptMachTerminate( void)
{
// Distruggo l'oggetto
s_pMO.Reset() ;
return ( IsNull( s_pMO)) ;
}
//----------------------------------------------------------------------------
bool
ExeOptMachAddTool( int nId, double dTCX, double dTCY, double dTCZ, double dTCA,
double dTCB, double dTCC, bool bX, bool bY, bool bZ, bool bA,
bool bB, bool bC, double dTLoad, double dTUnL)
{
// Se oggetto non instanziato, errore
if ( IsNull( s_pMO))
return false ;
// Inserisco il Record
return ( s_pMO->InsertTool( nId, dTCX, dTCY, dTCZ, dTCA, dTCB, dTCC, bX, bY, bZ, bA,
bB, bC, dTLoad, dTUnL)) ;
}
//----------------------------------------------------------------------------
bool
ExeOptMachAddMachining( int nId, int nToolId, int nGroup,
double dX_Start, double dY_Start, double dZ_Start,
double dA_Start, double dB_Start, double dC_Start,
double dX_End, double dY_End, double dZ_End,
double dA_End, double dB_End, double dC_End)
{
// Se oggetto non instanziato, errore
if ( IsNull( s_pMO))
return false ;
// Inserisco il Record
return ( s_pMO->InsertMachining( nId, nToolId, nGroup,
dX_Start, dY_Start, dZ_Start,
dA_Start, dB_Start, dC_Start,
dX_End, dY_End, dZ_End,
dA_End, dB_End, dC_End)) ;
}
//----------------------------------------------------------------------------
bool
ExeOptMachSetFirstMachining( int nId)
{
// Se oggetto non instanziato, errore
if ( IsNull( s_pMO))
return false ;
// Imposto la prima lavorazione
return ( s_pMO->SetFirstMachining( nId)) ;
}
//----------------------------------------------------------------------------
bool
ExeOptMachSetLastMachining( int nId)
{
// Se oggetto non instanziato, errore
if ( IsNull( s_pMO))
return false ;
// Imposto l'ultima lavorazione
return ( s_pMO->SetLastMachining( nId)) ;
}
//----------------------------------------------------------------------------
bool
ExeOptMachSetFeeds( double dFeedL, double dFeedA)
{
// Se oggetto non instanziato, errore
if ( IsNull( s_pMO))
return false ;
// Imposto l'ultima lavorazione
return ( s_pMO->SetFeeds( dFeedL, dFeedA)) ;
}
//----------------------------------------------------------------------------
bool
ExeOptMachAddDependence( int nIdPrec, int nIdSucc)
{
// Se oggetto non instanziato, errore
if ( IsNull( s_pMO))
return false ;
// Inserisco la Dipendenza obbligatoria
return ( s_pMO->InsertDependence( nIdPrec, nIdSucc)) ;
}
//----------------------------------------------------------------------------
bool
ExeOptMachAddSuggestedDependence( int nIdPrec, int nIdSucc)
{
// Se oggetto non instanziato, errore
if ( IsNull( s_pMO))
return false ;
// Inserisco la Dipendenza obbligatoria
return ( s_pMO->InsertSuggestedDependences( nIdPrec, nIdSucc)) ;
}
//----------------------------------------------------------------------------
bool
ExeOptMachSetAllGroupDependencesAsMandatory( bool bAllMandatory)
{
// Se oggetto non instanziato, errore
if ( IsNull( s_pMO))
return false ;
// Imposto il Flag
return ( s_pMO->SetAllGroupsAsMandatory( bAllMandatory)) ;
}
//----------------------------------------------------------------------------
bool
ExeOptMachSetOptimizationForGroups( bool bOptForGroups)
{
// Se oggetto non istanziato, errore
if ( IsNull( s_pMO))
return false ;
// Imposto il Flag
return ( s_pMO->SetOptimizationForGroups( bOptForGroups)) ;
}
//----------------------------------------------------------------------------
bool
ExeOptMachSetOpenBound( bool bStartVsEnd, int nFlag, double dX, double dY, double dZ)
{
// Se oggetto non istanziato, errore
if ( IsNull( s_pMO))
return false ;
// Imposto il Flag
return ( s_pMO->SetOpenBound( bStartVsEnd, nFlag, dX, dY, dZ)) ;
}
//----------------------------------------------------------------------------
bool
ExeOptMachSetOpenBoundForGroups( int nGroup, bool bStartVsEnd, int nFlag, double dX, double dY, double dZ)
{
// Se oggetto non istanziato, errore
if ( IsNull( s_pMO))
return false ;
// Impsto il Flag
return ( s_pMO->SetOpenBoundForGroups( nGroup, bStartVsEnd, nFlag, dX, dY, dZ)) ;
}
//----------------------------------------------------------------------------
bool
ExeOptMachCalculate( INTVECTOR& vIds)
{
vIds.clear() ;
// Se oggetto non instanziato, errore
if ( IsNull( s_pMO))
return false ;
// Recupero i risultati
return ( s_pMO->Calculate( vIds)) ;
}
+57
View File
@@ -0,0 +1,57 @@
//----------------------------------------------------------------------------
// EgalTech 2023-2023
//----------------------------------------------------------------------------
// File : EXE_Mutex.cpp Data : 05.02.23 Versione : 2.5a6
// Contenuto : Funzioni per gestione mutex.
//
//
//
// Modifiche : 05.02.23 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "EXE.h"
#include "/EgtDev/Include/EgtStringConverter.h"
using namespace std ;
//----------------------------------------------------------------------------
static HANDLE s_hMutex = NULL ;
//----------------------------------------------------------------------------
bool
ExeCreateMutex( const string& sMutexName)
{
if ( s_hMutex != NULL)
return false ;
HANDLE hMutex = CreateMutex( NULL, TRUE, stringtoW( sMutexName)) ;
if ( hMutex == NULL)
return false ;
else if ( GetLastError() == ERROR_ALREADY_EXISTS) {
ReleaseMutex( hMutex) ;
CloseHandle( hMutex) ;
return false ;
}
else {
s_hMutex = hMutex ;
return true ;
}
}
//----------------------------------------------------------------------------
bool
ExeReleaseMutex( void)
{
if ( s_hMutex == NULL)
return true ;
bool bOk = ( ReleaseMutex( s_hMutex) != FALSE) ;
CloseHandle( s_hMutex) ;
s_hMutex = NULL ;
return bOk ;
}
+10 -10
View File
@@ -16,13 +16,13 @@
class IGeomDB ; class IGeomDB ;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
int GetFlatPartRegion( IGeomDB* pGeomDB, int nId) ; int GetFlatPartRegion( IGeomDB* pGeomDB, int nId) ;
int GetFlatPartUpRegion( IGeomDB* pGeomDB, int nId) ; int GetFlatPartUpRegion( IGeomDB* pGeomDB, int nId) ;
int GetFlatPartDownRegion( IGeomDB* pGeomDB, int nId) ; int GetFlatPartDownRegion( IGeomDB* pGeomDB, int nId) ;
bool GetFlatPartCutRegions( IGeomDB* pGeomDB, int nId, bool bReduced, INTVECTOR& vCrId) ; bool GetFlatPartCutRegions( IGeomDB* pGeomDB, int nId, bool bReduced, INTVECTOR& vCrId) ;
bool GetFlatPartDownCutRegions( IGeomDB* pGeomDB, int nId, bool bReduced, INTVECTOR& vCrId) ; bool GetFlatPartDownCutRegions( IGeomDB* pGeomDB, int nId, bool bReduced, INTVECTOR& vCrId) ;
bool GetFlatPartInterpartGap(IGeomDB* pGeomDB, int nId, double& dGap); bool GetFlatPartInterpartGap(IGeomDB* pGeomDB, int nId, double& dGap);
int GetFlatPartFromRegion( IGeomDB* pGeomDB, int nId) ; int GetFlatPartFromRegion( IGeomDB* pGeomDB, int nId) ;
int GetFlatPartFromCut( IGeomDB* pGeomDB, int nId) ; int GetFlatPartFromCut( IGeomDB* pGeomDB, int nId) ;
int GetGeometryFromCut( IGeomDB* pGeomDB, IMachMgr* pMachMgr, int nId) ; INTVECTOR GetGeometryFromCut( IGeomDB* pGeomDB, IMachMgr* pMachMgr, int nId) ;
bool GetFlatPartApproxContour( IGeomDB* pGeomDB, int nId, PolyLine& PL) ; bool GetFlatPartApproxContour( IGeomDB* pGeomDB, int nId, PolyLine& PL) ;
+18 -1
View File
@@ -19,7 +19,6 @@
#include "DllNesting.h" #include "DllNesting.h"
#include "/EgtDev/Include/EGkCurve.h" #include "/EgtDev/Include/EGkCurve.h"
#include "/EgtDev/Include/EGkCurveComposite.h" #include "/EgtDev/Include/EGkCurveComposite.h"
#include "/EgtDev/Include/EGkOffsetCurve.h"
#include "/EgtDev/Include/EGkSurfFlatRegion.h" #include "/EgtDev/Include/EGkSurfFlatRegion.h"
#include "/EgtDev/Include/ENsAutoNester.h" #include "/EgtDev/Include/ENsAutoNester.h"
#include "/EgtDev/Include/EGnStringUtils.h" #include "/EgtDev/Include/EGnStringUtils.h"
@@ -258,6 +257,15 @@ ExeAutoNestSetInterpartGap( double dGap)
return s_pAutoNester->SetInterpartGap( dGap) ; return s_pAutoNester->SetInterpartGap( dGap) ;
} }
//-----------------------------------------------------------------------------
bool
ExeAutoNestSetShearGap( double dShearGap)
{
if ( IsNull( s_pAutoNester))
return false ;
return s_pAutoNester->SetShearGap( dShearGap) ;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool bool
ExeAutoNestSetReportFile( const string& sReportFile) ExeAutoNestSetReportFile( const string& sReportFile)
@@ -339,3 +347,12 @@ ExeAutoNestGetOneResult( int nInd, int& nType, int& nId, int& nFlag, double& dX,
dAngRot = s_vANestInfo[nInd].dAngRot ; dAngRot = s_vANestInfo[nInd].dAngRot ;
return true ; return true ;
} }
//-----------------------------------------------------------------------------
bool
ExeAutoNestCalcShearSequence( int nNesting, PNTVECTOR& vPtStart, PNTVECTOR& vPtEnd)
{
if ( IsNull( s_pAutoNester))
return false ;
return s_pAutoNester->CalcShearSequence( nNesting, vPtStart, vPtEnd) ;
}
+92 -19
View File
@@ -89,6 +89,10 @@ ApproxCurveIfNeeded( IGdbIterator* pEnt, double dToler)
PolyArc PA ; PolyArc PA ;
double dTol = max( dToler, LIN_TOL_FINE) ; double dTol = max( dToler, LIN_TOL_FINE) ;
bool bOk = pCrv->ApproxWithArcsEx( dTol, ANG_TOL_STD_DEG, LIN_FEA_STD, PA) && pCC->FromPolyArc( PA) ; bool bOk = pCrv->ApproxWithArcsEx( dTol, ANG_TOL_STD_DEG, LIN_FEA_STD, PA) && pCC->FromPolyArc( PA) ;
// eliminazione di small Z
bOk = bOk && pCC->RemoveSmallDefects( 0.5 * dTol, ANG_TOL_STD_DEG) ;
// merge di archi identici di biarchi
bOk = bOk && pCC->MergeCurves( 0.5 * dTol, ANG_TOL_STD_DEG) ;
bOk = bOk && pEnt->GetGDB()->ReplaceGeoObj( pEnt->GetId(), Release( pCC)) ; bOk = bOk && pEnt->GetGDB()->ReplaceGeoObj( pEnt->GetId(), Release( pCC)) ;
return bOk ; return bOk ;
} }
@@ -1613,6 +1617,50 @@ ExeCalcFlatPartUpRegion( int nPartId, bool bCalc)
return true ; return true ;
} }
//----------------------------------------------------------------------------
static bool
IgnoreOutlineFillet( IGeomDB* pGeomDB, int nCrvId, int nLayId)
{
// verifico se la curva nCrvId è un raccordo che deve essere ignorato, ovvero se si tratta di un arco non inclinato, in tangenza
// e consecutivo ad almeno un lato inclinato
// verifico se arco
if ( pGeomDB->GetGeoType( nCrvId) == CRV_ARC) {
// verifico se non inclinato
double dSideAng = 0, dSideAng2 = 0 ;
pGeomDB->GetInfo( nCrvId, NST_KEY_SIDEANG, dSideAng) ;
pGeomDB->GetInfo( nCrvId, NST_KEY_SIDEANG2, dSideAng2) ;
if ( abs( dSideAng) < EPS_ANG_SMALL && abs( dSideAng2) < EPS_ANG_SMALL) {
// verifico se in tangenza con curve consecutive
double dPrevAng = ANG_RIGHT, dNextAng = ANG_RIGHT ;
pGeomDB->GetInfo( nCrvId, MCH_KEY_PREVANG, dPrevAng) ;
pGeomDB->GetInfo( nCrvId, MCH_KEY_NEXTANG, dNextAng) ;
if ( abs( dPrevAng) < EPS_ANG_SMALL && abs( dNextAng) < EPS_ANG_SMALL) {
// verifico se è inclinata almeno una tra la curva precedente e quella successiva
int nPrevId = pGeomDB->GetPrev( nCrvId) ;
if ( nPrevId == GDB_ID_NULL)
nPrevId = pGeomDB->GetLastInGroup( nLayId) ;
if ( nPrevId == GDB_ID_NULL)
return false ;
double dSideAng, dSideAng2 ;
if ( ( pGeomDB->GetInfo( nPrevId, NST_KEY_SIDEANG, dSideAng) && abs( dSideAng) > EPS_ANG_SMALL) ||
( pGeomDB->GetInfo( nPrevId, NST_KEY_SIDEANG2, dSideAng2) && abs( dSideAng2) > EPS_ANG_SMALL))
return true ;
int nNextId = pGeomDB->GetNext( nCrvId) ;
if ( nNextId == GDB_ID_NULL)
nNextId = pGeomDB->GetFirstInGroup( nLayId) ;
if ( nNextId == GDB_ID_NULL)
return false ;
if ( ( pGeomDB->GetInfo( nNextId, NST_KEY_SIDEANG, dSideAng) && abs( dSideAng) > EPS_ANG_SMALL) ||
( pGeomDB->GetInfo( nNextId, NST_KEY_SIDEANG2, dSideAng2) && abs( dSideAng2) > EPS_ANG_SMALL))
return true ;
}
}
}
return false ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static bool static bool
AdjustLayerForSideAngle( IGeomDB* pGeomDB, int nLayOrigId, const string& sLayOrig, int nLayReg, double dH) AdjustLayerForSideAngle( IGeomDB* pGeomDB, int nLayOrigId, const string& sLayOrig, int nLayReg, double dH)
@@ -1683,7 +1731,8 @@ AdjustLayerForSideAngle( IGeomDB* pGeomDB, int nLayOrigId, const string& sLayOri
ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nNewId)) ; ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nNewId)) ;
if ( pCrv == nullptr) if ( pCrv == nullptr)
return false ; return false ;
pCrv->SimpleOffset( dCalcOffset) ; if ( ! pCrv->SimpleOffset( dCalcOffset))
pGeomDB->Erase( nNewId) ;
} }
else if ( pGeomDB->GetInfo( nCrvId, NST_KEY_SIDEANG2, dSideAng2) && abs( dSideAng2) > EPS_ANG_SMALL) { else if ( pGeomDB->GetInfo( nCrvId, NST_KEY_SIDEANG2, dSideAng2) && abs( dSideAng2) > EPS_ANG_SMALL) {
double dOffset2 = 0 ; double dOffset2 = 0 ;
@@ -1696,8 +1745,12 @@ AdjustLayerForSideAngle( IGeomDB* pGeomDB, int nLayOrigId, const string& sLayOri
ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nNewId)) ; ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nNewId)) ;
if ( pCrv == nullptr) if ( pCrv == nullptr)
return false ; return false ;
pCrv->SimpleOffset( dCalcOffset) ; if ( ! pCrv->SimpleOffset( dCalcOffset))
pGeomDB->Erase( nNewId) ;
} }
// verifico se raccordo da ignorare per poter calcolare la regione
else if ( IgnoreOutlineFillet( pGeomDB, nCrvId, nLayId))
pGeomDB->Erase( nNewId) ;
} }
// aggiusto tra loro le curve offsettate (allungandole e/o accorciandole) // aggiusto tra loro le curve offsettate (allungandole e/o accorciandole)
if ( ! AdjustLayerCurves( pGeomDB, nTmpLayId)) if ( ! AdjustLayerCurves( pGeomDB, nTmpLayId))
@@ -1720,7 +1773,7 @@ AdjustLayerForSideAngle( IGeomDB* pGeomDB, int nLayOrigId, const string& sLayOri
if ( nNewId == GDB_ID_NULL) if ( nNewId == GDB_ID_NULL)
return false ; return false ;
// determino ed eseguo offset // determino ed eseguo offset
double dSideAng ; double dSideAng, dSideAng2 ;
if ( pGeomDB->GetInfo( nCrvId, NST_KEY_SIDEANG, dSideAng) && abs( dSideAng) > EPS_ANG_SMALL) { if ( pGeomDB->GetInfo( nCrvId, NST_KEY_SIDEANG, dSideAng) && abs( dSideAng) > EPS_ANG_SMALL) {
double dOffset = 0 ; double dOffset = 0 ;
pGeomDB->GetInfo( nCrvId, NST_KEY_OFFSET, dOffset) ; pGeomDB->GetInfo( nCrvId, NST_KEY_OFFSET, dOffset) ;
@@ -1728,8 +1781,22 @@ AdjustLayerForSideAngle( IGeomDB* pGeomDB, int nLayOrigId, const string& sLayOri
ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nNewId)) ; ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nNewId)) ;
if ( pCrv == nullptr) if ( pCrv == nullptr)
return false ; return false ;
pCrv->SimpleOffset( dCalcOffset) ; if ( ! pCrv->SimpleOffset( dCalcOffset))
pGeomDB->Erase( nNewId) ;
} }
else if ( pGeomDB->GetInfo( nCrvId, NST_KEY_SIDEANG2, dSideAng2) && abs( dSideAng2) > EPS_ANG_SMALL) {
double dOffset2 = 0 ;
pGeomDB->GetInfo( nCrvId, NST_KEY_OFFSET2, dOffset2) ;
double dCalcOffset = dOffset2 ;
ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nNewId)) ;
if ( pCrv == nullptr)
return false ;
if ( ! pCrv->SimpleOffset( dCalcOffset))
pGeomDB->Erase( nNewId) ;
}
// verifico se raccordo da ignorare per poter calcolare la regione
else if ( IgnoreOutlineFillet( pGeomDB, nCrvId, nLayId))
pGeomDB->Erase( nNewId) ;
} }
// aggiusto tra loro le curve offsettate (allungandole e/o accorciandole) // aggiusto tra loro le curve offsettate (allungandole e/o accorciandole)
if ( ! AdjustLayerCurves( pGeomDB, nTmpLay2Id)) if ( ! AdjustLayerCurves( pGeomDB, nTmpLay2Id))
@@ -1769,10 +1836,13 @@ AdjustLayerForSideAngle( IGeomDB* pGeomDB, int nLayOrigId, const string& sLayOri
//if ( dStartProD > EPS_SMALL) //if ( dStartProD > EPS_SMALL)
// pCrv->ExtendStartByLen( dStartProD) ; // pCrv->ExtendStartByLen( dStartProD) ;
double dStartProMin = min( dStartProD, dStartProU) ; double dStartProMin = min( dStartProD, dStartProU) ;
if ( dStartProMin < - EPS_SMALL) if ( dStartProMin < - EPS_SMALL) {
pCrv->TrimStartAtLen( - dStartProMin) ; pCrv->TrimStartAtLen( - dStartProMin) ;
if ( abs( dStartProD - dStartProU) > EPS_SMALL) if ( abs( dStartProD - dStartProU) > EPS_SMALL)
pGeomDB->SetInfo( nCrvId, MCH_KEY_START_WHISKEXT, abs( dStartProD - dStartProU)) ; pGeomDB->SetInfo( nCrvId, MCH_KEY_START_WHISKEXT, abs( dStartProD - dStartProU)) ;
}
else
pGeomDB->SetInfo( nCrvId, MCH_KEY_START_WHISKEXT, max( dStartProD, dStartProU)) ;
} }
else { else {
if ( dStartProD < - EPS_SMALL) if ( dStartProD < - EPS_SMALL)
@@ -1799,9 +1869,11 @@ AdjustLayerForSideAngle( IGeomDB* pGeomDB, int nLayOrigId, const string& sLayOri
double dLen ; double dLen ;
pCrv->GetLength( dLen) ; pCrv->GetLength( dLen) ;
pCrv->TrimEndAtLen( dLen + dEndProMin) ; pCrv->TrimEndAtLen( dLen + dEndProMin) ;
if ( abs( dEndProD - dEndProU) > EPS_SMALL)
pGeomDB->SetInfo( nCrvId, MCH_KEY_END_WHISKEXT, abs( dEndProD - dEndProU)) ;
} }
if ( abs( dEndProD - dEndProU) > EPS_SMALL) else
pGeomDB->SetInfo( nCrvId, MCH_KEY_END_WHISKEXT, abs( dEndProD - dEndProU)) ; pGeomDB->SetInfo( nCrvId, MCH_KEY_END_WHISKEXT, max( dEndProD, dEndProU)) ;
} }
else { else {
if ( dEndProD < - EPS_SMALL) { if ( dEndProD < - EPS_SMALL) {
@@ -2112,24 +2184,25 @@ GetFlatPartFromCut( IGeomDB* pGeomDB, int nId)
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
int INTVECTOR
GetGeometryFromCut( IGeomDB* pGeomDB, IMachMgr* pMachMgr, int nId) GetGeometryFromCut( IGeomDB* pGeomDB, IMachMgr* pMachMgr, int nId)
{ {
INTVECTOR vnIds ;
if ( pGeomDB == nullptr || pMachMgr == nullptr) if ( pGeomDB == nullptr || pMachMgr == nullptr)
return GDB_ID_NULL ; return vnIds ;
// verifico appartenga ad una lavorazione // verifico appartenga ad una lavorazione
int nMchId ; int nMchId ;
if ( ! pGeomDB->GetInfo( pGeomDB->GetParentId( pGeomDB->GetParentId( nId)), "MId", nMchId)) if ( ! pGeomDB->GetInfo( pGeomDB->GetParentId( pGeomDB->GetParentId( nId)), "MId", nMchId))
return GDB_ID_NULL ; return vnIds ;
// recupero la geometria di applicazione della lavorazione (deve essere una sola) // recupero la geometria di applicazione della lavorazione (deve essere una sola)
if ( ! pMachMgr->SetCurrMachining( nMchId)) if ( ! pMachMgr->SetCurrMachining( nMchId))
return GDB_ID_NULL ; return vnIds ;
SELVECTOR vIds ; SELVECTOR vSelIds ;
pMachMgr->GetMachiningGeometry( vIds) ; pMachMgr->GetMachiningGeometry( vSelIds) ;
if ( vIds.size() == 1) vnIds.reserve( vSelIds.size()) ;
return vIds[0].nId ; for ( const SelData& mySelData : vSelIds)
else vnIds.emplace_back( mySelData.nId) ;
return GDB_ID_NULL ; return vnIds ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
+10 -10
View File
@@ -143,7 +143,7 @@ ExeVerifyMachining( int nMchId, int& nResult)
// confronto la regione di attacco della lavorazione con le regioni degli altri pezzi // confronto la regione di attacco della lavorazione con le regioni degli altri pezzi
for ( int nMchRegId : vMchLiReg) { for ( int nMchRegId : vMchLiReg) {
for ( int nOthRegId : vOthReg) { for ( int nOthRegId : vOthReg) {
if ( ExeSurfFrChunkSimpleClassify( nOthRegId, 0, nMchRegId, 0, VERIF_TOLER) != REGC_OUT) if ( ExeSurfFlatRegionInterference( nOthRegId, 0, nMchRegId, 0, VERIF_TOLER) != REGC_OUT)
nResult |= FMI_LI ; nResult |= FMI_LI ;
} }
} }
@@ -152,7 +152,7 @@ ExeVerifyMachining( int nMchId, int& nResult)
if ( vMchDwnLiReg[i] != GDB_ID_NULL || vOthDwnReg[j] != GDB_ID_NULL) { if ( vMchDwnLiReg[i] != GDB_ID_NULL || vOthDwnReg[j] != GDB_ID_NULL) {
int nMchRegId = ( ( vMchDwnLiReg[i] != GDB_ID_NULL) ? vMchDwnLiReg[i] : vMchLiReg[i]) ; int nMchRegId = ( ( vMchDwnLiReg[i] != GDB_ID_NULL) ? vMchDwnLiReg[i] : vMchLiReg[i]) ;
int nOthRegId = ( ( vOthDwnReg[j] != GDB_ID_NULL) ? vOthDwnReg[j] : vOthReg[j]) ; int nOthRegId = ( ( vOthDwnReg[j] != GDB_ID_NULL) ? vOthDwnReg[j] : vOthReg[j]) ;
if ( ExeSurfFrChunkSimpleClassify( nOthRegId, 0, nMchRegId, 0, VERIF_TOLER) != REGC_OUT) if ( ExeSurfFlatRegionInterference( nOthRegId, 0, nMchRegId, 0, VERIF_TOLER) != REGC_OUT)
nResult |= FMI_LI ; nResult |= FMI_LI ;
} }
} }
@@ -160,7 +160,7 @@ ExeVerifyMachining( int nMchId, int& nResult)
// confronto la regione ridotta della lavorazione con le regioni degli altri pezzi // confronto la regione ridotta della lavorazione con le regioni degli altri pezzi
for ( int nMchRegId : vMchRReg) { for ( int nMchRegId : vMchRReg) {
for ( int nOthRegId : vOthReg) { for ( int nOthRegId : vOthReg) {
if ( ExeSurfFrChunkSimpleClassify( nOthRegId, 0, nMchRegId, 0, VERIF_TOLER) != REGC_OUT) if ( ExeSurfFlatRegionInterference( nOthRegId, 0, nMchRegId, 0, VERIF_TOLER) != REGC_OUT)
nResult |= FMI_RM ; nResult |= FMI_RM ;
} }
} }
@@ -169,7 +169,7 @@ ExeVerifyMachining( int nMchId, int& nResult)
if ( vMchDwnRReg[i] != GDB_ID_NULL || vOthDwnReg[j] != GDB_ID_NULL) { if ( vMchDwnRReg[i] != GDB_ID_NULL || vOthDwnReg[j] != GDB_ID_NULL) {
int nMchRegId = ( ( vMchDwnRReg[i] != GDB_ID_NULL) ? vMchDwnRReg[i] : vMchRReg[i]) ; int nMchRegId = ( ( vMchDwnRReg[i] != GDB_ID_NULL) ? vMchDwnRReg[i] : vMchRReg[i]) ;
int nOthRegId = ( ( vOthDwnReg[j] != GDB_ID_NULL) ? vOthDwnReg[j] : vOthReg[j]) ; int nOthRegId = ( ( vOthDwnReg[j] != GDB_ID_NULL) ? vOthDwnReg[j] : vOthReg[j]) ;
if ( ExeSurfFrChunkSimpleClassify( nOthRegId, 0, nMchRegId, 0, VERIF_TOLER) != REGC_OUT) if ( ExeSurfFlatRegionInterference( nOthRegId, 0, nMchRegId, 0, VERIF_TOLER) != REGC_OUT)
nResult |= FMI_RM ; nResult |= FMI_RM ;
} }
} }
@@ -177,7 +177,7 @@ ExeVerifyMachining( int nMchId, int& nResult)
// confronto la regione di uscita della lavorazione con le regioni degli altri pezzi // confronto la regione di uscita della lavorazione con le regioni degli altri pezzi
for ( int nMchRegId : vMchLoReg) { for ( int nMchRegId : vMchLoReg) {
for ( int nOthRegId : vOthReg) { for ( int nOthRegId : vOthReg) {
if ( ExeSurfFrChunkSimpleClassify( nOthRegId, 0, nMchRegId, 0, VERIF_TOLER) != REGC_OUT) if ( ExeSurfFlatRegionInterference( nOthRegId, 0, nMchRegId, 0, VERIF_TOLER) != REGC_OUT)
nResult |= FMI_LO ; nResult |= FMI_LO ;
} }
} }
@@ -186,7 +186,7 @@ ExeVerifyMachining( int nMchId, int& nResult)
if ( vMchDwnLoReg[i] != GDB_ID_NULL || vOthDwnReg[j] != GDB_ID_NULL) { if ( vMchDwnLoReg[i] != GDB_ID_NULL || vOthDwnReg[j] != GDB_ID_NULL) {
int nMchRegId = ( ( vMchDwnLoReg[i] != GDB_ID_NULL) ? vMchDwnLoReg[i] : vMchLoReg[i]) ; int nMchRegId = ( ( vMchDwnLoReg[i] != GDB_ID_NULL) ? vMchDwnLoReg[i] : vMchLoReg[i]) ;
int nOthRegId = ( ( vOthDwnReg[j] != GDB_ID_NULL) ? vOthDwnReg[j] : vOthReg[j]) ; int nOthRegId = ( ( vOthDwnReg[j] != GDB_ID_NULL) ? vOthDwnReg[j] : vOthReg[j]) ;
if ( ExeSurfFrChunkSimpleClassify( nOthRegId, 0, nMchRegId, 0, VERIF_TOLER) != REGC_OUT) if ( ExeSurfFlatRegionInterference( nOthRegId, 0, nMchRegId, 0, VERIF_TOLER) != REGC_OUT)
nResult |= FMI_LO ; nResult |= FMI_LO ;
} }
} }
@@ -254,7 +254,7 @@ ExeVerifyCutAsSplitting( int nMchId)
pMachMgr->MachiningPreview( true) ; pMachMgr->MachiningPreview( true) ;
// verifico interferenza // verifico interferenza
int nRes ; int nRes ;
if ( ExeVerifyMachining( nMchId, nRes) && nRes == FMI_NONE) if ( ExeVerifyMachining( nMchId, nRes) && ( nRes == FMI_NONE || nRes == FMI_LO))
nResult += CAR_LI_OK ; nResult += CAR_LI_OK ;
// ripristino attacco originale // ripristino attacco originale
pMachMgr->SetMachiningParam( MPA_LEADINTYPE, nLiType) ; pMachMgr->SetMachiningParam( MPA_LEADINTYPE, nLiType) ;
@@ -265,7 +265,7 @@ ExeVerifyCutAsSplitting( int nMchId)
else { else {
// verifico interferenza // verifico interferenza
int nRes ; int nRes ;
if ( ExeVerifyMachining( nMchId, nRes) && nRes == FMI_NONE) if ( ExeVerifyMachining( nMchId, nRes) && ( nRes == FMI_NONE || nRes == FMI_LO))
nResult += CAR_LI_OK ; nResult += CAR_LI_OK ;
} }
// verifico se posso portare uscita al bordo grezzo // verifico se posso portare uscita al bordo grezzo
@@ -276,7 +276,7 @@ ExeVerifyCutAsSplitting( int nMchId)
pMachMgr->MachiningPreview( true) ; pMachMgr->MachiningPreview( true) ;
// verifico interferenza // verifico interferenza
int nRes ; int nRes ;
if ( ExeVerifyMachining( nMchId, nRes) && nRes == FMI_NONE) if ( ExeVerifyMachining( nMchId, nRes) && ( nRes == FMI_NONE || nRes == FMI_LI))
nResult += CAR_LO_OK ; nResult += CAR_LO_OK ;
// ripristino uscita originale // ripristino uscita originale
pMachMgr->SetMachiningParam( MPA_LEADOUTTYPE, nLoType) ; pMachMgr->SetMachiningParam( MPA_LEADOUTTYPE, nLoType) ;
@@ -287,7 +287,7 @@ ExeVerifyCutAsSplitting( int nMchId)
else { else {
// verifico interferenza // verifico interferenza
int nRes ; int nRes ;
if ( ExeVerifyMachining( nMchId, nRes) && nRes == FMI_NONE) if ( ExeVerifyMachining( nMchId, nRes) && ( nRes == FMI_NONE || nRes == FMI_LI))
nResult += CAR_LO_OK ; nResult += CAR_LO_OK ;
} }
// verifico se taglio non passante // verifico se taglio non passante
+331 -132
View File
@@ -22,8 +22,10 @@
#include "/EgtDev/Include/EGkCurveLine.h" #include "/EgtDev/Include/EGkCurveLine.h"
#include "/EgtDev/Include/EGkCurveComposite.h" #include "/EgtDev/Include/EGkCurveComposite.h"
#include "/EgtDev/Include/EGkDistPointCurve.h" #include "/EgtDev/Include/EGkDistPointCurve.h"
#include "/EgtDev/Include/EGkDistPointLine.h"
#include "/EgtDev/Include/EGkSfrCreate.h" #include "/EgtDev/Include/EGkSfrCreate.h"
#include "/EgtDev/Include/EGkCAvSimpleSurfFrMove.h" #include "/EgtDev/Include/EGkCAvSimpleSurfFrMove.h"
#include "/EgtDev/Include/EGkCAvSurfFrMove.h"
#include "/EgtDev/Include/EGkStringUtils3d.h" #include "/EgtDev/Include/EGkStringUtils3d.h"
#include "/EgtDev/Include/EMkMachiningGeoConst.h" #include "/EgtDev/Include/EMkMachiningGeoConst.h"
#include "/EgtDev/Include/EGkIntervals.h" #include "/EgtDev/Include/EGkIntervals.h"
@@ -32,6 +34,7 @@
using namespace std ; using namespace std ;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// collisioni semplici
struct SCollInfoEx : public SCollInfo struct SCollInfoEx : public SCollInfo
{ {
int nIdM ; // identificativo della regione mobile int nIdM ; // identificativo della regione mobile
@@ -43,7 +46,7 @@ struct SCollInfoEx : public SCollInfo
nIdF( GDB_ID_NULL), bIsCutF( false) {} nIdF( GDB_ID_NULL), bIsCutF( false) {}
SCollInfoEx( const SCollInfo& Sou) : SCollInfo( Sou), nIdM( GDB_ID_NULL), bIsCutM( false), SCollInfoEx( const SCollInfo& Sou) : SCollInfo( Sou), nIdM( GDB_ID_NULL), bIsCutM( false),
nIdF( GDB_ID_NULL), bIsCutF( false) {} nIdF( GDB_ID_NULL), bIsCutF( false) {}
} ; } ;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static const double SPESS = 100 ; static const double SPESS = 100 ;
@@ -92,7 +95,7 @@ ExeCreateOutRegion( int nParentId, double dXmin, double dYmin, double dXmax, dou
dYmax < dYmin + GAP + 2 * EPS_SMALL) dYmax < dYmin + GAP + 2 * EPS_SMALL)
return false ; return false ;
// se già esiste, posso uscire // se già esiste, posso uscire
int nBoxId = pGeomDB->GetFirstNameInGroup( nParentId, NST_SHEET_OUTREG) ; int nBoxId = pGeomDB->GetFirstNameInGroup( nParentId, NST_SHEET_OUTREG) ;
if ( nBoxId != GDB_ID_NULL) if ( nBoxId != GDB_ID_NULL)
return true ; return true ;
@@ -149,7 +152,7 @@ ExeCreateOutRegion( int nParentId, int nOutCrvId)
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false) VERIFY_GEOMDB( pGeomDB, false)
// se già esiste, posso uscire // se già esiste, posso uscire
int nBoxId = pGeomDB->GetFirstNameInGroup( nParentId, NST_SHEET_OUTREG) ; int nBoxId = pGeomDB->GetFirstNameInGroup( nParentId, NST_SHEET_OUTREG) ;
if ( nBoxId != GDB_ID_NULL) if ( nBoxId != GDB_ID_NULL)
return true ; return true ;
@@ -187,7 +190,7 @@ ExeCreateOutRegion( int nParentId, int nOutCrvId)
BBox3d b3Box ; BBox3d b3Box ;
pCompo->GetLocalBBox( b3Box) ; pCompo->GetLocalBBox( b3Box) ;
b3Box.Expand( SPESS, SPESS, 0) ; b3Box.Expand( SPESS, SPESS, 0) ;
// determino il punto più vicino al massimo del box e lo faccio diventare il nuovo inizio // determino il punto più vicino al massimo del box e lo faccio diventare il nuovo inizio
int nFlag ; int nFlag ;
double dU ; double dU ;
DistPointCurve distPC( b3Box.GetMax(), *pCompo) ; DistPointCurve distPC( b3Box.GetMax(), *pCompo) ;
@@ -250,7 +253,7 @@ ExeCreateReferenceRegion( int nParentId, int nOutCrvId, bool bBottomUp)
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false) VERIFY_GEOMDB( pGeomDB, false)
// se già esiste, posso uscire // se già esiste, posso uscire
int nRegId = pGeomDB->GetFirstNameInGroup( nParentId, NST_REFERENCE_REG) ; int nRegId = pGeomDB->GetFirstNameInGroup( nParentId, NST_REFERENCE_REG) ;
if ( nRegId != GDB_ID_NULL) if ( nRegId != GDB_ID_NULL)
return true ; return true ;
@@ -283,7 +286,7 @@ ExeCreateReferenceRegion( int nParentId, int nOutCrvId, bool bBottomUp)
// ne ricavo il bbox // ne ricavo il bbox
BBox3d b3Box ; BBox3d b3Box ;
PL.GetLocalBBox( b3Box) ; PL.GetLocalBBox( b3Box) ;
// cerco i punti più vicini ai quattro vertici (0=BL, 1=BR, 2=TR, 3=TL) // cerco i punti più vicini ai quattro vertici (0=BL, 1=BR, 2=TR, 3=TL)
double dU[4] = { -1, -1, -1, -1} ; double dU[4] = { -1, -1, -1, -1} ;
double dMinSqDist[4] = { SQ_INFINITO, SQ_INFINITO, SQ_INFINITO, SQ_INFINITO} ; double dMinSqDist[4] = { SQ_INFINITO, SQ_INFINITO, SQ_INFINITO, SQ_INFINITO} ;
Point3d ptVert[4] ; Point3d ptVert[4] ;
@@ -391,7 +394,7 @@ ExeCreateDamagedRegion( int nParentId, int nDmgCrvId)
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false) VERIFY_GEOMDB( pGeomDB, false)
// verifico se esiste già la regione associata // verifico se esiste già la regione associata
int nRegId = pGeomDB->GetFirstNameInGroup( nParentId, NST_DAMAGED_REG) ; int nRegId = pGeomDB->GetFirstNameInGroup( nParentId, NST_DAMAGED_REG) ;
while ( nRegId != GDB_ID_NULL) { while ( nRegId != GDB_ID_NULL) {
// recupero l'indice della curva di origine // recupero l'indice della curva di origine
@@ -710,7 +713,7 @@ MyVerifyPartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, const BBox3d&
// box delle regioni dei pezzi rispetto al box dell'esterno // box delle regioni dei pezzi rispetto al box dell'esterno
if ( ! b3Region.EnclosesXY( b3RegCluster)) if ( ! b3Region.EnclosesXY( b3RegCluster))
return false ; return false ;
// regioni dei pezzi rispetto alla regione dell'esterno // regioni dei pezzi rispetto alla regione dell'esterno (controllo semplice)
for ( int nRegId : vReg) { for ( int nRegId : vReg) {
if ( ExeSurfFrChunkSimpleClassify( nRegId, 0, nBoxId, 0) != REGC_OUT) if ( ExeSurfFrChunkSimpleClassify( nRegId, 0, nBoxId, 0) != REGC_OUT)
return false ; return false ;
@@ -721,7 +724,7 @@ MyVerifyPartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, const BBox3d&
return false ; return false ;
} }
// Verifico con l'eventuale regione di riferimento // Verifico con l'eventuale regione di riferimento (controllo semplice)
// recupero la regione // recupero la regione
int nRefReg = pGeomDB->GetFirstNameInGroup( nGroupId, NST_REFERENCE_REG) ; int nRefReg = pGeomDB->GetFirstNameInGroup( nGroupId, NST_REFERENCE_REG) ;
if ( pGeomDB->ExistsInfo( nRefReg, KEY_NST_OFF)) if ( pGeomDB->ExistsInfo( nRefReg, KEY_NST_OFF))
@@ -749,17 +752,17 @@ MyVerifyPartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, const BBox3d&
vDmgReg.emplace_back( nId) ; vDmgReg.emplace_back( nId) ;
nId = pGeomDB->GetNextName( nId, NST_DAMAGED_REG) ; nId = pGeomDB->GetNextName( nId, NST_DAMAGED_REG) ;
} }
// regioni dei pezzi rispetto alle regioni delle aree danneggiate // regioni dei pezzi rispetto alle regioni delle aree danneggiate (controllo completo)
for ( int nRegId : vReg) { for ( int nRegId : vReg) {
for ( int nDmgRegId : vDmgReg) { for ( int nDmgRegId : vDmgReg) {
if ( ExeSurfFrChunkSimpleClassify( nRegId, 0, nDmgRegId, 0) != REGC_OUT) if ( ExeSurfFlatRegionInterference( nRegId, 0, nDmgRegId, 0) != REGC_OUT)
return false ; return false ;
} }
} }
for ( int nDwnRegId : vDwnReg) { for ( int nDwnRegId : vDwnReg) {
if ( nDwnRegId != GDB_ID_NULL) { if ( nDwnRegId != GDB_ID_NULL) {
for ( int nDmgRegId : vDmgReg) { for ( int nDmgRegId : vDmgReg) {
if ( ExeSurfFrChunkSimpleClassify( nDwnRegId, 0, nDmgRegId, 0) != REGC_OUT) if ( ExeSurfFlatRegionInterference( nDwnRegId, 0, nDmgRegId, 0) != REGC_OUT)
return false ; return false ;
} }
} }
@@ -800,59 +803,62 @@ MyVerifyPartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, const BBox3d&
nId2 = ( bInRoot ? ExeGetNextPart( nId2, true) : ExeGetNextGroup( nId2)) ; nId2 = ( bInRoot ? ExeGetNextPart( nId2, true) : ExeGetNextGroup( nId2)) ;
} }
// Eseguo verifiche // Eseguo verifiche (controllo completo)
// regioni dei pezzi // regioni dei pezzi
for ( size_t i = 0 ; i < vReg.size() ; ++ i) { for ( int i = 0 ; i < ssize( vReg) ; ++ i) {
// verifico con le regioni degli altri pezzi (sempre regioni standard) // verifico con le regioni degli altri pezzi
for ( int nOthRegId : vOthReg) { for ( int nOthRegId : vOthReg) {
if ( ExeSurfFrChunkSimpleClassify( vReg[i], 0, nOthRegId, 0) != REGC_OUT) if ( ExeSurfFlatRegionInterference( vReg[i], 0, nOthRegId, 0) != REGC_OUT)
return false ; return false ;
} }
// e con le regioni dei tagli degli altri pezzi (se esistono le regioni up devo usarle) // e con le regioni dei tagli degli altri pezzi (se esistono le regioni up devo usarle)
int nRegUpId = ((vUpReg[i] == GDB_ID_NULL) ? vReg[i] : vUpReg[i]) ; int nRegUpId = ( ( vUpReg[i] == GDB_ID_NULL) ? vReg[i] : vUpReg[i]) ;
for ( int nOthCutRegId : vOthCutReg) { for ( int nOthCutRegId : vOthCutReg) {
if ( ExeSurfFrChunkSimpleClassify( nRegUpId, 0, nOthCutRegId, 0) != REGC_OUT) if ( ExeSurfFlatRegionInterference( nRegUpId, 0, nOthCutRegId, 0) != REGC_OUT)
return false ; return false ;
} }
} }
// regioni sotto dei pezzi
for ( size_t i = 0 ; i < vDwnReg.size() ; ++ i) { // regioni sotto dei pezzi (controllo completo)
for ( int i = 0 ; i < ssize( vDwnReg) ; ++ i) {
// verifico con le regioni sotto degli altri pezzi // verifico con le regioni sotto degli altri pezzi
for ( size_t j = 0 ; j < vOthDwnReg.size() ; ++ j) { for ( int j = 0 ; j < ssize( vOthDwnReg) ; ++ j) {
if ( vDwnReg[i] != GDB_ID_NULL || vOthDwnReg[j] != GDB_ID_NULL) { if ( vDwnReg[i] != GDB_ID_NULL || vOthDwnReg[j] != GDB_ID_NULL) {
int nDwnRegId = ( vDwnReg[i] != GDB_ID_NULL ? vDwnReg[i] : vReg[i]) ; int nDwnRegId = ( vDwnReg[i] != GDB_ID_NULL ? vDwnReg[i] : vReg[i]) ;
int nOthDwnRegId = ( vOthDwnReg[j] != GDB_ID_NULL ? vOthDwnReg[j] : vOthReg[j]) ; int nOthDwnRegId = ( vOthDwnReg[j] != GDB_ID_NULL ? vOthDwnReg[j] : vOthReg[j]) ;
if ( ExeSurfFrChunkSimpleClassify( nDwnRegId, 0, nOthDwnRegId, 0) != REGC_OUT) if ( ExeSurfFlatRegionInterference( nDwnRegId, 0, nOthDwnRegId, 0) != REGC_OUT)
return false ; return false ;
} }
} }
// e con le regioni sotto dei tagli degli altri pezzi // e con le regioni sotto dei tagli degli altri pezzi
for ( size_t j = 0 ; j < vOthDwnCutReg.size() ; ++ j) { for ( int j = 0 ; j < ssize( vOthDwnCutReg) ; ++ j) {
if ( vDwnReg[i] != GDB_ID_NULL || vOthDwnCutReg[j] != GDB_ID_NULL) { if ( vDwnReg[i] != GDB_ID_NULL || vOthDwnCutReg[j] != GDB_ID_NULL) {
int nDwnRegId = ( vDwnReg[i] != GDB_ID_NULL ? vDwnReg[i] : vReg[i]) ; int nDwnRegId = ( vDwnReg[i] != GDB_ID_NULL ? vDwnReg[i] : vReg[i]) ;
int nOthDwnCutRegId = ( vOthDwnCutReg[j] != GDB_ID_NULL ? vOthDwnCutReg[j] : vOthCutReg[j]) ; int nOthDwnCutRegId = ( vOthDwnCutReg[j] != GDB_ID_NULL ? vOthDwnCutReg[j] : vOthCutReg[j]) ;
if ( ExeSurfFrChunkSimpleClassify( nDwnRegId, 0, nOthDwnCutRegId, 0) != REGC_OUT) if ( ExeSurfFlatRegionInterference( nDwnRegId, 0, nOthDwnCutRegId, 0) != REGC_OUT)
return false ; return false ;
} }
} }
} }
// regioni delle lavorazioni dei pezzi // regioni delle lavorazioni dei pezzi
for ( int nCutRegId : vCutReg) { for ( int nCutRegId : vCutReg) {
// le confronto con le regioni degli altri pezzi // le confronto con le regioni degli altri pezzi (controllo completo)
for ( size_t j = 0 ; j < vOthReg.size() ; ++ j) { for ( int j = 0 ; j < ssize( vOthReg) ; ++ j) {
int nOthUpRegId = (( vOthUpReg[j] == GDB_ID_NULL) ? vOthReg[j] : vOthUpReg[j]) ; int nOthUpRegId = ( ( vOthUpReg[j] == GDB_ID_NULL) ? vOthReg[j] : vOthUpReg[j]) ;
if ( ExeSurfFrChunkSimpleClassify( nCutRegId, 0, nOthUpRegId, 0) != REGC_OUT) if ( ExeSurfFlatRegionInterference( nCutRegId, 0, nOthUpRegId, 0) != REGC_OUT)
return false ; return false ;
} }
} }
// regioni sotto delle lavorazioni dei pezzi // regioni sotto delle lavorazioni dei pezzi
for ( size_t i = 0 ; i < vDwnCutReg.size() ; ++ i) { for ( int i = 0 ; i < ssize( vDwnCutReg) ; ++ i) {
// le confronto con le regioni sotto degli altri pezzi // le confronto con le regioni sotto degli altri pezzi (controllo completo)
for ( size_t j = 0 ; j < vOthDwnReg.size() ; ++ j) { for ( int j = 0 ; j < ssize( vOthDwnReg) ; ++ j) {
if ( vDwnCutReg[i] != GDB_ID_NULL || vOthDwnReg[j] != GDB_ID_NULL) { if ( vDwnCutReg[i] != GDB_ID_NULL || vOthDwnReg[j] != GDB_ID_NULL) {
int nDwnCutRegId = ( vDwnCutReg[i] != GDB_ID_NULL ? vDwnCutReg[i] : vCutReg[i]) ; int nDwnCutRegId = ( vDwnCutReg[i] != GDB_ID_NULL ? vDwnCutReg[i] : vCutReg[i]) ;
int nOthDwnRegId = ( vOthDwnReg[j] != GDB_ID_NULL ? vOthDwnReg[j] : vOthReg[j]) ; int nOthDwnRegId = ( vOthDwnReg[j] != GDB_ID_NULL ? vOthDwnReg[j] : vOthReg[j]) ;
if ( ExeSurfFrChunkSimpleClassify( nDwnCutRegId, 0, nOthDwnRegId, 0) != REGC_OUT) if ( ExeSurfFlatRegionInterference( nDwnCutRegId, 0, nOthDwnRegId, 0) != REGC_OUT)
return false ; return false ;
} }
} }
@@ -1031,14 +1037,14 @@ ExePackPartCluster( const INTVECTOR& vIds, bool bReducedCut, bool bBottomUp)
double dRegClDimY = b3RegCluster.GetMax().y - b3RegCluster.GetMin().y ; double dRegClDimY = b3RegCluster.GetMax().y - b3RegCluster.GetMin().y ;
Point3d ptOrig = b3RegCluster.GetMin() ; Point3d ptOrig = b3RegCluster.GetMin() ;
// Determino punto più in basso a sinistra del cluster // Determino punto più in basso a sinistra del cluster
Point3d ptBL = b3RegCluster.GetMax() ; Point3d ptBL = b3RegCluster.GetMax() ;
double dDimBottom = 0 ; double dDimBottom = 0 ;
for ( int nId : vTrueIds) { for ( int nId : vTrueIds) {
// recupero l'approssimazione lineare del contorno del pezzo ( in globale) // recupero l'approssimazione lineare del contorno del pezzo ( in globale)
PolyLine PL ; PolyLine PL ;
if ( GetFlatPartApproxContour( pGeomDB, nId, PL)) { if ( GetFlatPartApproxContour( pGeomDB, nId, PL)) {
// cerco il punto più in basso a sinistra // cerco il punto più in basso a sinistra
Point3d ptP ; Point3d ptP ;
bool bFound = PL.GetFirstPoint( ptP) ; bool bFound = PL.GetFirstPoint( ptP) ;
while ( bFound) { while ( bFound) {
@@ -1163,6 +1169,7 @@ UpdateCollId( double dLen, double dPrevLen, int nId1, int nId2, bool bIsCut1, bo
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// Collisione semplice
static bool static bool
MySurfFrMoveSimpleNoCollision( int nId1, int nId2, const Vector3d& vtDir, double& dLen, SCollInfo& scInfo) MySurfFrMoveSimpleNoCollision( int nId1, int nId2, const Vector3d& vtDir, double& dLen, SCollInfo& scInfo)
{ {
@@ -1170,23 +1177,27 @@ MySurfFrMoveSimpleNoCollision( int nId1, int nId2, const Vector3d& vtDir, double
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// recupero la prima superficie FlatRegion // recupero la prima superficie FlatRegion
ISurfFlatRegion* pSfr1 = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId1)) ; ISurfFlatRegion* pSfr1 = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId1)) ;
bool bOk = ( pSfr1 != nullptr) ; if ( pSfr1 == nullptr)
return false ;
// recupero il riferimento della superficie // recupero il riferimento della superficie
Frame3d frSurf1 ; Frame3d frSurf1 ;
bOk = bOk && pGeomDB->GetGlobFrame( nId1, frSurf1) ; if ( ! pGeomDB->GetGlobFrame( nId1, frSurf1))
return false ;
// recupero la seconda superficie FlatRegion // recupero la seconda superficie FlatRegion
const ISurfFlatRegion* pSfr2 = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId2)) ; const ISurfFlatRegion* pSfr2 = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId2)) ;
bOk = bOk && ( pSfr2 != nullptr) ; if ( pSfr2 == nullptr)
return false ;
// recupero il riferimento della superficie // recupero il riferimento della superficie
Frame3d frSurf2 ; Frame3d frSurf2 ;
bOk = bOk && pGeomDB->GetGlobFrame( nId2, frSurf2) ; if ( ! pGeomDB->GetGlobFrame( nId2, frSurf2))
return false ;
// se riferimenti diversi, porto una copia della seconda nel riferimento della prima // se riferimenti diversi, porto una copia della seconda nel riferimento della prima
const ISurfFlatRegion* pSfr2L = pSfr2 ; const ISurfFlatRegion* pSfr2L = pSfr2 ;
PtrOwner<ISurfFlatRegion> pTmp ; PtrOwner<ISurfFlatRegion> pTmp ;
if ( ! AreSameFrame( frSurf1, frSurf2)) { if ( ! AreSameFrame( frSurf1, frSurf2)) {
pTmp.Set( pSfr2->Clone()) ; pTmp.Set( pSfr2->Clone()) ;
bOk = bOk && ! IsNull( pTmp) ; if ( IsNull( pTmp) || ! pTmp->LocToLoc( frSurf2, frSurf1))
bOk = bOk && pTmp->LocToLoc( frSurf2, frSurf1) ; return false ;
pSfr2L = pTmp ; pSfr2L = pTmp ;
} }
// porto in locale alla prima superficie il versore di movimento // porto in locale alla prima superficie il versore di movimento
@@ -1194,21 +1205,71 @@ MySurfFrMoveSimpleNoCollision( int nId1, int nId2, const Vector3d& vtDir, double
vtDirL.ToLoc( frSurf1) ; vtDirL.ToLoc( frSurf1) ;
// calcolo massima lunghezza di traslazione della prima regione senza semplice collisione con la seconda // calcolo massima lunghezza di traslazione della prima regione senza semplice collisione con la seconda
CAvSimpleSurfFrMove ScdSfrMove( *pSfr1, *pSfr2L) ; CAvSimpleSurfFrMove ScdSfrMove( *pSfr1, *pSfr2L) ;
bOk = bOk && ScdSfrMove.Translate( vtDirL, dLen) ; if ( ! ScdSfrMove.Translate( vtDirL, dLen))
if ( bOk) { return false ;
scInfo = ScdSfrMove.GetSCollInfo() ; scInfo = ScdSfrMove.GetSCollInfo() ;
if ( scInfo.nType != SCI_NONE) { if ( scInfo.nType != SCI_NONE) {
scInfo.ptP1.ToGlob( frSurf1) ; scInfo.ptP1.ToGlob( frSurf1) ;
scInfo.vtDirM.ToGlob( frSurf1) ; scInfo.vtDirM.ToGlob( frSurf1) ;
scInfo.vtDirF.ToGlob( frSurf1) ; scInfo.vtDirF.ToGlob( frSurf1) ;
}
if ( scInfo.nType == SCI_LINE_LINE)
scInfo.ptP2.ToGlob( frSurf1) ;
} }
return bOk ; if ( scInfo.nType == SCI_LINE_LINE)
scInfo.ptP2.ToGlob( frSurf1) ;
return true ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// Collisione completa
static bool
MySurfFrMoveNoCollision( int nId1, int nId2, const Vector3d& vtDir, double& dLen, SCollInfo& cInfo)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// recupero la prima superficie FlatRegion
ISurfFlatRegion* pSfr1 = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId1)) ;
if ( pSfr1 == nullptr)
return false ;
// recupero il riferimento della superficie
Frame3d frSurf1 ;
if ( ! pGeomDB->GetGlobFrame( nId1, frSurf1))
return false ;
// recupero la seconda superficie FlatRegion
const ISurfFlatRegion* pSfr2 = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId2)) ;
if ( pSfr2 == nullptr)
return false ;
// recupero il riferimento della superficie
Frame3d frSurf2 ;
if ( ! pGeomDB->GetGlobFrame( nId2, frSurf2))
return false ;
// se riferimenti diversi, porto una copia della seconda nel riferimento della prima
const ISurfFlatRegion* pSfr2L = pSfr2 ;
PtrOwner<ISurfFlatRegion> pTmp ;
if ( ! AreSameFrame( frSurf1, frSurf2)) {
pTmp.Set( pSfr2->Clone()) ;
if ( IsNull( pTmp) || ! pTmp->LocToLoc( frSurf2, frSurf1))
return false ;
pSfr2L = pTmp ;
}
// porto in locale alla prima superficie il versore di movimento
Vector3d vtDirL = vtDir ;
vtDirL.ToLoc( frSurf1) ;
// calcolo massima lunghezza di traslazione della prima regione senza collisione con la seconda
CAvSurfFrMove cdSfrMove( *pSfr1, *pSfr2L) ;
if ( ! cdSfrMove.Translate( vtDirL, dLen))
return false ;
cInfo = cdSfrMove.GetCollInfo() ;
if ( cInfo.nType != SCI_NONE) {
cInfo.ptP1.ToGlob( frSurf1) ;
cInfo.vtDirM.ToGlob( frSurf1) ;
cInfo.vtDirF.ToGlob( frSurf1) ;
}
if ( cInfo.nType == SCI_LINE_LINE)
cInfo.ptP2.ToGlob( frSurf1) ;
return true ;
}
//----------------------------------------------------------------------------
// Traslazione con CAvSurfFr
static bool static bool
MyMovePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d b3Cluster, bool bReducedCut, Vector3d& vtMove) MyMovePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d b3Cluster, bool bReducedCut, Vector3d& vtMove)
{ {
@@ -1293,67 +1354,67 @@ MyMovePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d b3Cluster
bOk = false ; bOk = false ;
break ; break ;
} }
// la confronto con il box // la confronto con il box (collisione semplice)
MySurfFrMoveSimpleNoCollision( nRegId, nBoxId, vtDir, dLen, scInfoCurr) ; MySurfFrMoveSimpleNoCollision( nRegId, nBoxId, vtDir, dLen, scInfoCurr) ;
dPrevLen = UpdateCollId( dLen, dPrevLen, nRegId, nBoxId, false, false, scInfoCurr) ; dPrevLen = UpdateCollId( dLen, dPrevLen, nRegId, nBoxId, false, false, scInfoCurr) ;
// la confronto con la regione di riferimento // la confronto con la regione di riferimento (collisione semplice)
if ( nRefReg != GDB_ID_NULL) { if ( nRefReg != GDB_ID_NULL) {
MySurfFrMoveSimpleNoCollision( nRegId, nRefReg, vtDir, dLen, scInfoCurr) ; MySurfFrMoveSimpleNoCollision( nRegId, nRefReg, vtDir, dLen, scInfoCurr) ;
dPrevLen = UpdateCollId( dLen, dPrevLen, nRegId, nRefReg, false, false, scInfoCurr) ; dPrevLen = UpdateCollId( dLen, dPrevLen, nRegId, nRefReg, false, false, scInfoCurr) ;
} }
// la confronto con le aree danneggiate // la confronto con le aree danneggiate (collisione completa)
for ( int nDmgRegId : vDmgReg) { for ( int nDmgRegId : vDmgReg) {
MySurfFrMoveSimpleNoCollision( nRegId, nDmgRegId, vtDir, dLen, scInfoCurr) ; MySurfFrMoveNoCollision( nRegId, nDmgRegId, vtDir, dLen, scInfoCurr) ;
dPrevLen = UpdateCollId( dLen, dPrevLen, nRegId, nDmgRegId, false, false, scInfoCurr) ; dPrevLen = UpdateCollId( dLen, dPrevLen, nRegId, nDmgRegId, false, false, scInfoCurr) ;
} }
// la confronto con le regioni degli altri pezzi // la confronto con le regioni degli altri pezzi (collisione completa)
for ( int nOthRegId : vOthReg) { for ( int nOthRegId : vOthReg) {
MySurfFrMoveSimpleNoCollision( nRegId, nOthRegId, vtDir, dLen, scInfoCurr) ; MySurfFrMoveNoCollision( nRegId, nOthRegId, vtDir, dLen, scInfoCurr) ;
dPrevLen = UpdateCollId( dLen, dPrevLen, nRegId, nOthRegId, false, false, scInfoCurr) ; dPrevLen = UpdateCollId( dLen, dPrevLen, nRegId, nOthRegId, false, false, scInfoCurr) ;
} }
// e con le regioni dei tagli degli altri pezzi // e con le regioni dei tagli degli altri pezzi
// recupero regione in alto del pezzo // recupero regione in alto del pezzo (collisione completa)
int nUpRegId = GetFlatPartUpRegion( pGeomDB, nTrueId) ; int nUpRegId = GetFlatPartUpRegion( pGeomDB, nTrueId) ;
int nTestRegId = (( nUpRegId == GDB_ID_NULL) ? nRegId : nUpRegId) ; int nTestRegId = (( nUpRegId == GDB_ID_NULL) ? nRegId : nUpRegId) ;
for ( int nOthCutRegId : vOthCutReg) { for ( int nOthCutRegId : vOthCutReg) {
MySurfFrMoveSimpleNoCollision( nTestRegId, nOthCutRegId, vtDir, dLen, scInfoCurr) ; MySurfFrMoveNoCollision( nTestRegId, nOthCutRegId, vtDir, dLen, scInfoCurr) ;
dPrevLen = UpdateCollId( dLen, dPrevLen, nTestRegId, nOthCutRegId, false, true, scInfoCurr) ; dPrevLen = UpdateCollId( dLen, dPrevLen, nTestRegId, nOthCutRegId, false, true, scInfoCurr) ;
} }
// ----------------------------------------- // -----------------------------------------
// recupero regione in basso del pezzo // recupero regione in basso del pezzo
int nDwnRegId = GetFlatPartDownRegion( pGeomDB, nTrueId) ; int nDwnRegId = GetFlatPartDownRegion( pGeomDB, nTrueId) ;
// la confronto con il box // la confronto con il box (collisone semplice)
if ( nDwnRegId != GDB_ID_NULL) { if ( nDwnRegId != GDB_ID_NULL) {
MySurfFrMoveSimpleNoCollision( nDwnRegId, nBoxId, vtDir, dLen, scInfoCurr) ; MySurfFrMoveSimpleNoCollision( nDwnRegId, nBoxId, vtDir, dLen, scInfoCurr) ;
dPrevLen = UpdateCollId( dLen, dPrevLen, nDwnRegId, nBoxId, false, false, scInfoCurr) ; dPrevLen = UpdateCollId( dLen, dPrevLen, nDwnRegId, nBoxId, false, false, scInfoCurr) ;
} }
// la confronto con la regione di riferimento // la confronto con la regione di riferimento (collisione completa)
if ( nDwnRegId != GDB_ID_NULL && nRefReg != GDB_ID_NULL) { if ( nDwnRegId != GDB_ID_NULL && nRefReg != GDB_ID_NULL) {
MySurfFrMoveSimpleNoCollision( nDwnRegId, nRefReg, vtDir, dLen, scInfoCurr) ; MySurfFrMoveNoCollision( nDwnRegId, nRefReg, vtDir, dLen, scInfoCurr) ;
dPrevLen = UpdateCollId( dLen, dPrevLen, nDwnRegId, nRefReg, false, false, scInfoCurr) ; dPrevLen = UpdateCollId( dLen, dPrevLen, nDwnRegId, nRefReg, false, false, scInfoCurr) ;
} }
// la confronto con le aree danneggiate // la confronto con le aree danneggiate (collisione completa)
if ( nDwnRegId != GDB_ID_NULL) { if ( nDwnRegId != GDB_ID_NULL) {
for ( int nDmgRegId : vDmgReg) { for ( int nDmgRegId : vDmgReg) {
MySurfFrMoveSimpleNoCollision( nDwnRegId, nDmgRegId, vtDir, dLen, scInfoCurr) ; MySurfFrMoveNoCollision( nDwnRegId, nDmgRegId, vtDir, dLen, scInfoCurr) ;
dPrevLen = UpdateCollId( dLen, dPrevLen, nDwnRegId, nDmgRegId, false, false, scInfoCurr) ; dPrevLen = UpdateCollId( dLen, dPrevLen, nDwnRegId, nDmgRegId, false, false, scInfoCurr) ;
} }
} }
// la confronto con le regioni in basso degli altri pezzi // la confronto con le regioni in basso degli altri pezzi (collisione completa)
for ( size_t j = 0 ; j < vOthDwnReg.size() ; ++ j) { for ( int j = 0 ; j < ssize( vOthDwnReg) ; ++ j) {
if ( nDwnRegId != GDB_ID_NULL || vOthDwnReg[j] != GDB_ID_NULL) { if ( nDwnRegId != GDB_ID_NULL || vOthDwnReg[j] != GDB_ID_NULL) {
int nTmpDwnRegId = ( nDwnRegId != GDB_ID_NULL ? nDwnRegId : nRegId) ; int nTmpDwnRegId = ( nDwnRegId != GDB_ID_NULL ? nDwnRegId : nRegId) ;
int nOthDwnRegId = ( vOthDwnReg[j] != GDB_ID_NULL ? vOthDwnReg[j] : vOthReg[j]) ; int nOthDwnRegId = ( vOthDwnReg[j] != GDB_ID_NULL ? vOthDwnReg[j] : vOthReg[j]) ;
MySurfFrMoveSimpleNoCollision( nTmpDwnRegId, nOthDwnRegId, vtDir, dLen, scInfoCurr) ; MySurfFrMoveNoCollision( nTmpDwnRegId, nOthDwnRegId, vtDir, dLen, scInfoCurr) ;
dPrevLen = UpdateCollId( dLen, dPrevLen, nTmpDwnRegId, nOthDwnRegId, false, false, scInfoCurr) ; dPrevLen = UpdateCollId( dLen, dPrevLen, nTmpDwnRegId, nOthDwnRegId, false, false, scInfoCurr) ;
} }
} }
// e con le regioni in basso dei tagli degli altri pezzi // e con le regioni in basso dei tagli degli altri pezzi (collisione completa)
for ( size_t j = 0 ; j < vOthDwnCutReg.size() ; ++ j) { for ( int j = 0 ; j < ssize( vOthDwnCutReg) ; ++ j) {
if ( nDwnRegId != GDB_ID_NULL || vOthDwnCutReg[j] != GDB_ID_NULL) { if ( nDwnRegId != GDB_ID_NULL || vOthDwnCutReg[j] != GDB_ID_NULL) {
int nTmpDwnRegId = ( nDwnRegId != GDB_ID_NULL ? nDwnRegId : nRegId) ; int nTmpDwnRegId = ( nDwnRegId != GDB_ID_NULL ? nDwnRegId : nRegId) ;
int nOthDwnCutRegId = ( vOthDwnCutReg[j] != GDB_ID_NULL ? vOthDwnCutReg[j] : vOthCutReg[j]) ; int nOthDwnCutRegId = ( vOthDwnCutReg[j] != GDB_ID_NULL ? vOthDwnCutReg[j] : vOthCutReg[j]) ;
MySurfFrMoveSimpleNoCollision( nTmpDwnRegId, nOthDwnCutRegId, vtDir, dLen, scInfoCurr) ; MySurfFrMoveNoCollision( nTmpDwnRegId, nOthDwnCutRegId, vtDir, dLen, scInfoCurr) ;
dPrevLen = UpdateCollId( dLen, dPrevLen, nTmpDwnRegId, nOthDwnCutRegId, false, true, scInfoCurr) ; dPrevLen = UpdateCollId( dLen, dPrevLen, nTmpDwnRegId, nOthDwnCutRegId, false, true, scInfoCurr) ;
} }
} }
@@ -1364,11 +1425,11 @@ MyMovePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d b3Cluster
bOk = false ; bOk = false ;
break ; break ;
} }
// le confronto con le regioni degli altri pezzi // le confronto con le regioni degli altri pezzi (collisione completa)
for ( int nCrId : vCrId) { for ( int nCrId : vCrId) {
for ( size_t k = 0 ; k < vOthReg.size() ; ++ k) { for ( int k = 0 ; k < ssize( vOthReg) ; ++ k) {
int nOthRegId = ( vOthUpReg[k] == GDB_ID_NULL ? vOthReg[k] : vOthUpReg[k]) ; int nOthRegId = ( vOthUpReg[k] == GDB_ID_NULL ? vOthReg[k] : vOthUpReg[k]) ;
MySurfFrMoveSimpleNoCollision( nCrId, nOthRegId, vtDir, dLen, scInfoCurr) ; MySurfFrMoveNoCollision( nCrId, nOthRegId, vtDir, dLen, scInfoCurr) ;
dPrevLen = UpdateCollId( dLen, dPrevLen, nCrId, nOthRegId, true, false, scInfoCurr) ; dPrevLen = UpdateCollId( dLen, dPrevLen, nCrId, nOthRegId, true, false, scInfoCurr) ;
} }
} }
@@ -1379,13 +1440,13 @@ MyMovePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d b3Cluster
bOk = false ; bOk = false ;
break ; break ;
} }
// le confronto con le regioni in basso degli altri pezzi // le confronto con le regioni in basso degli altri pezzi (collisione completa)
for ( size_t j = 0 ; j < vDwnCrId.size() ; ++ j) { for ( int j = 0 ; j < ssize( vDwnCrId) ; ++ j) {
for ( size_t k = 0 ; k < vOthDwnReg.size() ; ++ k) { for ( int k = 0 ; k < ssize( vOthDwnReg) ; ++ k) {
if ( vDwnCrId[j] != GDB_ID_NULL || vOthDwnReg[k] != GDB_ID_NULL) { if ( vDwnCrId[j] != GDB_ID_NULL || vOthDwnReg[k] != GDB_ID_NULL) {
int nTmpDwnCrId = ( vDwnCrId[j] != GDB_ID_NULL ? vDwnCrId[j] : vCrId[j]) ; int nTmpDwnCrId = ( vDwnCrId[j] != GDB_ID_NULL ? vDwnCrId[j] : vCrId[j]) ;
int nOthDwnRegId = ( vOthDwnReg[k] != GDB_ID_NULL ? vOthDwnReg[k] : vOthReg[k]) ; int nOthDwnRegId = ( vOthDwnReg[k] != GDB_ID_NULL ? vOthDwnReg[k] : vOthReg[k]) ;
MySurfFrMoveSimpleNoCollision( nTmpDwnCrId, nOthDwnRegId, vtDir, dLen, scInfoCurr) ; MySurfFrMoveNoCollision( nTmpDwnCrId, nOthDwnRegId, vtDir, dLen, scInfoCurr) ;
dPrevLen = UpdateCollId( dLen, dPrevLen, nTmpDwnCrId, nOthDwnRegId, true, false, scInfoCurr) ; dPrevLen = UpdateCollId( dLen, dPrevLen, nTmpDwnCrId, nOthDwnRegId, true, false, scInfoCurr) ;
} }
} }
@@ -1419,7 +1480,7 @@ MyMovePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d b3Cluster
} }
} }
// Se movimento risultante nullo, non faccio alcunché // Se movimento risultante nullo, non faccio alcunché
vtMoveXY = vtDir * dLen ; vtMoveXY = vtDir * dLen ;
if ( vtMoveXY.IsSmall()) if ( vtMoveXY.IsSmall())
return true ; return true ;
@@ -1464,7 +1525,7 @@ ExeMovePartCluster( const INTVECTOR& vIds, bool bReducedCut, Vector3d& vtMove)
vtMove = vtM ; vtMove = vtM ;
return true ; return true ;
} }
// altrimenti, riprovo con tagli standard // altrimenti, riprovo con tagli standard
else { else {
// annullo il movimento // annullo il movimento
for ( int nId : vTrueIds) for ( int nId : vTrueIds)
@@ -1475,7 +1536,50 @@ ExeMovePartCluster( const INTVECTOR& vIds, bool bReducedCut, Vector3d& vtMove)
} }
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static bool
MySurfFrRotateNoCollision( int nId1, int nId2, const Point3d& ptCen, double& dAngDeg, SCollInfo& cInfo)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// recupero la prima superficie FlatRegion
ISurfFlatRegion* pSfr1 = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId1)) ;
if ( pSfr1 == nullptr)
return false ;
// recupero il riferimento della superficie
Frame3d frSurf1 ;
if ( ! pGeomDB->GetGlobFrame( nId1, frSurf1))
return false ;
// recupero la seconda superficie FlatRegion
const ISurfFlatRegion* pSfr2 = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId2)) ;
if ( pSfr2 == nullptr)
return false ;
// recupero il riferimento della superficie
Frame3d frSurf2 ;
if ( ! pGeomDB->GetGlobFrame( nId2, frSurf2))
return false ;
// se riferimenti diversi, porto una copia della seconda nel riferimento della prima
const ISurfFlatRegion* pSfr2L = pSfr2 ;
PtrOwner<ISurfFlatRegion> pTmp ;
if ( ! AreSameFrame( frSurf1, frSurf2)) {
pTmp.Set( pSfr2->Clone()) ;
if ( IsNull( pTmp) || ! pTmp->LocToLoc( frSurf2, frSurf1))
return false ;
pSfr2L = pTmp ;
}
// porto in locale alla prima superficie il punto di rotazione
Point3d ptCenL = ptCen ;
ptCenL.ToLoc( frSurf1) ;
// calcolo massima lunghezza di traslazione della prima regione senza collisione con la seconda
CAvSurfFrMove cdSfrMove( *pSfr1, *pSfr2L) ;
if ( ! cdSfrMove.Rotate( ptCenL, dAngDeg))
return false ;
return true ;
}
//----------------------------------------------------------------------------
// Rotazione con CAvSurfFr
bool bool
MyRotatePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d& b3Cluster, bool bReducedCut, MyRotatePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d& b3Cluster, bool bReducedCut,
const Point3d& ptCen, double& dRotAngDeg) const Point3d& ptCen, double& dRotAngDeg)
@@ -1553,21 +1657,21 @@ MyRotatePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d& b3Clus
bOk = false ; bOk = false ;
break ; break ;
} }
// la confronto con il box // la confronto con il box (collisione semplice)
ExeSurfFrRotateSimpleNoCollision( nRegId, nBoxId, ptCen, dAng, RTY_GLOB) ; ExeSurfFrRotateSimpleNoCollision( nRegId, nBoxId, ptCen, dAng, RTY_GLOB) ;
// la confronto con la regione di riferimento // la confronto con la regione di riferimento (collisione semplice)
if ( nRefReg != GDB_ID_NULL) { if ( nRefReg != GDB_ID_NULL) {
ExeSurfFrRotateSimpleNoCollision( nRegId, nRefReg, ptCen, dAng, RTY_GLOB) ; ExeSurfFrRotateSimpleNoCollision( nRegId, nRefReg, ptCen, dAng, RTY_GLOB) ;
} }
// la confronto con le aree danneggiate // la confronto con le aree danneggiate (collisione completa)
for ( int nDmgRegId : vDmgReg) { for ( int nDmgRegId : vDmgReg) {
ExeSurfFrRotateSimpleNoCollision( nRegId, nDmgRegId, ptCen, dAng, RTY_GLOB) ; MySurfFrRotateNoCollision( nRegId, nDmgRegId, ptCen, dAng, s_scInfo) ;
} }
// la confronto con le regioni degli altri pezzi // la confronto con le regioni degli altri pezzi (collisione completa)
for ( int nOthRegId : vOthReg) { for ( int nOthRegId : vOthReg) {
ExeSurfFrRotateSimpleNoCollision( nRegId, nOthRegId, ptCen, dAng, RTY_GLOB) ; MySurfFrRotateNoCollision( nRegId, nOthRegId, ptCen, dAng, s_scInfo) ;
} }
// e con le regioni dei tagli degli altri pezzi // e con le regioni dei tagli degli altri pezzi (collisione completa)
// recupero regione in alto del pezzo // recupero regione in alto del pezzo
int nUpRegId = GetFlatPartUpRegion( pGeomDB, nTrueId) ; int nUpRegId = GetFlatPartUpRegion( pGeomDB, nTrueId) ;
int nTestRegId = (( nUpRegId == GDB_ID_NULL) ? nRegId : nUpRegId) ; int nTestRegId = (( nUpRegId == GDB_ID_NULL) ? nRegId : nUpRegId) ;
@@ -1577,33 +1681,33 @@ MyRotatePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d& b3Clus
// ----------------------------------------- // -----------------------------------------
// recupero regione in basso del pezzo // recupero regione in basso del pezzo
int nDwnRegId = GetFlatPartDownRegion( pGeomDB, nTrueId) ; int nDwnRegId = GetFlatPartDownRegion( pGeomDB, nTrueId) ;
// la confronto con il box // la confronto con il box (collisione semplice)
if ( nDwnRegId != GDB_ID_NULL) if ( nDwnRegId != GDB_ID_NULL)
ExeSurfFrRotateSimpleNoCollision( nDwnRegId, nBoxId, ptCen, dAng, RTY_GLOB) ; ExeSurfFrRotateSimpleNoCollision( nDwnRegId, nBoxId, ptCen, dAng, RTY_GLOB) ;
// la confronto con la regione di riferimento // la confronto con la regione di riferimento (collisione semplice)
if ( nRefReg != GDB_ID_NULL) { if ( nRefReg != GDB_ID_NULL) {
ExeSurfFrRotateSimpleNoCollision( nDwnRegId, nRefReg, ptCen, dAng, RTY_GLOB) ; ExeSurfFrRotateSimpleNoCollision( nDwnRegId, nRefReg, ptCen, dAng, RTY_GLOB) ;
} }
// la confronto con le aree danneggiate // la confronto con le aree danneggiate (collisione completa)
if ( nDwnRegId != GDB_ID_NULL) { if ( nDwnRegId != GDB_ID_NULL) {
for ( int nDmgRegId : vDmgReg) { for ( int nDmgRegId : vDmgReg) {
ExeSurfFrRotateSimpleNoCollision( nDwnRegId, nDmgRegId, ptCen, dAng, RTY_GLOB) ; MySurfFrRotateNoCollision( nDwnRegId, nDmgRegId, ptCen, dAng, s_scInfo) ;
} }
} }
// la confronto con le regioni in basso degli altri pezzi // la confronto con le regioni in basso degli altri pezzi (collisione completa)
for ( size_t j = 0 ; j < vOthDwnReg.size() ; ++ j) { for ( int j = 0 ; j < ssize( vOthDwnReg) ; ++ j) {
if ( nDwnRegId != GDB_ID_NULL || vOthDwnReg[j] != GDB_ID_NULL) { if ( nDwnRegId != GDB_ID_NULL || vOthDwnReg[j] != GDB_ID_NULL) {
int nTmpDwnRegId = ( nDwnRegId != GDB_ID_NULL ? nDwnRegId : nRegId) ; int nTmpDwnRegId = ( nDwnRegId != GDB_ID_NULL ? nDwnRegId : nRegId) ;
int nOthDwnRegId = ( vOthDwnReg[j] != GDB_ID_NULL ? vOthDwnReg[j] : vOthReg[j]) ; int nOthDwnRegId = ( vOthDwnReg[j] != GDB_ID_NULL ? vOthDwnReg[j] : vOthReg[j]) ;
ExeSurfFrRotateSimpleNoCollision( nTmpDwnRegId, nOthDwnRegId, ptCen, dAng, RTY_GLOB) ; MySurfFrRotateNoCollision( nTmpDwnRegId, nOthDwnRegId, ptCen, dAng, s_scInfo) ;
} }
} }
// e con le regioni in basso dei tagli degli altri pezzi // e con le regioni in basso dei tagli degli altri pezzi (collisione completa)
for ( size_t j = 0 ; j < vOthDwnCutReg.size() ; ++ j) { for ( int j = 0 ; j < ssize( vOthDwnCutReg) ; ++ j) {
if ( nDwnRegId != GDB_ID_NULL || vOthDwnCutReg[j] != GDB_ID_NULL) { if ( nDwnRegId != GDB_ID_NULL || vOthDwnCutReg[j] != GDB_ID_NULL) {
int nTmpDwnRegId = ( nDwnRegId != GDB_ID_NULL ? nDwnRegId : nRegId) ; int nTmpDwnRegId = ( nDwnRegId != GDB_ID_NULL ? nDwnRegId : nRegId) ;
int nOthDwnCutRegId = ( vOthDwnCutReg[j] != GDB_ID_NULL ? vOthDwnCutReg[j] : vOthCutReg[j]) ; int nOthDwnCutRegId = ( vOthDwnCutReg[j] != GDB_ID_NULL ? vOthDwnCutReg[j] : vOthCutReg[j]) ;
ExeSurfFrRotateSimpleNoCollision( nTmpDwnRegId, nOthDwnCutRegId, ptCen, dAng, RTY_GLOB) ; MySurfFrRotateNoCollision( nTmpDwnRegId, nOthDwnCutRegId, ptCen, dAng, s_scInfo) ;
} }
} }
// ----------------------------------------- // -----------------------------------------
@@ -1613,11 +1717,11 @@ MyRotatePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d& b3Clus
bOk = false ; bOk = false ;
break ; break ;
} }
// le confronto con le regioni degli altri pezzi // le confronto con le regioni degli altri pezzi (collisione completa)
for ( int nCrId : vCrId) { for ( int nCrId : vCrId) {
for ( size_t k = 0 ; k < vOthReg.size() ; ++ k) { for ( int k = 0 ; k < ssize( vOthReg) ; ++ k) {
int nOthRegId = ( vOthUpReg[k] == GDB_ID_NULL ? vOthReg[k] : vOthUpReg[k]) ; int nOthRegId = ( vOthUpReg[k] == GDB_ID_NULL ? vOthReg[k] : vOthUpReg[k]) ;
ExeSurfFrRotateSimpleNoCollision( nCrId, nOthRegId, ptCen, dAng, RTY_GLOB) ; MySurfFrRotateNoCollision( nCrId, nOthRegId, ptCen, dAng, s_scInfo) ;
} }
} }
// ----------------------------------------- // -----------------------------------------
@@ -1627,13 +1731,13 @@ MyRotatePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d& b3Clus
bOk = false ; bOk = false ;
break ; break ;
} }
// le confronto con le regioni in basso degli altri pezzi // le confronto con le regioni in basso degli altri pezzi (collisione completa)
for ( size_t j = 0 ; j < vDwnCrId.size() ; ++ j) { for ( int j = 0 ; j < ssize( vDwnCrId) ; ++ j) {
for ( size_t k = 0 ; k < vOthDwnReg.size() ; ++ k) { for ( int k = 0 ; k < ssize( vOthDwnReg) ; ++ k) {
if ( vDwnCrId[j] != GDB_ID_NULL || vOthDwnReg[k] != GDB_ID_NULL) { if ( vDwnCrId[j] != GDB_ID_NULL || vOthDwnReg[k] != GDB_ID_NULL) {
int nTmpDwnCrId = ( vDwnCrId[j] != GDB_ID_NULL ? vDwnCrId[j] : vCrId[j]) ; int nTmpDwnCrId = ( vDwnCrId[j] != GDB_ID_NULL ? vDwnCrId[j] : vCrId[j]) ;
int nOthDwnRegId = ( vOthDwnReg[k] != GDB_ID_NULL ? vOthDwnReg[k] : vOthReg[k]) ; int nOthDwnRegId = ( vOthDwnReg[k] != GDB_ID_NULL ? vOthDwnReg[k] : vOthReg[k]) ;
ExeSurfFrRotateSimpleNoCollision( nTmpDwnCrId, nOthDwnRegId, ptCen, dAng, RTY_GLOB) ; MySurfFrRotateNoCollision( nTmpDwnCrId, nOthDwnRegId, ptCen, dAng, s_scInfo) ;
} }
} }
} }
@@ -1643,7 +1747,7 @@ MyRotatePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d& b3Clus
if ( ! bOk) if ( ! bOk)
return false ; return false ;
// Se movimento risultante nullo, non faccio alcunché // Se movimento risultante nullo, non faccio alcunché
dRotAngDeg = dAng ; dRotAngDeg = dAng ;
if ( abs( dAng) < EPS_ANG_SMALL) if ( abs( dAng) < EPS_ANG_SMALL)
return true ; return true ;
@@ -1686,7 +1790,7 @@ GetObstacleTangent( Vector3d& vtTang)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static bool static bool
GetMovingTangent( Vector3d& vtTang) GetMovingTangent( Vector3d& vtTang)
{ {
if ( s_scInfo.nType != SCI_LINE_PNT && s_scInfo.nType != SCI_LINE_LINE) if ( s_scInfo.nType != SCI_LINE_PNT && s_scInfo.nType != SCI_LINE_LINE)
return false ; return false ;
@@ -1733,7 +1837,7 @@ ExeAlignPartClusterOnCollision( const INTVECTOR& vIds, bool bReducedCut, bool& b
Point3d ptCntL = s_scInfo.ptP1 ; Point3d ptCntL = s_scInfo.ptP1 ;
ptCntL.ToLoc( frSfr) ; ptCntL.ToLoc( frSfr) ;
// cerco le direzioni tangenti prima e dopo il punto di contatto sulle parti mobili // cerco le direzioni tangenti prima e dopo il punto di contatto sulle parti mobili
PtrOwner<ICurve> pCrv( pSfr->GetLoop( s_scInfo.nChunkM, 0)) ; PtrOwner<ICurve> pCrv( pSfr->GetLoop( s_scInfo.nChunkM, s_scInfo.nLoopM)) ;
if ( IsNull( pCrv)) if ( IsNull( pCrv))
return false ; return false ;
double dU ; double dU ;
@@ -1760,7 +1864,7 @@ ExeAlignPartClusterOnCollision( const INTVECTOR& vIds, bool bReducedCut, bool& b
string sOut = "vtTp=(" + ToString( vtTp) + ") vtTn=(" + ToString( vtTn) + ")" ; string sOut = "vtTp=(" + ToString( vtTp) + ") vtTn=(" + ToString( vtTn) + ")" ;
LOG_INFO( GetLogger(), sOut.c_str()) ; LOG_INFO( GetLogger(), sOut.c_str()) ;
} }
// ruoto dalla parte dell'angolo più piccolo (componente più grande) // ruoto dalla parte dell'angolo più piccolo (componente più grande)
double dRotAngDeg = ( abs( vtTp * s_scInfo.vtDirF) > abs( vtTn * s_scInfo.vtDirF)) ? 90 : - 90 ; double dRotAngDeg = ( abs( vtTp * s_scInfo.vtDirF) > abs( vtTn * s_scInfo.vtDirF)) ? 90 : - 90 ;
// provo a ruotare sul punto di collisione in senso orario // provo a ruotare sul punto di collisione in senso orario
Point3d ptCen = s_scInfo.ptP1 ; Point3d ptCen = s_scInfo.ptP1 ;
@@ -1784,6 +1888,7 @@ ExeMoveToSnapPointOnCollision( const INTVECTOR& vIds, bool bReducedCut, double d
// cerco i due tagli in collisione // cerco i due tagli in collisione
int nCutM = GDB_ID_NULL ; int nCutM = GDB_ID_NULL ;
int nGeoM = GDB_ID_NULL ; int nGeoM = GDB_ID_NULL ;
INTVECTOR vnGeoM, vnGeoF ;
Point3d ptStartM, ptEndM ; Point3d ptStartM, ptEndM ;
Vector3d vtDirM ; Vector3d vtDirM ;
Frame3d frGeoM ; Frame3d frGeoM ;
@@ -1792,13 +1897,38 @@ ExeMoveToSnapPointOnCollision( const INTVECTOR& vIds, bool bReducedCut, double d
Point3d ptStartF, ptEndF ; Point3d ptStartF, ptEndF ;
Vector3d vtDirF ; Vector3d vtDirF ;
Frame3d frGeoF ; Frame3d frGeoF ;
// se mobile è già un taglio, ne ricavo i dati // se mobile è già un taglio, ne ricavo i dati
if ( s_scInfo.bIsCutM) { if ( s_scInfo.bIsCutM) {
if ( s_scInfo.nIdM == GDB_ID_NULL)
return false ;
nCutM = s_scInfo.nIdM ; nCutM = s_scInfo.nIdM ;
nGeoM = GetGeometryFromCut( pGeomDB, pMachMgr, nCutM) ; vnGeoM = GetGeometryFromCut( pGeomDB, pMachMgr, nCutM) ;
ICurveLine* pLineM = GetCurveLine( pGeomDB->GetGeoObj( nGeoM)) ; if ( vnGeoM.empty())
if ( nCutM == GDB_ID_NULL || nGeoM == GDB_ID_NULL || return false ;
pLineM == nullptr || ! pGeomDB->GetGlobFrame( nGeoM, frGeoM)) ICurveLine* pLineM = nullptr ;
// se ho un solo taglio, allora è quello
if ( ssize( vnGeoM) == 1) {
pLineM = GetCurveLine( pGeomDB->GetGeoObj( vnGeoM[0])) ;
nGeoM = vnGeoM[0] ;
}
// se più tagli, cerco quello più vicino alla linea corrente
else {
double dMinSqDist = INFINITO ;
for ( int i = 0 ; i < ssize( vnGeoM) ; ++ i) {
Frame3d frCurrGeoM ;
ICurveLine* pCurrLineM = GetCurveLine( pGeomDB->GetGeoObj( vnGeoM[i])) ;
if ( pCurrLineM == nullptr || ! pGeomDB->GetGlobFrame( vnGeoM[i], frCurrGeoM))
return false ;
double dCurrSqDist ;
DistPointLine( GetToLoc( s_scInfo.ptP1, frCurrGeoM), *pCurrLineM).GetSqDist( dCurrSqDist) ;
if ( dCurrSqDist < dMinSqDist) {
dMinSqDist = dCurrSqDist ;
pLineM = pCurrLineM ;
nGeoM = vnGeoM[i] ;
}
}
}
if ( pLineM == nullptr || ! pGeomDB->GetGlobFrame( nGeoM, frGeoM))
return false ; return false ;
ptStartM = pLineM->GetStart() ; ptStartM = pLineM->GetStart() ;
ptStartM.ToGlob( frGeoM) ; ptStartM.ToGlob( frGeoM) ;
@@ -1807,13 +1937,36 @@ ExeMoveToSnapPointOnCollision( const INTVECTOR& vIds, bool bReducedCut, double d
vtDirM = ptEndM - ptStartM ; vtDirM = ptEndM - ptStartM ;
vtDirM.Normalize() ; vtDirM.Normalize() ;
} }
// se fisso è già un taglio, ne ricavo i dati // se fisso è già un taglio, ne ricavo i dati
if ( s_scInfo.bIsCutF) { if ( s_scInfo.bIsCutF) {
if ( s_scInfo.nChunkF == GDB_ID_NULL)
return false ;
nCutF = s_scInfo.nIdF ; nCutF = s_scInfo.nIdF ;
nGeoF = GetGeometryFromCut( pGeomDB, pMachMgr, nCutF) ; vnGeoF = GetGeometryFromCut( pGeomDB, pMachMgr, nCutF) ;
ICurveLine* pLineF = GetCurveLine( pGeomDB->GetGeoObj( nGeoF)) ; ICurveLine* pLineF = GetCurveLine( pGeomDB->GetGeoObj( nGeoF)) ;
if ( nCutF == GDB_ID_NULL || nGeoF == GDB_ID_NULL || // se ho un solo taglio, allora è quello
pLineF == nullptr || ! pGeomDB->GetGlobFrame( nGeoF, frGeoF)) if ( ssize( vnGeoF) == 1) {
pLineF = GetCurveLine( pGeomDB->GetGeoObj( vnGeoF[0])) ;
nGeoF = vnGeoF[0] ;
}
// se più tagli, cerco quello più vicino alla linea corrente
else {
double dMinSqDist = INFINITO ;
for ( int i = 0 ; i < ssize( vnGeoF) ; ++ i) {
Frame3d frCurrGeoF ;
ICurveLine* pCurrLineF = GetCurveLine( pGeomDB->GetGeoObj( vnGeoF[i])) ;
if ( pCurrLineF == nullptr || ! pGeomDB->GetGlobFrame( vnGeoF[i], frCurrGeoF))
return false ;
double dCurrSqDist ;
DistPointLine( GetToLoc( s_scInfo.ptP1, frCurrGeoF), *pCurrLineF).GetSqDist( dCurrSqDist) ;
if ( dCurrSqDist < dMinSqDist) {
dMinSqDist = dCurrSqDist ;
pLineF = pCurrLineF ;
nGeoF = vnGeoF[i] ;
}
}
}
if ( pLineF == nullptr || ! pGeomDB->GetGlobFrame( nGeoF, frGeoF))
return false ; return false ;
ptStartF = pLineF->GetStart() ; ptStartF = pLineF->GetStart() ;
ptStartF.ToGlob( frGeoF) ; ptStartF.ToGlob( frGeoF) ;
@@ -1838,8 +1991,31 @@ ExeMoveToSnapPointOnCollision( const INTVECTOR& vIds, bool bReducedCut, double d
BBox3d b3Temp ; BBox3d b3Temp ;
pGeomDB->GetGlobalBBox( nId, b3Temp) ; pGeomDB->GetGlobalBBox( nId, b3Temp) ;
if ( b3Temp.OverlapsXY( b3CutM)) { if ( b3Temp.OverlapsXY( b3CutM)) {
int nGeom = GetGeometryFromCut( pGeomDB, pMachMgr, nId) ; int nGeom = GDB_ID_NULL ;
ICurveLine* pLine = GetCurveLine( pGeomDB->GetGeoObj( nGeom)) ; INTVECTOR vnGeom = GetGeometryFromCut( pGeomDB, pMachMgr, nId) ;
ICurveLine* pLine = nullptr ;
// se ho un solo taglio, allora è quello
if ( ssize( vnGeom) == 1) {
pLine = GetCurveLine( pGeomDB->GetGeoObj( vnGeom[0])) ;
nGeom = vnGeom[0] ;
}
// se ho più tagli, cerco quello più vicino alla linea corrente
else {
double dMinSqDist = INFINITO ;
for ( int i = 0 ; i < ssize( vnGeom) ; ++ i) {
Frame3d frCurrGeo ;
ICurveLine* pCurrLine = GetCurveLine( pGeomDB->GetGeoObj( vnGeom[i])) ;
if ( pCurrLine == nullptr || ! pGeomDB->GetGlobFrame( vnGeom[i], frCurrGeo))
return false ;
double dCurrSqDist ;
DistPointLine( GetToLoc( s_scInfo.ptP1, frCurrGeo), *pCurrLine).GetSqDist( dCurrSqDist) ;
if ( dCurrSqDist < dMinSqDist) {
dMinSqDist = dCurrSqDist ;
pLine = pCurrLine ;
nGeom = vnGeom[i] ;
}
}
}
if ( nGeom == GDB_ID_NULL || pLine == nullptr || ! pGeomDB->GetGlobFrame( nGeom, frGeoF)) if ( nGeom == GDB_ID_NULL || pLine == nullptr || ! pGeomDB->GetGlobFrame( nGeom, frGeoF))
continue ; continue ;
ptStartF = pLine->GetStart() ; ptStartF = pLine->GetStart() ;
@@ -1872,8 +2048,31 @@ ExeMoveToSnapPointOnCollision( const INTVECTOR& vIds, bool bReducedCut, double d
BBox3d b3Temp ; BBox3d b3Temp ;
pGeomDB->GetGlobalBBox( nId, b3Temp) ; pGeomDB->GetGlobalBBox( nId, b3Temp) ;
if ( b3Temp.OverlapsXY( b3CutF)) { if ( b3Temp.OverlapsXY( b3CutF)) {
int nGeom = GetGeometryFromCut( pGeomDB, pMachMgr, nId) ; int nGeom = GDB_ID_NULL ;
ICurveLine* pLine = GetCurveLine( pGeomDB->GetGeoObj( nGeom)) ; INTVECTOR vnGeom = GetGeometryFromCut( pGeomDB, pMachMgr, nId) ;
ICurveLine* pLine = nullptr ;
// se ho un solo taglio, allora è quello
if ( ssize( vnGeom) == 1) {
pLine = GetCurveLine( pGeomDB->GetGeoObj( vnGeom[0])) ;
nGeom = vnGeom[0] ;
}
// se ho più tagli, cerco quello più vicino alla linea corrente
else {
double dMinSqDist = INFINITO ;
for ( int i = 0 ; i < ssize( vnGeom) ; ++ i) {
Frame3d frCurrGeo ;
ICurveLine* pCurrLine = GetCurveLine( pGeomDB->GetGeoObj( vnGeom[0])) ;
if ( pCurrLine == nullptr || ! pGeomDB->GetGlobFrame( vnGeom[i], frCurrGeo))
return false ;
double dCurrSqDist ;
DistPointLine( GetToLoc( s_scInfo.ptP1, frCurrGeo), *pCurrLine).GetSqDist( dCurrSqDist) ;
if ( dCurrSqDist < dMinSqDist) {
dMinSqDist = dCurrSqDist ;
pLine = pCurrLine ;
nGeom = vnGeom[i] ;
}
}
}
if ( nGeom == GDB_ID_NULL || pLine == nullptr || ! pGeomDB->GetGlobFrame( nGeom, frGeoM)) if ( nGeom == GDB_ID_NULL || pLine == nullptr || ! pGeomDB->GetGlobFrame( nGeom, frGeoM))
continue ; continue ;
ptStartM = pLine->GetStart() ; ptStartM = pLine->GetStart() ;
@@ -1950,9 +2149,9 @@ ExeMoveToSnapPointOnCollision( const INTVECTOR& vIds, bool bReducedCut, double d
dMoveMn = CrossXY( ptStartF - ptEndM, vtDirFp) / dDenom ; dMoveMn = CrossXY( ptStartF - ptEndM, vtDirFp) / dDenom ;
} }
} }
// pareggio la parte più vicina, se almeno una sotto soglia // pareggio la parte più vicina, se almeno una sotto soglia
if ( abs( dMoveMp) < dMaxMove || abs( dMoveMn) < dMaxMove) { if ( abs( dMoveMp) < dMaxMove || abs( dMoveMn) < dMaxMove) {
// calcolo movimento necessario, se nullo già a posto // calcolo movimento necessario, se nullo già a posto
Vector3d vtMove = (( abs( dMoveMp) < abs( dMoveMn)) ? dMoveMp : dMoveMn) * vtDirF ; Vector3d vtMove = (( abs( dMoveMp) < abs( dMoveMn)) ? dMoveMp : dMoveMn) * vtDirF ;
if ( vtMove.IsSmall()) { if ( vtMove.IsSmall()) {
bMoved = false ; bMoved = false ;
@@ -1977,7 +2176,7 @@ ExeMoveToSnapPointOnCollision( const INTVECTOR& vIds, bool bReducedCut, double d
pGeomDB->GetRefBBox( nCutM, frCutF, b3CutM) ; pGeomDB->GetRefBBox( nCutM, frCutF, b3CutM) ;
double dStartDelta = b3CutF.GetMin().x - b3CutM.GetMin().x ; double dStartDelta = b3CutF.GetMin().x - b3CutM.GetMin().x ;
double dEndDelta = b3CutF.GetMax().x - b3CutM.GetMax().x ; double dEndDelta = b3CutF.GetMax().x - b3CutM.GetMax().x ;
// pareggio la parte più vicina, se sotto soglia // pareggio la parte più vicina, se sotto soglia
if ( abs( dStartDelta) > dMaxMove && abs( dEndDelta) > dMaxMove) if ( abs( dStartDelta) > dMaxMove && abs( dEndDelta) > dMaxMove)
return false ; return false ;
Vector3d vtMove = (( abs( dStartDelta) < abs( dEndDelta)) ? dStartDelta : dEndDelta) * vtDirF ; Vector3d vtMove = (( abs( dStartDelta) < abs( dEndDelta)) ? dStartDelta : dEndDelta) * vtDirF ;
@@ -2079,7 +2278,7 @@ ExeAutomaticPackParts( INTVECTOR& vIds, bool bMinimizeOnXvsY, bool bReducedCut,
// Avvio nesting automatico // Avvio nesting automatico
ExeAutoNestStart() ; ExeAutoNestStart() ;
// Modalità ghigliottina incompatibile con tagli completi // Modalità ghigliottina incompatibile con tagli completi
if ( ! bReducedCut) if ( ! bReducedCut)
bGuillotineMode = false ; bGuillotineMode = false ;
@@ -2102,11 +2301,11 @@ ExeAutomaticPackParts( INTVECTOR& vIds, bool bMinimizeOnXvsY, bool bReducedCut,
nDamId = pGeomDB->GetNextName( nDamId, NST_DAMAGED_REG) ; nDamId = pGeomDB->GetNextName( nDamId, NST_DAMAGED_REG) ;
} }
// Modalità ghigliottina incompatibile con pannelli non rettangolari // Modalità ghigliottina incompatibile con pannelli non rettangolari
if ( ! bIsRect) if ( ! bIsRect)
bGuillotineMode = false ; bGuillotineMode = false ;
// Assegno le aree occupate dai pezzi già nestati // Assegno le aree occupate dai pezzi già nestati
bool bPartAlreadyNested = false ; bool bPartAlreadyNested = false ;
BBox3d b3Sheet ; BBox3d b3Sheet ;
pGeomDB->GetGlobalBBox( nRefReg, b3Sheet) ; pGeomDB->GetGlobalBBox( nRefReg, b3Sheet) ;
@@ -2132,18 +2331,18 @@ ExeAutomaticPackParts( INTVECTOR& vIds, bool bMinimizeOnXvsY, bool bReducedCut,
GetFlatPartDownCutRegions( pGeomDB, nId, bReducedCut, vCutReg) ; GetFlatPartDownCutRegions( pGeomDB, nId, bReducedCut, vCutReg) ;
for ( int nRegId : vCutReg) for ( int nRegId : vCutReg)
ExeAutoNestAddDefectToSheet( nSheetId, nRegId) ; ExeAutoNestAddDefectToSheet( nSheetId, nRegId) ;
// dichiaro ci sono pezzi già nestati // dichiaro ci sono pezzi già nestati
bPartAlreadyNested = true ; bPartAlreadyNested = true ;
} }
} }
nId = ( bInRoot ? ExeGetNextPart( nId, true) : ExeGetNextGroup( nId)) ; nId = ( bInRoot ? ExeGetNextPart( nId, true) : ExeGetNextGroup( nId)) ;
} }
// Pezzi già nestati incompatibili con ghigliottina // Pezzi già nestati incompatibili con ghigliottina
if ( bPartAlreadyNested) if ( bPartAlreadyNested)
bGuillotineMode = false ; bGuillotineMode = false ;
// Se richiesta modalità ghigliottina // Se richiesta modalità ghigliottina
if ( bGuillotineMode) { if ( bGuillotineMode) {
// cerco il gap necessario tra le parti // cerco il gap necessario tra le parti
double dGap = 0 ; double dGap = 0 ;
@@ -2153,7 +2352,7 @@ ExeAutomaticPackParts( INTVECTOR& vIds, bool bMinimizeOnXvsY, bool bReducedCut,
if ( GetFlatPartInterpartGap( pGeomDB, nPartId, dCurrGap) && dCurrGap > dGap) if ( GetFlatPartInterpartGap( pGeomDB, nPartId, dCurrGap) && dCurrGap > dGap)
dGap = dCurrGap ; dGap = dCurrGap ;
} }
// se non trovato disabilito richiesta modalità ghigliottina // se non trovato disabilito richiesta modalità ghigliottina
if ( dGap < EPS_SMALL) if ( dGap < EPS_SMALL)
bGuillotineMode = false ; bGuillotineMode = false ;
// altrimenti lo imposto // altrimenti lo imposto
@@ -2161,7 +2360,7 @@ ExeAutomaticPackParts( INTVECTOR& vIds, bool bMinimizeOnXvsY, bool bReducedCut,
ExeAutoNestSetInterpartGap( dGap) ; ExeAutoNestSetInterpartGap( dGap) ;
} }
// Se richiesto e abilitato, imposto modalità ghigliottina // Se richiesto e abilitato, imposto modalità ghigliottina
if ( bGuillotineMode) if ( bGuillotineMode)
ExeAutoNestSetGuillotineMode() ; ExeAutoNestSetGuillotineMode() ;
@@ -2177,7 +2376,7 @@ ExeAutomaticPackParts( INTVECTOR& vIds, bool bMinimizeOnXvsY, bool bReducedCut,
int nDwnRegId = GetFlatPartDownRegion( pGeomDB, nPartId) ; int nDwnRegId = GetFlatPartDownRegion( pGeomDB, nPartId) ;
if ( nDwnRegId != GDB_ID_NULL) if ( nDwnRegId != GDB_ID_NULL)
ExeAutoNestAddAnotherOutlineToPart( nPartId, nDwnRegId) ; ExeAutoNestAddAnotherOutlineToPart( nPartId, nDwnRegId) ;
// se non è ghigliottina imposto le regioni dei tagli (con ghigliottina si usa il gap) // se non è ghigliottina imposto le regioni dei tagli (con ghigliottina si usa il gap)
if ( ! bGuillotineMode) { if ( ! bGuillotineMode) {
// recupero regioni dei tagli del pezzo // recupero regioni dei tagli del pezzo
INTVECTOR vCutReg ; INTVECTOR vCutReg ;
+1713
View File
File diff suppressed because it is too large Load Diff
+256 -12
View File
@@ -16,10 +16,14 @@
#include "EXE.h" #include "EXE.h"
#include "EXE_Macro.h" #include "EXE_Macro.h"
#include "DllGraphics.h" #include "DllGraphics.h"
#include "DllMain.h"
#include "resource.h"
#include "/EgtDev/Include/EGkSurfBezier.h"
#include "/EgtDev/Include/EXeExecutor.h" #include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EXeConst.h" #include "/EgtDev/Include/EXeConst.h"
#include "/EgtDev/Include/EgtStringConverter.h" #include "/EgtDev/Include/EgtStringConverter.h"
#include "/EgtDev/Include/EgtPointerOwner.h" #include "/EgtDev/Include/EgtPointerOwner.h"
#include <Windowsx.h>
using namespace std ; using namespace std ;
@@ -109,12 +113,12 @@ ExeSetLineAttribs( int nWidth)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool bool
ExeSetMarkAttribs( Color MarkCol) ExeSetMarkAttribs( Color MarkCol, Color Mark2Col)
{ {
IEGrScene* pScene = GetCurrScene() ; IEGrScene* pScene = GetCurrScene() ;
VERIFY_SCENE( pScene, false) VERIFY_SCENE( pScene, false)
// imposto il colore del Mark // imposto il colore del Mark
return pScene->SetMark( MarkCol) ; return ( pScene->SetMark( MarkCol) && pScene->SetMark2( Mark2Col)) ;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -183,10 +187,23 @@ ExeSetGridGeo( double dSnapStep, int nMinLineSstep, int nMajLineSstep, int nExtS
{ {
IEGrScene* pScene = GetCurrScene() ; IEGrScene* pScene = GetCurrScene() ;
VERIFY_SCENE( pScene, false) VERIFY_SCENE( pScene, false)
// imposto i parametri geometrici di griglia // imposto i parametri geometrici di griglia
return pScene->SetGridGeo( dSnapStep, nMinLineSstep, nMajLineSstep, nExtSstep) ; return pScene->SetGridGeo( dSnapStep, nMinLineSstep, nMajLineSstep, nExtSstep) ;
} }
//-----------------------------------------------------------------------------
bool
ExeSetGridGeoAdv( double dSnapStep, int nMinLineSstep, int nMajLineSstep,
double dXmin, double dXmax, double dYmin, double dYmax)
{
IEGrScene* pScene = GetCurrScene() ;
VERIFY_SCENE( pScene, false)
// imposto i parametri geometrici di griglia
return pScene->SetGridGeoAdv( dSnapStep, nMinLineSstep, nMajLineSstep, dXmin, dXmax, dYmin, dYmax) ;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool bool
ExeSetGridColor( Color colMin, Color colMaj) ExeSetGridColor( Color colMin, Color colMaj)
@@ -197,6 +214,31 @@ ExeSetGridColor( Color colMin, Color colMaj)
return pScene->SetGridColor( colMin, colMaj) ; return pScene->SetGridColor( colMin, colMaj) ;
} }
//-----------------------------------------------------------------------------
bool
ExeSetCameraType( bool bOrthoOrPersp, bool bRedraw)
{
IEGrScene* pScene = GetCurrScene() ;
VERIFY_SCENE( pScene, false)
pScene->SetCameraType( bOrthoOrPersp) ;
if ( bRedraw)
pScene->RedrawWindow() ;
return true ;
}
//-----------------------------------------------------------------------------
bool
ExeSetZoomType( int nMode, bool bRedraw)
{
IEGrScene* pScene = GetCurrScene() ;
VERIFY_SCENE( pScene, false)
if ( ! pScene->SetZoomType( nMode))
return false ;
if ( bRedraw)
pScene->RedrawWindow() ;
return true ;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool bool
ExeResize( int nW, int nH) ExeResize( int nW, int nH)
@@ -212,16 +254,34 @@ ExeResize( int nW, int nH)
bool bool
ExeDraw( void) ExeDraw( void)
{ {
// se interfaccia disabilitata, esco subito
if ( ! ExeGetEnableUI())
return true ;
GseContext* pGseCtx = GetCurrGseContext() ; GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, false) VERIFY_CTX_SCENE( pGseCtx, false)
// se abilitato, eseguo disegno // eseguo disegno
if ( ExeGetEnableUI()) pGseCtx->m_pScene->Draw() ;
pGseCtx->m_pScene->Draw() ;
// valido la finestra disegnata // valido la finestra disegnata
ValidateRgn( pGseCtx->m_hWnd, NULL) ; ValidateRgn( pGseCtx->m_hWnd, NULL) ;
return true ; return true ;
} }
//-----------------------------------------------------------------------------
bool
ExeRedraw( void)
{
// se interfaccia disabilitata, esco subito
if ( ! ExeGetEnableUI())
return true ;
IEGrScene* pScene = GetCurrScene() ;
VERIFY_SCENE( pScene, false)
// forzo ridisegno
pScene->RedrawWindow() ;
return true ;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool bool
ExeSelect( int nWinX, int nWinY, int nSelW, int nSelH, int* pnSel) ExeSelect( int nWinX, int nWinY, int nSelW, int nSelH, int* pnSel)
@@ -415,17 +475,44 @@ ExeGetShowCurveDirection( void)
return pScene->GetShowCurveDirection() ; return pScene->GetShowCurveDirection() ;
} }
//-----------------------------------------------------------------------------
static bool
MyResetGroupObjGraphics( IGeomDB* pGDB, int nGroupId)
{
if ( pGDB == nullptr)
return false ;
int nEntId = pGDB->GetFirstInGroup( nGroupId) ;
while ( nEntId != GDB_ID_NULL) {
if ( pGDB->GetGdbType( nEntId) == GDB_TY_GROUP) {
MyResetGroupObjGraphics( pGDB, nEntId) ;
}
else {
IGeoObj* pGeoObj = pGDB->GetGeoObj( nEntId) ;
if ( pGeoObj != nullptr)
pGeoObj->SetObjGraphics( nullptr) ;
}
nEntId = pGDB->GetNext( nEntId) ;
}
return true ;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool bool
ExeSetShowTriaAdv( bool bAdvanced, bool bRedraw) ExeSetShowTriaAdv( bool bAdvanced, bool bRedraw)
{ {
IEGrScene* pScene = GetCurrScene() ; IEGrScene* pScene = GetCurrScene() ;
VERIFY_SCENE( pScene, false) VERIFY_SCENE( pScene, false)
// imposto stato // se cambiato, imposto stato
pScene->SetShowTriaAdvanced( bAdvanced) ; if ( pScene->GetShowTriaAdvanced() != bAdvanced) {
// imposto il nuovo stato
pScene->SetShowTriaAdvanced( bAdvanced) ;
// forzo ricalcolo della grafica di tutti gli oggetti
if ( ! MyResetGroupObjGraphics( pScene->GetGeomDB(), GDB_ID_ROOT))
return false ;
}
if ( bRedraw) if ( bRedraw)
pScene->RedrawWindow() ; pScene->RedrawWindow() ;
return TRUE ; return true ;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -438,17 +525,50 @@ ExeGetShowTriaAdv( void)
return pScene->GetShowTriaAdvanced() ; return pScene->GetShowTriaAdvanced() ;
} }
//-------------------------------------------------------------------------------
bool
ExeSetShowSurfBezierTol( double dLinTol, bool bRedraw)
{
IEGrScene* pScene = GetCurrScene() ;
VERIFY_SCENE( pScene, false)
// se diverso, imposto il nuovo valore
if ( abs( GetSurfBezierAuxSurfTol() - dLinTol) > 10 * EPS_SMALL) {
// imposto il nuovo valore di approssimazione
SetSurfBezierAuxSurfTol( dLinTol) ;
// forzo ricalcolo della grafica di tutti gli oggetti
if ( ! MyResetGroupObjGraphics( pScene->GetGeomDB(), GDB_ID_ROOT))
return false ;
}
if ( bRedraw)
pScene->RedrawWindow() ;
return true ;
}
//-----------------------------------------------------------------------------
double
ExeGetShowSurfBezierTol( void)
{
// recupero il valore
return GetSurfBezierAuxSurfTol() ;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool bool
ExeSetShowZmap( int nMode, bool bRedraw) ExeSetShowZmap( int nMode, bool bRedraw)
{ {
IEGrScene* pScene = GetCurrScene() ; IEGrScene* pScene = GetCurrScene() ;
VERIFY_SCENE( pScene, false) VERIFY_SCENE( pScene, false)
// imposto stato // se cambiato, imposto il nuovo stato
pScene->SetShowZmap( nMode) ; if ( pScene->GetShowZmap() != nMode) {
// imposto il nuovo stato
pScene->SetShowZmap( nMode) ;
// forzo ricalcolo della grafica di tutti gli oggetti
if ( ! MyResetGroupObjGraphics( pScene->GetGeomDB(), GDB_ID_ROOT))
return false ;
}
if ( bRedraw) if ( bRedraw)
pScene->RedrawWindow() ; pScene->RedrawWindow() ;
return TRUE ; return true ;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -456,7 +576,7 @@ int
ExeGetShowZmap( void) ExeGetShowZmap( void)
{ {
IEGrScene* pScene = GetCurrScene() ; IEGrScene* pScene = GetCurrScene() ;
VERIFY_SCENE( pScene, false) VERIFY_SCENE( pScene, -1)
// recupero lo stato // recupero lo stato
return pScene->GetShowZmap() ; return pScene->GetShowZmap() ;
} }
@@ -478,6 +598,10 @@ ExeZoomRadius( double dRadius, bool bRedraw)
bool bool
ExeZoom( int nZoom, bool bRedraw) ExeZoom( int nZoom, bool bRedraw)
{ {
// se interfaccia disabilitata, esco subito
if ( ! ExeGetEnableUI())
return true ;
IEGrScene* pScene = GetCurrScene() ; IEGrScene* pScene = GetCurrScene() ;
VERIFY_SCENE( pScene, false) VERIFY_SCENE( pScene, false)
@@ -625,10 +749,23 @@ ExeZoomWin( int nPrevX, int nPrevY, int nCurrX, int nCurrY, bool bRedraw)
return true ; return true ;
} }
//-----------------------------------------------------------------------------
bool
ExeSetViewOrizzOffsStep( int nDirOffsStep)
{
IEGrScene* pScene = GetCurrScene() ;
VERIFY_SCENE( pScene, false)
return pScene->SetCameraDirOrizzOffset( nDirOffsStep) ;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool bool
ExeSetView( int nDir, bool bRedraw) ExeSetView( int nDir, bool bRedraw)
{ {
// se interfaccia disabilitata, esco subito
if ( ! ExeGetEnableUI())
return true ;
IEGrScene* pScene = GetCurrScene() ; IEGrScene* pScene = GetCurrScene() ;
VERIFY_SCENE( pScene, false) VERIFY_SCENE( pScene, false)
// imposto vista // imposto vista
@@ -694,6 +831,19 @@ ExeRotateView( int nPrevX, int nPrevY, int nCurrX, int nCurrY, bool bRedraw)
return true ; return true ;
} }
//-----------------------------------------------------------------------------
bool
ExeGetViewOrizzOffsStep( int* pnDirOffsStep)
{
IEGrScene* pScene = GetCurrScene() ;
VERIFY_SCENE( pScene, false)
// recupero offset direzione di vista
if ( pnDirOffsStep == nullptr)
return false ;
*pnDirOffsStep = pScene->GetCameraDirOrizzOffset() ;
return true ;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool bool
ExeGetView( int* pnDir) ExeGetView( int* pnDir)
@@ -850,3 +1000,97 @@ ExeGetImage( int nShowMode, Color colBackTop, Color colBackBottom,
// creo e salvo una immagine della scena // creo e salvo una immagine della scena
return pScene->GetImage( nShowMode, colBackTop, colBackBottom, nWidth, nHeight, sFile) ; return pScene->GetImage( nShowMode, colBackTop, colBackBottom, nWidth, nHeight, sFile) ;
} }
//-------------------------------------------------------------------------------
static int s_nContext = 0 ;
static int s_nDriver = 3 ;
static bool s_b2Buff = true ;
static int s_nColorBits = 32 ;
static int s_nDepthBits = 24 ;
static int s_nShowMode = SM_SHADING ;
static Color s_colBackTop = WHITE ;
static Color s_colBackBottom = WHITE ;
static int s_nCameraDir = CT_TOP ;
static int s_nWidth = 1024 ;
static int s_nHeight = 1024 ;
static string s_sImageFile ;
//-------------------------------------------------------------------------------
BOOL
CALLBACK SceneBoxProc( HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
switch ( message) {
case WM_INITDIALOG :
{
// imposto dimensione box e picture
const int WIN_MAX_DIM = ( s_nDriver == 1 ? 512 : 1024) ;
int nWinW = ( s_nWidth >= s_nHeight ? WIN_MAX_DIM : ( WIN_MAX_DIM * s_nWidth) / s_nHeight) ;
int nWinH = ( s_nHeight >= s_nWidth ? WIN_MAX_DIM : ( WIN_MAX_DIM * s_nHeight) / s_nWidth) ;
HWND hPic = GetDlgItem( hwndDlg, IDC_PICTURE1) ;
SetWindowPos( hwndDlg, HWND_TOP, 0, 0, nWinW, nWinH, SWP_NOMOVE | SWP_NOREPOSITION) ;
SetWindowPos( hPic, HWND_TOP, 0, 0, nWinW, nWinH, SWP_NOMOVE | SWP_NOREPOSITION) ;
// imposto scena
int nContext = GetIndCurrGseContext() ;
GseContext* pGseCtx = GetGseContext( nContext) ;
if ( pGseCtx != nullptr && pGseCtx->m_pScene == nullptr) {
ExeInitScene( hPic, s_nDriver, s_b2Buff, s_nColorBits, s_nDepthBits) ;
if ( pGseCtx->m_pGeomDB != nullptr && pGseCtx->m_pScene != nullptr) {
s_nContext = nContext ;
pGseCtx->m_pScene->SetCamera( s_nCameraDir) ;
pGseCtx->m_pScene->ZoomAll() ;
if ( ! pGseCtx->m_pScene->GetImage( s_nShowMode, s_colBackTop, s_colBackBottom, s_nWidth, s_nHeight, s_sImageFile))
s_nContext = -s_nContext ;
MyResetGroupObjGraphics( pGseCtx->m_pGeomDB, GDB_ID_ROOT) ;
EndDialog( hwndDlg, wParam) ;
}
else {
s_nContext = 0 ;
EndDialog( hwndDlg, wParam) ;
}
}
else
s_nContext = 0 ;
}
break ;
}
return FALSE ;
}
//-------------------------------------------------------------------------------
bool
ExeGetImageEx( int nDriver, bool b2Buff, int nColorBits, int nDepthBits,
int nShowMode, Color colBackTop, Color colBackBottom,
int nCameraDir, int nWidth, int nHeight, const string& sFile)
{
// Se il contesto corrente possiede già una scena
if ( GetCurrScene() != nullptr) {
return ExeGetImage( nShowMode, colBackTop, colBackBottom, nWidth, nHeight, sFile) ;
}
// altrimenti ne creo una temporanea
else {
// salvo i parametri
s_nDriver = nDriver ;
s_b2Buff = b2Buff ;
s_nColorBits = nColorBits ;
s_nDepthBits = nDepthBits ;
s_nShowMode = nShowMode ;
s_colBackTop = colBackTop ;
s_colBackBottom = colBackBottom ;
s_nCameraDir = nCameraDir ;
s_nWidth = nWidth ;
s_nHeight = nHeight ;
s_sImageFile = sFile ;
// lancio dialogo
HWND hTopWnd = ExeGetMainWindowHandle() ;
DialogBox( GetModuleIstance(), MAKEINTRESOURCE( IDD_LUASCENE), hTopWnd, (DLGPROC)SceneBoxProc) ;
bool bOk = ( s_nContext > 0) ;
// elimino la scena dal contesto
GseContext* pGseCtx = GetGseContext( abs( s_nContext)) ;
if ( pGseCtx != nullptr) {
delete pGseCtx->m_pScene ;
pGseCtx->m_pScene = nullptr ;
}
s_nContext = 0 ;
return bOk ;
}
}
+317
View File
@@ -0,0 +1,317 @@
//----------------------------------------------------------------------------
// EgalTech 2024-2024
//----------------------------------------------------------------------------
// File : EXE_TestObjSurface.cpp Data : 24.03.24 Versione : 2.6c2
// Contenuto : Funzioni per verificare collisioni tra
// Objects e Superfici (TriMesh).
//
//
// Modifiche : 09.01.20 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "EXE.h"
#include "EXE_Macro.h"
#include "EXE_Const.h"
#include "AuxTools.h"
#include "GeoTools.h"
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EXeConst.h"
#include "/EgtDev/Include/EGkCDeBoxClosedSurfTm.h"
#include "/EgtDev/Include/EGkCDeRectPrismoidClosedSurfTm.h"
#include "/EgtDev/Include/EGkCDeCylClosedSurfTm.h"
#include "/EgtDev/Include/EGkCDeConeFrustumClosedSurfTm.h"
#include "/EgtDev/Include/EGkCDeSpheClosedSurfTm.h"
#include "/EgtDev/Include/EGkCDeClosedSurfTmClosedSurfTm.h"
#include "/EgtDev/Include/EGkSurfLocal.h"
#include "/EgtDev/Include/EGkStringUtils3d.h"
using namespace std ;
//----------------------------------------------------------------------------
static int
MyTestBoxSurfTm( const Frame3d& frBox, const Vector3d& vtDiag, int nSurfTmId, double dSafeDist, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, -1)
// recupero la superficie TriMesh
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nSurfTmId)) ;
if ( pStm == nullptr)
return -1 ;
// recupero il riferimento della superficie
Frame3d frSurf ;
if ( ! pGeomDB->GetGlobFrame( nSurfTmId, frSurf))
return -1 ;
// porto in locale alla superficie il riferimento del box (il vettore è già in questo stesso riferimento)
Frame3d frBoxL = GetFrameLocal( pGeomDB, frBox, nRefType, frSurf) ;
// verifico l'a collisione'interferenza
return ( TestBoxSurfTm( frBoxL, vtDiag, *pStm, dSafeDist) ? 1 : 0) ;
}
//----------------------------------------------------------------------------
int
ExeTestBoxSurface( const Frame3d& frBox, const Vector3d& vtDiag, int nSurfId, double dSafeDist, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
int nRes = -1 ;
if ( pGeomDB != nullptr && pGeomDB->GetGeoType( nSurfId) == SRF_TRIMESH)
nRes = MyTestBoxSurfTm( frBox, vtDiag, nSurfId, dSafeDist, nRefType) ;
// è da aggiungere il test con le superfici di Bezier
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtTestBoxSurface({{" + ToString( frBox.Orig()) + "},{" +
ToString( frBox.VersX()) + "},{" +
ToString( frBox.VersY()) + "},{" +
ToString( frBox.VersZ()) + "}},{" +
ToString( vtDiag) + "}," +
IdToString( nSurfId) + "," +
ToString( dSafeDist) + "," +
RefTypeToString( nRefType) + ")" +
" -- Res=" + ToString( nRes) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultato
return nRes ;
}
//----------------------------------------------------------------------------
static int
MyTestRectPrismoidSurfTm( const Frame3d& frPrismoid, double dBaseLenX, double dBaseLenY,
double dTopLenX, double dTopLenY, double dHeight,
int nSurfTmId, double dSafeDist, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, -1)
// recupero la superficie TriMesh
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nSurfTmId)) ;
if ( pStm == nullptr)
return -1 ;
// recupero il riferimento della superficie
Frame3d frSurf ;
if ( ! pGeomDB->GetGlobFrame( nSurfTmId, frSurf))
return -1 ;
// porto in locale alla superficie il riferimento del prismoide rettangolare
Frame3d frPrismoidL = GetFrameLocal( pGeomDB, frPrismoid, nRefType, frSurf) ;
// verifico l'a collisione'interferenza
return ( TestRectPrismoidSurfTm( frPrismoidL, dBaseLenX, dBaseLenY, dTopLenX, dTopLenY, dHeight, *pStm, dSafeDist) ? 1 : 0) ;
}
//----------------------------------------------------------------------------
int
ExeTestRectPrismoidSurface( const Frame3d& frPrismoid, double dBaseLenX, double dBaseLenY,
double dTopLenX, double dTopLenY, double dHeight,
int nSurfId, double dSafeDist, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
int nRes = -1 ;
if ( pGeomDB != nullptr && pGeomDB->GetGeoType( nSurfId) == SRF_TRIMESH)
nRes = MyTestRectPrismoidSurfTm( frPrismoid, dBaseLenX, dBaseLenY, dTopLenX, dTopLenY, dHeight, nSurfId, dSafeDist, nRefType) ;
// è da aggiungere il test con le superfici di Bezier
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtTestRectPrismoidSurface({{" + ToString( frPrismoid.Orig()) + "},{" +
ToString( frPrismoid.VersX()) + "},{" +
ToString( frPrismoid.VersY()) + "},{" +
ToString( frPrismoid.VersZ()) + "}}," +
ToString( dBaseLenX) + "," +
ToString( dBaseLenY) + "," +
ToString( dTopLenX) + "," +
ToString( dTopLenY) + "," +
ToString( dHeight) + "," +
IdToString( nSurfId) + "," +
ToString( dSafeDist) + "," +
RefTypeToString( nRefType) + ")" +
" -- Res=" + ToString( nRes) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultato
return nRes ;
}
//----------------------------------------------------------------------------
static int
MyTestCylSurfTm( const Frame3d& frCyl, double dR, double dH, int nSurfTmId, double dSafeDist, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, -1)
// recupero la superficie TriMesh
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nSurfTmId)) ;
if ( pStm == nullptr)
return -1 ;
// recupero il riferimento della superficie
Frame3d frSurf ;
if ( ! pGeomDB->GetGlobFrame( nSurfTmId, frSurf))
return -1 ;
// porto in locale alla superficie il riferimento del cilindro
Frame3d frCylL = GetFrameLocal( pGeomDB, frCyl, nRefType, frSurf) ;
// verifico l'interferenza
return ( TestCylSurfTm( frCylL, dR, dH, *pStm, dSafeDist) ? 1 : 0) ;
}
//----------------------------------------------------------------------------
int
ExeTestCylSurface( const Frame3d& frCyl, double dR, double dH, int nSurfId, double dSafeDist, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
int nRes = -1 ;
if ( pGeomDB != nullptr && pGeomDB->GetGeoType( nSurfId) == SRF_TRIMESH)
nRes = MyTestCylSurfTm( frCyl, dR, dH, nSurfId, dSafeDist, nRefType) ;
// è da aggiungere il test con le superfici di Bezier
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtTestCylSurface({{" + ToString( frCyl.Orig()) + "},{" +
ToString( frCyl.VersX()) + "},{" +
ToString( frCyl.VersY()) + "},{" +
ToString( frCyl.VersZ()) + "}}," +
ToString( dR) + "," +
ToString( dH) + "," +
IdToString( nSurfId) + "," +
ToString( dSafeDist) + "," +
RefTypeToString( nRefType) + ")" +
" -- Res=" + ToString( nRes) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultato
return nRes ;
}
//----------------------------------------------------------------------------
static int
MyTestConeSurfTm( const Frame3d& frCone, double dR1, double dR2, double dH, int nSurfTmId, double dSafeDist, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, -1)
// recupero la superficie TriMesh
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nSurfTmId)) ;
if ( pStm == nullptr)
return -1 ;
// recupero il riferimento della superficie
Frame3d frSurf ;
if ( ! pGeomDB->GetGlobFrame( nSurfTmId, frSurf))
return -1 ;
// porto in locale alla superficie il riferimento del cilindro
Frame3d frConeL = GetFrameLocal( pGeomDB, frCone, nRefType, frSurf) ;
// verifico l'interferenza
return ( TestConeFrustumSurfTm( frConeL, dR1, dR2, dH, *pStm, dSafeDist) ? 1 : 0) ;
}
//----------------------------------------------------------------------------
int
ExeTestConeSurface( const Frame3d& frCone, double dR1, double dR2, double dH, int nSurfId, double dSafeDist, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
int nRes = -1 ;
if ( pGeomDB != nullptr && pGeomDB->GetGeoType( nSurfId) == SRF_TRIMESH)
nRes = MyTestConeSurfTm( frCone, dR1, dR2, dH, nSurfId, dSafeDist, nRefType) ;
// è da aggiungere il test con le superfici di Bezier
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtTestConeSurface({{" + ToString( frCone.Orig()) + "},{" +
ToString( frCone.VersX()) + "},{" +
ToString( frCone.VersY()) + "},{" +
ToString( frCone.VersZ()) + "}}," +
ToString( dR1) + "," +
ToString( dR2) + "," +
ToString( dH) + "," +
IdToString( nSurfId) + "," +
ToString( dSafeDist) + "," +
RefTypeToString( nRefType) + ")" +
" -- Res=" + ToString( nRes) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultato
return nRes ;
}
//----------------------------------------------------------------------------
static int
MyTestSpheSurfTm( const Point3d& ptCen, double dR, int nSurfTmId, double dSafeDist, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, -1)
// recupero la superficie TriMesh
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nSurfTmId)) ;
if ( pStm == nullptr)
return -1 ;
// recupero il riferimento della superficie
Frame3d frSurf ;
if ( ! pGeomDB->GetGlobFrame( nSurfTmId, frSurf))
return -1 ;
// porto in locale alla superficie il centro della sfera
Point3d ptCenL = GetPointLocal( pGeomDB, ptCen, nRefType, frSurf) ;
// verifico l'interferenza
return ( TestSpheSurfTm( ptCenL, dR, *pStm, dSafeDist) ? 1 : 0) ;
}
//----------------------------------------------------------------------------
int
ExeTestSpheSurface( const Point3d& ptCen, double dR, int nSurfId, double dSafeDist, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
int nRes = -1 ;
if ( pGeomDB != nullptr && pGeomDB->GetGeoType( nSurfId) == SRF_TRIMESH)
nRes = MyTestSpheSurfTm( ptCen, dR, nSurfId, dSafeDist, nRefType) ;
// è da aggiungere il test con le superfici di Bezier
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtTestSpheSurface({" + ToString( ptCen) + "}," +
ToString( dR) + "," +
IdToString( nSurfId) + "," +
ToString( dSafeDist) + "," +
RefTypeToString( nRefType) + ")" +
" -- Res=" + ToString( nRes) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultato
return nRes ;
}
//----------------------------------------------------------------------------
static int
MyTestSurfTmSurfTm( int nSurfTm1Id, int nSurfTm2Id, double dSafeDist, bool bTestEnclosion)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, -1)
// recupero il riferimento della seconda superficie
Frame3d frSurf2 ;
if ( ! pGeomDB->GetGlobFrame( nSurfTm2Id, frSurf2))
return -1 ;
// recupero la prima superficie in locale alla seconda
SurfLocal Surf1Loc( pGeomDB, nSurfTm1Id, frSurf2) ;
const ISurfTriMesh* pStm1 = GetSurfTriMesh( Surf1Loc) ;
if ( pStm1 == nullptr)
return -1 ;
// recupero la seconda superficie TriMesh
const ISurfTriMesh* pStm2 = GetSurfTriMesh( pGeomDB->GetGeoObj( nSurfTm2Id)) ;
if ( pStm2 == nullptr)
return -1 ;
// verifico l'interferenza
return ( TestSurfTmSurfTm( *pStm1, *pStm2, dSafeDist, bTestEnclosion) ? 1 : 0) ;
}
//----------------------------------------------------------------------------
int
ExeTestSurfaceSurface( int nSurf1Id, int nSurf2Id, double dSafeDist, bool bTestEnclosion)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
int nRes = -1 ;
if ( pGeomDB != nullptr) {
if ( pGeomDB->GetGeoType( nSurf1Id) == SRF_TRIMESH && pGeomDB->GetGeoType( nSurf2Id) == SRF_TRIMESH)
nRes = MyTestSurfTmSurfTm( nSurf1Id, nSurf2Id, dSafeDist, bTestEnclosion) ;
// è da aggiungere il test con le superfici di Bezier
}
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtTestSurfaceSurface({" + IdToString( nSurf1Id) + "," +
IdToString( nSurf2Id) + "," +
ToString( dSafeDist) + "," +
( bTestEnclosion ? "true" : "false") + ")" +
" -- Res=" + ToString( nRes) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultato
return nRes ;
}
+898
View File
@@ -0,0 +1,898 @@
//----------------------------------------------------------------------------
// EgalTech 2025-2025
//----------------------------------------------------------------------------
// File : EXE_Trimming.cpp Data : 25.10.25 Versione : 2.7j3
// Funzioni per le lavorazioni di Trimming.
//
// Modifiche : 23.10.25 RE Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "EXE.h"
#include "EXE_Macro.h"
#include "DllExchange.h"
#include "GeoTools.h"
#include "AuxTools.h"
#include "/EgtDev/Include/EgtNumUtils.h"
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
#include "/EgtDev/Include/EGkSurfLocal.h"
#include "/EgtDev/Include/EGkCurveComposite.h"
#include "/EgtDev/Include/EGkTrimming.h"
#include "/EgtDev/Include/EGkStmFromTriangleSoup.h"
#include "/EgtDev/Include/EGkDistPointCurve.h"
#include <unordered_map>
#include <algorithm>
using namespace std ;
// ---------------------------------------------------------------------------
bool
ExeTrimmingGetHoleBorder( int nParentId, const INTVECTOR& vSurfIds, const INTVECTOR& vOtherSurfIds,
double dSurfLinTol, double dSurfAngTol, double dEdgeLinTol, double dEdgeAngTol,
double dEdgeThick, int& nFirstId, int& nCount)
{
// Verifica database geometrico
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// Inizializzo i valori di ritorno
nFirstId = GDB_ID_NULL ;
nCount = 0 ;
// Se non ho geometrie da ricercare, non faccio nulla
if ( vSurfIds.empty())
return true ;
// Recupero le superfici da cui estrarre i bordi
CISURFPVECTOR vpSurfs ; vpSurfs.reserve( vSurfIds.size()) ;
for ( int i = 0 ; i < ssize( vSurfIds) ; ++ i) {
int nSurfId = vSurfIds[i] ;
// Recupero l'entità
const IGeoObj* pGeoObj = pGeomDB->GetGeoObj( nSurfId) ;
if ( pGeoObj != nullptr) {
// Recupero il Tipo
int nType = pGeoObj->GetType() ;
if ( nType == SRF_TRIMESH || nType == SRF_BEZIER) {
// Recupero la superficie
const ISurf* pSurf = GetSurf( pGeoObj) ;
if ( pSurf != nullptr && pSurf->IsValid())
vpSurfs.emplace_back( pSurf) ;
}
}
}
// Se non ho superfici non faccio nulla
if ( vpSurfs.empty())
return false ;
// Calcolo il Centroide delle superfici complessive
Point3d ptRef = P_INVALID ;
if ( ! vOtherSurfIds.empty()) {
int nToTSurf = 0 ;
for ( int nOtherSurfId : vOtherSurfIds) {
// Recupero l'entità
const IGeoObj* pGeoObj = pGeomDB->GetGeoObj( nOtherSurfId) ;
if ( pGeoObj != nullptr) {
// Recupero il Tipo
int nType = pGeoObj->GetType() ;
if ( nType == SRF_TRIMESH || nType == SRF_BEZIER) {
// Recupero la superficie
const ISurf* pSurf = GetSurf( pGeoObj) ;
if ( pSurf != nullptr && pSurf->IsValid()) {
// Recupero il Centroide
Point3d ptCentroid ;
pSurf->GetCentroid( ptCentroid) ;
if ( ! ptRef.IsValid())
ptRef = ptCentroid ;
else
ptRef += ptCentroid ;
++ nToTSurf ;
}
}
}
}
if ( nToTSurf > 0) {
for ( const ISurf* pSurf : vpSurfs) {
Point3d ptCentroid ;
pSurf->GetCentroid( ptCentroid) ;
if ( ! ptRef.IsValid())
ptRef = ptCentroid ;
else
ptRef += ptCentroid ;
++ nToTSurf ;
}
ptRef /= nToTSurf ;
}
}
// Recupero i Bordi per fori ed asole
ICRVCOMPOPOVECTOR vHoleBorders ;
bool bOk = GetTrimmingHoleBorders( vpSurfs, ptRef, dSurfLinTol, dSurfAngTol, dEdgeLinTol, dEdgeAngTol,
dEdgeThick, vHoleBorders) ;
if ( bOk) {
// Inserisco le curve nel DB e imposto i parametri di ritorno
bool bFirst = true ;
for ( int i = 0 ; bOk && i < ssize( vHoleBorders) ; ++ i) {
// Verifico che sia valida
if ( ! IsNull( vHoleBorders[i]) && vHoleBorders[i]->IsValid()) {
int nCrvId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( vHoleBorders[i])) ;
bOk = ( nCrvId != GDB_ID_NULL) ;
if ( bOk) {
++ nCount ;
if ( bFirst) {
nFirstId = nCrvId ;
bFirst = false ;
}
}
}
}
}
ExeSetModified() ;
// Se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtTrimmingGetHoleBorder(" + ToString( nParentId) + "," +
ToString( vSurfIds) + "," +
ToString( dSurfLinTol) + "," +
ToString( dSurfAngTol) + "," +
ToString( dEdgeLinTol) + "," +
ToString( dEdgeAngTol) + "," +
ToString( dEdgeThick) + ")" +
" bOk=" + ToString( bOk) +
" nNewSurfId=" + ToString( nFirstId) + ", nCount= " + ToString( nCount) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
// ---------------------------------------------------------------------------
int
ExeTrimmingGetSurfTmFaceAdj( int nParentId, int nSurfId, int nTria, const Point3d& ptTria,
double dAngTol, double dSize, double dSizeTol)
{
// Verifica database geometrico
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// Recupero la superficie TriMesh
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nSurfId)) ;
bool bOk = ( pStm != nullptr && pStm->IsValid()) ;
// Recupero la superficie formata dai triangoli di adiacenza
int nNewSurfId = GDB_ID_NULL ;
if ( bOk) {
PtrOwner<ISurfTriMesh> pStmAdjFace( CreateSurfTriMesh()) ;
bOk = ( ! IsNull( pStmAdjFace) && pStmAdjFace->AdjustTopology()) ;
bOk = GetTrimmingStmAdjTria( pStm, nTria, ptTria, dAngTol, dSize, dSizeTol, pStmAdjFace) ;
bOk = ( ! IsNull( pStmAdjFace) && pStmAdjFace->IsValid() && pStmAdjFace->GetTriangleCount() > 0) ;
// Inserisco la Superficie nel DB geometrico
if ( bOk) {
nNewSurfId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pStmAdjFace)) ;
bOk = ( nNewSurfId != GDB_ID_NULL) ;
}
}
ExeSetModified() ;
// Se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtTrimmingGetSurfTmFromFaceAdj(" + ToString( nParentId) + "," +
ToString( nSurfId) + "," +
ToString( nTria) + "," +
"{ " + ToString( ptTria.x) + "," +
ToString( ptTria.y) + "," +
ToString( ptTria.z) + "}," +
ToString( dAngTol) + ")" +
" nNewSurfId=" + ToString( nNewSurfId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return nNewSurfId ;
}
// ---------------------------------------------------------------------------
int
ExeTrimmingGetSurfTmFromStmFaces( int nParentId, int nSurfId, const INTVECTOR& vFaces)
{
// Verifica database geometrico
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// Recupero il riferimento del gruppo di destinazione
Frame3d frDest ;
if ( ! pGeomDB->GetGlobFrame( nParentId, frDest))
return GDB_ID_NULL ;
// Recupero la superficie TriMesh
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nSurfId)) ;
if ( pStm == nullptr || ! pStm->IsValid())
return GDB_ID_NULL ;
// Verifico che le facce appartengano alla superficie
if ( vFaces.empty())
return CMD_ID_NULL ;
for ( int nF = 0 ; nF < int( vFaces.size()) ; ++ nF) {
double dArea = 0. ;
if ( ! pStm->GetFacetArea( vFaces[nF], dArea))
return GDB_ID_NULL ;
}
// Definisco la superficie
StmFromTriangleSoup TriaSoup ;
TriaSoup.Start() ;
for ( int nF = 0 ; nF < int( vFaces.size()) ; ++ nF) {
INTVECTOR vT ;
if ( ! pStm->GetAllTriaInFacet( vFaces[nF], vT))
return GDB_ID_NULL ;
for ( int nT = 0 ; nT < int( vT.size()) ; ++ nT) {
Triangle3d Tria ;
if ( ! pStm->GetTriangle( vT[nT], Tria) || ! TriaSoup.AddTriangle( Tria))
return GDB_ID_NULL ;
}
}
TriaSoup.End() ;
PtrOwner<ISurfTriMesh> pStmTria( TriaSoup.GetSurf()) ;
if ( IsNull( pStmTria) || ! pStmTria->IsValid() || pStmTria->GetTriangleCount() == 0)
return GDB_ID_NULL ;
// Aggiungo la superficie al DB
int nNewSurfId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pStmTria)) ;
ExeSetModified() ;
// Se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "TrimmingGetSurfTmFromStmFaces(" + ToString( nParentId) + "," +
ToString( nSurfId) + "," +
ToString( vFaces) + ")" +
" -- nId=" + ToString( nNewSurfId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return nNewSurfId ;
}
// ---------------------------------------------------------------------------
bool
ExeTrimmingGetAdjSurfs( const INTVECTOR& vSurfId, const INTVECTOR& vOtherSurfId, double dLinTol,
double dAngTol, double dAngFaceTol, INTVECTOR& vResId)
{
// Verifica database geometrico
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// Recupero le superfici di Riferimento
CISURFPVECTOR vRefSurf ; vRefSurf.reserve( vSurfId.size()) ;
bool bOk = true ;
for ( int i = 0 ; bOk && i < int( vSurfId.size()) ; ++ i) {
const ISurf* pSurf = GetSurf( pGeomDB->GetGeoObj( vSurfId[i])) ;
bOk = ( pSurf != nullptr && pSurf->IsValid()) ;
vRefSurf.emplace_back( pSurf) ;
}
// Recupero le superfici complessive, escludendo eventualmente quelle di riferimento se presenti
CISURFPVECTOR vOtherSurf ; vOtherSurf.reserve( vOtherSurfId.size()) ;
INTVECTOR vIds ;
for ( int i = 0 ; bOk && i < int( vOtherSurfId.size()) ; ++ i) {
if ( find( vSurfId.begin(), vSurfId.end(), vOtherSurfId[i]) == vSurfId.end()) {
const ISurf* pSurf = GetSurf( pGeomDB->GetGeoObj( vOtherSurfId[i])) ;
bOk = ( pSurf != nullptr && pSurf->IsValid()) ;
vOtherSurf.emplace_back( pSurf) ;
vIds.push_back( vOtherSurfId[i]) ;
}
}
// Recupero le facce adiancenti nella tolleranza richiesta
INTVECTOR vMyInds ;
bOk = bOk && GetTrimmingAdjSurfs( vRefSurf, vOtherSurf, dLinTol, dAngTol, dAngFaceTol, vMyInds) ;
if ( bOk) {
for ( int myInd : vMyInds)
vResId.push_back( vIds[myInd]) ;
}
ExeSetModified() ;
// Se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtTrimmingGetAdjSurfs(" + ToString( vSurfId) + "," +
ToString( vOtherSurfId) + "," +
ToString( dAngTol) + ")" +
" -- bOk=" + ToString( bOk) + ",vResId=" + ToString( vResId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
// ---------------------------------------------------------------------------
bool
ExeTrimmingGetBorders( int nParentId, const SELVECTOR& vIds, double dSurfLinTol, double dSurfAngTol,
double dLinTol, double dAngTol, int& nFirstId, int& nCount)
{
// Verifica database geometrico
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// Parametri da restituire
nFirstId = GDB_ID_NULL ;
nCount = 0 ;
// vIds : vettore di { nId = SurfId, nSubId = nSurfFace }
// Controllo che vIds non sia vuoto
bool bOk = ( ! vIds.empty()) ;
// Recupero il riferimento della prima superficie
Frame3d frSurf ;
bOk = bOk && pGeomDB->GetGlobFrame( vIds[0].nId, frSurf) ;
// Recupero il riferimento dei gruppi di destinazione
Frame3d frDest ;
bOk = bOk && pGeomDB->GetGlobFrame( nParentId, frDest) ;
// Recupero gli Id univoci delle superfici selezionate
INTSET setUniqueId ;
for ( const SelData& nIds : vIds)
setUniqueId.insert( nIds.nId) ;
// Recupero le superfici e le porto tutte in locale alla prima
unordered_map<int, int> uMapPos ; uMapPos.reserve( setUniqueId.size()) ;
SURFLOCALVECTOR vSurfL ; vSurfL.reserve( setUniqueId.size()) ;
CISURFPVECTOR vpSurf ; vpSurf.reserve( setUniqueId.size()) ;
int nSurf = 0 ;
for ( auto nIter = setUniqueId.begin() ; bOk && nIter != setUniqueId.end() ; ++ nIter) {
vSurfL.emplace_back( pGeomDB, *nIter, frSurf) ;
bOk = ( vSurfL.back().Get() != nullptr) ;
vpSurf.emplace_back( vSurfL.back().Get()) ;
uMapPos[*nIter] = nSurf ;
++ nSurf ;
}
// Recupero il vettore di Selezione associato non più agli Id delle superficie ma alle loro posizioni nel vettore
SELVECTOR vFaces ; vFaces.reserve( vIds.size()) ;
for ( int i = 0 ; bOk && i < int( vIds.size()) ; ++ i)
vFaces.emplace_back( uMapPos[vIds[i].nId], vIds[i].nSub) ;
// Calcolo le curve di Edge grezze ( quindi i tratti lineari)
ICRVCOMPOPOVECTOR vRawEdges ;
bOk = bOk && GetTrimmingRawEdges( vpSurf, vFaces, dSurfLinTol, dSurfAngTol, vRawEdges) &&
( ! vRawEdges.empty()) ;
// Calcolo le curve di Edge approssimate mediante curve di Bezier
ICRVCOMPOPOVECTOR vBezierEdges ;
bOk = bOk && GetTrimmingBezierEdges( vRawEdges, dLinTol, dAngTol, vBezierEdges) ;
nCount = int( vBezierEdges.size()) ;
if ( bOk) {
// Scorro i gli Edges ottenuti
for ( int nCrv = 0 ; bOk && nCrv < nCount ; ++ nCrv) {
vBezierEdges[nCrv]->ToLoc( frDest) ;
// Inserisco la curva nel DB Geometrico
int nCurrId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( vBezierEdges[nCrv])) ;
bOk = ( nCurrId != GDB_ID_NULL) ;
if ( nCrv == 0)
nFirstId = nCurrId ;
}
}
ExeSetModified() ;
// Se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtTrimmingGetBorders(" + IdToString( nParentId) + "," +
ToString( dSurfLinTol) + "," +
ToString( dSurfAngTol) + "," +
ToString( dLinTol) + "," +
ToString( dAngTol) + ")" ;
sLua += " -- bOk=" + ToString( bOk) +
" -- FirstId=" + ToString( nFirstId) + " CurveCount=" + ToString( nCount) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
// ---------------------------------------------------------------------------
bool
ExeTrimmingGetBordersByNormals( int nParentId, const SELVECTOR& vIds, double dSurfLinTol,
double dSurfAngTol, double dLinTol, double dAngTol, double dThick,
int& nFirstId, int& nCount)
{
// Verifica database geometrico
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// Parametri da restituire
nFirstId = GDB_ID_NULL ;
nCount = 0 ;
// vIds : vettore di { nId = SurfId, nSubId = nSurfFace }
// Controllo che vIds non sia vuoto
bool bOk = ( ! vIds.empty()) ;
// Recupero il riferimento della prima superficie
Frame3d frSurf ;
bOk = bOk && pGeomDB->GetGlobFrame( vIds[0].nId, frSurf) ;
// Recupero il riferimento dei gruppi di destinazione
Frame3d frDest ;
bOk = bOk && pGeomDB->GetGlobFrame( nParentId, frDest) ;
// Recupero gli Id univoci delle superfici selezionate
INTSET setUniqueId ;
for ( const SelData& nIds : vIds)
setUniqueId.insert( nIds.nId) ;
// Recupero le superfici e le porto tutte in locale alla prima
unordered_map<int, int> uMapPos ; uMapPos.reserve( setUniqueId.size()) ;
SURFLOCALVECTOR vSurfL ; vSurfL.reserve( setUniqueId.size()) ;
CISURFPVECTOR vpSurf ; vpSurf.reserve( setUniqueId.size()) ;
int nSurf = 0 ;
for ( auto nIter = setUniqueId.begin() ; bOk && nIter != setUniqueId.end() ; ++ nIter) {
vSurfL.emplace_back( pGeomDB, *nIter, frSurf) ;
bOk = ( vSurfL.back().Get() != nullptr) ;
vpSurf.emplace_back( vSurfL.back().Get()) ;
uMapPos[*nIter] = nSurf ;
++ nSurf ;
}
// Recupero il vettore di Selezione associato non più agli Id delle superficie ma alle loro posizioni nel vettore
SELVECTOR vFaces ; vFaces.reserve( vIds.size()) ;
for ( int i = 0 ; bOk && i < int( vIds.size()) ; ++ i)
vFaces.emplace_back( uMapPos[vIds[i].nId], vIds[i].nSub) ;
// Calcolo le curve di Edge approssimate mediante curve di Bezier
ICRVCOMPOPOVECTOR vBezierEdges ;
bOk = bOk && GetTrimmingFinalBorders( vpSurf, vFaces, dSurfLinTol, dSurfAngTol, dLinTol, dAngTol, dThick, vBezierEdges) ;
if ( bOk) {
nCount = int( vBezierEdges.size()) ;
// Scorro i gli Edges ottenuti
for ( int nCrv = 0 ; bOk && nCrv < nCount ; ++ nCrv) {
vBezierEdges[nCrv]->ToLoc( frDest) ;
// Inserisco la curva nel DB Geometrico
int nCurrId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( vBezierEdges[nCrv])) ;
bOk = ( nCurrId != GDB_ID_NULL) ;
if ( nCrv == 0)
nFirstId = nCurrId ;
}
}
ExeSetModified() ;
// Se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtTrimmingGetBordersByNormals(" + IdToString( nParentId) + "," +
ToString( dLinTol) + "," +
ToString( dAngTol) + ")" ;
sLua += " -- bOk=" + ToString( bOk) +
" -- FirstId=" + ToString( nFirstId) + " CurveCount=" + ToString( nCount) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
// ---------------------------------------------------------------------------
bool
ExeTrimmingGetFinalBorders( int nParentId, const INTVECTOR& vCrvBezierId, double dLinTol, double dAngTol,
const PNTVECTOR& vBrkPts, double dThick, double dThickTol,
int& nFirstId, int& nCount)
{
// Verifica database geometrico
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// Parametri da restituire
nFirstId = GDB_ID_NULL ;
nCount = 0 ;
// Recupero il riferimento del gruppo di destinazione
Frame3d frDest ;
bool bOk = ( pGeomDB->GetGlobFrame( nParentId, frDest)) ;
// Recupero le curve di Bordo approssimate come Bezier
ICRVCOMPOPOVECTOR vCompoBezierEdges ; vCompoBezierEdges.reserve( vCrvBezierId.size()) ;
for ( int nCrv = 0 ; bOk && nCrv < int( vCrvBezierId.size()) ; ++ nCrv) {
const ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( vCrvBezierId[nCrv])) ;
bOk = ( pCrv != nullptr && pCrv->IsValid()) ;
if ( bOk) {
PtrOwner<ICurveComposite> pCompoRawEdges( ConvertCurveToComposite( pCrv->Clone())) ;
bOk = ( ! IsNull( pCompoRawEdges) && pCompoRawEdges->IsValid() &&
vCompoBezierEdges.emplace_back( Release( pCompoRawEdges))) ;
}
}
// Converto i punti in coppie di punti ( se dispari l'ultimo viene ignorato)
BIPNTVECTOR vBreakingPts ; vBreakingPts.reserve( int( int( vBrkPts.size()) / 2)) ;
for ( int nPt = 0 ; bOk && nPt < int( vBrkPts.size()) - 1 ; nPt += 2)
vBreakingPts.emplace_back( make_pair( vBrkPts[nPt], vBrkPts[nPt+1])) ;
if ( int( vBrkPts.size()) % 2 != 0)
LOG_INFO( GetCmdLogger(), "Warning in EgtExtractSurfFrChunkLoops : Odd number of breaking points") ;
// Calcolo le curve di Edge
bOk = bOk && GetTrimmingFinalBorders( vCompoBezierEdges, dLinTol, dAngTol, vBreakingPts, dThick, dThickTol) ;
nCount = int( vCompoBezierEdges.size()) ;
if ( bOk) {
// Scorro i gli Edges ottenuti
for ( int nCrv = 0 ; bOk && nCrv < nCount ; ++ nCrv) {
vCompoBezierEdges[nCrv]->ToLoc( frDest) ;
// Inserisco la curva nel DB Geometrico
int nCurrId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( vCompoBezierEdges[nCrv])) ;
bOk = ( nCurrId != GDB_ID_NULL) ;
if ( nCrv == 0)
nFirstId = nCurrId ;
}
ExeSetModified() ;
}
// Se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtTrimmingGetFinalBorders(" + IdToString( nParentId) + "," +
ToString( vCrvBezierId) + "," +
ToString( dLinTol) + "," +
ToString( dAngTol) + "," ;
sLua += "{" ;
for ( int nP = 0 ; nP < int( vBrkPts.size()) ; ++ nP) {
sLua += "(" + ToString( vBrkPts[nP].x) + ", " + ToString( vBrkPts[nP].y) + ", " + ToString( vBrkPts[nP].z) + ")" +
( nP != int( vBrkPts.size()) - 1 ? "," : "") ;
}
sLua += "}" ;
sLua += ToString( dThick) + "," + ToString( dThickTol) + ")" ;
sLua += " -- bOk=" + ToString( bOk) +
" -- FirstId=" + ToString( nFirstId) + " CurveCount=" + ToString( nCount) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
// ---------------------------------------------------------------------------
int
ExeTrimmingGetRuledBezier( int nParentId, const INTVECTOR& vIds, int nEdge1Id, int nEdge2Id, double dLinTol,
const INTVECTOR& vnLineId)
{
// Verifica database geometrico
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// Aggiusto la tolleranza lineare se necessario
double dMyLinTol = Clamp( dLinTol, EPS_SMALL, 1e5 * EPS_SMALL) ;
// Recupero il riferimento dei gruppi di destinazione
Frame3d frDest ;
bool bOk = pGeomDB->GetGlobFrame( nParentId, frDest) ;
// Recupero la prima curva
const ICurve* pCrvEdge1 = GetCurve( pGeomDB->GetGeoObj( nEdge1Id)) ;
bOk = bOk && ( pCrvEdge1 != nullptr && pCrvEdge1->IsValid()) ;
// Recupero la seconda curva
const ICurve* pCrvEdge2 = GetCurve( pGeomDB->GetGeoObj( nEdge2Id)) ;
bOk = bOk && ( pCrvEdge2 != nullptr && pCrvEdge2->IsValid()) ;
// Se ci sono delle superfici di riferimento
CISURFPVECTOR vpSurf ; vpSurf.reserve( vIds.size()) ;
if ( ! vIds.empty()) {
SURFLOCALVECTOR vSurfL ; vSurfL.reserve( vIds.size()) ;
// Recupero il riferimento della prima superficie
Frame3d frSurf ;
bOk = bOk && ( pGeomDB->GetGlobFrame( vIds[0], frSurf)) ;
// Porto le altre nel riferimento della prima
for ( int nSurf = 0 ; bOk && nSurf < int( vIds.size()) ; ++ nSurf) {
vSurfL.emplace_back( pGeomDB, vIds[nSurf], frSurf) ;
if ( vSurfL.back().Get() == nullptr) {
bOk = false ;
break ;
}
vpSurf.emplace_back( vSurfL.back().Get()) ;
}
}
// Recupero i punti di sincronizzazione ( se presenti)
BIPNTVECTOR vSyncPoints ; vSyncPoints.reserve( pGeomDB->GetGroupObjs( vnLineId.size())) ;
for ( int i = 0 ; bOk && i < ssize( vnLineId) ; ++ i) {
// Recupero la Curva
const ICurve* pLine = GetCurve( pGeomDB->GetGeoObj( vnLineId[i])) ;
bOk = bOk && ( pLine != nullptr && pLine->IsValid()) ;
if ( bOk) {
// Recupero gli Estremi
Point3d ptStart ; pLine->GetStartPoint( ptStart) ;
Point3d ptEnd ; pLine->GetEndPoint( ptEnd) ;
// Mi assicuro che gli estremi siano sulle curve di Bordo e orientati correttamente ( nel caso inverto)
double dSqDistS1 = INFINITO ;
if ( ! DistPointCurve( ptStart, *pCrvEdge1).GetSqDist( dSqDistS1))
continue ;
if ( dSqDistS1 < dLinTol * dLinTol) {
double dSqDistE2 = INFINITO ;
if ( ! DistPointCurve( ptEnd, *pCrvEdge2).GetSqDist( dSqDistE2) ||
dSqDistE2 > dLinTol * dLinTol)
continue ;
}
else {
double dSqDistS2 = INFINITO ;
if ( ! DistPointCurve( ptStart, *pCrvEdge2).GetSqDist( dSqDistS2) ||
dSqDistS2 > dLinTol * dLinTol)
continue ;
double dSqDistE1 = INFINITO ;
if ( ! DistPointCurve( ptEnd, *pCrvEdge1).GetSqDist( dSqDistE1) ||
dSqDistE1 > dLinTol * dLinTol)
continue ;
swap( ptStart, ptEnd) ;
}
vSyncPoints.emplace_back( make_pair( ptStart, ptEnd)) ;
}
}
// Recupero la superficie Bezier rigata
PtrOwner<ISurfBezier> pSurfBzRuled ;
if ( bOk) {
pSurfBzRuled.Set( GetTrimmingRuledBezier( vpSurf, pCrvEdge1, pCrvEdge2, dMyLinTol, vSyncPoints)) ;
bOk = bOk && ( ! IsNull( pSurfBzRuled) && pSurfBzRuled->IsValid()) ;
}
// Inserisco la curva nel DB Geometrico
int nSurfBzId = GDB_ID_NULL ;
if ( bOk) {
pSurfBzRuled->ToLoc( frDest) ;
nSurfBzId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pSurfBzRuled)) ;
bOk = bOk && ( nSurfBzId != GDB_ID_NULL) ;
}
ExeSetModified() ;
// Se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtTrimmingGetRuledBezier(" + ToString( nParentId) + "," +
ToString( vIds) + "," +
ToString( nEdge1Id) + "," +
ToString( nEdge2Id) + "," +
ToString( dLinTol) + ")" +
" -- bOk=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// Restituisco il risultato
return nSurfBzId ;
}
// ---------------------------------------------------------------------------
bool
ExeTrimmingInterpolateSyncLines( int nParentId, int nSync1Id, int nSync2Id, int nBorder1Id,
int nBorder2Id, double dEdgeLinTol, double dEdgeAngTol,
int& nFirstId, int& nCount)
{
// Verifica database geometrico
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// Reset parametri di ritorno
nFirstId = GDB_ID_NULL ;
nCount = 0 ;
// Aggiusto la tolleranza lineare e angolare se necessario
double dMyEdgeLinTol = Clamp( dEdgeLinTol, EPS_SMALL, 1e5 * EPS_SMALL) ;
double dMyEdgeAngTol = Clamp( dEdgeAngTol, EPS_ANG_SMALL, 60.) ;
// recupero le due curve di sincronizzazione
const ICurve* pSync1 = GetCurve( pGeomDB->GetGeoObj( nSync1Id)) ;
const ICurve* pSync2 = GetCurve( pGeomDB->GetGeoObj( nSync2Id)) ;
bool bOk = ( pSync1 != nullptr && pSync1->IsValid() &&
pSync2 != nullptr && pSync2->IsValid()) ;
// Recupero le due curve di bordo
const ICurve* pCrvEdge1 = GetCurve( pGeomDB->GetGeoObj( nBorder1Id)) ;
const ICurve* pCrvEdge2 = GetCurve( pGeomDB->GetGeoObj( nBorder2Id)) ;
bOk = bOk && ( pCrvEdge1 != nullptr && pCrvEdge1->IsValid()) ;
bOk = bOk && ( pCrvEdge2 != nullptr && pCrvEdge2->IsValid()) ;
// Calcolo le Curve di sincornizzazione Interpolate
BIPNTVECTOR vSyncPoints ;
bOk = bOk && GetTrimmingSyncInterpolation( pCrvEdge1, pCrvEdge2, pSync1, pSync2, dMyEdgeLinTol,
dMyEdgeAngTol, vSyncPoints) ;
if ( bOk && ! vSyncPoints.empty()) {
// Inserisco le curve di sincronizzazione nel DB
// [orientate da pCrvEdge1 a pCrvEdge2]
for ( int i = 0 ; bOk && i < ssize( vSyncPoints) ; ++ i) {
PtrOwner<ICurveLine> pSyncLine( CreateCurveLine()) ;
bOk = ( ! IsNull( pSyncLine) && pSyncLine->Set( vSyncPoints[i].first, vSyncPoints[i].second)) ;
if ( bOk) {
if ( pCrvEdge1->IsPointOn( vSyncPoints[i].second, dMyEdgeLinTol))
pSyncLine->Invert() ;
int nSyncId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pSyncLine)) ;
bOk = ( nSyncId != CMD_ID_NULL) ;
if ( i == 0)
nFirstId = nSyncId ;
}
}
nCount = ssize( vSyncPoints) ;
}
ExeSetModified() ;
// Se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtTrimmingInterpolateSyncLines(" + ToString( nParentId) + "," +
ToString( nSync1Id) + "," +
ToString( nSync2Id) + "," +
ToString( nBorder1Id) + "," +
ToString( nBorder2Id) + "," +
ToString( dEdgeLinTol) + "," +
ToString( dEdgeAngTol) + ")" +
" -- bOk=" + ToString( bOk) +
" -- nFirstId=" + ToString( nFirstId) + " nCount=" + ToString( nCount) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
// ---------------------------------------------------------------------------
bool
ExeTrimmingGetSurfBzSyncPoints( int nParentId, int nEdge1Id, int nEdge2Id, double dLinTol,
double dAngTol, int nLineNbr, bool bShowOnCorners,
int& nFirstId, int& nCount)
{
// Verifica database geometrico
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// Imposto i parametri di ritorno
nFirstId = GDB_ID_NULL ;
nCount = 0 ;
// Se non devo visualizzare alcuna linea, non faccio nulla
if ( nLineNbr <= 0 && ! bShowOnCorners)
return true ;
// Se necessario aggiusto le tolleranze
double dMyLinTol = Clamp( dLinTol, EPS_SMALL, 1e5 * EPS_SMALL) ;
double dMyAngTol = Clamp( dAngTol, EPS_ANG_SMALL, ANG_RIGHT) ;
// Recupero il riferimento del gruppo di destinazione
Frame3d frDest ;
bool bOk = ( pGeomDB->GetGlobFrame( nParentId, frDest)) ;
// Recupero le due Curve di bordo
const ICurve* pCrvEdge1 = GetCurve( pGeomDB->GetGeoObj( nEdge1Id)) ;
const ICurve* pCrvEdge2 = GetCurve( pGeomDB->GetGeoObj( nEdge2Id)) ;
bOk = bOk && ( pCrvEdge1 != nullptr && pCrvEdge1->IsValid() &&
pCrvEdge2 != nullptr && pCrvEdge2->IsValid()) ;
// Verifico che le curve siano entrambe Aperte o entrambe Chiuse
bOk = bOk && ( pCrvEdge1->IsClosed() == pCrvEdge2->IsClosed()) ;
// Recupero i punti di sincronizzazione
BIPNTVECTOR vSyncPoints ;
bOk = bOk && GetTrimmingSurfBzSyncPoints( pCrvEdge1, pCrvEdge2, dMyLinTol, vSyncPoints) &&
( ! vSyncPoints.empty()) ;
int nToTSyncLines = ssize( vSyncPoints) ;
// Ogni punto di sincronizzazione deve avere gli estremi sulle curve di Bordo
for ( int i = 0 ; bOk && i < ssize( vSyncPoints) ; ++ i) {
double dSqDistStart = INFINITO, dSqDistEnd = INFINITO ;
bOk = ( DistPointCurve( vSyncPoints[i].first, *pCrvEdge1).GetSqDist( dSqDistStart) &&
dSqDistStart < dMyLinTol * dMyLinTol &&
DistPointCurve( vSyncPoints[i].second, *pCrvEdge2).GetSqDist( dSqDistEnd) &&
dSqDistEnd < dMyLinTol * dMyLinTol) ;
}
if ( bOk) {
INTSET setInds ;
// Se devo visualizzare più linee di quante ne ho ricavate, allora le devo visualizzare tutte
if ( nLineNbr >= nToTSyncLines) {
for ( int i = 0 ; i < nToTSyncLines ; ++ i)
setInds.insert( i) ;
}
// Altrimenti
else {
// Se voglio visualizzare gli Spigoli
if ( bShowOnCorners) {
for ( int nL = 0 ; bOk && nL < nToTSyncLines ; ++ nL) {
// Controllo se punto su spigolo della curva
double dU = 0. ;
Vector3d vtTanPrev, vtTanAft ;
Point3d ptUseless ;
bOk = ( pCrvEdge1->GetParamAtPoint( vSyncPoints[nL].first, dU, dMyLinTol) &&
pCrvEdge1->GetPointD1D2( dU, ICurve::FROM_MINUS, ptUseless, &vtTanPrev) &&
pCrvEdge1->GetPointD1D2( dU, ICurve::FROM_PLUS, ptUseless, &vtTanAft)) ;
if ( ! bOk)
break ;
vtTanPrev.Normalize() ;
vtTanAft.Normalize() ;
if ( vtTanPrev * vtTanAft < cos( ( dMyAngTol + EPS_ANG_SMALL) * DEGTORAD)) {
setInds.insert( nL) ;
continue ;
}
bOk = ( pCrvEdge2->GetParamAtPoint( vSyncPoints[nL].second, dU, dMyLinTol) &&
pCrvEdge2->GetPointD1D2( dU, ICurve::FROM_MINUS, ptUseless, &vtTanPrev) &&
pCrvEdge2->GetPointD1D2( dU, ICurve::FROM_PLUS, ptUseless, &vtTanAft)) ;
if ( ! bOk)
break ;
vtTanPrev.Normalize() ;
vtTanAft.Normalize() ;
if ( vtTanPrev * vtTanAft < cos( ( dMyAngTol + EPS_ANG_SMALL) * DEGTORAD)) {
setInds.insert( nL) ;
continue ;
}
}
}
// Se devo mostrare alcune Linee
if ( bOk && nLineNbr > 0) {
bool bBothOpen = ( ! pCrvEdge1->IsClosed() && ! pCrvEdge2->IsClosed()) ;
bool bBothClosed = ( ! bBothOpen) ;
int nLastIdx = nToTSyncLines - 1 ;
if ( bBothClosed) {
int nLine = nLineNbr ;
if ( nLine == 1)
setInds.insert( 0) ;
else {
int nMaxIndex = nToTSyncLines - 2 ;
for ( int i = 0 ; i < nLine ; ++ i) {
double dT = double( i) / double( nLine) ;
int nIdx = int( 0.5 + dT * nMaxIndex) ;
setInds.insert( nIdx) ;
}
setInds.erase( nLastIdx) ;
}
}
else {
int nInternal = nLineNbr ;
setInds.insert( 0) ;
setInds.insert( nLastIdx) ;
int nMaxIndex = nLastIdx ;
for ( int i = 0; i < nInternal ; ++ i) {
double dT = double( i + 1) / double( nInternal + 1) ;
int nIdx = int( 0.5 + dT * nMaxIndex) ;
setInds.insert( nIdx) ;
}
}
}
}
// Visualizzo i segmenti lineari di sincronizzazione per ogni indice ricavato
bool bFirst = true ;
for ( auto Iter = setInds.begin() ; bOk && Iter != setInds.end() ; ++ Iter) {
PtrOwner<ICurveLine> pLine( CreateCurveLine()) ;
bOk = ( ! IsNull( pLine) && pLine->Set( vSyncPoints[*Iter].first, vSyncPoints[*Iter].second)) ;
if ( bOk) {
int nLineId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pLine)) ;
bOk = ( nLineId != GDB_ID_NULL) ;
if ( bFirst) {
nFirstId = nLineId ;
bFirst = false ;
}
++ nCount ;
}
}
}
ExeSetModified() ;
// Se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtTrimmingGetSurfBzSyncPoints(" + ToString( nParentId) + "," +
ToString( nEdge1Id) + "," +
ToString( nEdge2Id) + "," +
ToString( dLinTol) + "," +
ToString( nFirstId) + "," +
ToString( nCount) + ")" +
" -- bOk=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
// ---------------------------------------------------------------------------
int
ExeRegolarizeSurfaceLocally( int nParentId, int nSurfId, int nSyncStartId, int nSyncEndId, double dLinTol)
{
bool bOk = true ;
// Verifica database geometrico
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie
ISurfBezier* pSurfBez = GetSurfBezier( GetSurf( pGeomDB->GetGeoObj( nSurfId))) ;
// recupero le due isocurve
const ICurve* pSyncStart = GetCurveLine( GetCurve( pGeomDB->GetGeoObj( nSyncStartId))) ;
const ICurve* pSyncEnd = GetCurveLine( GetCurve( pGeomDB->GetGeoObj( nSyncEndId))) ;
Point3d ptS1 ; pSyncStart->GetStartPoint( ptS1) ;
Point3d ptE1 ; pSyncStart->GetEndPoint( ptE1) ;
BIPOINT bpIsoStart( ptS1, ptE1) ;
Point3d ptS2 ; pSyncEnd->GetStartPoint( ptS2) ;
Point3d ptE2 ; pSyncEnd->GetEndPoint( ptE2) ;
BIPOINT bpIsoEnd( ptS2, ptE2) ;
PtrOwner<ISurfBezier> pNewSurf( RegolarizeBordersLocally( pSurfBez, bpIsoStart, bpIsoEnd, dLinTol)) ;
if ( IsNull( pNewSurf))
return GDB_ID_NULL ;
int nId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pNewSurf)) ;
return nId ;
}
+6 -5
View File
@@ -36,7 +36,6 @@ const int STR_DIM = 50 ;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
static HINSTANCE s_hModule = nullptr ; static HINSTANCE s_hModule = nullptr ;
static char s_szEXeNameVer[STR_DIM] ;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
BOOL APIENTRY BOOL APIENTRY
@@ -71,10 +70,12 @@ DllMain( HMODULE hModule, DWORD dwReason, LPVOID lpReserved)
const char* const char*
GetEXeVersion( void) GetEXeVersion( void)
{ {
std::string sVer ; static char s_szEXeNameVer[STR_DIM] = "" ;
if ( s_szEXeNameVer[0] == '\0') {
GetModuleVersion( s_hModule, sVer) ; std::string sVer ;
sprintf_s( s_szEXeNameVer, STR_DIM, "%s%s", EXE_STR, sVer.c_str()) ; GetModuleVersion( s_hModule, sVer) ;
sprintf_s( s_szEXeNameVer, STR_DIM, "%s%s", EXE_STR, sVer.c_str()) ;
}
return s_szEXeNameVer ; return s_szEXeNameVer ;
} }
BIN
View File
Binary file not shown.
+7 -2
View File
@@ -1,6 +1,8 @@
 
Microsoft Visual Studio Solution File, Format Version 11.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2010 # Visual Studio Version 17
VisualStudioVersion = 17.13.35919.96 d17.13
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EgtExecutor", "EgtExecutor.vcxproj", "{DF654897-F85B-4108-A621-F2C4AB099A48}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EgtExecutor", "EgtExecutor.vcxproj", "{DF654897-F85B-4108-A621-F2C4AB099A48}"
EndProject EndProject
Global Global
@@ -23,4 +25,7 @@ Global
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {30B63942-DD1D-428A-BFD1-E603299B17B6}
EndGlobalSection
EndGlobal EndGlobal
+26 -6
View File
@@ -22,14 +22,14 @@
<ProjectGuid>{DF654897-F85B-4108-A621-F2C4AB099A48}</ProjectGuid> <ProjectGuid>{DF654897-F85B-4108-A621-F2C4AB099A48}</ProjectGuid>
<Keyword>Win32Proj</Keyword> <Keyword>Win32Proj</Keyword>
<RootNamespace>EgtExecutor</RootNamespace> <RootNamespace>EgtExecutor</RootNamespace>
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion> <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType> <ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v141_xp</PlatformToolset> <PlatformToolset>v143</PlatformToolset>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType> <ConfigurationType>DynamicLibrary</ConfigurationType>
@@ -42,7 +42,7 @@
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v141_xp</PlatformToolset> <PlatformToolset>v143</PlatformToolset>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType> <ConfigurationType>DynamicLibrary</ConfigurationType>
@@ -104,6 +104,8 @@
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<MultiProcessorCompilation>true</MultiProcessorCompilation> <MultiProcessorCompilation>true</MultiProcessorCompilation>
<MinimalRebuild>false</MinimalRebuild> <MinimalRebuild>false</MinimalRebuild>
<OpenMPSupport>false</OpenMPSupport>
<LanguageStandard>stdcpp20</LanguageStandard>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
@@ -129,7 +131,7 @@ copy $(TargetPath) \EgtProg\DllD32</Command>
<OmitFramePointers>false</OmitFramePointers> <OmitFramePointers>false</OmitFramePointers>
<MultiProcessorCompilation>true</MultiProcessorCompilation> <MultiProcessorCompilation>true</MultiProcessorCompilation>
<MinimalRebuild>false</MinimalRebuild> <MinimalRebuild>false</MinimalRebuild>
<LanguageStandard>stdcpp17</LanguageStandard> <LanguageStandard>stdcpp20</LanguageStandard>
<AdditionalOptions>-Wno-tautological-undefined-compare</AdditionalOptions> <AdditionalOptions>-Wno-tautological-undefined-compare</AdditionalOptions>
</ClCompile> </ClCompile>
<Link> <Link>
@@ -164,6 +166,7 @@ copy $(TargetPath) \EgtProg\DllD64</Command>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet> <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations> <EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration> <EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
<LanguageStandard>stdcpp20</LanguageStandard>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
@@ -197,8 +200,8 @@ copy $(TargetPath) \EgtProg\Dll32</Command>
<OpenMPSupport>false</OpenMPSupport> <OpenMPSupport>false</OpenMPSupport>
<EnableFiberSafeOptimizations>false</EnableFiberSafeOptimizations> <EnableFiberSafeOptimizations>false</EnableFiberSafeOptimizations>
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration> <EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
<EnableEnhancedInstructionSet>AdvancedVectorExtensions2</EnableEnhancedInstructionSet> <EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
<LanguageStandard>stdcpp17</LanguageStandard> <LanguageStandard>stdcpp20</LanguageStandard>
<AdditionalOptions>-Wno-tautological-undefined-compare</AdditionalOptions> <AdditionalOptions>-Wno-tautological-undefined-compare</AdditionalOptions>
</ClCompile> </ClCompile>
<Link> <Link>
@@ -225,6 +228,8 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClInclude Include="..\Include\EXeConst.h" /> <ClInclude Include="..\Include\EXeConst.h" />
<ClInclude Include="..\Include\EXeDllMain.h" /> <ClInclude Include="..\Include\EXeDllMain.h" />
<ClInclude Include="..\Include\EXeExecutor.h" /> <ClInclude Include="..\Include\EXeExecutor.h" />
<ClInclude Include="AuxDialogBox.h" />
<ClInclude Include="DllExch3dm.h" />
<ClInclude Include="DllMain.h" /> <ClInclude Include="DllMain.h" />
<ClInclude Include="DllNesting.h" /> <ClInclude Include="DllNesting.h" />
<ClInclude Include="EXE.h" /> <ClInclude Include="EXE.h" />
@@ -245,20 +250,26 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClInclude Include="stdafx.h" /> <ClInclude Include="stdafx.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="AuxDialogBox.cpp" />
<ClCompile Include="DllExch3dm.cpp" />
<ClCompile Include="DllNesting.cpp" /> <ClCompile Include="DllNesting.cpp" />
<ClCompile Include="EXE_Base64.cpp" />
<ClCompile Include="EXE_BeamMgr.cpp" /> <ClCompile Include="EXE_BeamMgr.cpp" />
<ClCompile Include="EXE_CAvTool.cpp" /> <ClCompile Include="EXE_CAvTool.cpp" />
<ClCompile Include="EXE_CDeObjSolid.cpp" /> <ClCompile Include="EXE_CDeObjSolid.cpp" />
<ClCompile Include="EXE_GdbCreateVol.cpp" /> <ClCompile Include="EXE_GdbCreateVol.cpp" />
<ClCompile Include="EXE_GdbGet.cpp" /> <ClCompile Include="EXE_GdbGet.cpp" />
<ClCompile Include="EXE_GdbGetCurve.cpp" /> <ClCompile Include="EXE_GdbGetCurve.cpp" />
<ClCompile Include="EXE_GdbGetPocketing.cpp" />
<ClCompile Include="EXE_GdbGetSurf.cpp" /> <ClCompile Include="EXE_GdbGetSurf.cpp" />
<ClCompile Include="EXE_GdbGetVol.cpp" /> <ClCompile Include="EXE_GdbGetVol.cpp" />
<ClCompile Include="EXE_GdbModifyVol.cpp" /> <ClCompile Include="EXE_GdbModifyVol.cpp" />
<ClCompile Include="EXE_GeoDist.cpp" /> <ClCompile Include="EXE_GeoDist.cpp" />
<ClCompile Include="EXE_GeoInters.cpp" /> <ClCompile Include="EXE_GeoInters.cpp" />
<ClCompile Include="EXE_Image.cpp" /> <ClCompile Include="EXE_Image.cpp" />
<ClCompile Include="EXE_MachOpt.cpp" />
<ClCompile Include="EXE_MaxFiller.cpp" /> <ClCompile Include="EXE_MaxFiller.cpp" />
<ClCompile Include="EXE_Mutex.cpp" />
<ClCompile Include="EXE_NstAutoNesting.cpp" /> <ClCompile Include="EXE_NstAutoNesting.cpp" />
<ClCompile Include="EXE_NstMachining.cpp" /> <ClCompile Include="EXE_NstMachining.cpp" />
<ClCompile Include="EXE_NstPartNesting.cpp" /> <ClCompile Include="EXE_NstPartNesting.cpp" />
@@ -284,8 +295,11 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClCompile Include="EXE_NstCreateFlatParts.cpp" /> <ClCompile Include="EXE_NstCreateFlatParts.cpp" />
<ClCompile Include="EXE_Photo.cpp" /> <ClCompile Include="EXE_Photo.cpp" />
<ClCompile Include="EXE_Picture.cpp" /> <ClCompile Include="EXE_Picture.cpp" />
<ClCompile Include="EXE_Redis.cpp" />
<ClCompile Include="EXE_Scene.cpp" /> <ClCompile Include="EXE_Scene.cpp" />
<ClCompile Include="EXE_ShortestPath.cpp" /> <ClCompile Include="EXE_ShortestPath.cpp" />
<ClCompile Include="EXE_TestObjSurface.cpp" />
<ClCompile Include="EXE_Trimming.cpp" />
<ClCompile Include="EXE_TscExec.cpp" /> <ClCompile Include="EXE_TscExec.cpp" />
<ClCompile Include="AuxTools.cpp" /> <ClCompile Include="AuxTools.cpp" />
<ClCompile Include="DllExchange.cpp" /> <ClCompile Include="DllExchange.cpp" />
@@ -296,18 +310,24 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClCompile Include="GenTools.cpp" /> <ClCompile Include="GenTools.cpp" />
<ClCompile Include="GeoTools.cpp" /> <ClCompile Include="GeoTools.cpp" />
<ClCompile Include="GseContext.cpp" /> <ClCompile Include="GseContext.cpp" />
<ClCompile Include="LUA_Base64.cpp" />
<ClCompile Include="LUA_BeamMgr.cpp" /> <ClCompile Include="LUA_BeamMgr.cpp" />
<ClCompile Include="LUA_CAvTool.cpp" /> <ClCompile Include="LUA_CAvTool.cpp" />
<ClCompile Include="LUA_CDeObjSolid.cpp" /> <ClCompile Include="LUA_CDeObjSolid.cpp" />
<ClCompile Include="LUA_GdbGet.cpp" /> <ClCompile Include="LUA_GdbGet.cpp" />
<ClCompile Include="LUA_GdbGetCurve.cpp" /> <ClCompile Include="LUA_GdbGetCurve.cpp" />
<ClCompile Include="LUA_GdbGetPocketing.cpp" />
<ClCompile Include="LUA_GdbGetSurf.cpp" /> <ClCompile Include="LUA_GdbGetSurf.cpp" />
<ClCompile Include="LUA_GdbGetVol.cpp" /> <ClCompile Include="LUA_GdbGetVol.cpp" />
<ClCompile Include="LUA_GeoDist.cpp" /> <ClCompile Include="LUA_GeoDist.cpp" />
<ClCompile Include="LUA_GeoInters.cpp" /> <ClCompile Include="LUA_GeoInters.cpp" />
<ClCompile Include="LUA_MachOpt.cpp" />
<ClCompile Include="LUA_MaxFiller.cpp" /> <ClCompile Include="LUA_MaxFiller.cpp" />
<ClCompile Include="LUA_Picture.cpp" /> <ClCompile Include="LUA_Picture.cpp" />
<ClCompile Include="LUA_PolynomialRoots.cpp" /> <ClCompile Include="LUA_PolynomialRoots.cpp" />
<ClCompile Include="LUA_Redis.cpp" />
<ClCompile Include="LUA_TestObjSurface.cpp" />
<ClCompile Include="LUA_Trimming.cpp" />
<ClCompile Include="PictureObj.cpp" /> <ClCompile Include="PictureObj.cpp" />
<ClCompile Include="LUA_Base.cpp" /> <ClCompile Include="LUA_Base.cpp" />
<ClCompile Include="LUA_GdbCreateCurve.cpp" /> <ClCompile Include="LUA_GdbCreateCurve.cpp" />
+51
View File
@@ -108,6 +108,12 @@
<ClInclude Include="DllNesting.h"> <ClInclude Include="DllNesting.h">
<Filter>File di intestazione</Filter> <Filter>File di intestazione</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="DllExch3dm.h">
<Filter>File di intestazione</Filter>
</ClInclude>
<ClInclude Include="AuxDialogBox.h">
<Filter>File di intestazione</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="LUA_Exchange.cpp"> <ClCompile Include="LUA_Exchange.cpp">
@@ -386,6 +392,51 @@
<ClCompile Include="LUA_BeamMgr.cpp"> <ClCompile Include="LUA_BeamMgr.cpp">
<Filter>File di origine\LUA</Filter> <Filter>File di origine\LUA</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="EXE_Mutex.cpp">
<Filter>File di origine\EXE</Filter>
</ClCompile>
<ClCompile Include="DllExch3dm.cpp">
<Filter>File di origine\Optional Dll</Filter>
</ClCompile>
<ClCompile Include="EXE_GdbGetPocketing.cpp">
<Filter>File di origine\EXE</Filter>
</ClCompile>
<ClCompile Include="LUA_GdbGetPocketing.cpp">
<Filter>File di origine\LUA</Filter>
</ClCompile>
<ClCompile Include="EXE_TestObjSurface.cpp">
<Filter>File di origine\EXE</Filter>
</ClCompile>
<ClCompile Include="LUA_TestObjSurface.cpp">
<Filter>File di origine\LUA</Filter>
</ClCompile>
<ClCompile Include="Lua_Trimming.cpp">
<Filter>File di origine\LUA</Filter>
</ClCompile>
<ClCompile Include="EXE_Trimming.cpp">
<Filter>File di origine\EXE</Filter>
</ClCompile>
<ClCompile Include="EXE_MachOpt.cpp">
<Filter>File di origine\EXE</Filter>
</ClCompile>
<ClCompile Include="LUA_MachOpt.cpp">
<Filter>File di origine\LUA</Filter>
</ClCompile>
<ClCompile Include="EXE_Redis.cpp">
<Filter>File di origine\EXE</Filter>
</ClCompile>
<ClCompile Include="LUA_Redis.cpp">
<Filter>File di origine\LUA</Filter>
</ClCompile>
<ClCompile Include="EXE_Base64.cpp">
<Filter>File di origine\EXE</Filter>
</ClCompile>
<ClCompile Include="LUA_Base64.cpp">
<Filter>File di origine\LUA</Filter>
</ClCompile>
<ClCompile Include="AuxDialogBox.cpp">
<Filter>File di origine\Global</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ResourceCompile Include="EgtExecutor.rc"> <ResourceCompile Include="EgtExecutor.rc">
+2 -2
View File
@@ -20,9 +20,9 @@
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
int int
AdjustId( int nId) AdjustId( int nId, int nCtx)
{ {
GseContext* pCtx = GetCurrGseContext() ; GseContext* pCtx = ( nCtx == 0 ? GetCurrGseContext() : GetGseContext( nCtx));
VERIFY_CTX( pCtx, GDB_ID_NULL) VERIFY_CTX( pCtx, GDB_ID_NULL)
if ( nId == GDB_ID_CURRPART) if ( nId == GDB_ID_CURRPART)
return pCtx->m_nCurrPart ; return pCtx->m_nCurrPart ;
+1 -1
View File
@@ -20,7 +20,7 @@ class IGeomDB ;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// Sistemo Id per pezzo o layer correnti // Sistemo Id per pezzo o layer correnti
int AdjustId( int nId) ; int AdjustId( int nId, int nCtx = 0) ;
// Vettore espresso nel riferimento desiderato partendo da vettore nel riferimento RefType // Vettore espresso nel riferimento desiderato partendo da vettore nel riferimento RefType
Vector3d GetVectorLocal( IGeomDB* pGeomDB, const Vector3d& vtV, int nRefType, const Frame3d& frLoc) ; Vector3d GetVectorLocal( IGeomDB* pGeomDB, const Vector3d& vtV, int nRefType, const Frame3d& frLoc) ;
// Vettore espresso nel riferimento RefType partendo da vettore nel riferimento locale // Vettore espresso nel riferimento RefType partendo da vettore nel riferimento locale
+20 -3
View File
@@ -1,7 +1,7 @@
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// EgalTech 2014-2015 // EgalTech 2014-2025
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// File : LUA.h Data : 16.01.15 Versione : 1.6a3 // File : LUA.h Data : 03.11.25 Versione : 2.7k1
// Contenuto : Dichiarazioni locali per moduli LUA. // Contenuto : Dichiarazioni locali per moduli LUA.
// //
// //
@@ -54,6 +54,9 @@ bool LuaInstallGdbModifyVol( LuaMgr& luaMgr) ;
//-------------------------- GdbGet ------------------------------------------ //-------------------------- GdbGet ------------------------------------------
bool LuaInstallGdbGet( LuaMgr& luaMgr) ; bool LuaInstallGdbGet( LuaMgr& luaMgr) ;
//-------------------------- GdbGetPocketing ---------------------------------
bool LuaInstallGdbGetPocketing( LuaMgr& luaMgr) ;
//-------------------------- GdbGetCurve ------------------------------------- //-------------------------- GdbGetCurve -------------------------------------
bool LuaInstallGdbGetCurve( LuaMgr& luaMgr) ; bool LuaInstallGdbGetCurve( LuaMgr& luaMgr) ;
@@ -62,7 +65,7 @@ bool LuaInstallGdbGetSurf( LuaMgr& luaMgr) ;
//-------------------------- GdbGetVol --------------------------------------- //-------------------------- GdbGetVol ---------------------------------------
bool LuaInstallGdbGetVol( LuaMgr& luaMgr) ; bool LuaInstallGdbGetVol( LuaMgr& luaMgr) ;
//-------------------------- GdbPartLayer ------------------------------------ //-------------------------- GdbPartLayer ------------------------------------
bool LuaInstallGdbPartLayer( LuaMgr& luaMgr) ; bool LuaInstallGdbPartLayer( LuaMgr& luaMgr) ;
@@ -90,6 +93,9 @@ bool LuaInstallGeoInters( LuaMgr& luaMgr) ;
//-------------------------- Collision Detection ----------------------------- //-------------------------- Collision Detection -----------------------------
bool LuaInstallCDeObjSolid( LuaMgr& luaMgr) ; bool LuaInstallCDeObjSolid( LuaMgr& luaMgr) ;
//-------------------------- Test Interference -------------------------------
bool LuaInstallTestObjSurface( LuaMgr& luaMgr) ;
//-------------------------- MachMgr ----------------------------------------- //-------------------------- MachMgr -----------------------------------------
bool LuaInstallMachMgr( LuaMgr& luaMgr) ; bool LuaInstallMachMgr( LuaMgr& luaMgr) ;
@@ -123,6 +129,17 @@ bool LuaInstallPolynomialRoots( LuaMgr& luaMgr) ;
//-------------------------- Shortest Path ----------------------------------- //-------------------------- Shortest Path -----------------------------------
bool LuaInstallShortestPath( LuaMgr& luaMgr) ; bool LuaInstallShortestPath( LuaMgr& luaMgr) ;
//----------------------- Machining Time Optimization ------------------------
bool LuaInstallMachiningOptimization( LuaMgr& luaMgr) ;
//-------------------------- Collision Avoidance Tool ------------------------ //-------------------------- Collision Avoidance Tool ------------------------
bool LuaInstallCAvTool( LuaMgr& luaMgr) ; bool LuaInstallCAvTool( LuaMgr& luaMgr) ;
//---------------------------------- Redis ----------------------------------
bool LuaInstallRedis( LuaMgr& luaMgr) ;
//-------------------------- Base64 ------------------------------------------
bool LuaInstallBase64( LuaMgr& luaMgr) ;
//---------------------------------- Trimming ----------------------------------
bool LuaInstallTrimming( LuaMgr& luaMgr) ;
+25
View File
@@ -78,6 +78,10 @@ LuaInstallEgtFunctions( LuaMgr& LuaMgr)
LOG_ERROR( GetLogger(), "Error in LuaInstallGdbGet (LuaInstallEgtFunctions)") LOG_ERROR( GetLogger(), "Error in LuaInstallGdbGet (LuaInstallEgtFunctions)")
return false ; return false ;
} }
if ( ! LuaInstallGdbGetPocketing( LuaMgr)) {
LOG_ERROR( GetLogger(), "Error in LuaInstallGdbGetPocketing (LuaInstallEgtFunctions)")
return false ;
}
if ( ! LuaInstallGdbGetCurve( LuaMgr)) { if ( ! LuaInstallGdbGetCurve( LuaMgr)) {
LOG_ERROR( GetLogger(), "Error in LuaInstallGdbGetCurve (LuaInstallEgtFunctions)") LOG_ERROR( GetLogger(), "Error in LuaInstallGdbGetCurve (LuaInstallEgtFunctions)")
return false ; return false ;
@@ -126,6 +130,10 @@ LuaInstallEgtFunctions( LuaMgr& LuaMgr)
LOG_ERROR( GetLogger(), "Error in LuaInstallCDeObjSolid (LuaInstallEgtFunctions)") LOG_ERROR( GetLogger(), "Error in LuaInstallCDeObjSolid (LuaInstallEgtFunctions)")
return false ; return false ;
} }
if ( ! LuaInstallTestObjSurface( LuaMgr)) {
LOG_ERROR( GetLogger(), "Error in LuaInstallTestObjSurface (LuaInstallEgtFunctions)")
return false ;
}
if ( ! LuaInstallMachMgr( LuaMgr)) { if ( ! LuaInstallMachMgr( LuaMgr)) {
LOG_ERROR( GetLogger(), "Error in LuaInstallMachMgr (LuaInstallEgtFunctions)") LOG_ERROR( GetLogger(), "Error in LuaInstallMachMgr (LuaInstallEgtFunctions)")
return false ; return false ;
@@ -170,10 +178,27 @@ LuaInstallEgtFunctions( LuaMgr& LuaMgr)
LOG_ERROR( GetLogger(), "Error in LuaInstallShortestPath (LuaInstallEgtFunctions)") LOG_ERROR( GetLogger(), "Error in LuaInstallShortestPath (LuaInstallEgtFunctions)")
return false ; return false ;
} }
if ( ! LuaInstallMachiningOptimization( LuaMgr)) {
LOG_ERROR( GetLogger(), "Error in LuaInstallMachiningOptimization (LuaInstallEgtFunctions)")
return false ;
}
if ( ! LuaInstallCAvTool( LuaMgr)) { if ( ! LuaInstallCAvTool( LuaMgr)) {
LOG_ERROR( GetLogger(), "Error in LuaInstallCAvTool (LuaInstallEgtFunctions)") LOG_ERROR( GetLogger(), "Error in LuaInstallCAvTool (LuaInstallEgtFunctions)")
return false ; return false ;
} }
if ( ! LuaInstallRedis( LuaMgr)) {
LOG_ERROR( GetLogger(), "Error in LuaInstallRedis (LuaInstallEgtFunctions)")
return false ;
}
if ( ! LuaInstallBase64( LuaMgr)) {
LOG_ERROR( GetLogger(), "Error in LuaInstallBase64 (LuaInstallEgtFunctions)")
return false ;
}
if ( ! LuaInstallTrimming( LuaMgr)) {
LOG_ERROR( GetLogger(), "Error in LuaInstallTrimming (LuaInstallEgtFunctions)")
return false ;
}
return true ; return true ;
} }
+65
View File
@@ -0,0 +1,65 @@
//----------------------------------------------------------------------------
// EgalTech 2025-2025
//----------------------------------------------------------------------------
// File : LUA_Base64.cpp Data : 03.11.25 Versione : 2.7k1
// Contenuto : Funzioni per codificare/decodificare in Base64 per LUA.
//
//
//
// Modifiche : 03.11.25 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "LUA.h"
#include "/EgtDev/Include/EXeExecutor.h"
using namespace std ;
//-------------------------------------------------------------------------------
static int
LuaBase64Encode( lua_State* L)
{
// 1 parametro : sFile
string sFile ;
LuaCheckParam( L, 1, sFile) ;
LuaClearStack( L) ;
// eseguo la codifica del contenuto del file
string sB64Dest ;
bool bOk = ExeBase64Encode( sFile, sB64Dest) ;
// restituisco il risultato
if ( bOk)
LuaSetParam( L, sB64Dest) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaBase64Decode( lua_State* L)
{
// 2 parametro : sB64Sou, sFile
string sB64Sou ;
LuaCheckParam( L, 1, sB64Sou) ;
string sFile ;
LuaCheckParam( L, 2, sFile) ;
LuaClearStack( L) ;
// eseguo la decodifica della stringa nel file
bool bOk = ExeBase64Decode( sB64Sou, sFile) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
bool
LuaInstallBase64( LuaMgr& luaMgr)
{
bool bOk = ( &luaMgr != nullptr) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtBase64Encode", LuaBase64Encode) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtBase64Decode", LuaBase64Decode) ;
return bOk ;
}
+66 -8
View File
@@ -21,6 +21,21 @@
using namespace std ; using namespace std ;
//-------------------------------------------------------------------------------
static int
LuaInitBeamMgr( lua_State* L)
{
// 1 o nessun parametro : [nFlag]
int nFlag = EIB_FLAG_NONE ;
LuaGetParam( L, 1, nFlag) ;
LuaClearStack( L) ;
// inizializzo in gestore di travi e pareti
bool bOk = ExeInitBeamMgr( nFlag) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
static int static int
LuaBeamCreatePart( lua_State* L) LuaBeamCreatePart( lua_State* L)
@@ -151,7 +166,7 @@ LuaBeamGetSideData( lua_State* L)
int nSide ; int nSide ;
LuaCheckParam( L, 1, nSide) LuaCheckParam( L, 1, nSide)
LuaClearStack( L) ; LuaClearStack( L) ;
// imposto le dimensioni al pezzo corrente // restituisce i dati della faccia indicata del pezzo corrente
Frame3d frRef ; Frame3d frRef ;
double dLength, dWidth, dHeight ; double dLength, dWidth, dHeight ;
bool bOk = ExeBeamGetSideData( nSide, frRef, dLength, dWidth, dHeight) ; bool bOk = ExeBeamGetSideData( nSide, frRef, dLength, dWidth, dHeight) ;
@@ -173,7 +188,7 @@ LuaBeamGetSideData( lua_State* L)
static int static int
LuaBeamAddProcess( lua_State* L) LuaBeamAddProcess( lua_State* L)
{ {
// 9 o 10 o 11 o 12 parametri : nGroup, nProc, nSide, sDes, nProcId, vdPar, sPar [, nCrv, nCrv2] [, bUpdate] // 9 o 10 o 11 o 12 parametri : nGroup, nProc, nSide, sDes, nProcId, vdPar, sPar, vsUAtt [, nCrv] [, nCrv2] [, bUpdate]
int nGroup ; int nGroup ;
LuaCheckParam( L, 1, nGroup) LuaCheckParam( L, 1, nGroup)
int nProc ; int nProc ;
@@ -198,6 +213,8 @@ LuaBeamAddProcess( lua_State* L)
if ( LuaGetParam( L, 10, nCrvId) && if ( LuaGetParam( L, 10, nCrvId) &&
LuaGetParam( L, 11, nCrv2Id)) LuaGetParam( L, 11, nCrv2Id))
LuaGetParam( L, 12, bUpdate) ; LuaGetParam( L, 12, bUpdate) ;
else if ( LuaGetParam( L, 10, nCrvId))
LuaGetParam( L, 11, bUpdate) ;
else else
LuaGetParam( L, 10, bUpdate) ; LuaGetParam( L, 10, bUpdate) ;
LuaClearStack( L) ; LuaClearStack( L) ;
@@ -215,7 +232,7 @@ LuaBeamAddProcess( lua_State* L)
static int static int
LuaBeamModifyProcess( lua_State* L) LuaBeamModifyProcess( lua_State* L)
{ {
// 10 o 11 o 12 o 13 parametri : nGeomId, nGroup, nProc, nSide, sDes, nProcId, vdPar, sPar [, nCrv, nCrv2] [, bUpdate] // 10 o 11 o 12 o 13 parametri : nGeomId, nGroup, nProc, nSide, sDes, nProcId, vdPar, sPar, vsUAtt [, nCrv, nCrv2] [, bUpdate]
int nGeomId ; int nGeomId ;
LuaCheckParam( L, 1, nGeomId) LuaCheckParam( L, 1, nGeomId)
int nGroup ; int nGroup ;
@@ -242,6 +259,8 @@ LuaBeamModifyProcess( lua_State* L)
if ( LuaGetParam( L, 11, nCrvId) && if ( LuaGetParam( L, 11, nCrvId) &&
LuaGetParam( L, 12, nCrv2Id)) LuaGetParam( L, 12, nCrv2Id))
LuaGetParam( L, 13, bUpdate) ; LuaGetParam( L, 13, bUpdate) ;
else if ( LuaGetParam( L, 11, nCrvId))
LuaGetParam( L, 12, bUpdate) ;
else else
LuaGetParam( L, 11, bUpdate) ; LuaGetParam( L, 11, bUpdate) ;
LuaClearStack( L) ; LuaClearStack( L) ;
@@ -291,6 +310,38 @@ LuaBeamEnableProcess( lua_State* L)
return 1 ; return 1 ;
} }
//-------------------------------------------------------------------------------
static int
LuaBeamCalcAllSolids( lua_State* L)
{
// 1 o 2 parametri : bShow [,bRecalc]
bool bShow ;
LuaCheckParam( L, 1, bShow)
bool bRecalc = false ;
LuaGetParam( L, 2, bRecalc) ;
LuaClearStack( L) ;
// eseguo calcolo dei solidi di tutte le travi
bool bOk = ExeBeamCalcAllSolids( bShow, bRecalc) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaBeamShowAllSolids( lua_State* L)
{
// 1 parametro : bShow
bool bShow ;
LuaCheckParam( L, 1, bShow)
LuaClearStack( L) ;
// aggiorno stato di visualizzazione dei solidi di tutte le travi
bool bOk = ExeBeamShowAllSolids( bShow) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
static int static int
LuaBeamCalcSolid( lua_State* L) LuaBeamCalcSolid( lua_State* L)
@@ -347,10 +398,12 @@ LuaBeamShowSolid( lua_State* L)
static int static int
LuaBeamGetBuildingIsOn( lua_State* L) LuaBeamGetBuildingIsOn( lua_State* L)
{ {
// Nessun parametro // 1 o nessun parametro : [nAssGrpId]
int nAssGrpId = GDB_ID_NULL ;
LuaGetParam( L, 1, nAssGrpId) ;
LuaClearStack( L) ; LuaClearStack( L) ;
// restituisco identificativo del solido della trave // restituisco identificativo del solido della trave
bool bOk = ExeBeamGetBuildingIsOn() ; bool bOk = ExeBeamGetBuildingIsOn( nAssGrpId) ;
// restituisco il risultato // restituisco il risultato
LuaSetParam( L, bOk) ; LuaSetParam( L, bOk) ;
return 1 ; return 1 ;
@@ -360,12 +413,14 @@ LuaBeamGetBuildingIsOn( lua_State* L)
static int static int
LuaBeamShowBuilding( lua_State* L) LuaBeamShowBuilding( lua_State* L)
{ {
// 1 parametro : bShow // 1 o 2 parametri : [nAssGrpId,] bShow
int nAssGrpId = GDB_ID_NULL ;
int nPar = ( LuaGetParam( L, 1, nAssGrpId) ? 2 : 1) ;
bool bShow ; bool bShow ;
LuaCheckParam( L, 1, bShow) LuaCheckParam( L, nPar, bShow)
LuaClearStack( L) ; LuaClearStack( L) ;
// attivo o disattivo la visualizzazione l'assemblaggio // attivo o disattivo la visualizzazione l'assemblaggio
bool bOk = ExeBeamShowBuilding( bShow) ; bool bOk = ExeBeamShowBuilding( nAssGrpId, bShow) ;
// restituisco il risultato // restituisco il risultato
LuaSetParam( L, bOk) ; LuaSetParam( L, bOk) ;
return 1 ; return 1 ;
@@ -376,6 +431,7 @@ bool
LuaInstallBeamMgr( LuaMgr& luaMgr) LuaInstallBeamMgr( LuaMgr& luaMgr)
{ {
bool bOk = ( &luaMgr != nullptr) ; bool bOk = ( &luaMgr != nullptr) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtInitBeamMgr", LuaInitBeamMgr) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtBeamCreatePart", LuaBeamCreatePart) ; bOk = bOk && luaMgr.RegisterFunction( "EgtBeamCreatePart", LuaBeamCreatePart) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtBeamSetPart", LuaBeamSetPart) ; bOk = bOk && luaMgr.RegisterFunction( "EgtBeamSetPart", LuaBeamSetPart) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtBeamErasePart", LuaBeamErasePart) ; bOk = bOk && luaMgr.RegisterFunction( "EgtBeamErasePart", LuaBeamErasePart) ;
@@ -389,6 +445,8 @@ LuaInstallBeamMgr( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtBeamModifyProcess", LuaBeamModifyProcess) ; bOk = bOk && luaMgr.RegisterFunction( "EgtBeamModifyProcess", LuaBeamModifyProcess) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtBeamEraseProcess", LuaBeamEraseProcess) ; bOk = bOk && luaMgr.RegisterFunction( "EgtBeamEraseProcess", LuaBeamEraseProcess) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtBeamEnableProcess", LuaBeamEnableProcess) ; bOk = bOk && luaMgr.RegisterFunction( "EgtBeamEnableProcess", LuaBeamEnableProcess) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtBeamCalcAllSolids", LuaBeamCalcAllSolids) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtBeamShowAllSolids", LuaBeamShowAllSolids) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtBeamCalcSolid", LuaBeamCalcSolid) ; bOk = bOk && luaMgr.RegisterFunction( "EgtBeamCalcSolid", LuaBeamCalcSolid) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtBeamGetSolid", LuaBeamGetSolid) ; bOk = bOk && luaMgr.RegisterFunction( "EgtBeamGetSolid", LuaBeamGetSolid) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtBeamShowSolid", LuaBeamShowSolid) ; bOk = bOk && luaMgr.RegisterFunction( "EgtBeamShowSolid", LuaBeamShowSolid) ;
+22
View File
@@ -118,6 +118,27 @@ LuaCAvGetToolOutline( lua_State* L)
return 1 ; return 1 ;
} }
//-------------------------------------------------------------------------------
static int
LuaCAvToolPosBox( lua_State* L)
{
// 4 parametri : ptP, vtAx, b3Box, vtMove
Point3d ptP ;
LuaCheckParam( L, 1, ptP)
Vector3d vtAx ;
LuaCheckParam( L, 2, vtAx)
BBox3d b3Box ;
LuaCheckParam( L, 3, b3Box)
Vector3d vtMove ;
LuaCheckParam( L, 4, vtMove)
LuaClearStack( L) ;
// determino il movimento da dare all'utensile per evitare la collisione con il parallelepipedo
double dMove = ExeCAvToolPosBox( ptP, vtAx, b3Box, vtMove) ;
// restituisco il risultato
LuaSetParam( L, dMove) ;
return 1 ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
static int static int
LuaCAvToolPosStm( lua_State* L) LuaCAvToolPosStm( lua_State* L)
@@ -176,6 +197,7 @@ LuaInstallCAvTool( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtCAvSetSawTool", LuaCAvSetSawTool) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCAvSetSawTool", LuaCAvSetSawTool) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCAvSetGenTool", LuaCAvSetGenTool) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCAvSetGenTool", LuaCAvSetGenTool) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCAvGetToolOutline", LuaCAvGetToolOutline) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCAvGetToolOutline", LuaCAvGetToolOutline) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCAvToolPosBox", LuaCAvToolPosBox) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCAvToolPosStm", LuaCAvToolPosStm) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCAvToolPosStm", LuaCAvToolPosStm) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCAvToolPathStm", LuaCAvToolPathStm) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCAvToolPathStm", LuaCAvToolPathStm) ;
return bOk ; return bOk ;
+23
View File
@@ -165,6 +165,28 @@ LuaCDeSpheSolid( lua_State* L)
return 1 ; return 1 ;
} }
//----------------------------------------------------------------------------
static int
LuaCDeSolidSolid( lua_State* L)
{
// 3 parametri : nSolid1Id, nSolid2Id, dSafeDist
int nSolid1Id ;
LuaCheckParam( L, 1, nSolid1Id)
int nSolid2Id ;
LuaCheckParam( L, 2, nSolid2Id)
double dSafeDist ;
LuaCheckParam( L, 3, dSafeDist)
LuaClearStack( L) ;
// eseguo verifica di collisione
int nRes = ExeCDeSolidSolid( nSolid1Id, nSolid2Id, dSafeDist) ;
// restituisco il risultato
if ( nRes >= 0)
LuaSetParam( L, ( nRes != 0)) ;
else
LuaSetParam( L) ;
return 1 ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
bool bool
LuaInstallCDeObjSolid( LuaMgr& luaMgr) LuaInstallCDeObjSolid( LuaMgr& luaMgr)
@@ -175,5 +197,6 @@ LuaInstallCDeObjSolid( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtCDeCylSolid", LuaCDeCylSolid) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCDeCylSolid", LuaCDeCylSolid) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCDeConeSolid", LuaCDeConeSolid) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCDeConeSolid", LuaCDeConeSolid) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCDeSpheSolid", LuaCDeSpheSolid) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCDeSpheSolid", LuaCDeSpheSolid) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCDeSolidSolid", LuaCDeSolidSolid) ;
return bOk ; return bOk ;
} }
+102 -20
View File
@@ -154,17 +154,68 @@ LuaImportStl( lua_State* L)
return 1 ; return 1 ;
} }
//-------------------------------------------------------------------------------
static int
LuaImportOff( lua_State* L)
{
// 1 o 2 parametri : path del file da importare [, Fattore di scala]
string sFilePath ;
LuaCheckParam( L, 1, sFilePath)
double dScaleFactor = 1.0 ;
LuaGetParam( L, 2, dScaleFactor) ;
LuaClearStack( L) ;
// apro il file
bool bOk = ExeImportOff( sFilePath, dScaleFactor) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaImportPly( lua_State* L)
{
// 1 o 2 parametri : path del file da importare [, Fattore di scala]
string sFilePath ;
LuaCheckParam( L, 1, sFilePath)
double dScaleFactor = 1.0 ;
LuaGetParam( L, 2, dScaleFactor) ;
LuaClearStack( L) ;
// apro il file
bool bOk = ExeImportPly( sFilePath, dScaleFactor) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
static int static int
LuaImport3MF( lua_State* L) LuaImport3MF( lua_State* L)
{ {
// 1 parametro : path del file da importare // 1 o 2 parametri : path del file da importare [, flag]
string sFilePath ;
LuaCheckParam( L, 1, sFilePath)
int nFlag = 0 ;
LuaGetParam( L, 2, nFlag) ;
LuaClearStack( L) ;
// apro il file
bool bOk = ExeImport3MF( sFilePath, nFlag) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaImport3dm( lua_State* L)
{
// 1 parametro : path del file da importare
string sFilePath ; string sFilePath ;
LuaCheckParam( L, 1, sFilePath) LuaCheckParam( L, 1, sFilePath)
LuaClearStack( L) ; LuaClearStack( L) ;
// apro il file // apro il file
bool bOk = ExeImport3MF( sFilePath) ; bool bOk = ExeImport3dm( sFilePath) ;
// restituisco il risultato // restituisco il risultato
LuaSetParam( L, bOk) ; LuaSetParam( L, bOk) ;
return 1 ; return 1 ;
} }
@@ -173,14 +224,16 @@ LuaImport3MF( lua_State* L)
static int static int
LuaAdvancedImport( lua_State* L) LuaAdvancedImport( lua_State* L)
{ {
// 1 o 2 parametri : path del file da importare [, dLinToler] // 1 o 2 o 3 parametri : path del file da importare [, dLinToler] [, nFlag]
string sFilePath ; string sFilePath ;
LuaCheckParam( L, 1, sFilePath) LuaCheckParam( L, 1, sFilePath)
double dLinToler = 0.1 ; double dLinToler = 0.1 ;
LuaGetParam( L, 2, dLinToler) ; LuaGetParam( L, 2, dLinToler) ;
int nFlag = 0 ;
LuaGetParam( L, 3, nFlag) ;
LuaClearStack( L) ; LuaClearStack( L) ;
// apro il file // apro il file
bool bOk = ExeAdvancedImport( sFilePath, dLinToler) ; bool bOk = ExeAdvancedImport( sFilePath, dLinToler, nFlag) ;
// restituisco il risultato // restituisco il risultato
LuaSetParam( L, bOk) ; LuaSetParam( L, bOk) ;
return 1 ; return 1 ;
@@ -190,16 +243,18 @@ LuaAdvancedImport( lua_State* L)
static int static int
LuaExportDxf( lua_State* L) LuaExportDxf( lua_State* L)
{ {
// 2 o 3 parametri, GroupId e path del file da esportare [, Flag] // 2, 3 o 4 parametri : GroupId e path del file da esportare [, Flag] [, Filter]
int nGroupId ; int nGroupId ;
LuaCheckParam( L, 1, nGroupId) LuaCheckParam( L, 1, nGroupId)
string sFilePath ; string sFilePath ;
LuaCheckParam( L, 2, sFilePath) LuaCheckParam( L, 2, sFilePath)
int nFlag = EEXFLAG_DEFAULT ; int nFlag = EEXFLAG_DEFAULT ;
LuaGetParam( L, 3, nFlag) ; LuaGetParam( L, 3, nFlag) ;
int nFilter = EEXFLT_DEFAULT ;
LuaGetParam( L, 4, nFilter) ;
LuaClearStack( L) ; LuaClearStack( L) ;
// creo il file // creo il file
bool bOk = ExeExportDxf( nGroupId, sFilePath, nFlag) ; bool bOk = ExeExportDxf( nGroupId, sFilePath, nFlag, nFilter) ;
// restituisco il risultato // restituisco il risultato
LuaSetParam( L, bOk) ; LuaSetParam( L, bOk) ;
return 1 ; return 1 ;
@@ -209,11 +264,13 @@ LuaExportDxf( lua_State* L)
static int static int
LuaExportStl( lua_State* L) LuaExportStl( lua_State* L)
{ {
// 2 parametri, GroupId e path del file da esportare // 2 parametri : GroupId e path del file da esportare [, Filter]
int nGroupId ; int nGroupId ;
LuaCheckParam( L, 1, nGroupId) LuaCheckParam( L, 1, nGroupId)
string sFilePath ; string sFilePath ;
LuaCheckParam( L, 2, sFilePath) LuaCheckParam( L, 2, sFilePath)
int nFilter = EEXFLT_DEFAULT ;
LuaGetParam( L, 3, nFilter) ;
LuaClearStack( L) ; LuaClearStack( L) ;
// creo il file // creo il file
bool bOk = ExeExportStl( nGroupId, sFilePath) ; bool bOk = ExeExportStl( nGroupId, sFilePath) ;
@@ -226,14 +283,16 @@ LuaExportStl( lua_State* L)
static int static int
LuaExport3MF( lua_State* L) LuaExport3MF( lua_State* L)
{ {
// 2 parametri, GroupId e path del file da esportare // 2 o 3 parametri : GroupId e path del file da esportare [, Filter]
int nGroupId ; int nGroupId ;
LuaCheckParam( L, 1, nGroupId) LuaCheckParam( L, 1, nGroupId)
string sFilePath ; string sFilePath ;
LuaCheckParam( L, 2, sFilePath) LuaCheckParam( L, 2, sFilePath)
int nFilter = EEXFLT_DEFAULT ;
LuaGetParam( L, 3, nFilter) ;
LuaClearStack( L) ; LuaClearStack( L) ;
// creo il file // creo il file
bool bOk = ExeExport3MF( nGroupId, sFilePath) ; bool bOk = ExeExport3MF( nGroupId, sFilePath, nFilter) ;
// restituisco il risultato // restituisco il risultato
LuaSetParam( L, bOk) ; LuaSetParam( L, bOk) ;
return 1 ; return 1 ;
@@ -241,19 +300,19 @@ LuaExport3MF( lua_State* L)
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
static int static int
LuaExportThreeJS( lua_State* L) LuaExport3dm( lua_State* L)
{ {
// 2 o 3 parametri, GroupId e path del file da esportare [, Filter] // 2 o 3 parametri : GroupId e path del file da esportare [, Filter]
int nGroupId ; int nGroupId ;
LuaCheckParam( L, 1, nGroupId) LuaCheckParam( L, 1, nGroupId)
string sFilePath ; string sFilePath ;
LuaCheckParam( L, 2, sFilePath) LuaCheckParam( L, 2, sFilePath)
int nFilter = EEXFLT_DEFAULT; int nFilter = EEXFLT_DEFAULT ;
LuaGetParam( L, 3, nFilter); LuaGetParam( L, 3, nFilter) ;
LuaClearStack( L) ; LuaClearStack( L) ;
// creo il file // creo il file
bool bOk = ExeExportThreeJS( nGroupId, sFilePath, nFilter) ; bool bOk = ExeExport3dm( nGroupId, sFilePath, nFilter) ;
// restituisco il risultato // restituisco il risultato
LuaSetParam( L, bOk) ; LuaSetParam( L, bOk) ;
return 1 ; return 1 ;
} }
@@ -262,7 +321,7 @@ LuaExportThreeJS( lua_State* L)
static int static int
LuaExportSvg( lua_State* L) LuaExportSvg( lua_State* L)
{ {
// 2 o 3 parametri, GroupId, Path del file da esportare [, Filter] // 2 o 3 parametri : GroupId, Path del file da esportare [, Filter]
int nGroupId ; int nGroupId ;
LuaCheckParam( L, 1, nGroupId) LuaCheckParam( L, 1, nGroupId)
string sFilePath ; string sFilePath ;
@@ -277,6 +336,25 @@ LuaExportSvg( lua_State* L)
return 1 ; return 1 ;
} }
//-------------------------------------------------------------------------------
static int
LuaExportThreeJS( lua_State* L)
{
// 2 o 3 parametri : GroupId, Path del file da esportare [, Filter]
int nGroupId ;
LuaCheckParam( L, 1, nGroupId)
string sFilePath ;
LuaCheckParam( L, 2, sFilePath)
int nFilter = EEXFLT_DEFAULT ;
LuaGetParam( L, 3, nFilter) ;
LuaClearStack( L) ;
// creo il file
bool bOk = ExeExportThreeJS( nGroupId, sFilePath, nFilter) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
bool bool
LuaInstallExchange( LuaMgr& luaMgr) LuaInstallExchange( LuaMgr& luaMgr)
@@ -290,12 +368,16 @@ LuaInstallExchange( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtImportDxf", LuaImportDxf) ; bOk = bOk && luaMgr.RegisterFunction( "EgtImportDxf", LuaImportDxf) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtImportPnt", LuaImportPnt) ; bOk = bOk && luaMgr.RegisterFunction( "EgtImportPnt", LuaImportPnt) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtImportStl", LuaImportStl) ; bOk = bOk && luaMgr.RegisterFunction( "EgtImportStl", LuaImportStl) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtImportOff", LuaImportOff) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtImportPly", LuaImportPly) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtImport3MF", LuaImport3MF) ; bOk = bOk && luaMgr.RegisterFunction( "EgtImport3MF", LuaImport3MF) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtImport3dm", LuaImport3dm) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAdvancedImport", LuaAdvancedImport) ; bOk = bOk && luaMgr.RegisterFunction( "EgtAdvancedImport", LuaAdvancedImport) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtExportDxf", LuaExportDxf) ; bOk = bOk && luaMgr.RegisterFunction( "EgtExportDxf", LuaExportDxf) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtExportStl", LuaExportStl) ; bOk = bOk && luaMgr.RegisterFunction( "EgtExportStl", LuaExportStl) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtExport3MF", LuaExport3MF) ; bOk = bOk && luaMgr.RegisterFunction( "EgtExport3MF", LuaExport3MF) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtExportThreeJS", LuaExportThreeJS) ; bOk = bOk && luaMgr.RegisterFunction( "EgtExport3dm", LuaExport3dm) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtExportSvg", LuaExportSvg) ; bOk = bOk && luaMgr.RegisterFunction( "EgtExportSvg", LuaExportSvg) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtExportThreeJS", LuaExportThreeJS) ;
return bOk ; return bOk ;
} }
+172
View File
@@ -344,6 +344,172 @@ LuaCreateAlignedDimension( lua_State* L)
return 1 ; return 1 ;
} }
//-------------------------------------------------------------------------------
static int
LuaCreateRadialDimension( lua_State* L)
{
// 4 o 5 parametri : nParentId, nCrvId, ptDim, Text [, nRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
int nCrvId ;
LuaCheckParam( L, 2, nCrvId) ;
Point3d ptDim ;
LuaCheckParam( L, 3, ptDim) ;
string sText ;
LuaCheckParam( L, 4, sText) ;
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 5, nRefType) ;
LuaClearStack( L ) ;
// creo la quota allineata
int nId = ExeCreateRadialDimension( nParentId, nCrvId, ptDim, sText, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateDiametralDimension( lua_State* L )
{
// 4 o 5 parametri : nParentId, nCrvId, ptDim, Text [, nRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
int nCrvId ;
LuaCheckParam( L, 2, nCrvId) ;
Point3d ptDim ;
LuaCheckParam( L, 3, ptDim) ;
string sText ;
LuaCheckParam( L, 4, sText) ;
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 5, nRefType) ;
LuaClearStack( L) ;
// creo la quota allineata
int nId = ExeCreateDiametralDimension( nParentId, nCrvId, ptDim, sText, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateAngularDimension(lua_State* L)
{
// 6 o 7 parametri : ParentId, ptV, ptP1, ptP2, ptDim, Text [, nRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
Point3d ptV ;
LuaCheckParam( L, 2, ptV) ;
Point3d ptP1 ;
LuaCheckParam( L, 3, ptP1) ;
Point3d ptP2 ;
LuaCheckParam( L, 4, ptP2) ;
Point3d ptDim ;
LuaCheckParam( L, 5, ptDim) ;
string sText ;
LuaCheckParam( L, 6, sText) ;
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 7, nRefType) ;
LuaClearStack( L) ;
// creo la quota angolare
int nId = ExeCreateAngularDimension( nParentId, ptV, ptP1, ptP2, ptDim, sText, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateAngularDimensionEx(lua_State* L)
{
// 7 o 8 parametri : ParentId, ptV1, ptP1, ptV2, ptP2, ptDim, Text [, nRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
Point3d ptV1 ;
LuaCheckParam( L, 2, ptV1) ;
Point3d ptP1 ;
LuaCheckParam( L, 3, ptP1) ;
Point3d ptV2 ;
LuaCheckParam( L, 4, ptV2) ;
Point3d ptP2 ;
LuaCheckParam( L, 5, ptP2) ;
Point3d ptDim ;
LuaCheckParam( L, 6, ptDim) ;
string sText ;
LuaCheckParam( L, 7, sText) ;
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 8, nRefType) ;
LuaClearStack( L) ;
// creo la quota angolare
int nId = ExeCreateAngularDimensionEx( nParentId, ptV1, ptP1, ptV2, ptP2, ptDim, sText, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateAngularDimensionFromLines( lua_State* L)
{
// 4 o 5 parametri : nParentId, vLineIds, ptDim, Text [, nRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
INTVECTOR vLineIds ;
LuaCheckParam( L, 2, vLineIds) ;
Point3d ptDim ;
LuaCheckParam( L, 3, ptDim) ;
string sText ;
LuaCheckParam( L, 4, sText) ;
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 5, nRefType) ;
LuaClearStack( L ) ;
// creo la quota allineata
int nId = ExeCreateAngularDimensionFromLines( nParentId, vLineIds, ptDim, sText, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L ) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateAngularDimensionFromArc( lua_State* L)
{
// 4 o 5 parametri : nParentId, nCrvId, ptDim, Text [, nRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
int nCrvId ;
LuaCheckParam( L, 2, nCrvId) ;
Point3d ptDim ;
LuaCheckParam( L, 3, ptDim) ;
string sText ;
LuaCheckParam( L, 4, sText) ;
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 5, nRefType) ;
LuaClearStack( L) ;
// creo la quota allineata
int nId = ExeCreateAngularDimensionFromArc( nParentId, nCrvId, ptDim, sText, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
bool bool
LuaInstallGdbCreate( LuaMgr& luaMgr) LuaInstallGdbCreate( LuaMgr& luaMgr)
@@ -361,5 +527,11 @@ LuaInstallGdbCreate( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtHorizontalDimension", LuaCreateHorizontalDimension) ; bOk = bOk && luaMgr.RegisterFunction( "EgtHorizontalDimension", LuaCreateHorizontalDimension) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVerticalDimension", LuaCreateVerticalDimension) ; bOk = bOk && luaMgr.RegisterFunction( "EgtVerticalDimension", LuaCreateVerticalDimension) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAlignedDimension", LuaCreateAlignedDimension) ; bOk = bOk && luaMgr.RegisterFunction( "EgtAlignedDimension", LuaCreateAlignedDimension) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRadialDimension", LuaCreateRadialDimension) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtDiametralDimension", LuaCreateDiametralDimension) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAngularDimension", LuaCreateAngularDimension) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAngularDimensionEx", LuaCreateAngularDimensionEx) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAngularDimensionFromLines", LuaCreateAngularDimensionFromLines) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAngularDimensionFromArc", LuaCreateAngularDimensionFromArc) ;
return bOk ; return bOk ;
} }
+78
View File
@@ -425,6 +425,60 @@ LuaCreateArc3P( lua_State* L)
return 1 ; return 1 ;
} }
//-------------------------------------------------------------------------------
static int
LuaCreateArc2PR( lua_State* L)
{
// 5 o 6 parametri : ParentId, PtStart, PtEnd, dRad, bCCW [, nRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
Point3d ptStart ;
LuaCheckParam( L, 2, ptStart)
Point3d ptEnd ;
LuaCheckParam( L, 3, ptEnd)
double dRad ;
LuaCheckParam( L, 4, dRad)
bool bCCW ;
LuaCheckParam( L, 5, bCCW) ;
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 6, nRefType) ;
LuaClearStack( L) ;
// creo l'arco
int nId = ExeCreateArc2PR( nParentId, ptStart, ptEnd, dRad, bCCW, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateArc2PB( lua_State* L)
{
// 4 o 5 parametri : ParentId, PtStart, PtEnd, dBulge [, nRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
Point3d ptStart ;
LuaCheckParam( L, 2, ptStart)
Point3d ptEnd ;
LuaCheckParam( L, 3, ptEnd)
double dBulge ;
LuaCheckParam( L, 4, dBulge)
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 5, nRefType) ;
LuaClearStack( L) ;
// creo l'arco
int nId = ExeCreateArc2PB( nParentId, ptStart, ptEnd, dBulge, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
static int static int
LuaCreateArc2PD( lua_State* L) LuaCreateArc2PD( lua_State* L)
@@ -674,6 +728,27 @@ LuaCreateCurveBezierFromArc( lua_State* L)
return 1 ; return 1 ;
} }
//-------------------------------------------------------------------------------
static int
LuaCreateCurveBezierFromCurve( lua_State* L)
{
// 2 o 3 parametri : ParentId, nCrvId [, bRat]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
int nCrvId ;
LuaCheckParam( L, 2, nCrvId)
bool bRat = true ;
LuaGetParam( L, 3, bRat) ;
// creo la versione bezier della curva
int nId = ExeCreateCurveBezierFromCurve( nParentId, nCrvId, bRat) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
static int static int
LuaCreateCurveCompo( lua_State* L) LuaCreateCurveCompo( lua_State* L)
@@ -1057,6 +1132,8 @@ LuaInstallGdbCreateCurve( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtArcC2P", LuaCreateArcC2P) ; bOk = bOk && luaMgr.RegisterFunction( "EgtArcC2P", LuaCreateArcC2P) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtArcC2PEx", LuaCreateArcC2PEx) ; bOk = bOk && luaMgr.RegisterFunction( "EgtArcC2PEx", LuaCreateArcC2PEx) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtArc3P", LuaCreateArc3P) ; bOk = bOk && luaMgr.RegisterFunction( "EgtArc3P", LuaCreateArc3P) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtArc2PR", LuaCreateArc2PR) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtArc2PB", LuaCreateArc2PB) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtArc2PD", LuaCreateArc2PD) ; bOk = bOk && luaMgr.RegisterFunction( "EgtArc2PD", LuaCreateArc2PD) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtArc2PDEx", LuaCreateArc2PDEx) ; bOk = bOk && luaMgr.RegisterFunction( "EgtArc2PDEx", LuaCreateArc2PDEx) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtArc2PV", LuaCreateArc2PV) ; bOk = bOk && luaMgr.RegisterFunction( "EgtArc2PV", LuaCreateArc2PV) ;
@@ -1066,6 +1143,7 @@ LuaInstallGdbCreateCurve( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveBezier", LuaCreateCurveBezier) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCurveBezier", LuaCreateCurveBezier) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveBezierRat", LuaCreateCurveBezierRational) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCurveBezierRat", LuaCreateCurveBezierRational) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveBezierFromArc", LuaCreateCurveBezierFromArc) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCurveBezierFromArc", LuaCreateCurveBezierFromArc) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveBezierFromCurve", LuaCreateCurveBezierFromCurve) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCompo", LuaCreateCurveCompo) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCompo", LuaCreateCurveCompo) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCompoByChain", LuaCreateCurveCompoByChain) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCompoByChain", LuaCreateCurveCompoByChain) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCompoByReorder", LuaCreateCurveCompoByReorder) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCompoByReorder", LuaCreateCurveCompoByReorder) ;
+763 -46
View File
@@ -14,6 +14,8 @@
//--------------------------- Include ---------------------------------------- //--------------------------- Include ----------------------------------------
#include "stdafx.h" #include "stdafx.h"
#include "LUA.h" #include "LUA.h"
#include "EXE_Const.h"
#include "/EgtDev/Include/EGkSurfTriMesh.h"
#include "/EgtDev/Include/EXeExecutor.h" #include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EXeConst.h" #include "/EgtDev/Include/EXeConst.h"
#include "/EgtDev/Include/EGkLuaAux.h" #include "/EgtDev/Include/EGkLuaAux.h"
@@ -22,9 +24,6 @@
using namespace std ; using namespace std ;
//-------------------------------------------------------------------------------
static const double LIN_TOL_DEF = 0.05 ;
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
static int static int
LuaCreateSurfFrRectangle( lua_State* L) LuaCreateSurfFrRectangle( lua_State* L)
@@ -149,7 +148,7 @@ LuaCreateSurfFlatRegion( lua_State* L)
static int static int
LuaCreateSurfFrFatCurve( lua_State* L) LuaCreateSurfFrFatCurve( lua_State* L)
{ {
// 4 parametri : ParentId, nCrvId, dRad, bSquared // 4 o 5 o 6 parametri : ParentId, nCrvId, dRad, bSquared [, bSquaredMids] [, dLinTol]
int nParentId ; int nParentId ;
LuaCheckParam( L, 1, nParentId) LuaCheckParam( L, 1, nParentId)
int nCrvId ; int nCrvId ;
@@ -158,9 +157,31 @@ LuaCreateSurfFrFatCurve( lua_State* L)
LuaCheckParam( L, 3, dRad) LuaCheckParam( L, 3, dRad)
bool bSquared ; bool bSquared ;
LuaCheckParam( L, 4, bSquared) LuaCheckParam( L, 4, bSquared)
bool bSquaredMids = bSquared ;
LuaGetParam( L, 5, bSquaredMids) ;
double dLinTol = 10 * EPS_SMALL ;
LuaGetParam( L, 6, dLinTol) ;
LuaClearStack( L) ; LuaClearStack( L) ;
// creo una regione piana // creo una regione piana
int nId = ExeCreateSurfFrFatCurve( nParentId, nCrvId, dRad, bSquared) ; int nId = ExeCreateSurfFrFatCurve( nParentId, nCrvId, dRad, bSquared, bSquaredMids, dLinTol) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateSurfTmEmpty( lua_State* L)
{
// 1 parametro : ParentId
int nParentId ;
LuaCheckParam( L, 1, nParentId)
LuaClearStack( L) ;
// creo STM vuoto
int nId = ExeCreateSurfTmEmpty( nParentId) ;
// restituisco il risultato // restituisco il risultato
if ( nId != GDB_ID_NULL) if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ; LuaSetParam( L, nId) ;
@@ -320,7 +341,7 @@ LuaCreateSurfTmCylinder( lua_State* L)
LuaCheckParam( L, 4, dRad) LuaCheckParam( L, 4, dRad)
double dHeight ; double dHeight ;
LuaCheckParam( L, 5, dHeight) LuaCheckParam( L, 5, dHeight)
double dLinTol = LIN_TOL_DEF ; double dLinTol = LIN_TOL_SRF ;
int nRefType = RTY_DEFAULT ; int nRefType = RTY_DEFAULT ;
if ( LuaGetParam( L, 6, dLinTol)) if ( LuaGetParam( L, 6, dLinTol))
LuaGetParam( L, 7, nRefType) ; LuaGetParam( L, 7, nRefType) ;
@@ -352,7 +373,7 @@ LuaCreateSurfTmCone( lua_State* L)
LuaCheckParam( L, 4, dRad) LuaCheckParam( L, 4, dRad)
double dHeight ; double dHeight ;
LuaCheckParam( L, 5, dHeight) LuaCheckParam( L, 5, dHeight)
double dLinTol = LIN_TOL_DEF ; double dLinTol = LIN_TOL_SRF ;
int nRefType = RTY_DEFAULT ; int nRefType = RTY_DEFAULT ;
if ( LuaGetParam( L, 6, dLinTol)) if ( LuaGetParam( L, 6, dLinTol))
LuaGetParam( L, 7, nRefType) ; LuaGetParam( L, 7, nRefType) ;
@@ -380,14 +401,14 @@ LuaCreateSurfTmSphere( lua_State* L)
LuaCheckParam( L, 2, ptOrig) LuaCheckParam( L, 2, ptOrig)
double dRad ; double dRad ;
LuaCheckParam( L, 3, dRad) LuaCheckParam( L, 3, dRad)
double dLinTol = LIN_TOL_DEF ; double dLinTol = LIN_TOL_SRF ;
int nRefType = RTY_DEFAULT ; int nRefType = RTY_DEFAULT ;
if ( LuaGetParam( L, 4, dLinTol)) if ( LuaGetParam( L, 4, dLinTol))
LuaGetParam( L, 5, nRefType) ; LuaGetParam( L, 5, nRefType) ;
else else
LuaGetParam( L, 4, nRefType) ; LuaGetParam( L, 4, nRefType) ;
LuaClearStack( L) ; LuaClearStack( L) ;
// creo STM cilindro // creo STM sfera
int nId = ExeCreateSurfTmSphere( nParentId, ptOrig, dRad, dLinTol, nRefType) ; int nId = ExeCreateSurfTmSphere( nParentId, ptOrig, dRad, dLinTol, nRefType) ;
// restituisco il risultato // restituisco il risultato
if ( nId != GDB_ID_NULL) if ( nId != GDB_ID_NULL)
@@ -397,6 +418,178 @@ LuaCreateSurfTmSphere( lua_State* L)
return 1 ; return 1 ;
} }
//-------------------------------------------------------------------------------
static int
LuaCreateSurfTmPyramidFrustum( lua_State* L)
{
// 6 parametri : ParentId, dBaseDimX, dBaseDimY, dTopDimX, dTopDimY, dHeight
int nParentId ;
LuaCheckParam( L, 1, nParentId)
double dBaseDimX ;
LuaCheckParam( L, 2, dBaseDimX)
double dBaseDimY ;
LuaCheckParam( L, 3, dBaseDimY)
double dTopDimX ;
LuaCheckParam( L, 4, dTopDimX)
double dTopDimY ;
LuaCheckParam( L, 5, dTopDimY)
double dHeight ;
LuaCheckParam( L, 6, dHeight)
LuaClearStack( L) ;
// creo STM cilindro
int nId = ExeCreateSurfTmPyramidFrustum( nParentId, dBaseDimX, dBaseDimY, dTopDimX, dTopDimY, dHeight) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateSurfTmConeFrustum( lua_State* L)
{
// 4 o 5 parametri : ParentId, dBaseRad, dTopRad, dHeight [, dTol]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
double dBaseRad ;
LuaCheckParam( L, 2, dBaseRad)
double dTopRad ;
LuaCheckParam( L, 3, dTopRad)
double dHeight ;
LuaCheckParam( L, 4, dHeight)
double dLinTol = LIN_TOL_SRF ;
LuaGetParam( L, 5, dLinTol) ;
LuaClearStack( L) ;
// creo STM cilindro
int nId = ExeCreateSurfTmConeFrustum( nParentId, dBaseRad, dTopRad, dHeight, dLinTol) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateSurfTmTriangle( lua_State* L)
{
// 4 o 5 parametri : ParentId, PtP1, PtP2, PtP3 [, nRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
Point3d PtP1 ;
LuaCheckParam( L, 2, PtP1)
Point3d PtP2 ;
LuaCheckParam( L, 3, PtP2)
Point3d PtP3 ;
LuaCheckParam( L, 4, PtP3)
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 5, nRefType) ;
LuaClearStack( L) ;
// creo STM triangolo
int nId = ExeCreateSurfTmTriangle( nParentId, PtP1, PtP2, PtP3, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateSurfTmRectangle( lua_State* L)
{
// 4 o 5 parametri : ParentId, PtO, PtL, PtT [, nRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
Point3d ptO ;
LuaCheckParam( L, 2, ptO)
Point3d ptL ;
LuaCheckParam( L, 3, ptL)
Point3d ptT ;
LuaCheckParam( L, 4, ptT)
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 5, nRefType) ;
LuaClearStack( L) ;
// creo STM rettangolo
int nId = ExeCreateSurfTmRectangle( nParentId, ptO, ptL, ptT, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateSurfTmByPolygon( lua_State* L)
{
// 2 o 3 parametri : ParentId, ptPs [, nRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
PNTVECTOR vPnt ;
LuaCheckParam( L, 2, vPnt)
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 3, nRefType) ;
LuaClearStack( L) ;
// creo una polilinea a partire dai punti
PolyLine PL ;
for ( size_t i = 0 ; i < vPnt.size() ; ++ i) {
if ( ! vPnt[i].IsValid())
break ;
PL.AddUPoint( double( i), vPnt[i]) ;
}
PL.Close() ;
// creo la SurfTriMesh del poligono
int nId = ExeCreateSurfTmByPolygon( nParentId, PL, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateSurfTmByPolygonWithHoles( lua_State* L)
{
// 2 o 3 parametri : ParentId, ptPs [, nRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
PNTVECTOR vPnt ;
LuaCheckParam( L, 2, vPnt)
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 3, nRefType) ;
LuaClearStack( L) ;
// creo un vettore di polilinee a partire dai punti
POLYLINEVECTOR vPL ;
vPL.push_back( {}) ;
for ( size_t i = 0 ; i < vPnt.size() ; ++ i) {
if ( vPnt[i].IsValid())
vPL.back().AddUPoint( double( i), vPnt[i]) ;
else {
if ( ! vPL.empty())
vPL.back().Close() ;
vPL.push_back( {}) ;
}
}
if ( ! vPL.empty())
vPL.back().Close() ;
// creo la SurfTriMesh del poligono
int nId = ExeCreateSurfTmByPolygonWithHoles( nParentId, vPL, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
static int static int
LuaCreateSurfTmByFlatContour( lua_State* L) LuaCreateSurfTmByFlatContour( lua_State* L)
@@ -406,7 +599,7 @@ LuaCreateSurfTmByFlatContour( lua_State* L)
LuaCheckParam( L, 1, nParentId) LuaCheckParam( L, 1, nParentId)
int nCrvId ; int nCrvId ;
LuaCheckParam( L, 2, nCrvId) LuaCheckParam( L, 2, nCrvId)
double dLinTol = LIN_TOL_DEF ; double dLinTol = LIN_TOL_SRF ;
if ( lua_gettop( L) >= 3) if ( lua_gettop( L) >= 3)
LuaCheckParam( L, 3, dLinTol) ; LuaCheckParam( L, 3, dLinTol) ;
LuaClearStack( L) ; LuaClearStack( L) ;
@@ -429,7 +622,7 @@ LuaCreateSurfTmByRegion( lua_State* L)
LuaCheckParam( L, 1, nParentId) LuaCheckParam( L, 1, nParentId)
INTVECTOR vCrvIds ; INTVECTOR vCrvIds ;
LuaCheckParam( L, 2, vCrvIds) LuaCheckParam( L, 2, vCrvIds)
double dLinTol = LIN_TOL_DEF ; double dLinTol = LIN_TOL_SRF ;
if ( lua_gettop( L) >= 3) if ( lua_gettop( L) >= 3)
LuaCheckParam( L, 3, dLinTol) ; LuaCheckParam( L, 3, dLinTol) ;
LuaClearStack( L) ; LuaClearStack( L) ;
@@ -454,12 +647,10 @@ LuaCreateSurfTmByExtrusion( lua_State* L)
LuaCheckParam( L, 2, vCrvIds) LuaCheckParam( L, 2, vCrvIds)
Vector3d vtExtr ; Vector3d vtExtr ;
LuaCheckParam( L, 3, vtExtr) LuaCheckParam( L, 3, vtExtr)
double dLinTol = LIN_TOL_DEF ; double dLinTol = LIN_TOL_SRF ;
LuaGetParam( L, 4, dLinTol) ;
int nRefType = RTY_DEFAULT ; int nRefType = RTY_DEFAULT ;
if ( LuaGetParam( L, 4, dLinTol)) LuaGetParam( L, 5, nRefType) ;
LuaGetParam( L, 5, nRefType) ;
else
LuaGetParam( L, 4, nRefType) ;
LuaClearStack( L) ; LuaClearStack( L) ;
// creo STM estrudendo uno o più percorsi, se piani si possono mettere i tappi // creo STM estrudendo uno o più percorsi, se piani si possono mettere i tappi
int nId = ExeCreateSurfTmByExtrusion( nParentId, vCrvIds, vtExtr, int nId = ExeCreateSurfTmByExtrusion( nParentId, vCrvIds, vtExtr,
@@ -483,7 +674,7 @@ LuaCreateSurfTmByRegionExtrusion( lua_State* L)
LuaCheckParam( L, 2, vCrvIds) LuaCheckParam( L, 2, vCrvIds)
Vector3d vtExtr ; Vector3d vtExtr ;
LuaCheckParam( L, 3, vtExtr) LuaCheckParam( L, 3, vtExtr)
double dLinTol = LIN_TOL_DEF ; double dLinTol = LIN_TOL_SRF ;
int nRefType = RTY_DEFAULT ; int nRefType = RTY_DEFAULT ;
if ( LuaGetParam( L, 4, dLinTol)) if ( LuaGetParam( L, 4, dLinTol))
LuaGetParam( L, 5, nRefType) ; LuaGetParam( L, 5, nRefType) ;
@@ -515,7 +706,7 @@ LuaCreateSurfTmByRevolve( lua_State* L)
LuaCheckParam( L, 4, vtAx) LuaCheckParam( L, 4, vtAx)
bool bCapEnds ; bool bCapEnds ;
LuaCheckParam( L, 5, bCapEnds) LuaCheckParam( L, 5, bCapEnds)
double dLinTol = LIN_TOL_DEF ; double dLinTol = LIN_TOL_SRF ;
int nRefType = RTY_DEFAULT ; int nRefType = RTY_DEFAULT ;
if ( LuaGetParam( L, 6, dLinTol)) if ( LuaGetParam( L, 6, dLinTol))
LuaGetParam( L, 7, nRefType) ; LuaGetParam( L, 7, nRefType) ;
@@ -553,7 +744,7 @@ LuaCreateSurfTmByScrewing( lua_State* L)
bool bCapEnds = false ; bool bCapEnds = false ;
if ( LuaGetParam( L, nPar, bCapEnds)) if ( LuaGetParam( L, nPar, bCapEnds))
++ nPar ; ++ nPar ;
double dLinTol = LIN_TOL_DEF ; double dLinTol = LIN_TOL_SRF ;
if ( LuaGetParam( L, nPar, dLinTol)) if ( LuaGetParam( L, nPar, dLinTol))
++ nPar ; ++ nPar ;
int nRefType = RTY_DEFAULT ; int nRefType = RTY_DEFAULT ;
@@ -570,9 +761,76 @@ LuaCreateSurfTmByScrewing( lua_State* L)
return 1 ; return 1 ;
} }
//-------------------------------------------------------------------------------
static int
LuaCreateSurfTmRectSwept( lua_State* L)
{
// 7 o 8 parametri : ParentId, dDimH, dDimV, dBevelH, dBevelV, GuideId, nCapType [, dTol]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
double dDimH ;
LuaCheckParam( L, 2, dDimH)
double dDimV ;
LuaCheckParam( L, 3, dDimV)
double dBevelH ;
LuaCheckParam( L, 4, dBevelH)
double dBevelV ;
LuaCheckParam( L, 5, dBevelV)
int nGuideId ;
LuaCheckParam( L, 6, nGuideId)
int nCapType ;
LuaCheckParam( L, 7, nCapType)
double dLinTol = LIN_TOL_SRF ;
LuaGetParam( L, 8, dLinTol) ;
LuaClearStack( L) ;
// creo STM rectangular swept
int nId = ExeCreateSurfTmRectSwept( nParentId, dDimH, dDimV, dBevelH, dBevelV, nGuideId, nCapType, dLinTol) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
static int static int
LuaCreateSurfTmSwept( lua_State* L) LuaCreateSurfTmSwept( lua_State* L)
{
// 4, 5, 6 o 7 parametri : ParentId, SectId, GuideId [, vtAx], bCapEnds [, dTol] [, nRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
int nSectId ;
LuaCheckParam( L, 2, nSectId)
int nGuideId ;
LuaCheckParam( L, 3, nGuideId)
int nPar = 4 ;
Vector3d vtAx = V_NULL ;
if ( LuaGetParam( L, nPar, vtAx))
++ nPar ;
bool bCapEnds ;
LuaCheckParam( L, nPar, bCapEnds)
++ nPar ;
double dLinTol = LIN_TOL_SRF ;
if ( LuaGetParam( L, nPar, dLinTol))
++ nPar ;
int nRefType = RTY_DEFAULT ;
if ( LuaGetParam( L, nPar, nRefType))
++ nPar ;
LuaClearStack( L) ;
// creo STM swept
int nId = ExeCreateSurfTmSwept( nParentId, nSectId, nGuideId, vtAx, bCapEnds, dLinTol, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateSurfTmTransSwept( lua_State* L)
{ {
// 4 o 5 parametri : ParentId, SectId, GuideId, bCapEnds [, dTol] // 4 o 5 parametri : ParentId, SectId, GuideId, bCapEnds [, dTol]
int nParentId ; int nParentId ;
@@ -583,12 +841,11 @@ LuaCreateSurfTmSwept( lua_State* L)
LuaCheckParam( L, 3, nGuideId) LuaCheckParam( L, 3, nGuideId)
bool bCapEnds ; bool bCapEnds ;
LuaCheckParam( L, 4, bCapEnds) LuaCheckParam( L, 4, bCapEnds)
double dLinTol = LIN_TOL_DEF ; double dLinTol = LIN_TOL_SRF ;
if ( lua_gettop( L) >= 5) LuaGetParam( L, 5, dLinTol) ;
LuaCheckParam( L, 5, dLinTol) ;
LuaClearStack( L) ; LuaClearStack( L) ;
// creo STM swept // creo STM swept di traslazione
int nId = ExeCreateSurfTmSwept( nParentId, nSectId, nGuideId, bCapEnds, dLinTol) ; int nId = ExeCreateSurfTmTransSwept( nParentId, nSectId, nGuideId, bCapEnds, dLinTol) ;
// restituisco il risultato // restituisco il risultato
if ( nId != GDB_ID_NULL) if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ; LuaSetParam( L, nId) ;
@@ -609,7 +866,7 @@ LuaCreateSurfTmRuled( lua_State* L)
int nPtOrCrvId2 ; int nPtOrCrvId2 ;
LuaCheckParam( L, 3, nPtOrCrvId2) LuaCheckParam( L, 3, nPtOrCrvId2)
string sType = "IP" ; string sType = "IP" ;
double dLinTol = LIN_TOL_DEF ; double dLinTol = LIN_TOL_SRF ;
if ( LuaGetParam( L, 4, sType)) if ( LuaGetParam( L, 4, sType))
LuaGetParam( L, 5, dLinTol) ; LuaGetParam( L, 5, dLinTol) ;
else else
@@ -676,26 +933,6 @@ LuaCreateSurfTmBySewing( lua_State* L)
return 1 ; return 1 ;
} }
//-------------------------------------------------------------------------------
static int
LuaCreateSurfTmBySurfBezier( lua_State* L)
{
// 2 parametri : ParentId, nSbezId
int nParentId ;
LuaCheckParam( L, 1, nParentId)
int nZmapId ;
LuaCheckParam( L, 2, nZmapId)
LuaClearStack( L) ;
// creo STM partendo da superficie di Bezier
int nId = ExeCreateSurfTmBySurfBezier( nParentId, nZmapId) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
static int static int
LuaCreateSurfTmByVolZmap( lua_State* L) LuaCreateSurfTmByVolZmap( lua_State* L)
@@ -719,6 +956,29 @@ LuaCreateSurfTmByVolZmap( lua_State* L)
return 1 ; return 1 ;
} }
//-------------------------------------------------------------------------------
static int
LuaCreateSurfShell( lua_State* L)
{
// 4 parametri : nParentId, nSurfId, dThick, dLinTol
int nParentId ;
LuaCheckParam( L, 1, nParentId) ;
int nSurfId ;
LuaCheckParam( L, 2, nSurfId) ;
double dThick ;
LuaCheckParam( L, 3, dThick) ;
double dLinTol ;
LuaCheckParam( L, 4, dLinTol) ;
// creo la STM
int nId = ExeCreateSurfShell( nParentId, nSurfId, dThick, dLinTol) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
static int static int
LuaCreateSurfBezier( lua_State* L) LuaCreateSurfBezier( lua_State* L)
@@ -787,6 +1047,440 @@ LuaCreateSurfBezierRational( lua_State* L)
return 1 ; return 1 ;
} }
//-------------------------------------------------------------------------------
static int
LuaCreateSurfBezierLeaves( lua_State* L)
{
// 2, 3 o 4 parametri : ParentId, nId [, nTextHeight] [, bShowTrim] [, bRefined]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
int nSurfBzId ;
LuaCheckParam( L, 2, nSurfBzId)
int nTextHeight = 50 ;
bool bShowTrim = false ;
bool bRefined = false ;
// testo più due booleani o solo due booleani
if ( LuaGetParam( L, 3, nTextHeight)) {
if ( LuaGetParam( L, 4, bShowTrim))
LuaGetParam( L, 5, bRefined) ;
}
else {
LuaGetParam( L, 3, bShowTrim) ;
LuaGetParam( L, 4, bRefined) ;
}
LuaClearStack( L) ;
// creo la superficie
int nCount = 0 ;
int nId = ExeCreateSurfBezierLeaves( nParentId, nSurfBzId, nTextHeight, bShowTrim, bRefined, &nCount) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL) {
LuaSetParam( L, nId) ;
LuaSetParam( L, nCount) ;
}
else {
LuaSetParam( L) ;
LuaSetParam( L) ;
}
return 2 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateSurfBezierTria2D( lua_State* L)
{
// 2, 3 o 4 parametri : ParentId, nId [, nTextHeight] [, bShowTrim]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
int nSurfBzId ;
LuaCheckParam( L, 2, nSurfBzId)
int nTextHeight = 50 ;
bool bShowTrim = false ;
if ( LuaGetParam( L, 3, nTextHeight))
LuaGetParam( L, 4, bShowTrim) ;
else
LuaGetParam( L, 3, bShowTrim) ;
LuaClearStack( L) ;
// creo la superficie
int nCount = 0 ;
int nId = ExeCreateSurfBezierTria2D( nParentId, nSurfBzId, nTextHeight, bShowTrim, &nCount) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL) {
LuaSetParam( L, nId) ;
LuaSetParam( L, nCount) ;
}
else {
LuaSetParam( L) ;
LuaSetParam( L) ;
}
return 2 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateBezierSphere( lua_State* L)
{
// 3 o 4 parametri : ParentId, ptCenter, dRad [, nRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
Point3d ptCenter ;
LuaCheckParam( L, 2, ptCenter)
double dRad ;
LuaCheckParam( L, 3, dRad)
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 4, nRefType) ;
// creo la superficie
int nCount = 0 ;
int nId = ExeCreateBezierSphere( nParentId, ptCenter, dRad, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL) {
LuaSetParam( L, nId) ;
LuaSetParam( L, nCount) ;
}
else {
LuaSetParam( L) ;
LuaSetParam( L) ;
}
return 2 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateSurfBzByFlatContour( lua_State* L)
{
// 2 o 3 parametri : ParentId, CrvId [, dTol]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
int nCrvId ;
LuaCheckParam( L, 2, nCrvId)
double dLinTol = LIN_TOL_SRF ;
if ( lua_gettop( L) >= 3)
LuaCheckParam( L, 3, dLinTol) ;
LuaClearStack( L) ;
// creo Sbz piana e la trimmo con il contorno
int nId = ExeCreateSurfBzByFlatContour( nParentId, nCrvId, dLinTol) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateSurfBzByRegion( lua_State* L)
{
// 2 o 3 parametri : ParentId, CrvIds [, dTol]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
INTVECTOR vCrvIds ;
LuaCheckParam( L, 2, vCrvIds)
double dLinTol = LIN_TOL_SRF ;
if ( lua_gettop( L) >= 3)
LuaCheckParam( L, 3, dLinTol) ;
LuaClearStack( L) ;
// creo una Sbz piana a cui aggiungo le curve come trim
int nId = ExeCreateSurfBzByRegion( nParentId, vCrvIds, dLinTol) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateSurfBzByExtrusion( lua_State* L)
{
// 3 o 4 o 5 o 6 parametri : ParentId, CrvId, vtExtr [, bool bCapEnds] [, dTol] [, nRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
int nCrvId ;
LuaCheckParam( L, 2, nCrvId)
Vector3d vtExtr ;
LuaCheckParam( L, 3, vtExtr)
bool bCapEnds = false ;
int nPar = 4 ;
if ( LuaGetParam( L, nPar, bCapEnds))
++ nPar ;
double dLinTol = LIN_TOL_SRF ;
if ( LuaGetParam( L, nPar, dLinTol))
++ nPar ;
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, nPar, nRefType) ;
LuaClearStack( L) ;
// creo SurfBezier estrudendo un percorso, se piano si possono mettere i tappi
int nCount = 0 ;
int nId = ExeCreateSurfBzByExtrusion( nParentId, nCrvId, vtExtr, bCapEnds, dLinTol, nRefType, &nCount) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
LuaSetParam( L, nCount) ;
return 2 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateSurfBzByRegionExtrusion( lua_State* L)
{
// 3 o 4 o 5 o 6 parametri : ParentId, CrvIds, vtExtr [, bool bCapEnds] [, dTol] [, nRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
INTVECTOR vCrvIds ;
LuaCheckParam( L, 2, vCrvIds)
Vector3d vtExtr ;
LuaCheckParam( L, 3, vtExtr)
bool bCapEnds = false ;
int nPar = 4 ;
if ( LuaGetParam( L, nPar, bCapEnds))
++ nPar ;
double dLinTol = LIN_TOL_SRF ;
if ( LuaGetParam( L, nPar, dLinTol))
++ nPar ;
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, nPar, nRefType) ;
LuaClearStack( L) ;
// creo STM estrudendo uno o più percorsi, se piani si possono mettere i tappi
int nId = ExeCreateSurfBzByRegionExtrusion( nParentId, vCrvIds, vtExtr, bCapEnds, dLinTol, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateSurfBzByScrewing( lua_State* L)
{
// 6 o 7 o 8 o 9 parametri : ParentId, CrvId, ptAx, vtAx, dAngRotDeg, dMove [, bCapEnds] [, dTol] [, nRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
int nCrvId ;
LuaCheckParam( L, 2, nCrvId)
Point3d ptAx ;
LuaCheckParam( L, 3, ptAx)
Vector3d vtAx ;
LuaCheckParam( L, 4, vtAx)
double dAngRotDeg ;
LuaCheckParam( L, 5, dAngRotDeg)
double dMove ;
LuaCheckParam( L, 6, dMove)
int nPar = 7 ;
bool bCapEnds = false ;
if ( LuaGetParam( L, nPar, bCapEnds))
++ nPar ;
double dLinTol = LIN_TOL_SRF ;
if ( LuaGetParam( L, nPar, dLinTol))
++ nPar ;
int nRefType = RTY_DEFAULT ;
if ( LuaGetParam( L, nPar, nRefType))
++ nPar ;
LuaClearStack( L) ;
// creo STM riempiendo un contorno piano
int nId = ExeCreateSurfBzByScrewing( nParentId, nCrvId, ptAx, vtAx, dAngRotDeg, dMove, bCapEnds, dLinTol, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateSurfBzByRevolve( lua_State* L)
{
// 4 o 5 o 6 o 7 parametri : ParentId, CrvId, ptAx, vtAx [, bCapEnds] [, dTol] [, nRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
int nCrvId ;
LuaCheckParam( L, 2, nCrvId)
Point3d ptAx ;
LuaCheckParam( L, 3, ptAx)
Vector3d vtAx ;
LuaCheckParam( L, 4, vtAx)
int nPar = 5 ;
bool bCapEnds = false ;
if ( LuaGetParam( L, nPar, bCapEnds))
++ nPar ;
double dLinTol = LIN_TOL_SRF ;
if ( LuaGetParam( L, nPar, dLinTol))
++ nPar ;
int nRefType = RTY_DEFAULT ;
if ( LuaGetParam( L, nPar, nRefType))
++ nPar ;
LuaClearStack( L) ;
// creo STM riempiendo un contorno piano
int nId = ExeCreateSurfBzByRevolve( nParentId, nCrvId, ptAx, vtAx, bCapEnds, dLinTol, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateSurfBzByPointCurve( lua_State* L)
{
// 4 o 5 o 6 o 7 parametri : ParentId, CrvId, ptAx, vtAx [, bCapEnds] [, dTol] [, nRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
int nCrvId ;
LuaCheckParam( L, 2, nCrvId)
Point3d ptTop ;
LuaCheckParam( L, 3, ptTop)
int nPar = 4 ;
bool bCapEnds = false ;
if ( LuaGetParam( L, nPar, bCapEnds))
++ nPar ;
double dLinTol = LIN_TOL_SRF ;
if ( LuaGetParam( L, nPar, dLinTol))
++ nPar ;
int nRefType = RTY_DEFAULT ;
if ( LuaGetParam( L, nPar, nRefType))
++ nPar ;
LuaClearStack( L) ;
// creo STM riempiendo un contorno piano
int nId = ExeCreateSurfBzByPointCurve( nParentId, nCrvId, ptTop, bCapEnds, dLinTol, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateSurfBzRuled( lua_State* L)
{
// 4 o 5 o 6 parametri : ParentId, CrvId1, CrvId2, nRuledType [, bCapEnds] [, dTol]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
int nCrvId1 ;
LuaCheckParam( L, 2, nCrvId1)
int nCrvId2 ;
LuaCheckParam( L, 3, nCrvId2)
int nRuledType ;
LuaCheckParam( L, 4, nRuledType)
bool bCapEnds = false ;
int nPar = 5 ;
if ( LuaGetParam( L, nPar, bCapEnds))
++ nPar ;
double dLinTol = LIN_TOL_SRF ;
LuaGetParam( L, nPar, dLinTol) ;
LuaClearStack( L) ;
// creo una surf bezier come rigata tra le due curve passate
int nId = ExeCreateSurfBzRuled( nParentId, nCrvId1, nCrvId2, nRuledType, bCapEnds, dLinTol) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateSurfBzRuledGuided( lua_State* L)
{
// 4 o 5 o 6 parametri : ParentId, CrvId1, CrvId2, nLayGuides [, bCapEnds] [, dTol]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
int nCrvId1 ;
LuaCheckParam( L, 2, nCrvId1)
int nCrvId2 ;
LuaCheckParam( L, 3, nCrvId2)
int nLayGuides ;
LuaCheckParam( L, 4, nLayGuides)
bool bCapEnds = false ;
int nPar = 5 ;
if ( LuaGetParam( L, nPar, bCapEnds))
++ nPar ;
double dLinTol = LIN_TOL_SRF ;
LuaGetParam( L, nPar, dLinTol) ;
LuaClearStack( L) ;
BIPNTVECTOR vGuides ;
// creo una surf bezier come rigata tra le due curve passate, usando le isocurve nel layer nLayIso
int nId = ExeCreateSurfBzRuledGuided( nParentId, nCrvId1, nCrvId2, vGuides, bCapEnds, dLinTol, nLayGuides) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateSurfBzSkinned( lua_State* L)
{
// 2 o 3 o 4 parametri : ParentId, vCrvIds [, bCapEnds] [, dTol]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
INTVECTOR vCrvIds ;
LuaCheckParam( L, 2, vCrvIds)
bool bCapEnds = false ;
int nPar = 3 ;
if ( LuaGetParam( L, nPar, bCapEnds))
++ nPar ;
double dLinTol = LIN_TOL_SRF ;
LuaGetParam( L, nPar, dLinTol) ;
LuaClearStack( L) ;
// creo STM riempiendo un contorno piano
int nId = ExeCreateSurfBzSkinned( nParentId, vCrvIds, bCapEnds, dLinTol) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateSurfBzSwept( lua_State* L)
{
// 3 o 4 o 5 o 6 o 7 parametri : ParentId, nSectCrvId, nGuideCrvId [, vtAx] [, bCapEnds] [, dTol] [, nRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
int nSectId ;
LuaCheckParam( L, 2, nSectId)
int nGuideId ;
LuaCheckParam( L, 3, nGuideId)
Vector3d vtAx = V_NULL ;
int nPar = 4 ;
if ( LuaGetParam( L, nPar, vtAx))
++ nPar ;
bool bCapEnds = false ;
if ( LuaGetParam( L, nPar, bCapEnds))
++ nPar ;
double dLinTol = LIN_TOL_SRF ;
if ( LuaGetParam( L, nPar, dLinTol))
++ nPar ;
int nRefType = RTY_DEFAULT ;
if ( LuaGetParam( L, nPar, dLinTol))
++ nPar ;
LuaClearStack( L) ;
// creo STM riempiendo un contorno piano
int nId = ExeCreateSurfBzSwept( nParentId, nSectId, nGuideId, vtAx, bCapEnds, dLinTol, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
bool bool
LuaInstallGdbCreateSurf( LuaMgr& luaMgr) LuaInstallGdbCreateSurf( LuaMgr& luaMgr)
@@ -798,6 +1492,7 @@ LuaInstallGdbCreateSurf( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrDisk", LuaCreateSurfFrDisk) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrDisk", LuaCreateSurfFrDisk) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrFatCurve", LuaCreateSurfFrFatCurve) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrFatCurve", LuaCreateSurfFrFatCurve) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFlatRegion", LuaCreateSurfFlatRegion) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFlatRegion", LuaCreateSurfFlatRegion) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmEmpty", LuaCreateSurfTmEmpty) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmPlaneInBBox", LuaCreateSurfTmPlaneInBBox) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmPlaneInBBox", LuaCreateSurfTmPlaneInBBox) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmConvexHullInBBox", LuaCreateSurfTmConvexHullInBBox) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmConvexHullInBBox", LuaCreateSurfTmConvexHullInBBox) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmBBox", LuaCreateSurfTmBBox) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmBBox", LuaCreateSurfTmBBox) ;
@@ -806,19 +1501,41 @@ LuaInstallGdbCreateSurf( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmCylinder", LuaCreateSurfTmCylinder) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmCylinder", LuaCreateSurfTmCylinder) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmCone", LuaCreateSurfTmCone) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmCone", LuaCreateSurfTmCone) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSphere", LuaCreateSurfTmSphere) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSphere", LuaCreateSurfTmSphere) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmPyramidFrustum", LuaCreateSurfTmPyramidFrustum) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmConeFrustum", LuaCreateSurfTmConeFrustum) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmTriangle", LuaCreateSurfTmTriangle) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmRectangle", LuaCreateSurfTmRectangle) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByPolygon", LuaCreateSurfTmByPolygon) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByPolygonWithHoles", LuaCreateSurfTmByPolygonWithHoles) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByFlatContour", LuaCreateSurfTmByFlatContour) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByFlatContour", LuaCreateSurfTmByFlatContour) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByRegion", LuaCreateSurfTmByRegion) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByRegion", LuaCreateSurfTmByRegion) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByExtrusion", LuaCreateSurfTmByExtrusion) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByExtrusion", LuaCreateSurfTmByExtrusion) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByRegionExtrusion", LuaCreateSurfTmByRegionExtrusion) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByRegionExtrusion", LuaCreateSurfTmByRegionExtrusion) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByRevolve", LuaCreateSurfTmByRevolve) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByRevolve", LuaCreateSurfTmByRevolve) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByScrewing", LuaCreateSurfTmByScrewing) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByScrewing", LuaCreateSurfTmByScrewing) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmRectSwept", LuaCreateSurfTmRectSwept) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSwept", LuaCreateSurfTmSwept) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSwept", LuaCreateSurfTmSwept) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmTransSwept", LuaCreateSurfTmTransSwept) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmRuled", LuaCreateSurfTmRuled) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmRuled", LuaCreateSurfTmRuled) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByTriangles", LuaCreateSurfTmByTriangles) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByTriangles", LuaCreateSurfTmByTriangles) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmBySewing", LuaCreateSurfTmBySewing) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmBySewing", LuaCreateSurfTmBySewing) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmBySurfBezier", LuaCreateSurfTmBySurfBezier) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByVolZmap", LuaCreateSurfTmByVolZmap) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByVolZmap", LuaCreateSurfTmByVolZmap) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmShell", LuaCreateSurfShell) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezier", LuaCreateSurfBezier) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezier", LuaCreateSurfBezier) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierRat", LuaCreateSurfBezierRational) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierRat", LuaCreateSurfBezierRational) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierLeaves", LuaCreateSurfBezierLeaves) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierTria2D", LuaCreateSurfBezierTria2D) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBzSphere", LuaCreateBezierSphere) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBzByFlatContour", LuaCreateSurfBzByFlatContour) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBzByRegion", LuaCreateSurfBzByRegion) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBzByExtrusion", LuaCreateSurfBzByExtrusion) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBzByRegionExtrusion", LuaCreateSurfBzByRegionExtrusion) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBzByScrewing", LuaCreateSurfBzByScrewing) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBzByRevolve", LuaCreateSurfBzByRevolve) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBzByPointCurve", LuaCreateSurfBzByPointCurve) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBzRuled", LuaCreateSurfBzRuled) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBzRuledGuided", LuaCreateSurfBzRuledGuided) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBzSkinned", LuaCreateSurfBzSkinned) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBzSwept", LuaCreateSurfBzSwept) ;
return bOk ; return bOk ;
} }
+45 -3
View File
@@ -14,6 +14,7 @@
//--------------------------- Include ---------------------------------------- //--------------------------- Include ----------------------------------------
#include "stdafx.h" #include "stdafx.h"
#include "LUA.h" #include "LUA.h"
#include "/EgtDev/Include/EGkSurfTriMesh.h"
#include "/EgtDev/Include/EXeExecutor.h" #include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EXeConst.h" #include "/EgtDev/Include/EXeConst.h"
#include "/EgtDev/Include/EGkLuaAux.h" #include "/EgtDev/Include/EGkLuaAux.h"
@@ -54,6 +55,42 @@ LuaCreateVolZmapBox( lua_State* L)
return 1 ; return 1 ;
} }
//-------------------------------------------------------------------------------
static int
LuaCreateVolZmapEmpty( lua_State* L)
{
// 6 o 7 o 8 parametri : ParentId, PtIni, dDimX, dDimY, dDimZ, dPrec [, bTriDex] [, nRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
Point3d ptIni ;
LuaCheckParam( L, 2, ptIni)
double dDimX ;
LuaCheckParam( L, 3, dDimX)
double dDimY ;
LuaCheckParam( L, 4, dDimY)
double dDimZ ;
LuaCheckParam( L, 5, dDimZ)
double dPrec ;
LuaCheckParam( L, 6, dPrec)
bool bTriDex = true ;
int nRefType = RTY_DEFAULT ;
if ( ! LuaGetParam( L, 7, bTriDex))
LuaGetParam( L, 7, nRefType) ;
else
LuaGetParam( L, 8, nRefType) ;
LuaClearStack( L) ;
// creo VZM parallelepipedo
int nId = ExeCreateVolZmapEmpty( nParentId, ptIni, dDimX, dDimY, dDimZ, dPrec, bTriDex, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
static int static int
LuaCreateVolZmapByRegionExtrusion( lua_State* L) LuaCreateVolZmapByRegionExtrusion( lua_State* L)
@@ -84,7 +121,7 @@ LuaCreateVolZmapByRegionExtrusion( lua_State* L)
static int static int
LuaCreateVolZmapFromSurfTm( lua_State* L) LuaCreateVolZmapFromSurfTm( lua_State* L)
{ {
// 3 o 4 parametri : ParentId, StmId, dPrec [, bTriDex] // 3 o 4 o 5 parametri : ParentId, StmId, dPrec [, bTriDex] [, dExtraBox]
int nParentId ; int nParentId ;
LuaCheckParam( L, 1, nParentId) LuaCheckParam( L, 1, nParentId)
int nStmId ; int nStmId ;
@@ -92,10 +129,14 @@ LuaCreateVolZmapFromSurfTm( lua_State* L)
double dPrec ; double dPrec ;
LuaCheckParam( L, 3, dPrec) LuaCheckParam( L, 3, dPrec)
bool bTriDex = true ; bool bTriDex = true ;
LuaGetParam( L, 4, bTriDex) ; double dExtraBox = 0 ;
if ( LuaGetParam( L, 4, bTriDex))
LuaGetParam( L, 5, dExtraBox) ;
else
LuaGetParam( L, 4, dExtraBox) ;
LuaClearStack( L) ; LuaClearStack( L) ;
// creo VZM da superficie trimesh // creo VZM da superficie trimesh
int nId = ExeCreateVolZmapFromSurfTm( nParentId, nStmId, dPrec, bTriDex) ; int nId = ExeCreateVolZmapFromSurfTm( nParentId, nStmId, dPrec, bTriDex, dExtraBox) ;
// restituisco il risultato // restituisco il risultato
if ( nId != GDB_ID_NULL) if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ; LuaSetParam( L, nId) ;
@@ -110,6 +151,7 @@ LuaInstallGdbCreateVol( LuaMgr& luaMgr)
{ {
bool bOk = ( &luaMgr != nullptr) ; bool bOk = ( &luaMgr != nullptr) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapBox", LuaCreateVolZmapBox) ; bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapBox", LuaCreateVolZmapBox) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapEmpty", LuaCreateVolZmapEmpty) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapByRegionExtrusion", LuaCreateVolZmapByRegionExtrusion) ; bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapByRegionExtrusion", LuaCreateVolZmapByRegionExtrusion) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapFromSurfTm", LuaCreateVolZmapFromSurfTm) ; bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapFromSurfTm", LuaCreateVolZmapFromSurfTm) ;
return bOk ; return bOk ;
+173 -4
View File
@@ -57,6 +57,25 @@ LuaCurveLength( lua_State* L)
return 1 ; return 1 ;
} }
//----------------------------------------------------------------------------
static int
LuaCurveLengthAtParam( lua_State* L)
{
// 2 parametri : Id, dPar
int nId ;
LuaCheckParam( L, 1, nId)
double dPar ;
LuaCheckParam( L, 2, dPar) ;
LuaClearStack( L) ;
// recupero la lunghezza della curva
double dLen ;
if ( ExeCurveLengthAtParam( nId, dPar, &dLen))
LuaSetParam( L, dLen) ;
else
LuaSetParam( L) ;
return 1 ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static int static int
LuaCurveParamAtLength( lua_State* L) LuaCurveParamAtLength( lua_State* L)
@@ -142,7 +161,7 @@ LuaCurveIsACircle( lua_State* L)
double dToler = EPS_SMALL ; double dToler = EPS_SMALL ;
LuaGetParam( L, 2, dToler) ; LuaGetParam( L, 2, dToler) ;
LuaClearStack( L) ; LuaClearStack( L) ;
// verifico se curva è equivalente ad una circonferenza // verifico se curva equivalente ad una circonferenza
Point3d ptCen ; Point3d ptCen ;
Vector3d vtN ; Vector3d vtN ;
double dRad ; double dRad ;
@@ -166,7 +185,7 @@ LuaCurveIsARectangle( lua_State* L)
double dToler = EPS_SMALL ; double dToler = EPS_SMALL ;
LuaGetParam( L, 2, dToler) ; LuaGetParam( L, 2, dToler) ;
LuaClearStack( L) ; LuaClearStack( L) ;
// verifico se curva è equivalente ad un rettangolo // verifico se curva equivalente ad un rettangolo
Point3d ptP ; Point3d ptP ;
Vector3d vtL1 ; Vector3d vtL1 ;
Vector3d vtL2 ; Vector3d vtL2 ;
@@ -188,7 +207,7 @@ LuaCurveIsATrapezoid( lua_State* L)
double dToler = EPS_SMALL ; double dToler = EPS_SMALL ;
LuaGetParam( L, 2, dToler) ; LuaGetParam( L, 2, dToler) ;
LuaClearStack( L) ; LuaClearStack( L) ;
// verifico se curva è equivalente ad un trapezio // verifico se curva equivalente ad un trapezio
Point3d ptP ; Point3d ptP ;
Vector3d vtB1 ; Vector3d vtB1 ;
Vector3d vtL1 ; Vector3d vtL1 ;
@@ -242,6 +261,23 @@ LuaCurveArea( lua_State* L)
} }
} }
//----------------------------------------------------------------------------
static int
LuaCurveMaxOffset( lua_State* L)
{
// 2 parametri : Id
int nId ;
LuaCheckParam( L, 1, nId)
LuaClearStack( L) ;
// recupero la sua area senza eventuali buchi
double dMaxOffset ;
if ( ExeCurveMaxOffset( nId, dMaxOffset))
LuaSetParam( L, dMaxOffset) ;
else
LuaSetParam( L) ;
return 1 ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static int static int
LuaCurveExtrusion( lua_State* L) LuaCurveExtrusion( lua_State* L)
@@ -432,6 +468,25 @@ LuaArcNormVersor( lua_State* L)
return 1 ; return 1 ;
} }
//----------------------------------------------------------------------------
static int
LuaCurveCompoLength( lua_State* L)
{
// 2 parametri : Id, nCrv
int nId ;
LuaCheckParam( L, 1, nId)
int nCrv ;
LuaCheckParam( L, 2, nCrv)
LuaClearStack( L) ;
// recupero il centro della curva semplice indicizzata
double dLen ;
if ( ExeCurveCompoLength( nId, nCrv, dLen))
LuaSetParam( L, dLen) ;
else
LuaSetParam( L) ;
return 1 ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static int static int
LuaCurveCompoCenter( lua_State* L) LuaCurveCompoCenter( lua_State* L)
@@ -503,7 +558,7 @@ LuaCurveCompoNormVersor( lua_State* L)
int nRefId = nId ; int nRefId = nId ;
LuaGetParam( L, 3, nRefId) ; LuaGetParam( L, 3, nRefId) ;
LuaClearStack( L) ; LuaClearStack( L) ;
// recupero l'angolo al centro della curva semplice indicizzata // recupero il versore normale della curva semplice indicizzata (non nullo solo se arco)
Vector3d vtNorm ; Vector3d vtNorm ;
if ( ExeCurveCompoNormVersor( nId, nCrv, nRefId, vtNorm)) if ( ExeCurveCompoNormVersor( nId, nCrv, nRefId, vtNorm))
LuaSetParam( L, vtNorm) ; LuaSetParam( L, vtNorm) ;
@@ -512,6 +567,112 @@ LuaCurveCompoNormVersor( lua_State* L)
return 1 ; return 1 ;
} }
//----------------------------------------------------------------------------
static int
LuaCurveCompoGetTempProp( lua_State* L)
{
// 1 o 2 parametri : Id [, nPropInd]
int nId ;
LuaCheckParam( L, 1, nId)
int nPropInd = 0 ;
LuaGetParam( L, 2, nPropInd) ;
LuaClearStack( L) ;
// recupero il vettore delle proprietà temporanee di indice dato
INTVECTOR vProp ;
if ( ExeCurveCompoGetTempProp( nId, vProp, nPropInd))
LuaSetParam( L, vProp) ;
else
LuaSetParam( L) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaCurveCompoGetTempParam( lua_State* L)
{
// 1 o 2 parametri : Id [, nParamInd]
int nId ;
LuaCheckParam( L, 1, nId)
int nParamInd = 0 ;
LuaGetParam( L, 2, nParamInd) ;
LuaClearStack( L) ;
// recupero il vettore dei parametri temporanei di indice dato
DBLVECTOR vParam ;
if ( ExeCurveCompoGetTempParam( nId, vParam, nParamInd))
LuaSetParam( L, vParam) ;
else
LuaSetParam( L) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaShowCurveBezierControlPoints( lua_State* L)
{
// 2 parametri : nCrvId, nDestGrpId
int nCrvId ;
LuaCheckParam( L, 1, nCrvId)
int nDestGrpId ;
LuaCheckParam( L, 2, nDestGrpId)
LuaClearStack( L) ;
int nCount = 0 ;
int nId = ExeShowCurveBezierControlPoints( nCrvId, nDestGrpId, &nCount) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL) {
LuaSetParam( L, nId) ;
LuaSetParam( L, nCount) ;
}
else {
LuaSetParam( L) ;
LuaSetParam( L) ;
}
return 2 ;
}
//----------------------------------------------------------------------------
static int
LuaCopyCompoSubCurve( lua_State* L)
{
// 3 parametri : nCrvId, nSubCrvToCopy, nDestGrpId
int nCrvId ;
LuaCheckParam( L, 1, nCrvId)
int nSubCrvToCopy ;
LuaCheckParam( L, 2, nSubCrvToCopy)
int nDestGrpId ;
LuaCheckParam( L, 3, nDestGrpId)
LuaClearStack( L) ;
int nId = ExeCopyCompoSubCurve( nCrvId, nSubCrvToCopy, nDestGrpId) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaCopyParamRange( lua_State* L)
{
// 4 parametri : nCrvId, dUStart, dUEnd, nDestGrpId
int nCrvId ;
LuaCheckParam( L, 1, nCrvId)
double dUStart ;
LuaCheckParam( L, 2, dUStart)
double dUEnd ;
LuaCheckParam( L, 3, dUEnd)
int nDestGrpId ;
LuaCheckParam( L, 4, nDestGrpId)
LuaClearStack( L) ;
int nId = ExeCopyParamRange( nCrvId, dUStart, dUEnd, nDestGrpId) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
bool bool
LuaInstallGdbGetCurve( LuaMgr& luaMgr) LuaInstallGdbGetCurve( LuaMgr& luaMgr)
@@ -519,6 +680,7 @@ LuaInstallGdbGetCurve( LuaMgr& luaMgr)
bool bOk = ( &luaMgr != nullptr) ; bool bOk = ( &luaMgr != nullptr) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveDomain", LuaCurveDomain) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCurveDomain", LuaCurveDomain) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveLength", LuaCurveLength) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCurveLength", LuaCurveLength) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveLengthAtParam", LuaCurveLengthAtParam) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveParamAtLength", LuaCurveParamAtLength) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCurveParamAtLength", LuaCurveParamAtLength) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveParamAtPoint", LuaCurveParamAtPoint) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCurveParamAtPoint", LuaCurveParamAtPoint) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveIsClosed", LuaCurveIsClosed) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCurveIsClosed", LuaCurveIsClosed) ;
@@ -528,6 +690,7 @@ LuaInstallGdbGetCurve( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveIsATrapezoid", LuaCurveIsATrapezoid) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCurveIsATrapezoid", LuaCurveIsATrapezoid) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveAreaXY", LuaCurveAreaXY) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCurveAreaXY", LuaCurveAreaXY) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveArea", LuaCurveArea) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCurveArea", LuaCurveArea) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveMaxOffset", LuaCurveMaxOffset) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveExtrusion", LuaCurveExtrusion) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCurveExtrusion", LuaCurveExtrusion) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveThickness", LuaCurveThickness) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCurveThickness", LuaCurveThickness) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveSelfIntersCount", LuaCurveSelfIntersCount) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCurveSelfIntersCount", LuaCurveSelfIntersCount) ;
@@ -538,9 +701,15 @@ LuaInstallGdbGetCurve( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtArcAngCenter", LuaArcAngCenter) ; bOk = bOk && luaMgr.RegisterFunction( "EgtArcAngCenter", LuaArcAngCenter) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtArcDeltaN", LuaArcDeltaN) ; bOk = bOk && luaMgr.RegisterFunction( "EgtArcDeltaN", LuaArcDeltaN) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtArcNormVersor", LuaArcNormVersor) ; bOk = bOk && luaMgr.RegisterFunction( "EgtArcNormVersor", LuaArcNormVersor) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCompoLength", LuaCurveCompoLength) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCompoCenter", LuaCurveCompoCenter) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCompoCenter", LuaCurveCompoCenter) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCompoRadius", LuaCurveCompoRadius) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCompoRadius", LuaCurveCompoRadius) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCompoAngCenter", LuaCurveCompoAngCenter) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCompoAngCenter", LuaCurveCompoAngCenter) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCompoNormVersor", LuaCurveCompoNormVersor) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCompoNormVersor", LuaCurveCompoNormVersor) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCompoGetTempProp", LuaCurveCompoGetTempProp) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCompoGetTempParam", LuaCurveCompoGetTempParam) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtShowCurveBezierControlPoints", LuaShowCurveBezierControlPoints) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCopyCompoSubCurve", LuaCopyCompoSubCurve) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCopyParamRange", LuaCopyParamRange) ;
return bOk ; return bOk ;
} }
+90
View File
@@ -0,0 +1,90 @@
//----------------------------------------------------------------------------
// EgalTech 2023-2023
//----------------------------------------------------------------------------
// File : LUA_GdbGetPocketing.cpp Data : 28.11.23 Versione : 2.5k6
// Contenuto : Funzioni di creazione percorsi di svuotatura o infill per LUA.
//
//
//
// Modifiche : 29.11.23 RE Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "LUA.h"
#include "/EgtDev/Include/EXeExecutor.h"
using namespace std ;
//----------------------------------------------------------------------------
static int
LuaPocketing( lua_State* L) {
// 7 parametri : nId, dRad, dStep, dAngle, nType, bSmooth, nDestGrpId
int nId ;
LuaCheckParam( L, 1, nId) ;
double dRad ;
LuaCheckParam( L, 2, dRad) ;
double dStep ;
LuaCheckParam( L, 3, dStep) ;
double dAngle ;
LuaCheckParam( L, 4, dAngle) ;
int nType ;
LuaCheckParam( L, 5, nType) ;
bool bSmooth ;
LuaCheckParam( L, 6, bSmooth) ;
int nDestGrpId ;
LuaCheckParam( L, 7, nDestGrpId) ;
LuaClearStack( L) ;
// calcolo delle curve elementari di svuotatura
int nFirstId = GDB_ID_NULL ;
int nCrvCount = 0 ;
bool bOk = ExePocketing( nId, dRad, dStep, dAngle, nType, bSmooth, nDestGrpId, nFirstId, nCrvCount) ;
if ( ! bOk)
LuaSetParam( L) ;
else
LuaSetParam( L, nFirstId) ;
LuaSetParam( L, nCrvCount) ;
return 2 ;
}
//----------------------------------------------------------------------------
static int
LuaSurfFrGetZigZagInfill( lua_State* L)
{
// 6 parametri : nId, nDestGrpId, dSideStep, dAng, bSmooth, bRemoveOverlapLink
int nId ;
LuaCheckParam( L, 1, nId)
int nDestGrpId ;
LuaCheckParam( L, 2, nDestGrpId)
double dStep ;
LuaCheckParam( L, 3, dStep)
double dAng ;
LuaCheckParam( L, 4, dAng) ;
bool bSmooth ;
LuaCheckParam( L, 5, bSmooth) ;
bool bRemoveOverlapLink ;
LuaCheckParam( L, 6, bRemoveOverlapLink) ;
LuaClearStack( L) ;
// recupero i contorni della superficie
int nCount = 0 ;
int nNewId = ExeSurfFrGetZigZagInfill( nId, nDestGrpId, dStep, dAng, bSmooth, bRemoveOverlapLink, &nCount) ;
// restituisco il risultato
if ( nNewId != GDB_ID_NULL)
LuaSetParam( L, nNewId) ;
else
LuaSetParam( L) ;
LuaSetParam( L, nCount) ;
return 2 ;
}
//-------------------------------------------------------------------------------
bool
LuaInstallGdbGetPocketing( LuaMgr& luaMgr)
{
bool bOk = ( &luaMgr != nullptr) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtPocketing", LuaPocketing) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetSurfFrZigZagInfill", LuaSurfFrGetZigZagInfill) ;
return bOk ;
}
+442 -31
View File
@@ -40,6 +40,20 @@ LuaSurfArea( lua_State* L)
return 1 ; return 1 ;
} }
//----------------------------------------------------------------------------
static int
LuaSurfIsClosed( lua_State* L)
{
// 1 parametro : Id
int nId ;
LuaCheckParam( L, 1, nId)
LuaClearStack( L) ;
// verifico se superficie chiusa
bool bOk = ExeSurfIsClosed( nId) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static int static int
LuaSurfVolume( lua_State* L) LuaSurfVolume( lua_State* L)
@@ -107,6 +121,25 @@ LuaSurfFrChunkCount( lua_State* L)
return 1 ; return 1 ;
} }
//----------------------------------------------------------------------------
static int
LuaSurfFrChunkMaxOffset( lua_State* L)
{
// 2 parametri : Id, nChunk
int nId ;
LuaCheckParam( L, 1, nId)
int nChunk ;
LuaCheckParam( L, 2, nChunk)
LuaClearStack( L) ;
// recupero la sua area senza eventuali buchi
double dMaxOffset ;
if ( ExeSurfFrChunkMaxOffset( nId, nChunk, dMaxOffset))
LuaSetParam( L, dMaxOffset) ;
else
LuaSetParam( L) ;
return 1 ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static int static int
LuaSurfFrChunkSimpleClassify( lua_State* L) LuaSurfFrChunkSimpleClassify( lua_State* L)
@@ -185,7 +218,7 @@ LuaSurfFrMoveSimpleNoCollision( lua_State* L)
int nRefType = RTY_DEFAULT ; int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 4, nRefType) ; LuaGetParam( L, 4, nRefType) ;
LuaClearStack( L) ; LuaClearStack( L) ;
// verifico quale è la massima traslazione possibile // verifico quale la massima traslazione possibile
double dLen = vtMove.Len() ; double dLen = vtMove.Len() ;
Vector3d vtDir = ( dLen > EPS_SMALL ? vtMove / dLen : V_NULL) ; Vector3d vtDir = ( dLen > EPS_SMALL ? vtMove / dLen : V_NULL) ;
bool bOk = ExeSurfFrMoveSimpleNoCollision( nId1, nId2, vtDir, dLen, nRefType) ; bool bOk = ExeSurfFrMoveSimpleNoCollision( nId1, nId2, vtDir, dLen, nRefType) ;
@@ -213,7 +246,7 @@ LuaSurfFrRotateSimpleNoCollision( lua_State* L)
int nRefType = RTY_DEFAULT ; int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 5, nRefType) ; LuaGetParam( L, 5, nRefType) ;
LuaClearStack( L) ; LuaClearStack( L) ;
// verifico quale è la massima (in valore assoluto) rotazione possibile // verifico quale la massima (in valore assoluto) rotazione possibile
bool bOk = ExeSurfFrRotateSimpleNoCollision( nId1, nId2, ptCen, dAngDeg, nRefType) ; bool bOk = ExeSurfFrRotateSimpleNoCollision( nId1, nId2, ptCen, dAngDeg, nRefType) ;
// restituisco il risultato // restituisco il risultato
if ( bOk) if ( bOk)
@@ -223,35 +256,18 @@ LuaSurfFrRotateSimpleNoCollision( lua_State* L)
return 1 ; return 1 ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static int static int
LuaSurfFrGetZigZagInfill( lua_State* L) LuaSurfTmVertexCount( lua_State* L)
{ {
// 6 parametri : nId, nDestGrpId, dSideStep, dAng, bAllowStepCorrection, bInvert // 1 parametro : Id
int nId ; int nId ;
LuaCheckParam( L, 1, nId) LuaCheckParam( L, 1, nId)
int nDestGrpId ;
LuaCheckParam( L, 2, nDestGrpId)
double dStep ;
LuaCheckParam( L, 3, dStep)
double dAng ;
LuaCheckParam( L, 4, dAng) ;
bool bStepCorrection ;
LuaCheckParam( L, 5, bStepCorrection)
bool bInvert ;
LuaCheckParam( L, 6, bInvert)
LuaClearStack( L) ; LuaClearStack( L) ;
// recupero i contorni della superficie // recupero il numero di vertici della superficie trimesh
int nCount = 0 ; int nNbr = ExeSurfTmVertexCount( nId) ;
int nNewId = ExeSurfFrGetZigZagInfill( nId, nDestGrpId, dStep, dAng, bStepCorrection, bInvert, &nCount) ; LuaSetParam( L, nNbr) ;
// restituisco il risultato return 1 ;
if ( nNewId != GDB_ID_NULL)
LuaSetParam( L, nNewId) ;
else
LuaSetParam( L) ;
LuaSetParam( L, nCount) ;
return 2 ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -268,6 +284,112 @@ LuaSurfTmFacetCount( lua_State* L)
return 1 ; return 1 ;
} }
//----------------------------------------------------------------------------
static int
LuaSurfTmPartCount( lua_State* L)
{
// 1 parametro : Id
int nId ;
LuaCheckParam( L, 1, nId)
LuaClearStack( L) ;
// recupero il numero di parti della superficie trimesh
int nParts = ExeSurfTmPartCount( nId) ;
if ( nParts >= 0)
LuaSetParam( L, nParts) ;
else
LuaSetParam( L) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaSurfTmGetPartAndShellFromFacet( lua_State* L)
{
// 2 parametri : Id SurfTm, Id Facet
int nIdSurfTm ;
LuaCheckParam( L, 1, nIdSurfTm)
int nIdFacet ;
LuaCheckParam( L, 2, nIdFacet)
LuaClearStack( L) ;
// recupero il numero di parti della superficie trimesh
int nPart = - 1 ;
int nShell = - 1 ;
ExeSurfTmGetPartAndShellFromFacet( nIdSurfTm, nIdFacet, nPart, nShell) ;
LuaSetParam( L, nPart) ;
LuaSetParam( L, nShell) ;
return 2 ;
}
//----------------------------------------------------------------------------
static int
LuaSurfTmGetVertex( lua_State* L)
{
// 2 o 3 parametri : Id, nVert, [, nRefId]
int nId ;
LuaCheckParam( L, 1, nId)
int nVert ;
LuaCheckParam( L, 2, nVert)
int nRefId = nId ;
LuaGetParam( L, 3, nRefId) ;
LuaClearStack( L) ;
// recupero il vertice di indice dato (0-based)
Point3d ptVert ;
bool bOk = ExeSurfTmGetVertex( nId, nVert, nRefId, ptVert) ;
if ( bOk)
LuaSetParam( L, ptVert) ;
else
LuaSetParam( L) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaSurfTmGetNearestVertex( lua_State* L)
{
// 2 o 3 parametri : Id, ptNear [, nRefId]
int nId ;
LuaCheckParam( L, 1, nId)
Point3d ptNear ;
LuaCheckParam( L, 2, ptNear)
int nRefId = nId ;
LuaGetParam( L, 3, nRefId) ;
LuaClearStack( L) ;
// recupero il vertice pi vicino della superficie
int nVert ;
Point3d ptVert ;
bool bOk = ExeSurfTmGetNearestVertex( nId, ptNear, nRefId, nVert, ptVert) ;
if ( bOk) {
LuaSetParam( L, nVert) ;
LuaSetParam( L, ptVert) ;
}
else {
LuaSetParam( L) ;
LuaSetParam( L) ;
}
return 2 ;
}
//----------------------------------------------------------------------------
static int
LuaSurfTmTriangleNormVersor( lua_State* L)
{
// 2 o 3 parametri : nId, nTria [, nRefId]
int nId ;
LuaCheckParam( L, 1, nId)
int nTria ;
LuaCheckParam( L, 2, nTria)
int nRefId = nId ;
LuaGetParam( L, 3, nRefId) ;
LuaClearStack( L) ;
// recupero la normale del triangolo della superficie
Vector3d vtNorm ;
if ( ExeSurfTmTriangleNormVersor( nId, nTria, nRefId, vtNorm))
LuaSetParam( L, vtNorm) ;
else
LuaSetParam( L) ;
return 1 ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static int static int
LuaSurfTmFacetFromTria( lua_State* L) LuaSurfTmFacetFromTria( lua_State* L)
@@ -288,6 +410,27 @@ LuaSurfTmFacetFromTria( lua_State* L)
return 1 ; return 1 ;
} }
//----------------------------------------------------------------------------
static int
LuaSurfTmGetAllVertInFacet( lua_State* L)
{
// 2 parametri : nId, nFacet
int nId ;
LuaCheckParam( L, 1, nId)
int nFacet ;
LuaCheckParam( L, 2, nFacet)
LuaClearStack( L) ;
// recupero l'elenco dei vertici nella faccia
INTVECTOR vVert ;
bool bOk = ExeSurfTmGetAllVertInFacet( nId, nFacet, vVert) ;
// restituisco il risultato
if ( bOk)
LuaSetParam( L, vVert) ;
else
LuaSetParam( L) ;
return 1 ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static int static int
LuaSurfTmGetFacetBBox( lua_State* L) LuaSurfTmGetFacetBBox( lua_State* L)
@@ -359,6 +502,44 @@ LuaSurfTmGetFacetBBoxRef( lua_State* L)
return 1 ; return 1 ;
} }
//----------------------------------------------------------------------------
static int
LuaSurfTmGetFacetOutlineInfo( lua_State* L)
{
// 2 o 3 parametri : Id, nFacet [, nRefId]
int nId ;
LuaCheckParam( L, 1, nId)
int nFacet ;
LuaCheckParam( L, 2, nFacet)
int nRefId = nId ;
LuaGetParam( L, 3, nRefId) ;
LuaClearStack( L) ;
// recupero le informazioni
int nStatus ;
BOOLVECTOR vbOpen ;
INTVECTOR vnAdj ;
PNTVECTOR vptStart ;
VCT3DVECTOR vvtNorm ;
DBLVECTOR vdElev ;
DBLVECTOR vdLen ;
bool bOk = ExeSurfTmGetFacetOutlineInfo( nId, nFacet, nRefId, nStatus, vbOpen, vnAdj, vdLen, vptStart, vvtNorm, vdElev) ;
// restituisco il risultato
if ( bOk) {
LuaSetParam( L, nStatus) ;
LuaSetParam( L, vbOpen) ;
LuaSetParam( L, vnAdj) ;
LuaSetParam( L, vdLen) ;
LuaSetParam( L, vptStart) ;
LuaSetParam( L, vvtNorm) ;
LuaSetParam( L, vdElev) ;
return 7 ;
}
else {
LuaSetParam( L) ;
return 1 ;
}
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static int static int
LuaSurfTmFacetAdjacencies( lua_State* L) LuaSurfTmFacetAdjacencies( lua_State* L)
@@ -394,7 +575,7 @@ LuaSurfTmFacetNearestEndPoint( lua_State* L)
int nRefId = nId ; int nRefId = nId ;
LuaGetParam( L, 4, nRefId) ; LuaGetParam( L, 4, nRefId) ;
LuaClearStack( L) ; LuaClearStack( L) ;
// recupero il punto End più vicino della faccia della superficie trimesh // recupero il punto End pi vicino della faccia della superficie trimesh
Point3d ptEnd ; Point3d ptEnd ;
Vector3d vtN ; Vector3d vtN ;
if ( ExeSurfTmFacetNearestEndPoint( nId, nFacet, ptNear, nRefId, ptEnd, vtN)) { if ( ExeSurfTmFacetNearestEndPoint( nId, nFacet, ptNear, nRefId, ptEnd, vtN)) {
@@ -422,7 +603,7 @@ LuaSurfTmFacetNearestMidPoint( lua_State* L)
int nRefId = nId ; int nRefId = nId ;
LuaGetParam( L, 4, nRefId) ; LuaGetParam( L, 4, nRefId) ;
LuaClearStack( L) ; LuaClearStack( L) ;
// recupero il punto Mid più vicino della faccia della superficie trimesh // recupero il punto Mid pi vicino della faccia della superficie trimesh
Point3d ptMid ; Point3d ptMid ;
Vector3d vtN ; Vector3d vtN ;
if ( ExeSurfTmFacetNearestMidPoint( nId, nFacet, ptNear, nRefId, ptMid, vtN)) { if ( ExeSurfTmFacetNearestMidPoint( nId, nFacet, ptNear, nRefId, ptMid, vtN)) {
@@ -510,6 +691,58 @@ LuaSurfTmFacetMinAreaRectangle( lua_State* L)
} }
} }
//----------------------------------------------------------------------------
static int
LuaSurfTmFacetElevationInBBox( lua_State* L)
{
// 3 o 4 o 5 parametri : Id, nFacet, b3Box [, bAcceptOutFacet] [, nRefId]
int nId ;
LuaCheckParam( L, 1, nId)
int nFacet ;
LuaCheckParam( L, 2, nFacet)
BBox3d b3Box ;
LuaCheckParam( L, 3, b3Box)
bool bAcceptOutFacet = false ;
int nRefId = nId ;
if ( ! LuaGetParam( L, 4, nRefId)) {
LuaGetParam( L, 4, bAcceptOutFacet) ;
LuaGetParam( L, 5, nRefId) ;
}
LuaClearStack( L) ;
// calcolo elevazione
double dElev ;
bool bOk = ExeSurfTmFacetElevationInBBox( nId, nFacet, b3Box, bAcceptOutFacet, nRefId, dElev) ;
if ( bOk)
LuaSetParam( L, dElev) ;
else
LuaSetParam( L) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaSurfTmFacetElevationInClosedSurfTm( lua_State* L)
{
// 3 o 4 parametri : nFacetStmId, nFacet, nClosedStmId [, bAcceptOutFacet]
int nFacetStmId ;
LuaCheckParam( L, 1, nFacetStmId)
int nFacet ;
LuaCheckParam( L, 2, nFacet)
int nClosedStmId ;
LuaCheckParam( L, 3, nClosedStmId)
bool bAcceptOutFacet = false ;
LuaGetParam( L, 4, bAcceptOutFacet) ;
LuaClearStack( L) ;
// calcolo elevazione
double dElev ;
bool bOk = ExeSurfTmFacetElevationInClosedSurfTm( nFacetStmId, nFacet, nClosedStmId, bAcceptOutFacet, dElev) ;
if ( bOk)
LuaSetParam( L, dElev) ;
else
LuaSetParam( L) ;
return 1 ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static int static int
LuaSurfTmFacetOppositeSide( lua_State* L) LuaSurfTmFacetOppositeSide( lua_State* L)
@@ -608,7 +841,7 @@ LuaExtractSurfTmLoops( lua_State* L)
static int static int
LuaGetSurfTmSilhouette( lua_State* L) LuaGetSurfTmSilhouette( lua_State* L)
{ {
// 4 o 5 parametri : nId, vtDir, dToler, nDestGrpId [, nRefType] // 4 o 5 o 6 parametri : nId, vtDir, dToler, nDestGrpId [, nRefType [, bAllTria]]
int nId ; int nId ;
LuaCheckParam( L, 1, nId) LuaCheckParam( L, 1, nId)
Vector3d vtDir ; Vector3d vtDir ;
@@ -618,11 +851,15 @@ LuaGetSurfTmSilhouette( lua_State* L)
int nDestGrpId ; int nDestGrpId ;
LuaCheckParam( L, 4, nDestGrpId) LuaCheckParam( L, 4, nDestGrpId)
int nRefType = RTY_DEFAULT ; int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 5, nRefType) ; bool bAllTria = false ;
if ( LuaGetParam( L, 5, nRefType))
LuaGetParam( L, 6, bAllTria) ;
else
LuaGetParam( L, 5, bAllTria) ;
LuaClearStack( L) ; LuaClearStack( L) ;
// recupero i contorni della superficie // recupero i contorni della superficie
int nCount = 0 ; int nCount = 0 ;
int nNewId = ExeGetSurfTmSilhouette( nId, vtDir, dToler, nDestGrpId, nRefType, &nCount) ; int nNewId = ExeGetSurfTmSilhouette( nId, vtDir, dToler, nDestGrpId, nRefType, &nCount, bAllTria) ;
// restituisco il risultato // restituisco il risultato
if ( nNewId != GDB_ID_NULL) if ( nNewId != GDB_ID_NULL)
LuaSetParam( L, nNewId) ; LuaSetParam( L, nNewId) ;
@@ -632,6 +869,38 @@ LuaGetSurfTmSilhouette( lua_State* L)
return 2 ; return 2 ;
} }
//----------------------------------------------------------------------------
static int
LuaGetSurfTmParSilhouettes( lua_State* L)
{
// 6 o 7 parametri : vIds, ptOn, vtN, vdDist, dToler, nDestGrpId [, nRefType]
INTVECTOR vIds ;
LuaCheckParam( L, 1, vIds)
Point3d ptOn ;
LuaCheckParam( L, 2, ptOn)
Vector3d vtN ;
LuaCheckParam( L, 3, vtN)
DBLVECTOR vdDist ;
LuaCheckParam( L, 4, vdDist)
double dToler ;
LuaCheckParam( L, 5, dToler)
int nDestGrpId ;
LuaCheckParam( L, 6, nDestGrpId)
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 7, nRefType) ;
LuaClearStack( L) ;
// recupero i contorni della superficie
int nCount = 0 ;
int nNewId = ExeGetSurfTmParSilhouettes( vIds, ptOn, vtN, vdDist, dToler, nDestGrpId, nRefType, &nCount) ;
// restituisco il risultato
if ( nCount >= 0)
LuaSetParam( L, nNewId) ;
else
LuaSetParam( L) ;
LuaSetParam( L, nCount) ;
return 2 ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static int static int
LuaExtractSurfTmFacetLoops( lua_State* L) LuaExtractSurfTmFacetLoops( lua_State* L)
@@ -656,6 +925,28 @@ LuaExtractSurfTmFacetLoops( lua_State* L)
return 2 ; return 2 ;
} }
//----------------------------------------------------------------------------
static int
LuaExtractSurfTmTriaLoop( lua_State* L)
{
// 3 parametri : nId, nT, nDestGrpId
int nId ;
LuaCheckParam( L, 1, nId)
int nT ;
LuaCheckParam( L, 2, nT)
int nDestGrpId ;
LuaCheckParam( L, 3, nDestGrpId)
LuaClearStack( L) ;
// recupero i contorni della superficie
int nNewId = ExeExtractSurfTmTriaLoop( nId, nT, nDestGrpId) ;
// restituisco il risultato
if ( nNewId != GDB_ID_NULL)
LuaSetParam( L, nNewId) ;
else
LuaSetParam( L) ;
return 2 ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static int static int
LuaCopySurfTmFacet( lua_State* L) LuaCopySurfTmFacet( lua_State* L)
@@ -678,6 +969,57 @@ LuaCopySurfTmFacet( lua_State* L)
return 1 ; return 1 ;
} }
//----------------------------------------------------------------------------
static int
LuaSurfTmGetEdges( lua_State* L)
{
// 2 o 3 parametri : nId, nDestGrpId [, bSmoothAng]
int nId ;
LuaCheckParam( L, 1, nId)
int nDestGrpId ;
LuaCheckParam( L, 2, nDestGrpId)
bool bSmoothAng = true ;
LuaGetParam( L, 3, bSmoothAng) ;
LuaClearStack( L) ;
// calcolo gli spigoli della superficie
int nCount ;
int nFirstId = ExeSurfTmGetEdges( nId, nDestGrpId, bSmoothAng, &nCount) ;
// restituisco il risultato
if ( nFirstId != GDB_ID_NULL || nCount != -1) {
LuaSetParam( L, nFirstId) ;
LuaSetParam( L, nCount) ;
}
else {
LuaSetParam( L) ;
LuaSetParam( L) ;
}
return 2 ;
}
//----------------------------------------------------------------------------
static int
LuaSurfTmGetCurvature( lua_State* L)
{
// 2 parametri : nStmId, nIndV
int nStmId ;
LuaCheckParam( L, 1, nStmId) ;
int nIndVertex ;
LuaCheckParam( L, 2, nIndVertex) ;
LuaClearStack( L) ;
double dK1 = 0., dK2 = 0. ;
Vector3d vtK1 = V_NULL, vtK2 = V_NULL ;
bool bOk = ExeSurfTmGetCurvatures( nStmId, nIndVertex, dK1, vtK1, dK2, vtK2) ;
LuaSetParam( L, bOk) ;
if ( bOk) {
LuaSetParam( L, dK1) ;
LuaSetParam( L, vtK1) ;
LuaSetParam( L, dK2) ;
LuaSetParam( L, vtK2) ;
return 5 ;
}
return 1 ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static int static int
LuaSurfBezierGetPoint( lua_State* L) LuaSurfBezierGetPoint( lua_State* L)
@@ -817,6 +1159,34 @@ LuaSurfBezierGetCurveV( lua_State* L)
return 1 ; return 1 ;
} }
//----------------------------------------------------------------------------
static int
LuaSurfBezParamsFromPoint( lua_State* L)
{
// 2 o 3 parametri : nSurfId, ptOnSurf [, nRefId]
int nSurfId ;
LuaCheckParam( L, 1, nSurfId)
Point3d ptOnSurf ;
LuaCheckParam( L, 2, ptOnSurf)
int nRefId = nSurfId ;
LuaGetParam( L, 3, nRefId) ;
LuaClearStack( L) ;
// recupero le coordinate parametriche del punto
double dU = - 1 ;
double dV = - 1 ;
bool bOk = ExeSurfBezierParamsFromPoint( nSurfId, ptOnSurf, nRefId, dU, dV) ;
if ( bOk) {
LuaSetParam( L, dU) ;
LuaSetParam( L, dV) ;
}
else {
LuaSetParam( L) ;
LuaSetParam( L) ;
}
return 2 ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static int static int
LuaSurfBezierGetInfo( lua_State* L) LuaSurfBezierGetInfo( lua_State* L)
@@ -913,47 +1283,88 @@ LuaExtractSurfBezierLoops( lua_State* L)
return 2 ; return 2 ;
} }
//----------------------------------------------------------------------------
static int
LuaShowSurfBezierControlPoints( lua_State* L)
{
// 2 parametri : nCrvId, nDestGrpId
int nCrvId ;
LuaCheckParam( L, 1, nCrvId)
int nDestGrpId ;
LuaCheckParam( L, 2, nDestGrpId)
LuaClearStack( L) ;
int nCount = 0 ;
int nId = ExeShowSurfBezierControlPoints( nCrvId, nDestGrpId, &nCount) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL) {
LuaSetParam( L, nId) ;
LuaSetParam( L, nCount) ;
}
else {
LuaSetParam( L) ;
LuaSetParam( L) ;
}
return 2 ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
bool bool
LuaInstallGdbGetSurf( LuaMgr& luaMgr) LuaInstallGdbGetSurf( LuaMgr& luaMgr)
{ {
bool bOk = ( &luaMgr != nullptr) ; bool bOk = ( &luaMgr != nullptr) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfArea", LuaSurfArea) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfArea", LuaSurfArea) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfIsClosed", LuaSurfIsClosed) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfVolume", LuaSurfVolume) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfVolume", LuaSurfVolume) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrNormVersor", LuaSurfFrNormVersor) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrNormVersor", LuaSurfFrNormVersor) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrGrossArea", LuaSurfFrGrossArea) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrGrossArea", LuaSurfFrGrossArea) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrChunkCount", LuaSurfFrChunkCount) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrChunkCount", LuaSurfFrChunkCount) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrChunkMaxOffset", LuaSurfFrChunkMaxOffset) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrChunkSimpleClassify", LuaSurfFrChunkSimpleClassify) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrChunkSimpleClassify", LuaSurfFrChunkSimpleClassify) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrTestExternal", LuaSurfFrTestExternal) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrTestExternal", LuaSurfFrTestExternal) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtExtractSurfFrChunkLoops", LuaExtractSurfFrChunkLoops) ; bOk = bOk && luaMgr.RegisterFunction( "EgtExtractSurfFrChunkLoops", LuaExtractSurfFrChunkLoops) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrMoveSimpleNoCollision", LuaSurfFrMoveSimpleNoCollision) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrMoveSimpleNoCollision", LuaSurfFrMoveSimpleNoCollision) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrRotateSimpleNoCollision", LuaSurfFrRotateSimpleNoCollision) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrRotateSimpleNoCollision", LuaSurfFrRotateSimpleNoCollision) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetSurfFrZigZagInfill", LuaSurfFrGetZigZagInfill) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmVertexCount", LuaSurfTmVertexCount) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetCount", LuaSurfTmFacetCount) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetCount", LuaSurfTmFacetCount) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmPartCount", LuaSurfTmPartCount) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetPartAndShellFromFacet", LuaSurfTmGetPartAndShellFromFacet) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetVertex", LuaSurfTmGetVertex) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetNearestVertex", LuaSurfTmGetNearestVertex) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmTriangleNormVersor", LuaSurfTmTriangleNormVersor) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetFromTria", LuaSurfTmFacetFromTria) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetFromTria", LuaSurfTmFacetFromTria) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetAllVertInFacet", LuaSurfTmGetAllVertInFacet) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetFacetBBox", LuaSurfTmGetFacetBBox) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetFacetBBox", LuaSurfTmGetFacetBBox) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetFacetBBoxGlob", LuaSurfTmGetFacetBBoxGlob) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetFacetBBoxGlob", LuaSurfTmGetFacetBBoxGlob) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetFacetBBoxRef", LuaSurfTmGetFacetBBoxRef) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetFacetBBoxRef", LuaSurfTmGetFacetBBoxRef) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetFacetOutlineInfo", LuaSurfTmGetFacetOutlineInfo) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetAdjacencies", LuaSurfTmFacetAdjacencies) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetAdjacencies", LuaSurfTmFacetAdjacencies) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetNearestEndPoint", LuaSurfTmFacetNearestEndPoint) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetNearestEndPoint", LuaSurfTmFacetNearestEndPoint) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetNearestMidPoint", LuaSurfTmFacetNearestMidPoint) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetNearestMidPoint", LuaSurfTmFacetNearestMidPoint) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetCenter", LuaSurfTmFacetCenter) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetCenter", LuaSurfTmFacetCenter) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetNormVersor", LuaSurfTmFacetNormVersor) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetNormVersor", LuaSurfTmFacetNormVersor) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetMinAreaRectangle", LuaSurfTmFacetMinAreaRectangle) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetMinAreaRectangle", LuaSurfTmFacetMinAreaRectangle) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetElevationInBBox", LuaSurfTmFacetElevationInBBox) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetElevationInClosedSurfTm", LuaSurfTmFacetElevationInClosedSurfTm) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetOppositeSide", LuaSurfTmFacetOppositeSide) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetOppositeSide", LuaSurfTmFacetOppositeSide) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetsContact", LuaSurfTmFacetsContact) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetsContact", LuaSurfTmFacetsContact) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtExtractSurfTmLoops", LuaExtractSurfTmLoops) ; bOk = bOk && luaMgr.RegisterFunction( "EgtExtractSurfTmLoops", LuaExtractSurfTmLoops) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetSurfTmSilhouette", LuaGetSurfTmSilhouette) ; bOk = bOk && luaMgr.RegisterFunction( "EgtGetSurfTmSilhouette", LuaGetSurfTmSilhouette) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetSurfTmParSilhouettes", LuaGetSurfTmParSilhouettes) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtExtractSurfTmFacetLoops", LuaExtractSurfTmFacetLoops) ; bOk = bOk && luaMgr.RegisterFunction( "EgtExtractSurfTmFacetLoops", LuaExtractSurfTmFacetLoops) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtExtractSurfTmTriaLoop", LuaExtractSurfTmTriaLoop) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCopySurfTmFacet", LuaCopySurfTmFacet) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCopySurfTmFacet", LuaCopySurfTmFacet) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetEdges", LuaSurfTmGetEdges) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetCurvature", LuaSurfTmGetCurvature) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierGetPoint", LuaSurfBezierGetPoint) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierGetPoint", LuaSurfBezierGetPoint) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierGetPointD1", LuaSurfBezierGetPointD1) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierGetPointD1", LuaSurfBezierGetPointD1) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierGetPointNrmD1", LuaSurfBezierGetPointNrmD1) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierGetPointNrmD1", LuaSurfBezierGetPointNrmD1) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierGetCurveU", LuaSurfBezierGetCurveU) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierGetCurveU", LuaSurfBezierGetCurveU) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierGetCurveV", LuaSurfBezierGetCurveV) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierGetCurveV", LuaSurfBezierGetCurveV) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezParamsFromPoint", LuaSurfBezParamsFromPoint) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierGetInfo", LuaSurfBezierGetInfo) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierGetInfo", LuaSurfBezierGetInfo) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierGetControlCurveU", LuaSurfBezierGetControlCurveU) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierGetControlCurveU", LuaSurfBezierGetControlCurveU) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierGetControlCurveV", LuaSurfBezierGetControlCurveV) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierGetControlCurveV", LuaSurfBezierGetControlCurveV) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtExtractSurfBezierLoops", LuaExtractSurfBezierLoops) ; bOk = bOk && luaMgr.RegisterFunction( "EgtExtractSurfBezierLoops", LuaExtractSurfBezierLoops) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtShowSurfBezierControlPoints", LuaShowSurfBezierControlPoints) ;
return bOk ; return bOk ;
} }
+2 -1
View File
@@ -211,6 +211,7 @@ LuaVolZmapGetDepth( lua_State* L)
} }
return 2 ; return 2 ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static int static int
LuaVolZmapGetEdges( lua_State* L) LuaVolZmapGetEdges( lua_State* L)
@@ -221,7 +222,7 @@ LuaVolZmapGetEdges( lua_State* L)
int nDestGrpId ; int nDestGrpId ;
LuaCheckParam( L, 2, nDestGrpId) LuaCheckParam( L, 2, nDestGrpId)
LuaClearStack( L) ; LuaClearStack( L) ;
// eseguo calcolo profondità dal punto lungo la direzione // calcolo gli spigoli del solido
int nCount ; int nCount ;
int nFirstId = ExeVolZmapGetEdges( nId, nDestGrpId, &nCount) ; int nFirstId = ExeVolZmapGetEdges( nId, nDestGrpId, &nCount) ;
// restituisco il risultato // restituisco il risultato
+336 -6
View File
@@ -19,6 +19,7 @@
#include "/EgtDev/Include/EXeConst.h" #include "/EgtDev/Include/EXeConst.h"
#include "/EgtDev/Include/EGkCurve.h" #include "/EgtDev/Include/EGkCurve.h"
#include "/EgtDev/Include/EGkLuaAux.h" #include "/EgtDev/Include/EGkLuaAux.h"
#include "/EgtDev/Include/EGkCalcPocketing.h"
using namespace std ; using namespace std ;
@@ -59,17 +60,19 @@ LuaOffsetCurve( lua_State* L)
static int static int
LuaOffsetCurveAdv( lua_State* L) LuaOffsetCurveAdv( lua_State* L)
{ {
// 2 o 3 parametri : Id, dDist [, nType] // 2 o 3 o 4 parametri : Id, dDist [, nType] [, dLinTol]
int nId ; int nId ;
LuaCheckParam( L, 1, nId) LuaCheckParam( L, 1, nId)
double dDist ; double dDist ;
LuaCheckParam( L, 2, dDist) LuaCheckParam( L, 2, dDist)
int nType = ICurve::OFF_FILLET ; int nType = ICurve::OFF_FILLET ;
LuaGetParam( L, 3, nType) ; LuaGetParam( L, 3, nType) ;
double dLinTol = 10 * EPS_SMALL ;
LuaGetParam( L, 4, dLinTol) ;
LuaClearStack( L) ; LuaClearStack( L) ;
// offset della curva // offset della curva
int nCount ; int nCount ;
int nNewId = ExeOffsetCurveAdv( nId, dDist, nType, &nCount) ; int nNewId = ExeOffsetCurveAdv( nId, dDist, nType, &nCount, dLinTol) ;
if ( nCount >= 0) { if ( nCount >= 0) {
LuaSetParam( L, nNewId) ; LuaSetParam( L, nNewId) ;
LuaSetParam( L, nCount) ; LuaSetParam( L, nCount) ;
@@ -102,16 +105,18 @@ LuaCurveMedialAxis( lua_State* L)
static int static int
LuaApproxCurve( lua_State* L) LuaApproxCurve( lua_State* L)
{ {
// 2 o 3 parametri : Id, nApprType [, dLinTol] // 2 o 3 o 4 parametri : Id, nApprType [, dLinTol [, dMaxSegmLen]]
int nId ; int nId ;
LuaCheckParam( L, 1, nId) LuaCheckParam( L, 1, nId)
int nApprType ; int nApprType ;
LuaCheckParam( L, 2, nApprType) LuaCheckParam( L, 2, nApprType)
double dLinTol = 0.01 ; double dLinTol = 0.01 ;
LuaGetParam( L, 3, dLinTol) ; double dMaxSegmLen = INFINITO ;
if ( LuaGetParam( L, 3, dLinTol))
LuaGetParam( L, 4, dMaxSegmLen) ;
LuaClearStack( L) ; LuaClearStack( L) ;
// approssimazione della curva con rette // approssimazione della curva con rette
bool bOk = ExeApproxCurve( nId, nApprType, dLinTol) ; bool bOk = ExeApproxCurve( nId, nApprType, dLinTol, dMaxSegmLen) ;
LuaSetParam( L, bOk) ; LuaSetParam( L, bOk) ;
return 1 ; return 1 ;
} }
@@ -206,6 +211,40 @@ LuaModifyCurveEndPoint( lua_State* L)
return 1 ; return 1 ;
} }
//----------------------------------------------------------------------------
static int
LuaSpiralizeCurveAlongExtrusion( lua_State* L)
{
// 2 parametri : Id, Delta
int nId ;
LuaCheckParam( L, 1, nId)
double dDelta ;
LuaCheckParam( L, 2, dDelta)
LuaClearStack( L) ;
// modifico la curva
bool bOk = ExeSpiralizeCurveAlongExtrusion( nId, dDelta) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaSpiralizeCurveAlongGuide( lua_State* L)
{
// 2 o 3 parametri : Id, IdGuide, dTol
int nId ;
LuaCheckParam( L, 1, nId)
int nGuideId ;
LuaCheckParam( L, 2, nGuideId)
double dTol = 10 * EPS_SMALL ;
LuaGetParam( L, 3, dTol) ;
LuaClearStack( L) ;
// modifico la curva
bool bOk = ExeSpiralizeCurveAlongGuide( nId, nGuideId, dTol) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static int static int
LuaModifyCurveExtrusion( lua_State* L) LuaModifyCurveExtrusion( lua_State* L)
@@ -547,6 +586,22 @@ LuaModifyArcRadius( lua_State* L)
return 1 ; return 1 ;
} }
//-------------------------------------------------------------------------------
static int
LuaModifyArcAngCenter( lua_State* L)
{
// 2 parametri : Id, dNewAngCenter
int nId ;
LuaCheckParam( L, 1, nId)
double dNewAngCenter ;
LuaCheckParam( L, 2, dNewAngCenter)
LuaClearStack( L) ;
// modifica dell'angolo al centro
bool bOk = ExeModifyArcAngCenter( nId, dNewAngCenter) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
static int static int
LuaModifyArcToExplementary( lua_State* L) LuaModifyArcToExplementary( lua_State* L)
@@ -702,7 +757,7 @@ LuaRemoveCurveCompoCurve( lua_State* L)
// 1 o 2 parametri : Id [, bLast] // 1 o 2 parametri : Id [, bLast]
int nId ; int nId ;
LuaCheckParam( L, 1, nId) LuaCheckParam( L, 1, nId)
bool bLast ; bool bLast = true ;
LuaGetParam( L, 2, bLast) ; LuaGetParam( L, 2, bLast) ;
LuaClearStack( L) ; LuaClearStack( L) ;
// rimuovo prima o ultima curva della composita // rimuovo prima o ultima curva della composita
@@ -874,6 +929,46 @@ LuaRemoveCurveCompoUndercutOnY( lua_State* L)
return 1 ; return 1 ;
} }
//-------------------------------------------------------------------------------
static int
LuaCurveCompoSetTempProp( lua_State* L)
{
// 3 parametri : Id, nCrv, nProp [, nPropInd]
int nId ;
LuaCheckParam( L, 1, nId)
int nCrv ;
LuaCheckParam( L, 2, nCrv)
int nProp ;
LuaCheckParam( L, 3, nProp)
int nPropInd = 0 ;
LuaGetParam( L, 4, nPropInd) ;
LuaClearStack( L) ;
// imposto sulla curva della composita la proprietà temporanea
bool bOk = ExeCurveCompoSetTempProp( nId, nCrv, nProp, nPropInd) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCurveCompoSetTempParam( lua_State* L)
{
// 3 parametri : Id, nCrv, dParam [, nParamInd]
int nId ;
LuaCheckParam( L, 1, nId)
int nCrv ;
LuaCheckParam( L, 2, nCrv)
double dParam ;
LuaCheckParam( L, 3, dParam)
int nParamInd = 0 ;
LuaGetParam( L, 4, nParamInd) ;
LuaClearStack( L) ;
// imposto sulla curva della composita il parametro temporaneo
bool bOk = ExeCurveCompoSetTempParam( nId, nCrv, dParam, nParamInd) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static int static int
LuaChainCurvesInGroup( lua_State* L) LuaChainCurvesInGroup( lua_State* L)
@@ -910,6 +1005,226 @@ LuaReorderCurvesInGroup( lua_State* L)
return 1 ; return 1 ;
} }
//----------------------------------------------------------------------------
static int
LuaProjectCurveOnSurf( lua_State* L)
{
// 3, 4 o 5 parametri : nCurveId, vSurfId, nDestGrpId [, dLinTol [, dMaxSegmLen]]
int nCurveId ;
LuaCheckParam( L, 1, nCurveId)
INTVECTOR vSurfId ;
LuaCheckParam( L, 2, vSurfId)
int nDestGrpId ;
LuaCheckParam( L, 3, nDestGrpId)
double dLinTol = 0.01 ;
double dMaxSegmLen = INFINITO ;
if ( LuaGetParam( L, 4, dLinTol))
LuaGetParam( L, 5, dMaxSegmLen) ;
LuaClearStack( L) ;
// proietto la curva su una o più superfici a minima distanza
bool bOk = ExeProjectCurveOnSurf( nCurveId, vSurfId, nDestGrpId, dLinTol, dMaxSegmLen) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaProjectCurveOnSurfDir( lua_State* L)
{
// 4, 5, 6, 7 o 8 parametri : nCurveId, vSurfId, vtDir, nDestGrpId [, dLinTol [, dMaxSegmLen] [, bDirFromProj] [,bFromVsTo] [, nRefType]]
int nCurveId ;
LuaCheckParam( L, 1, nCurveId)
INTVECTOR vSurfId ;
LuaCheckParam( L, 2, vSurfId)
Vector3d vtDir ;
LuaCheckParam( L, 3, vtDir)
int nDestGrpId ;
LuaCheckParam( L, 4, nDestGrpId)
double dLinTol = 0.01 ;
double dMaxSegmLen = INFINITO ;
bool bDirFromProj = false ;
bool bFromVsTo = true ;
int nRefType = RTY_DEFAULT ;
if ( LuaGetParam( L, 5, dLinTol) &&
LuaGetParam( L, 6, dMaxSegmLen) &&
LuaGetParam( L, 7, bDirFromProj) &&
LuaGetParam( L, 8, bFromVsTo))
LuaGetParam( L, 9, nRefType) ;
LuaClearStack( L) ;
// proietto la curva su una o più superfici secondo la direzione data
bool bOk = ExeProjectCurveOnSurfDir( nCurveId, vSurfId, vtDir, nDestGrpId, dLinTol, dMaxSegmLen, bDirFromProj, bFromVsTo, nRefType) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaProjectCurveOnSurfExt( lua_State* L)
{
// 4, 5, 6 o 7 parametri : nCurveId, vSurfId, nGuideId, nDestGrpId [, dLinTol [, dMaxSegmLen] [, bDirFromGuide] [,bFromVsTo]]
int nCurveId ;
LuaCheckParam( L, 1, nCurveId)
INTVECTOR vSurfId ;
LuaCheckParam( L, 2, vSurfId)
int nGuideId ;
LuaCheckParam( L, 3, nGuideId)
int nDestGrpId ;
LuaCheckParam( L, 4, nDestGrpId)
double dLinTol = 0.01 ;
double dMaxSegmLen = INFINITO ;
bool bDirFromGuide = false ;
bool bFromVsTo = true ;
if ( LuaGetParam( L, 5, dLinTol) &&
LuaGetParam( L, 6, dMaxSegmLen) &&
LuaGetParam( L, 7, bDirFromGuide))
LuaGetParam( L, 8, bFromVsTo) ;
LuaClearStack( L) ;
// proietto la curva su una o più superfici secondo la direzione verso la guida
bool bOk = ExeProjectCurveOnSurfExt( nCurveId, vSurfId, nGuideId, nDestGrpId, dLinTol, dMaxSegmLen, bDirFromGuide, bFromVsTo) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaCurveGetVoronoi( lua_State* L)
{
// 2 o 3 parametri : Id/s, nDestGrpId [, nBound]
INTVECTOR vIds ;
LuaCheckParam( L, 1, vIds)
int nDestGrpId ;
LuaCheckParam( L, 2, nDestGrpId)
int nBound = 3 ; // VORONOI_STD_BOUND
LuaGetParam( L, 3, nBound) ;
LuaClearStack( L) ;
// eseguo
int nCount = 0 ;
int nNewId = ExeCurveGetVoronoi( vIds, nDestGrpId, nBound, &nCount) ;
if ( nNewId != GDB_ID_NULL)
LuaSetParam( L, nNewId) ;
else
LuaSetParam( L) ;
LuaSetParam( L, nCount) ;
return 2 ;
}
//----------------------------------------------------------------------------
static int
LuaCurveMedialAxisAdv( lua_State* L)
{
// 2 o 3 parametri : Id/s, nDestGrpId [, nSide]
INTVECTOR vIds ;
LuaCheckParam( L, 1, vIds)
int nDestGrpId ;
LuaCheckParam( L, 2, nDestGrpId)
int nSide = 1 ; // WMAT_LEFT
LuaGetParam( L, 3, nSide) ;
LuaClearStack( L) ;
// eseguo
int nCount = 0 ;
int nNewId = ExeCurveGetMedialAxis( vIds, nDestGrpId, nSide, &nCount) ;
if ( nNewId != GDB_ID_NULL)
LuaSetParam( L, nNewId) ;
else
LuaSetParam( L) ;
LuaSetParam( L, nCount) ;
return 2 ;
}
//----------------------------------------------------------------------------
static int
LuaCurveGetFatCurve( lua_State* L)
{
// 4 o 5 parametri : Id, nDestGrpId, dRad, bSquare [, bSquareMids]
int nId ;
LuaCheckParam( L, 1, nId)
int nDestGrpId ;
LuaCheckParam( L, 2, nDestGrpId)
double dRad ;
LuaCheckParam( L, 3, dRad)
bool bSquareEnds ;
LuaCheckParam( L, 4, bSquareEnds)
bool bSquareMids = bSquareEnds ;
LuaGetParam( L, 5, bSquareMids) ;
LuaClearStack( L) ;
// eseguo
int nCount = 0 ;
int nNewId = ExeCurveGetFatCurve( nId, nDestGrpId, dRad, bSquareEnds, bSquareMids, &nCount) ;
if ( nNewId != GDB_ID_NULL)
LuaSetParam( L, nNewId) ;
else
LuaSetParam( L) ;
LuaSetParam( L, nCount) ;
return 2 ;
}
//----------------------------------------------------------------------------
static int
LuaCurveBezierIncreaseDegree( lua_State* L)
{
// 1 parametro : CrvId
int nId ;
LuaCheckParam( L, 1, nId)
LuaClearStack( L) ;
// eseguo
bool bOk = ExeCurveBezierIncreaseDegree( nId) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaCurveBezierDecreaseDegree( lua_State* L)
{
// 1 parametro : CrvId
int nId ;
LuaCheckParam( L, 1, nId)
LuaClearStack( L) ;
// eseguo
bool bOk = ExeCurveBezierDecreaseDegree( nId) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaCurveBezierApproxToNonRat( lua_State* L)
{
// 1 o 2 parametri : CrvId [, dTol]
int nId ;
LuaCheckParam( L, 1, nId)
double dTol = 10 * EPS_SMALL ;
LuaGetParam( L, 2, dTol) ;
LuaClearStack( L) ;
// eseguo
bool bOk = ExeCurveBezierApproxToNonRat( nId, dTol) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaCurveBezierApproxWithCubicBeziers( lua_State* L)
{
// 1 o 2 parametri : CrvId [, dTol]
int nId ;
LuaCheckParam( L, 1, nId)
double dTol = 10 * EPS_SMALL ;
LuaGetParam( L, 2, dTol) ;
LuaClearStack( L) ;
// eseguo
bool bOk = ExeCurveBezierApproxWithCubicBeziers( nId, dTol) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
bool bool
LuaInstallGdbModifyCurve( LuaMgr& luaMgr) LuaInstallGdbModifyCurve( LuaMgr& luaMgr)
@@ -925,6 +1240,8 @@ LuaInstallGdbModifyCurve( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtChangeClosedCurveStartPoint", LuaChangeClosedCurveStartPoint) ; bOk = bOk && luaMgr.RegisterFunction( "EgtChangeClosedCurveStartPoint", LuaChangeClosedCurveStartPoint) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtModifyCurveStartPoint", LuaModifyCurveStartPoint) ; bOk = bOk && luaMgr.RegisterFunction( "EgtModifyCurveStartPoint", LuaModifyCurveStartPoint) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtModifyCurveEndPoint", LuaModifyCurveEndPoint) ; bOk = bOk && luaMgr.RegisterFunction( "EgtModifyCurveEndPoint", LuaModifyCurveEndPoint) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSpiralizeCurveAlongExtrusion", LuaSpiralizeCurveAlongExtrusion) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSpiralizeCurveAlongGuide", LuaSpiralizeCurveAlongGuide) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtModifyCurveExtrusion", LuaModifyCurveExtrusion) ; bOk = bOk && luaMgr.RegisterFunction( "EgtModifyCurveExtrusion", LuaModifyCurveExtrusion) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtModifyCurveThickness", LuaModifyCurveThickness) ; bOk = bOk && luaMgr.RegisterFunction( "EgtModifyCurveThickness", LuaModifyCurveThickness) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtTrimCurveStartAtLen", LuaTrimCurveStartAtLen) ; bOk = bOk && luaMgr.RegisterFunction( "EgtTrimCurveStartAtLen", LuaTrimCurveStartAtLen) ;
@@ -943,6 +1260,7 @@ LuaInstallGdbModifyCurve( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtSplitCurveAtCorners", LuaSplitCurveAtCorners) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSplitCurveAtCorners", LuaSplitCurveAtCorners) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSplitCurveAtSelfInters", LuaSplitCurveAtSelfInters) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSplitCurveAtSelfInters", LuaSplitCurveAtSelfInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtModifyArcRadius", LuaModifyArcRadius) ; bOk = bOk && luaMgr.RegisterFunction( "EgtModifyArcRadius", LuaModifyArcRadius) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtModifyArcAngCenter", LuaModifyArcAngCenter) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtModifyArcToExplementary", LuaModifyArcToExplementary) ; bOk = bOk && luaMgr.RegisterFunction( "EgtModifyArcToExplementary", LuaModifyArcToExplementary) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtModifyArcByFlip", LuaModifyArcByFlip) ; bOk = bOk && luaMgr.RegisterFunction( "EgtModifyArcByFlip", LuaModifyArcByFlip) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCloseCurveCompo", LuaCloseCurveCompo) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCloseCurveCompo", LuaCloseCurveCompo) ;
@@ -961,7 +1279,19 @@ LuaInstallGdbModifyCurve( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtExplodeCurveCompo", LuaExplodeCurveCompo) ; bOk = bOk && luaMgr.RegisterFunction( "EgtExplodeCurveCompo", LuaExplodeCurveCompo) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtMergeCurvesInCurveCompo", LuaMergeCurvesInCurveCompo) ; bOk = bOk && luaMgr.RegisterFunction( "EgtMergeCurvesInCurveCompo", LuaMergeCurvesInCurveCompo) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRemoveCurveCompoUndercutOnY", LuaRemoveCurveCompoUndercutOnY) ; bOk = bOk && luaMgr.RegisterFunction( "EgtRemoveCurveCompoUndercutOnY", LuaRemoveCurveCompoUndercutOnY) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCompoSetTempProp", LuaCurveCompoSetTempProp) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCompoSetTempParam", LuaCurveCompoSetTempParam) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtChainCurvesInGroup", LuaChainCurvesInGroup) ; bOk = bOk && luaMgr.RegisterFunction( "EgtChainCurvesInGroup", LuaChainCurvesInGroup) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtReorderCurvesInGroup", LuaReorderCurvesInGroup) ; bOk = bOk && luaMgr.RegisterFunction( "EgtReorderCurvesInGroup", LuaReorderCurvesInGroup) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtProjectCurveOnSurf", LuaProjectCurveOnSurf) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtProjectCurveOnSurfDir", LuaProjectCurveOnSurfDir) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtProjectCurveOnSurfExt", LuaProjectCurveOnSurfExt) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveGetVoronoi", LuaCurveGetVoronoi) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveMedialAxisAdv", LuaCurveMedialAxisAdv) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveGetFatCurve", LuaCurveGetFatCurve) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveBezierIncreaseDeg", LuaCurveBezierIncreaseDegree) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveBezierDecreaseDeg", LuaCurveBezierDecreaseDegree) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveBezierApproxToNonRat", LuaCurveBezierApproxToNonRat) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtApproxBezierWithCubics", LuaCurveBezierApproxWithCubicBeziers) ;
return bOk ; return bOk ;
} }
+385 -17
View File
@@ -14,15 +14,16 @@
//--------------------------- Include ---------------------------------------- //--------------------------- Include ----------------------------------------
#include "stdafx.h" #include "stdafx.h"
#include "LUA.h" #include "LUA.h"
#include "EXE_Const.h"
#include "/EgtDev/Include/EXeExecutor.h" #include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EXeConst.h" #include "/EgtDev/Include/EXeConst.h"
#include "/EgtDev/Include/EGkCurve.h" #include "/EgtDev/Include/EGkCurve.h"
#include "/EgtDev/Include/EGkSurfTriMeshAux.h"
#include "/EgtDev/Include/EGkGdbConst.h" #include "/EgtDev/Include/EGkGdbConst.h"
#include "/EgtDev/Include/EGkLuaAux.h" #include "/EgtDev/Include/EGkLuaAux.h"
using namespace std ; using namespace std ;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static int static int
LuaInvertSurf( lua_State* L) LuaInvertSurf( lua_State* L)
@@ -57,6 +58,25 @@ LuaExplodeSurf( lua_State* L)
return 2 ; return 2 ;
} }
//-------------------------------------------------------------------------------
static int
LuaApproxSurf( lua_State* L)
{
// 1 o 2 parametri : Id [, dLinTol [, dTriaMinSide]]
int nId ;
LuaCheckParam( L, 1, nId)
double dLinTol = LIN_TOL_SRF ;
double dTriaMinSide = 100 * EPS_SMALL ;
if ( LuaGetParam( L, 2, dLinTol))
LuaGetParam( L, 3, dTriaMinSide) ;
LuaClearStack( L) ;
// approssimazione della superficie
bool bOk = ExeApproxSurface( nId, dLinTol, dTriaMinSide) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
static int static int
LuaSurfFrAdd( lua_State* L) LuaSurfFrAdd( lua_State* L)
@@ -123,6 +143,113 @@ LuaSurfFrOffset( lua_State* L)
return 1 ; return 1 ;
} }
//-------------------------------------------------------------------------------
static int
LuaSurfFrOffsetAdv( lua_State* L)
{
// 3 parametri : Id, dDist, nType
int nId ;
LuaCheckParam( L, 1, nId)
double dDist ;
LuaCheckParam( L, 2, dDist)
int nType = ICurve::OFF_FILLET ;
LuaGetParam( L, 3, nType) ;
LuaClearStack( L) ;
// eseguo l'offset della regione
int nNewId = GDB_ID_NULL ;
bool bOk = ExeSurfFrOffsetAdv( nId, dDist, nType, nNewId) ;
if ( bOk)
LuaSetParam( L, nNewId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaSurfFrEraseChunk( lua_State* L)
{
// 2 parametri : Id, nChunk
int nId ;
LuaCheckParam( L, 1, nId)
int nChunk ;
LuaCheckParam( L, 2, nChunk)
LuaClearStack( L) ;
// eseguo l'offset della regione
bool bOk = ExeSurfFrEraseChunk( nId, nChunk) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaSurfTmMoveVertex( lua_State* L)
{
// 3 o 4 o 5 parametri : nId, nVert, ptNewVert [, nRefId] [, bUpdate]
int nId ;
LuaCheckParam( L, 1, nId)
int nVert ;
LuaCheckParam( L, 2, nVert)
Point3d ptNewVert ;
LuaCheckParam( L, 3, ptNewVert)
int nRefType = RTY_DEFAULT ;
bool bUpdate = true ;
if ( LuaGetParam( L, 4, nRefType))
LuaGetParam( L, 5, bUpdate) ;
else
LuaGetParam( L, 4, bUpdate) ;
LuaClearStack( L) ;
// sposto il vertice di indice dato della trimesh
bool bOk = ExeSurfTmMoveVertex( nId, nVert, ptNewVert, nRefType, bUpdate) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaSurfTmMoveFacet( lua_State* L)
{
// 3 o 4 o 5 parametri : nId, nFacet, vtMove [, nRefId] [, bUpdate]
int nId ;
LuaCheckParam( L, 1, nId)
int nFacet ;
LuaCheckParam( L, 2, nFacet)
Vector3d vtMove ;
LuaCheckParam( L, 3, vtMove)
int nRefType = RTY_DEFAULT ;
bool bUpdate = true ;
if ( LuaGetParam( L, 4, nRefType))
LuaGetParam( L, 5, bUpdate) ;
else
LuaGetParam( L, 4, bUpdate) ;
LuaClearStack( L) ;
// sposto la faccia di indice dato della trimesh
bool bOk = ExeSurfTmMoveFacet( nId, nFacet, vtMove, nRefType, bUpdate) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaSurfTmToTriangles( lua_State* L)
{
// 1 parametro : nId
int nId ;
LuaCheckParam( L, 1, nId)
LuaClearStack( L) ;
// esplosione della trimesh in triangoli
int nCount ;
int nFirstId = ExeSurfTmToTriangles( nId, &nCount) ;
if ( nFirstId != GDB_ID_NULL)
LuaSetParam( L, nFirstId) ;
else
LuaSetParam( L) ;
LuaSetParam( L, nCount) ;
return 2 ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static int static int
LuaSurfTmRemoveFacet( lua_State* L) LuaSurfTmRemoveFacet( lua_State* L)
@@ -272,20 +399,6 @@ LuaSurfTmIntersect( lua_State* L)
return 1 ; return 1 ;
} }
//-------------------------------------------------------------------------------
static int
LuaSurfTmResetTwoColors( lua_State* L)
{
// 1 parametro : Id
int nId ;
LuaCheckParam( L, 1, nId)
LuaClearStack( L) ;
// eseguo reset TFlag per annullare due colori
bool bOk = ExeSurfTmResetTwoColors( nId) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
static int static int
LuaSurfTmSplit( lua_State* L) LuaSurfTmSplit( lua_State* L)
@@ -327,17 +440,261 @@ LuaSurfTmCut( lua_State* L)
return 1 ; return 1 ;
} }
//-------------------------------------------------------------------------------
static int
LuaSurfTmSubtractProjectedFacesOnFace( lua_State* L)
{
// 3 o 4 o 5 parametri : nSurfId, nFaceInd, nDestGrpId [, vSurfsId] [, bOCFlag]
int nSurfId ;
LuaCheckParam( L, 1, nSurfId) ;
int nFaceInd ;
LuaCheckParam( L, 2, nFaceInd) ;
int nDestGrpId ;
LuaCheckParam( L, 3, nDestGrpId) ;
INTVECTOR vSurfsId ;
bool bOCFlag = true ;
if ( LuaGetParam( L, 4, vSurfsId))
LuaGetParam( L, 5, bOCFlag) ;
else
LuaGetParam( L, 4, bOCFlag) ;
LuaClearStack( L) ;
// sottraggo alla faccia scelta la proiezione delle altre TriMesh
int nNewId = GDB_ID_NULL;
bool bExistProjection = false ;
int nNewFaceNbr = 0 ;
bool bOk = ExeSurfTmSubtractProjectedFacesOnFace( nSurfId, nFaceInd, nDestGrpId, vSurfsId,
bOCFlag, bExistProjection, nNewId, nNewFaceNbr) ;
LuaSetParam( L, bOk) ;
LuaSetParam( L, bExistProjection) ;
if ( nNewId != GDB_ID_NULL)
LuaSetParam( L, nNewId) ;
else
LuaSetParam( L) ;
LuaSetParam( L, nNewFaceNbr) ;
return 4 ;
}
//-------------------------------------------------------------------------------
static int
LuaSurfTmSetFaceColor( lua_State* L)
{
// 3 parametri : Id, nFacet, nColor
int nId ;
LuaCheckParam( L, 1, nId)
int nFacet ;
LuaCheckParam( L, 2, nFacet)
int nColor ;
LuaCheckParam( L, 3, nColor)
LuaClearStack( L) ;
// imposto il colore alla faccia della superficie TM
bool bOk = ExeSurfTmSetFaceColor( nId, nFacet, nColor) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaSurfTmGetTriaColor( lua_State* L)
{
// 2 parametri : Id, nTria
int nId ;
LuaCheckParam( L, 1, nId)
int nTria ;
LuaCheckParam( L, 2, nTria)
LuaClearStack( L) ;
// recupero il flag di colore del triangolo della superficie TM
int nColor ;
bool bOk = ExeSurfTmGetTriaColor( nId, nTria, nColor) ;
if ( bOk)
LuaSetParam( L, nColor) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaSurfTmResetTwoColors( lua_State* L)
{
// 1 parametro : Id
int nId ;
LuaCheckParam( L, 1, nId)
LuaClearStack( L) ;
// eseguo reset TFlag per annullare due colori
bool bOk = ExeSurfTmResetTwoColors( nId) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaSurfTmSetShowEdges( lua_State* L)
{
// 2 parametri : Id, bShow
int nId ;
LuaCheckParam( L, 1, nId)
bool bShow ;
LuaCheckParam( L, 2, bShow) ;
LuaClearStack( L) ;
// imposto flag visualizzazione spigoli vivi
bool bOk = ExeSurfTmSetShowEdges( nId, bShow) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaSurfTmGetShowEdges( lua_State* L)
{
// 1 parametro : Id
int nId ;
LuaCheckParam( L, 1, nId)
LuaClearStack( L) ;
// recupero il flag di visualizzazione degli spigoli vivi della superficie TM
bool bShow ;
bool bOk = ExeSurfTmGetShowEdges( nId, bShow) ;
if ( bOk)
LuaSetParam( L, bShow) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaSurfTmSetSmoothAng( lua_State* L)
{
// 2 parametri : nId, dAngDeg
int nId ;
LuaCheckParam( L, 1, nId)
double dAngDeg ;
LuaCheckParam( L, 2, dAngDeg)
LuaClearStack( L) ;
// aggiorno lo smooth angle della superficie
bool bOk = ExeSurfTmSetSmoothAng( nId, dAngDeg) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaSurfTmGetSmoothAng( lua_State* L)
{
// 1 parametro : nId
int nId ;
LuaCheckParam( L, 1, nId)
LuaClearStack( L) ;
// recupero lo smooth angle della superficie
double dAngDeg ;
bool bOk = ExeSurfTmGetSmoothAng( nId, dAngDeg) ;
if ( bOk)
LuaSetParam( L, dAngDeg) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaSurfTmOffset( lua_State* L)
{
// 4 o 5 parametri : ParentId, vIds, dOffs, dLinTol [, nType]
int nParentId ;
LuaGetParam( L, 1, nParentId) ;
INTVECTOR vIds ;
LuaCheckParam( L, 2, vIds)
double dOffs ;
LuaCheckParam( L, 3, dOffs)
double dLinTol ;
LuaCheckParam( L, 4, dLinTol) ;
int nType = STMOFF_FILLET ;
LuaGetParam( L, 5, nType) ;
LuaClearStack( L) ;
// interseco la prima superficie con la seconda
int nId = ExeSurfTmOffset( nParentId, vIds, dOffs, dLinTol, nType) ;
LuaSetParam( L, nId) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaSurfTmThickeningOffset( lua_State* L)
{
// 4 o 5 parametri : ParentId, vIds, dOffs, dLinTol [, nType]
int nParentId ;
LuaGetParam( L, 1, nParentId) ;
INTVECTOR vIds ;
LuaCheckParam( L, 2, vIds)
double dOffs ;
LuaCheckParam( L, 3, dOffs)
double dLinTol ;
LuaCheckParam( L, 4, dLinTol) ;
int nType = STMOFF_FILLET ;
LuaGetParam( L, 5, nType) ;
LuaClearStack( L) ;
// interseco la prima superficie con la seconda
int nId = ExeSurfTmThickeningOffset( nParentId, vIds, dOffs, dLinTol, nType) ;
LuaSetParam( L, nId) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaCutSurfBzPlane( lua_State* L)
{
// 4 o 5 parametri : Id, ptOn, vtN, bSaveOnEq [, nRefType]
int nId ;
LuaCheckParam( L, 1, nId)
Point3d ptOn ;
LuaCheckParam( L, 2, ptOn)
Vector3d vtN ;
LuaCheckParam( L, 3, vtN)
bool bSaveOnEq ;
LuaGetParam( L, 4, bSaveOnEq) ;
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 5, nRefType) ;
LuaClearStack( L) ;
// taglio la superficie con ilpiano
bool bOk = ExeCutSurfBzPlane( nId, ptOn, vtN, bSaveOnEq, nRefType) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaSurfBzTrim( lua_State* L)
{
// 2 parametri : nId, nCutterId
int nId ;
LuaCheckParam( L, 1, nId)
int nCutterId ;
LuaCheckParam( L, 2, nCutterId)
LuaClearStack( L) ;
// taglio la prima superficie in base alla seconda
bool bOk = ExeSurfBzTrim( nId, nCutterId) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
bool bool
LuaInstallGdbModifySurf( LuaMgr& luaMgr) LuaInstallGdbModifySurf( LuaMgr& luaMgr)
{ {
bool bOk = ( &luaMgr != nullptr) ; bool bOk = true ;
bOk = bOk && luaMgr.RegisterFunction( "EgtInvertSurf", LuaInvertSurf) ; bOk = bOk && luaMgr.RegisterFunction( "EgtInvertSurf", LuaInvertSurf) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtExplodeSurf", LuaExplodeSurf) ; bOk = bOk && luaMgr.RegisterFunction( "EgtExplodeSurf", LuaExplodeSurf) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtApproxSurf", LuaApproxSurf) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrAdd", LuaSurfFrAdd) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrAdd", LuaSurfFrAdd) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrSubtract", LuaSurfFrSubtract) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrSubtract", LuaSurfFrSubtract) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrIntersect", LuaSurfFrIntersect) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrIntersect", LuaSurfFrIntersect) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrOffset", LuaSurfFrOffset) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrOffset", LuaSurfFrOffset) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrOffsetAdv", LuaSurfFrOffsetAdv) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrEraseChunk", LuaSurfFrEraseChunk) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmMoveVertex", LuaSurfTmMoveVertex) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmMoveFacet", LuaSurfTmMoveFacet) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmToTriangles", LuaSurfTmToTriangles) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmRemoveFacet", LuaSurfTmRemoveFacet) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmRemoveFacet", LuaSurfTmRemoveFacet) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSwapFacets", LuaSurfTmSwapFacets) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSwapFacets", LuaSurfTmSwapFacets) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmRemovePart", LuaSurfTmRemovePart) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmRemovePart", LuaSurfTmRemovePart) ;
@@ -346,8 +703,19 @@ LuaInstallGdbModifySurf( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmAdd", LuaSurfTmAdd) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmAdd", LuaSurfTmAdd) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSubtract", LuaSurfTmSubtract) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSubtract", LuaSurfTmSubtract) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmIntersect", LuaSurfTmIntersect) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmIntersect", LuaSurfTmIntersect) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmResetTwoColors", LuaSurfTmResetTwoColors) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSplit", LuaSurfTmSplit) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSplit", LuaSurfTmSplit) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmCut", LuaSurfTmCut) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmCut", LuaSurfTmCut) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSubtractProjectedFacesOnFace", LuaSurfTmSubtractProjectedFacesOnFace) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSetFaceColor", LuaSurfTmSetFaceColor) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetTriaColor", LuaSurfTmGetTriaColor) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmResetTwoColors", LuaSurfTmResetTwoColors) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSetShowEdges", LuaSurfTmSetShowEdges) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetShowEdges", LuaSurfTmGetShowEdges) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSetSmoothAng", LuaSurfTmSetSmoothAng) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetSmoothAng", LuaSurfTmGetSmoothAng) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmOffset", LuaSurfTmOffset) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmThickeningOffset", LuaSurfTmThickeningOffset) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCutSurfBzPlane", LuaCutSurfBzPlane) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBzTrim", LuaSurfBzTrim) ;
return bOk ; return bOk ;
} }
+152 -12
View File
@@ -56,6 +56,42 @@ LuaVolZmapChangeResolution( lua_State* L)
return 1 ; return 1 ;
} }
//-------------------------------------------------------------------------------
static int
LuaVolZmapSetShowEdges( lua_State* L)
{
// 2 parametri : Id, bShow
int nId ;
LuaCheckParam( L, 1, nId)
bool bShow ;
LuaCheckParam( L, 2, bShow) ;
LuaClearStack( L) ;
// imposto flag visualizzazione spigoli vivi
bool bOk = ExeVolZmapSetShowEdges( nId, bShow) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaVolZmapGetShowEdges( lua_State* L)
{
// 1 parametro : Id
int nId ;
LuaCheckParam( L, 1, nId)
LuaClearStack( L) ;
// imposto flag visualizzazione spigoli vivi
bool bShow ;
bool bOk = ExeVolZmapGetShowEdges( nId, bShow) ;
// restituisco il risultato
if ( bOk)
LuaSetParam( L, bShow) ;
else
LuaSetParam( L) ;
return 1 ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static int static int
LuaRemoveVolZmapPart( lua_State* L) LuaRemoveVolZmapPart( lua_State* L)
@@ -94,7 +130,7 @@ LuaVolZmapSetStdTool( lua_State* L)
LuaGetParam( L, 7, nFlag) ; LuaGetParam( L, 7, nFlag) ;
LuaClearStack( L) ; LuaClearStack( L) ;
// imposto utensile standard a Zmap indicati // imposto utensile standard a Zmap indicati
bool bOk = ExeVolZmapSetStdTool( vIds, sToolName, dLen, dDiam, dCornR, dCutterH, nFlag) ; bool bOk = ExeVolZmapSetStdTool( vIds, sToolName, dLen, dDiam, dCornR, dCutterH, nFlag, true) ;
// restituisco il risultato // restituisco il risultato
LuaSetParam( L, bOk) ; LuaSetParam( L, bOk) ;
return 1 ; return 1 ;
@@ -125,7 +161,7 @@ LuaVolZmapSetAdvTool( lua_State* L)
LuaGetParam( L, 9, nFlag) ; LuaGetParam( L, 9, nFlag) ;
LuaClearStack( L) ; LuaClearStack( L) ;
// imposto utensile avanzato a Zmap indicati // imposto utensile avanzato a Zmap indicati
bool bOk = ExeVolZmapSetAdvTool( vIds, sToolName, dLen, dDiam, dTipLen, dTipDiam, dCornR, dCutterH, nFlag) ; bool bOk = ExeVolZmapSetAdvTool( vIds, sToolName, dLen, dDiam, dTipLen, dTipDiam, dCornR, dCutterH, nFlag, true) ;
// restituisco il risultato // restituisco il risultato
LuaSetParam( L, bOk) ; LuaSetParam( L, bOk) ;
return 1 ; return 1 ;
@@ -135,7 +171,7 @@ LuaVolZmapSetAdvTool( lua_State* L)
static int static int
LuaVolZmapSetSawTool( lua_State* L) LuaVolZmapSetSawTool( lua_State* L)
{ {
// 7 o 8 parametri : vIds, sToolName, dLen, dDiam, dThick, dStemDiam, dCornR, nFlag // 7 o 8 parametri : vIds, sToolName, dLen, dDiam, dThick, dStemDiam, dCornR [, nFlag]
INTVECTOR vIds ; INTVECTOR vIds ;
LuaCheckParam( L, 1, vIds) LuaCheckParam( L, 1, vIds)
string sToolName ; string sToolName ;
@@ -154,7 +190,7 @@ LuaVolZmapSetSawTool( lua_State* L)
LuaGetParam( L, 8, nFlag) ; LuaGetParam( L, 8, nFlag) ;
LuaClearStack( L) ; LuaClearStack( L) ;
// imposto utensile avanzato a Zmap indicati // imposto utensile avanzato a Zmap indicati
bool bOk = ExeVolZmapSetSawTool( vIds, sToolName, dLen, dDiam, dThick, dStemDiam, dCornR, nFlag) ; bool bOk = ExeVolZmapSetSawTool( vIds, sToolName, dLen, dDiam, dThick, dStemDiam, dCornR, nFlag, true) ;
// restituisco il risultato // restituisco il risultato
LuaSetParam( L, bOk) ; LuaSetParam( L, bOk) ;
return 1 ; return 1 ;
@@ -164,7 +200,7 @@ LuaVolZmapSetSawTool( lua_State* L)
static int static int
LuaVolZmapSetGenTool( lua_State* L) LuaVolZmapSetGenTool( lua_State* L)
{ {
// 3 o 4 parametri : vIds, sToolName, ToolSectId, nFlag // 3 o 4 parametri : vIds, sToolName, ToolSectId [, nFlag]
INTVECTOR vIds ; INTVECTOR vIds ;
LuaCheckParam( L, 1, vIds) LuaCheckParam( L, 1, vIds)
string sToolName ; string sToolName ;
@@ -175,7 +211,7 @@ LuaVolZmapSetGenTool( lua_State* L)
LuaGetParam( L, 4, nFlag) ; LuaGetParam( L, 4, nFlag) ;
LuaClearStack( L) ; LuaClearStack( L) ;
// imposto utensile generico a Zmap indicati // imposto utensile generico a Zmap indicati
bool bOk = ExeVolZmapSetGenTool( vIds, sToolName, nToolSectId, nFlag) ; bool bOk = ExeVolZmapSetGenTool( vIds, sToolName, nToolSectId, nFlag, true) ;
// restituisco il risultato // restituisco il risultato
LuaSetParam( L, bOk) ; LuaSetParam( L, bOk) ;
return 1 ; return 1 ;
@@ -185,7 +221,7 @@ LuaVolZmapSetGenTool( lua_State* L)
static int static int
LuaVolZmapSetMortiserTool( lua_State* L) LuaVolZmapSetMortiserTool( lua_State* L)
{ {
// 6 o 7 parametri : Id, sToolName, dLen, dWidth, dThick, dCornR, nFlag // 6 o 7 parametri : Id, sToolName, dLen, dWidth, dThick, dCornR [, nFlag]
INTVECTOR vIds ; INTVECTOR vIds ;
LuaCheckParam( L, 1, vIds) LuaCheckParam( L, 1, vIds)
string sToolName ; string sToolName ;
@@ -202,7 +238,7 @@ LuaVolZmapSetMortiserTool( lua_State* L)
LuaGetParam( L, 7, nFlag) ; LuaGetParam( L, 7, nFlag) ;
LuaClearStack( L) ; LuaClearStack( L) ;
// imposto mortasatrice a Zmap indicati // imposto mortasatrice a Zmap indicati
bool bOk = ExeVolZmapSetMortiserTool( vIds, sToolName, dLen, dWidth, dThick, dCornR, nFlag) ; bool bOk = ExeVolZmapSetMortiserTool( vIds, sToolName, dLen, dWidth, dThick, dCornR, nFlag, true) ;
// restituisco il risultato // restituisco il risultato
LuaSetParam( L, bOk) ; LuaSetParam( L, bOk) ;
return 1 ; return 1 ;
@@ -212,7 +248,7 @@ LuaVolZmapSetMortiserTool( lua_State* L)
static int static int
LuaVolZmapSetChiselTool( lua_State* L) LuaVolZmapSetChiselTool( lua_State* L)
{ {
// 5 o 6 parametri : vIds, sToolName, dLen, dWidth, dThick, nFlag // 5 o 6 parametri : vIds, sToolName, dLen, dWidth, dThick [, nFlag]
INTVECTOR vIds ; INTVECTOR vIds ;
LuaCheckParam( L, 1, vIds) LuaCheckParam( L, 1, vIds)
string sToolName ; string sToolName ;
@@ -227,7 +263,32 @@ LuaVolZmapSetChiselTool( lua_State* L)
LuaGetParam( L, 6, nFlag) ; LuaGetParam( L, 6, nFlag) ;
LuaClearStack( L) ; LuaClearStack( L) ;
// imposto scalpello a Zmap indicati // imposto scalpello a Zmap indicati
bool bOk = ExeVolZmapSetChiselTool( vIds, sToolName, dLen, dWidth, dThick, nFlag) ; bool bOk = ExeVolZmapSetChiselTool( vIds, sToolName, dLen, dWidth, dThick, nFlag, true) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaVolZmapSetAdditiveTool( lua_State* L)
{
// 5 o 6 parametri : vIds, sToolName, dLen, dDiam, dCornR [, nFlag]
INTVECTOR vIds ;
LuaCheckParam( L, 1, vIds)
string sToolName ;
LuaCheckParam( L, 2, sToolName)
double dLen ;
LuaCheckParam( L, 3, dLen)
double dDiam ;
LuaCheckParam( L, 4, dDiam)
double dCornR ;
LuaCheckParam( L, 5, dCornR)
int nFlag = 1 ;
LuaGetParam( L, 6, nFlag) ;
LuaClearStack( L) ;
// imposto utensile additivo a Zmap indicati
bool bOk = ExeVolZmapSetAdditiveTool( vIds, sToolName, dLen, dDiam, dCornR, nFlag, true) ;
// restituisco il risultato // restituisco il risultato
LuaSetParam( L, bOk) ; LuaSetParam( L, bOk) ;
return 1 ; return 1 ;
@@ -242,7 +303,7 @@ LuaVolZmapResetTool( lua_State* L)
LuaCheckParam( L, 1, vIds) LuaCheckParam( L, 1, vIds)
LuaClearStack( L) ; LuaClearStack( L) ;
// reset utensile a Zmap indicati // reset utensile a Zmap indicati
bool bOk = ExeVolZmapResetTool( vIds) ; bool bOk = ExeVolZmapResetTools( vIds) ;
// restituisco il risultato // restituisco il risultato
LuaSetParam( L, bOk) ; LuaSetParam( L, bOk) ;
return 1 ; return 1 ;
@@ -336,13 +397,85 @@ LuaCutVolZmapPlane( lua_State* L)
int nRefType = RTY_DEFAULT ; int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 4, nRefType) ; LuaGetParam( L, 4, nRefType) ;
LuaClearStack( L) ; LuaClearStack( L) ;
// taglio la superficie con ilpiano // taglio la superficie con il piano
bool bOk = ExeCutVolZmapPlane( nId, ptOn, vtN, nRefType) ; bool bOk = ExeCutVolZmapPlane( nId, ptOn, vtN, nRefType) ;
// restituisco il risultato // restituisco il risultato
LuaSetParam( L, bOk) ; LuaSetParam( L, bOk) ;
return 1 ; return 1 ;
} }
//-------------------------------------------------------------------------------
static int
LuaUpdateVolZmapByAddingSurfTm( lua_State* L)
{
// 2 parametri : nVolZmapId, StmId,
int nVolZmapId ;
LuaCheckParam( L, 1, nVolZmapId) ;
int nStmId ;
LuaCheckParam( L, 2, nStmId) ;
LuaClearStack( L) ;
bool bOk = ExeUpdateVolZmapByAddingSurfTm( nVolZmapId, nStmId) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaVolZmapMakeUniform( lua_State* L)
{
// 2 o 3 o 4 parametri : nVolZmapId, dToler [, bExtensionFirst] [, nToolNum]
int nVolZmapId ;
LuaCheckParam( L, 1, nVolZmapId) ;
double dToler ;
LuaCheckParam( L, 2, dToler) ;
bool bExtensionFirst = true ;
LuaGetParam( L, 3, bExtensionFirst) ;
int nToolNum = 0 ;
LuaGetParam( L, 4, nToolNum) ;
LuaClearStack( L) ;
bool bOk = ExeVolZmapMakeUniform( nVolZmapId, dToler, bExtensionFirst, nToolNum) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaVolZmapOffset( lua_State* L)
{
// 3 parametri : Id, dDist, nType
int nId ;
LuaCheckParam( L, 1, nId)
double dDist ;
LuaCheckParam( L, 2, dDist)
int nType = VolZmapOffset::FILLET ;
LuaGetParam( L, 3, nType) ;
LuaClearStack( L) ;
// eseguo l'offset della regione
bool bOk = ExeVolZMapOffset( nId, dDist, nType) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaVolZmapRemoveFins( lua_State* L)
{
// 3 parametri : Id, vtDir, dThick
int nId ;
LuaCheckParam( L, 1, nId) ;
Vector3d vtDir ;
LuaCheckParam( L, 2, vtDir) ;
double dThick ;
LuaCheckParam( L, 3, dThick) ;
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 4, nRefType) ;
LuaClearStack( L) ;
// Eseguo la rimozione delle alette
bool bOk = ExeVolZMapRemoveFins( nId, vtDir, dThick, nRefType) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
bool bool
LuaInstallGdbModifyVol( LuaMgr& luaMgr) LuaInstallGdbModifyVol( LuaMgr& luaMgr)
@@ -350,6 +483,8 @@ LuaInstallGdbModifyVol( LuaMgr& luaMgr)
bool bOk = ( &luaMgr != nullptr) ; bool bOk = ( &luaMgr != nullptr) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtExplodeVolume", LuaExplodeVolume) ; bOk = bOk && luaMgr.RegisterFunction( "EgtExplodeVolume", LuaExplodeVolume) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapChangeResolution", LuaVolZmapChangeResolution) ; bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapChangeResolution", LuaVolZmapChangeResolution) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetShowEdges", LuaVolZmapSetShowEdges) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapGetShowEdges", LuaVolZmapGetShowEdges) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRemoveVolZmapPart", LuaRemoveVolZmapPart) ; bOk = bOk && luaMgr.RegisterFunction( "EgtRemoveVolZmapPart", LuaRemoveVolZmapPart) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetStdTool", LuaVolZmapSetStdTool) ; bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetStdTool", LuaVolZmapSetStdTool) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetAdvTool", LuaVolZmapSetAdvTool) ; bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetAdvTool", LuaVolZmapSetAdvTool) ;
@@ -357,9 +492,14 @@ LuaInstallGdbModifyVol( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetGenTool", LuaVolZmapSetGenTool) ; bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetGenTool", LuaVolZmapSetGenTool) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetMortiserTool", LuaVolZmapSetMortiserTool) ; bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetMortiserTool", LuaVolZmapSetMortiserTool) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetChiselTool", LuaVolZmapSetChiselTool) ; bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetChiselTool", LuaVolZmapSetChiselTool) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetAdditiveTool", LuaVolZmapSetAdditiveTool) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapResetTool", LuaVolZmapResetTool) ; bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapResetTool", LuaVolZmapResetTool) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapGetToolOutline", LuaVolZmapGetToolOutline) ; bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapGetToolOutline", LuaVolZmapGetToolOutline) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapMillingStep", LuaVolZmapMillingStep) ; bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapMillingStep", LuaVolZmapMillingStep) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCutVolZmapPlane", LuaCutVolZmapPlane) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCutVolZmapPlane", LuaCutVolZmapPlane) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtUpdateVolZmapByAddingSurfTm", LuaUpdateVolZmapByAddingSurfTm ) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapMakeUniform", LuaVolZmapMakeUniform) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapOffset", LuaVolZmapOffset) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapRemoveFins", LuaVolZmapRemoveFins) ;
return bOk ; return bOk ;
} }
+56 -24
View File
@@ -42,13 +42,13 @@ LuaCopyAttributes( lua_State* L)
static int static int
LuaSetLevel( lua_State* L) LuaSetLevel( lua_State* L)
{ {
// 2 parametri : nId, nLevel // 2 parametri : Ids, nLevel
int nId ; INTVECTOR vId ;
LuaCheckParam( L, 1, nId) LuaCheckParam( L, 1, vId)
int nLevel ; int nLevel ;
LuaCheckParam( L, 2, nLevel) LuaCheckParam( L, 2, nLevel)
// imposto lo stato // imposto lo stato
bool bOk = ExeSetLevel( nId, nLevel) ; bool bOk = ExeSetLevel( vId, nLevel) ;
// restituisco il risultato // restituisco il risultato
LuaSetParam( L, bOk) ; LuaSetParam( L, bOk) ;
return 1 ; return 1 ;
@@ -111,14 +111,14 @@ LuaGetCalcLevel( lua_State* L)
static int static int
LuaSetMode( lua_State* L) LuaSetMode( lua_State* L)
{ {
// 2 parametri : nId, nMode // 2 parametri : Ids, nMode
int nId ; INTVECTOR vId ;
LuaCheckParam( L, 1, nId) LuaCheckParam( L, 1, vId)
int nMode ; int nMode ;
LuaCheckParam( L, 2, nMode) LuaCheckParam( L, 2, nMode)
LuaClearStack( L) ; LuaClearStack( L) ;
// imposto il modo // imposto il modo
bool bOk = ExeSetMode( nId, nMode) ; bool bOk = ExeSetMode( vId, nMode) ;
// restituisco il risultato // restituisco il risultato
LuaSetParam( L, bOk) ; LuaSetParam( L, bOk) ;
return 1 ; return 1 ;
@@ -179,7 +179,7 @@ LuaGetCalcMode( lua_State* L)
static int static int
LuaSetStatus( lua_State* L) LuaSetStatus( lua_State* L)
{ {
// 2 parametri : Id, nStatus // 2 parametri : Ids, nStatus
INTVECTOR vId ; INTVECTOR vId ;
LuaCheckParam( L, 1, vId) LuaCheckParam( L, 1, vId)
int nStatus ; int nStatus ;
@@ -247,12 +247,14 @@ LuaGetCalcStatus( lua_State* L)
static int static int
LuaSetMark( lua_State* L) LuaSetMark( lua_State* L)
{ {
// 1 parametro : Id // 1 o 2 parametri : Id [, nMark]
int nId ; int nId ;
LuaCheckParam( L, 1, nId) LuaCheckParam( L, 1, nId)
int nMark = 1 ;
LuaGetParam( L, 2, nMark) ;
LuaClearStack( L) ; LuaClearStack( L) ;
// imposto l'evidenziazione // imposto l'evidenziazione
bool bOk = ExeSetMark( nId) ; bool bOk = ExeSetMark( nId, nMark) ;
// restituisco il risultato // restituisco il risultato
LuaSetParam( L, bOk) ; LuaSetParam( L, bOk) ;
return 1 ; return 1 ;
@@ -519,10 +521,8 @@ LuaSetInfo( lua_State* L)
} break ; } break ;
case LUA_TTABLE : case LUA_TTABLE :
{ Frame3d frVal ; { Frame3d frVal ;
BBox3d b3Val ; BBox3d b3Val ;
Vector3d vtVal ; // va bene anche per Point3d DBLVECTOR vdVal ; // va bene anche per Vector3d, Point3d, vnVal
INTVECTOR vnVal ;
DBLVECTOR vdVal ;
STRVECTOR vsVal ; STRVECTOR vsVal ;
if ( LuaGetParam( L, 3, frVal)) { if ( LuaGetParam( L, 3, frVal)) {
LuaClearStack( L) ; LuaClearStack( L) ;
@@ -531,15 +531,7 @@ LuaSetInfo( lua_State* L)
else if ( LuaGetParam( L, 3, b3Val)) { else if ( LuaGetParam( L, 3, b3Val)) {
LuaClearStack( L) ; LuaClearStack( L) ;
bOk = ExeSetInfo( nId, sKey, b3Val) ; bOk = ExeSetInfo( nId, sKey, b3Val) ;
} }
else if ( LuaGetParam( L, 3, vtVal)) {
LuaClearStack( L) ;
bOk = ExeSetInfo( nId, sKey, vtVal) ;
}
else if ( LuaGetParam( L, 3, vnVal)) {
LuaClearStack( L) ;
bOk = ExeSetInfo( nId, sKey, vnVal) ;
}
else if ( LuaGetParam( L, 3, vdVal)) { else if ( LuaGetParam( L, 3, vdVal)) {
LuaClearStack( L) ; LuaClearStack( L) ;
bOk = ExeSetInfo( nId, sKey, vdVal) ; bOk = ExeSetInfo( nId, sKey, vdVal) ;
@@ -682,6 +674,25 @@ LuaRemoveInfo( lua_State* L)
return 1 ; return 1 ;
} }
//-------------------------------------------------------------------------------
static int
LuaGetAllInfo( lua_State* L)
{
// 1 parametro : Id
int nId ;
LuaCheckParam( L, 1, nId)
LuaClearStack( L) ;
// recupero tutte le info
STRVECTOR vsInfo ;
bool bOk = ExeGetAllInfo( nId, vsInfo) ;
// restituisco il risultato
if ( bOk)
LuaSetParam( L, vsInfo) ;
else
LuaSetParam( L) ;
return 1 ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
static int static int
LuaSetTextureName( lua_State* L) LuaSetTextureName( lua_State* L)
@@ -773,6 +784,25 @@ LuaGetTextureFrame( lua_State* L)
return 1 ; return 1 ;
} }
//-------------------------------------------------------------------------------
static int
LuaSetStipple( lua_State* L)
{
// 3 parametri : Id, nFactor, nPattern
int nId ;
LuaCheckParam( L, 1, nId)
int nFactor ;
LuaCheckParam( L, 2, nFactor)
int nPattern ;
LuaCheckParam( L, 3, nPattern)
LuaClearStack( L) ;
// setto stipple
bool bOk = ExeSetStipple( nId, nFactor, nPattern) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
bool bool
LuaInstallGdbObjAttribs( LuaMgr& luaMgr) LuaInstallGdbObjAttribs( LuaMgr& luaMgr)
@@ -809,10 +839,12 @@ LuaInstallGdbObjAttribs( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtGetInfo", LuaGetInfo) ; bOk = bOk && luaMgr.RegisterFunction( "EgtGetInfo", LuaGetInfo) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtExistsInfo", LuaExistsInfo) ; bOk = bOk && luaMgr.RegisterFunction( "EgtExistsInfo", LuaExistsInfo) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRemoveInfo", LuaRemoveInfo) ; bOk = bOk && luaMgr.RegisterFunction( "EgtRemoveInfo", LuaRemoveInfo) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAllInfo", LuaGetAllInfo) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSetTextureName", LuaSetTextureName) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSetTextureName", LuaSetTextureName) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSetTextureFrame", LuaSetTextureFrame) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSetTextureFrame", LuaSetTextureFrame) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRemoveTextureData", LuaRemoveTextureData) ; bOk = bOk && luaMgr.RegisterFunction( "EgtRemoveTextureData", LuaRemoveTextureData) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetTextureName", LuaGetTextureName) ; bOk = bOk && luaMgr.RegisterFunction( "EgtGetTextureName", LuaGetTextureName) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetTextureFrame", LuaGetTextureFrame) ; bOk = bOk && luaMgr.RegisterFunction( "EgtGetTextureFrame", LuaGetTextureFrame) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSetStipple", LuaSetStipple) ;
return bOk ; return bOk ;
} }
+118 -26
View File
@@ -208,31 +208,6 @@ LuaGetPrev( lua_State* L)
return 1 ; return 1 ;
} }
//-------------------------------------------------------------------------------
static int
LuaGetNameInGroup( lua_State* L)
{
// 2 parametri : GroupId, sName
int nGroupId = GDB_ID_NULL ;
LuaGetParam( L, 1, nGroupId) ;
string sName ;
LuaGetParam( L, 2, sName) ;
LuaClearStack( L) ;
// recupero tutti gli oggetti del gruppo con il nome o suo inizio desiderato
INTVECTOR vId ;
int nId = ExeGetFirstNameInGroup( nGroupId, sName) ;
while ( nId != GDB_ID_NULL) {
vId.push_back ( nId) ;
nId = ExeGetNextName( nId, sName) ;
}
// restituisco il risultato
if ( ! vId.empty())
LuaSetParam( L, vId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
static int static int
LuaGetFirstNameInGroup( lua_State* L) LuaGetFirstNameInGroup( lua_State* L)
@@ -313,6 +288,48 @@ LuaGetPrevName( lua_State* L)
return 1 ; return 1 ;
} }
//-------------------------------------------------------------------------------
static int
LuaGetNameInGroup( lua_State* L)
{
// 2 parametri : GroupId, sName
int nGroupId = GDB_ID_NULL ;
LuaGetParam( L, 1, nGroupId) ;
string sName ;
LuaGetParam( L, 2, sName) ;
LuaClearStack( L) ;
// recupero tutti gli oggetti del gruppo con il nome o suo inizio desiderato
INTVECTOR vIds ;
bool bOk = ExeGetNameInGroup( nGroupId, sName, vIds) ;
// restituisco il risultato
if ( bOk)
LuaSetParam( L, vIds) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaGetInfoInGroup( lua_State* L)
{
// 2 parametri : GroupId, sKey
int nGroupId = GDB_ID_NULL ;
LuaGetParam( L, 1, nGroupId) ;
string sKey ;
LuaGetParam( L, 2, sKey) ;
LuaClearStack( L) ;
// recupero tutti gli oggetti con l'info richiesta
INTVECTOR vIds ;
bool bOk = ExeGetInfoInGroup( nGroupId, sKey, vIds) ;
// restituisco il risultato
if ( bOk)
LuaSetParam( L, vIds) ;
else
LuaSetParam( L) ;
return 1 ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
static int static int
LuaGetFirstGroupInGroup( lua_State* L) LuaGetFirstGroupInGroup( lua_State* L)
@@ -472,6 +489,32 @@ LuaCopy( lua_State* L)
return 1 ; return 1 ;
} }
//-------------------------------------------------------------------------------
static int
LuaCopyEx( lua_State* L)
{
// 4 o 5 parametri : nSouCtx, SouId, nDestCtx, RefId [, nSonBeforeAfter]
int nSouCtx ;
LuaCheckParam( L, 1, nSouCtx)
int nSouId ;
LuaCheckParam( L, 2, nSouId)
int nDestCtx ;
LuaCheckParam( L, 3, nDestCtx)
int nRefId ;
LuaCheckParam( L, 4, nRefId)
int nSonBeforeAfter = GDB_LAST_SON ;
LuaGetParam( L, 5, nSonBeforeAfter) ;
LuaClearStack( L) ;
// eseguo la copia
int nNewId = ExeCopyEx( nSouCtx, nSouId, nDestCtx, nRefId, nSonBeforeAfter) ;
// restituisco il risultato
if ( nNewId != GDB_ID_NULL)
LuaSetParam( L, nNewId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
static int static int
LuaCopyGlob( lua_State* L) LuaCopyGlob( lua_State* L)
@@ -494,6 +537,51 @@ LuaCopyGlob( lua_State* L)
return 1 ; return 1 ;
} }
//-------------------------------------------------------------------------------
static int
LuaCopyGlobEx( lua_State* L)
{
// 4 o 5 parametri : nSouCtx, SouId, nDestCtx, RefId [, nSonBeforeAfter]
int nSouCtx ;
LuaCheckParam( L, 1, nSouCtx)
int nSouId ;
LuaCheckParam( L, 2, nSouId)
int nDestCtx ;
LuaCheckParam( L, 3, nDestCtx)
int nRefId ;
LuaCheckParam( L, 4, nRefId)
int nSonBeforeAfter = GDB_LAST_SON ;
LuaGetParam( L, 5, nSonBeforeAfter) ;
LuaClearStack( L) ;
// eseguo la copia
int nNewId = ExeCopyGlobEx( nSouCtx, nSouId, nDestCtx, nRefId, nSonBeforeAfter) ;
// restituisco il risultato
if ( nNewId != GDB_ID_NULL)
LuaSetParam( L, nNewId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaDuplicateGeomDB( lua_State* L)
{
// 2 o 3 parametri : nSouCtx, nDestCtx [, bSkipTemp]
int nSouCtx ;
LuaCheckParam( L, 1, nSouCtx)
int nDestCtx ;
LuaCheckParam( L, 2, nDestCtx)
bool bSkipTemp = false ;
LuaGetParam( L, 3, bSkipTemp) ;
LuaClearStack( L) ;
// eseguo la copia
bool bOk = ExeDuplicateGeomDB( nSouCtx, nDestCtx, bSkipTemp) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
static int static int
LuaRelocate( lua_State* L) LuaRelocate( lua_State* L)
@@ -632,11 +720,12 @@ LuaInstallGdbObjects( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtGetNext", LuaGetNext) ; bOk = bOk && luaMgr.RegisterFunction( "EgtGetNext", LuaGetNext) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetLastInGroup", LuaGetLastInGroup) ; bOk = bOk && luaMgr.RegisterFunction( "EgtGetLastInGroup", LuaGetLastInGroup) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetPrev", LuaGetPrev) ; bOk = bOk && luaMgr.RegisterFunction( "EgtGetPrev", LuaGetPrev) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetNameInGroup", LuaGetNameInGroup) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetFirstNameInGroup", LuaGetFirstNameInGroup) ; bOk = bOk && luaMgr.RegisterFunction( "EgtGetFirstNameInGroup", LuaGetFirstNameInGroup) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetNextName", LuaGetNextName) ; bOk = bOk && luaMgr.RegisterFunction( "EgtGetNextName", LuaGetNextName) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetLastNameInGroup", LuaGetLastNameInGroup) ; bOk = bOk && luaMgr.RegisterFunction( "EgtGetLastNameInGroup", LuaGetLastNameInGroup) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetPrevName", LuaGetPrevName) ; bOk = bOk && luaMgr.RegisterFunction( "EgtGetPrevName", LuaGetPrevName) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetNameInGroup", LuaGetNameInGroup) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetInfoInGroup", LuaGetInfoInGroup) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetFirstGroupInGroup", LuaGetFirstGroupInGroup) ; bOk = bOk && luaMgr.RegisterFunction( "EgtGetFirstGroupInGroup", LuaGetFirstGroupInGroup) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetNextGroup", LuaGetNextGroup) ; bOk = bOk && luaMgr.RegisterFunction( "EgtGetNextGroup", LuaGetNextGroup) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetLastGroupInGroup", LuaGetLastGroupInGroup) ; bOk = bOk && luaMgr.RegisterFunction( "EgtGetLastGroupInGroup", LuaGetLastGroupInGroup) ;
@@ -645,7 +734,10 @@ LuaInstallGdbObjects( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtGetBBoxGlob", LuaGetBBoxGlob) ; bOk = bOk && luaMgr.RegisterFunction( "EgtGetBBoxGlob", LuaGetBBoxGlob) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetBBoxRef", LuaGetBBoxRef) ; bOk = bOk && luaMgr.RegisterFunction( "EgtGetBBoxRef", LuaGetBBoxRef) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCopy", LuaCopy) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCopy", LuaCopy) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCopyEx", LuaCopyEx) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCopyGlob", LuaCopyGlob) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCopyGlob", LuaCopyGlob) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCopyGlobEx", LuaCopyGlobEx) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtDuplicateGeomDB", LuaDuplicateGeomDB) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRelocate", LuaRelocate) ; bOk = bOk && luaMgr.RegisterFunction( "EgtRelocate", LuaRelocate) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRelocateGlob", LuaRelocateGlob) ; bOk = bOk && luaMgr.RegisterFunction( "EgtRelocateGlob", LuaRelocateGlob) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGroupSwap", LuaGroupSwap) ; bOk = bOk && luaMgr.RegisterFunction( "EgtGroupSwap", LuaGroupSwap) ;
+54
View File
@@ -277,6 +277,21 @@ LuaGetPrevLayer( lua_State* L)
return 1 ; return 1 ;
} }
//-------------------------------------------------------------------------------
static int
LuaIsGhostPart( lua_State* L)
{
// 1 parametro : nGhostId
int nGhostId ;
LuaCheckParam( L, 1, nGhostId)
LuaClearStack( L) ;
// verifico sia un segnaposto di pezzo messo in grezzo
bool bOk = ExeIsGhostPart( nGhostId) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
static int static int
LuaGetFirstGhostPart( lua_State* L) LuaGetFirstGhostPart( lua_State* L)
@@ -454,6 +469,42 @@ LuaDuploList( lua_State* L)
return 1 ; return 1 ;
} }
//-------------------------------------------------------------------------------
static int
LuaDuploInRawCount( lua_State* L)
{
// 1 parametro : nSouId
int nSouId ;
LuaCheckParam( L, 1, nSouId)
LuaClearStack( L) ;
// recupero il numero di duplicati che sono riferiti da grezzi nei vari gruppi di lavoro del progetto
int nCount ;
bool bOk = ExeDuploInRawCount( nSouId, nCount) ;
// restituisco il risultato
if ( bOk)
LuaSetParam( L, nCount) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaDuploWithoutRawList( lua_State* L)
{
// nessun parametro
LuaClearStack( L) ;
// recupero l'elenco dei duplicati
INTVECTOR vnDup ;
bool bOk = ExeDuploWithoutRawList( vnDup) ;
// restituisco il risultato
if ( bOk)
LuaSetParam( L, vnDup) ;
else
LuaSetParam( L) ;
return 1 ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
static int static int
LuaDuploSetModified( lua_State* L) LuaDuploSetModified( lua_State* L)
@@ -605,6 +656,7 @@ LuaInstallGdbPartLayer( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtGetNextLayer", LuaGetNextLayer) ; bOk = bOk && luaMgr.RegisterFunction( "EgtGetNextLayer", LuaGetNextLayer) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetLastLayer", LuaGetLastLayer) ; bOk = bOk && luaMgr.RegisterFunction( "EgtGetLastLayer", LuaGetLastLayer) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetPrevLayer", LuaGetPrevLayer) ; bOk = bOk && luaMgr.RegisterFunction( "EgtGetPrevLayer", LuaGetPrevLayer) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtIsGhostPart", LuaIsGhostPart) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetFirstGhostPart", LuaGetFirstGhostPart) ; bOk = bOk && luaMgr.RegisterFunction( "EgtGetFirstGhostPart", LuaGetFirstGhostPart) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetNextGhostPart", LuaGetNextGhostPart) ; bOk = bOk && luaMgr.RegisterFunction( "EgtGetNextGhostPart", LuaGetNextGhostPart) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtEraseEmptyParts", LuaEraseEmptyParts) ; bOk = bOk && luaMgr.RegisterFunction( "EgtEraseEmptyParts", LuaEraseEmptyParts) ;
@@ -616,6 +668,8 @@ LuaInstallGdbPartLayer( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtDuploNew", LuaDuploNew) ; bOk = bOk && luaMgr.RegisterFunction( "EgtDuploNew", LuaDuploNew) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtDuploCount", LuaDuploCount) ; bOk = bOk && luaMgr.RegisterFunction( "EgtDuploCount", LuaDuploCount) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtDuploList", LuaDuploList) ; bOk = bOk && luaMgr.RegisterFunction( "EgtDuploList", LuaDuploList) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtDuploInRawCount", LuaDuploInRawCount) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtDuploWithoutRawList", LuaDuploWithoutRawList) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtDuploSetModified", LuaDuploSetModified) ; bOk = bOk && luaMgr.RegisterFunction( "EgtDuploSetModified", LuaDuploSetModified) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtDuploGetModified", LuaDuploGetModified) ; bOk = bOk && luaMgr.RegisterFunction( "EgtDuploGetModified", LuaDuploGetModified) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtDuploSetLocked", LuaDuploSetLocked) ; bOk = bOk && luaMgr.RegisterFunction( "EgtDuploSetLocked", LuaDuploSetLocked) ;
+1025 -152
View File
File diff suppressed because it is too large Load Diff
+81
View File
@@ -530,6 +530,83 @@ LuaBBoxLocToLoc( lua_State* L)
} }
} }
//-------------------------------------------------------------------------------
static int
LuaQuaternionFromAxisAngle( lua_State* L)
{
// 2 parametri : vtAx, dAngDeg
Vector3d vtAx ;
LuaCheckParam( L, 1, vtAx)
double dAngDeg ;
LuaCheckParam( L, 2, dAngDeg)
LuaClearStack( L) ;
// calcolo il quaternione che produce la rotazione equivalente
Quaternion qtQ = FromAxisAngle( vtAx, dAngDeg) ;
if ( ! qtQ.IsSmall())
LuaSetParam( L, qtQ) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaQuaternionToAxisAngle( lua_State* L)
{
// 1 parametro : Quaternion
Quaternion qtQ ;
LuaCheckParam( L, 1, qtQ)
LuaClearStack( L) ;
// calcolo l'asse e l'angolo di rotazione equivalenti
Vector3d vtAx ;
double dAngDeg ;
bool bOk = ToAxisAngle( qtQ, vtAx, dAngDeg) ;
if ( bOk) {
LuaSetParam( L, vtAx) ;
LuaSetParam( L, dAngDeg) ;
return 2 ;
}
else {
LuaSetParam( L) ;
return 1 ;
}
}
//-------------------------------------------------------------------------------
static int
LuaQuaternionFromFrame( lua_State* L)
{
// 1 parametro : Frame
Frame3d frFrame ;
LuaCheckParam( L, 1, frFrame)
LuaClearStack( L) ;
// calcolo il quaternione che produce l'orientamento di questo frame tramite rotazione dal globale
Quaternion qtQ = FromFrame( frFrame) ;
if ( ! qtQ.IsSmall())
LuaSetParam( L, qtQ) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaQuaternionToFrame( lua_State* L)
{
// 1 parametro : Quaternion
Quaternion qtQ ;
LuaCheckParam( L, 1, qtQ)
LuaClearStack( L) ;
// calcolo il frame equivalente come orientamento a quello globale ruotato dal quaternione
Frame3d frFrame ;
bool bOk = ToFrame( qtQ, frFrame) ;
if ( bOk)
LuaSetParam( L, frFrame) ;
else
LuaSetParam( L) ;
return 1 ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
bool bool
LuaInstallGeoBase( LuaMgr& luaMgr) LuaInstallGeoBase( LuaMgr& luaMgr)
@@ -557,5 +634,9 @@ LuaInstallGeoBase( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtBBoxToGlob", LuaBBoxToGlob) ; bOk = bOk && luaMgr.RegisterFunction( "EgtBBoxToGlob", LuaBBoxToGlob) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtBBoxToLoc", LuaBBoxToLoc) ; bOk = bOk && luaMgr.RegisterFunction( "EgtBBoxToLoc", LuaBBoxToLoc) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtBBoxLocToLoc", LuaBBoxLocToLoc) ; bOk = bOk && luaMgr.RegisterFunction( "EgtBBoxLocToLoc", LuaBBoxLocToLoc) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtQuaternionFromAxisAngle", LuaQuaternionFromAxisAngle) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtQuaternionToAxisAngle", LuaQuaternionToAxisAngle) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtQuaternionFromFrame", LuaQuaternionFromFrame) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtQuaternionToFrame", LuaQuaternionToFrame) ;
return bOk ; return bOk ;
} }
+64
View File
@@ -49,6 +49,38 @@ LuaPointCurveDist( lua_State* L)
return 3 ; return 3 ;
} }
//----------------------------------------------------------------------------
static int
LuaPointCurveDistSide( lua_State* L)
{
// 3 o 4 parametri : ptP, nCrvId, vtN [, nRefId]
Point3d ptP ;
LuaCheckParam( L, 1, ptP)
int nId ;
LuaCheckParam( L, 2, nId)
Vector3d vtN ;
LuaCheckParam( L, 3, vtN)
int nRefType = nId ;
LuaGetParam( L, 4, nRefType) ;
LuaClearStack( L) ;
// calcolo la distanza
int nSide ;
double dDist ;
Point3d ptMin ;
bool bOk = ExePointCurveDistSide( ptP, nId, vtN, nRefType, &dDist, ptMin, &nSide) ;
if ( bOk) {
LuaSetParam( L, dDist) ;
LuaSetParam( L, ptMin) ;
LuaSetParam( L, nSide) ;
}
else {
LuaSetParam( L) ;
LuaSetParam( L) ;
LuaSetParam( L) ;
}
return 3 ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static int static int
LuaPointSurfTmDist( lua_State* L) LuaPointSurfTmDist( lua_State* L)
@@ -79,12 +111,44 @@ LuaPointSurfTmDist( lua_State* L)
return 3 ; return 3 ;
} }
//----------------------------------------------------------------------------
static int
LuaPointSurfBzDist( lua_State* L)
{
// 2 o 3 parametri : ptP, nSbzId, [, nRefId]
Point3d ptP ;
LuaCheckParam( L, 1, ptP)
int nId ;
LuaCheckParam( L, 2, nId)
int nRefType = nId ;
LuaGetParam( L, 3, nRefType) ;
LuaClearStack( L) ;
// calcolo la distanza
double dDist ;
Point3d ptMin ;
Vector3d vtN ;
bool bOk = ExePointSurfBzDist( ptP, nId, nRefType, &dDist, ptMin, vtN) ;
if ( bOk) {
LuaSetParam( L, dDist) ;
LuaSetParam( L, ptMin) ;
LuaSetParam( L, vtN) ;
}
else {
LuaSetParam( L) ;
LuaSetParam( L) ;
LuaSetParam( L) ;
}
return 3 ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
bool bool
LuaInstallGeoDist( LuaMgr& luaMgr) LuaInstallGeoDist( LuaMgr& luaMgr)
{ {
bool bOk = ( &luaMgr != nullptr) ; bool bOk = ( &luaMgr != nullptr) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtPointCurveDist", LuaPointCurveDist) ; bOk = bOk && luaMgr.RegisterFunction( "EgtPointCurveDist", LuaPointCurveDist) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtPointCurveDistSide", LuaPointCurveDistSide) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtPointSurfTmDist", LuaPointSurfTmDist) ; bOk = bOk && luaMgr.RegisterFunction( "EgtPointSurfTmDist", LuaPointSurfTmDist) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtPointSurfBzDist", LuaPointSurfBzDist) ;
return bOk ; return bOk ;
} }
+273 -124
View File
@@ -20,6 +20,41 @@
using namespace std ; using namespace std ;
//----------------------------------------------------------------------------
static int
LuaLineCurveInters( lua_State* L)
{
// 3 o 4 parametri : ptP, vtDir, Id, [, nRefId]
Point3d ptP ;
LuaCheckParam( L, 1, ptP)
Vector3d vtDir ;
LuaCheckParam( L, 2, vtDir)
int nId ;
LuaCheckParam( L, 3, nId)
int nRefType = nId ;
LuaGetParam( L, 4, nRefType) ;
LuaClearStack( L) ;
// recupero i punti di intersezione tra linea e curva
INTDBLVECTOR vInters ;
if ( ExeLineCurveInters( ptP, vtDir, nId, nRefType, vInters)) {
LuaSetParam( L, true) ;
INTVECTOR vType( vInters.size()) ;
DBLVECTOR vPar( vInters.size()) ;
for ( size_t i = 0 ; i < vInters.size() ; ++ i) {
vType[i] = vInters[i].first ;
vPar[i] = vInters[i].second ;
}
LuaSetParam( L, vType) ;
LuaSetParam( L, vPar) ;
}
else {
LuaSetParam( L) ;
LuaSetParam( L) ;
LuaSetParam( L) ;
}
return 3 ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static int static int
LuaLineBoxInters( lua_State* L) LuaLineBoxInters( lua_State* L)
@@ -53,38 +88,6 @@ LuaLineBoxInters( lua_State* L)
return 3 ; return 3 ;
} }
//----------------------------------------------------------------------------
static int
LuaPlaneBoxInters( lua_State* L)
{
// 4 o 5 parametri : ptOn, vtN, b3Box, nDestGrpId [, nRefType]
Point3d ptOn ;
LuaCheckParam( L, 1, ptOn)
Vector3d vtN ;
LuaCheckParam( L, 2, vtN)
BBox3d b3Box ;
LuaCheckParam( L, 3, b3Box)
int nDestGrpId ;
LuaCheckParam( L, 4, nDestGrpId) ;
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 5, nRefType) ;
LuaClearStack( L) ;
// eseguo l'intersezione
int nPntCount = 0 ;
int nCrvCount = 0 ;
int nSrfCount = 0 ;
int nNewId = ExePlaneBoxInters( ptOn, vtN, b3Box, nDestGrpId, nRefType, &nPntCount, &nCrvCount, &nSrfCount) ;
// restituisco il risultato
if ( nNewId != GDB_ID_NULL)
LuaSetParam( L, nNewId) ;
else
LuaSetParam( L) ;
LuaSetParam( L, nPntCount) ;
LuaSetParam( L, nCrvCount) ;
LuaSetParam( L, nSrfCount) ;
return 4 ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static int static int
LuaLineSurfTmInters( lua_State* L) LuaLineSurfTmInters( lua_State* L)
@@ -120,6 +123,136 @@ LuaLineSurfTmInters( lua_State* L)
return 3 ; return 3 ;
} }
//----------------------------------------------------------------------------
static int
LuaLineSurfBzInters( lua_State* L)
{
// 3 o 4 parametri : ptP, vtDir, Id, [, nRefId]
Point3d ptP ;
LuaCheckParam( L, 1, ptP)
Vector3d vtDir ;
LuaCheckParam( L, 2, vtDir)
int nId ;
LuaCheckParam( L, 3, nId)
int nRefType = nId ;
LuaGetParam( L, 4, nRefType) ;
LuaClearStack( L) ;
// recupero i punti di intersezione tra linea e superficie trimesh
INTDBLVECTOR vInters ;
if ( ExeLineSurfBzInters( ptP, vtDir, nId, nRefType, vInters)) {
LuaSetParam( L, true) ;
INTVECTOR vType( vInters.size()) ;
DBLVECTOR vPar( vInters.size()) ;
for ( size_t i = 0 ; i < vInters.size() ; ++ i) {
vType[i] = vInters[i].first ;
vPar[i] = vInters[i].second ;
}
LuaSetParam( L, vType) ;
LuaSetParam( L, vPar) ;
}
else {
LuaSetParam( L) ;
LuaSetParam( L) ;
LuaSetParam( L) ;
}
return 3 ;
}
//----------------------------------------------------------------------------
static int
LuaLineVolZmapInters( lua_State* L)
{
// 3 o 4 parametri : ptP, vtDir, Id, [, nRefId]
Point3d ptP ;
LuaCheckParam( L, 1, ptP)
Vector3d vtDir ;
LuaCheckParam( L, 2, vtDir)
int nId ;
LuaCheckParam( L, 3, nId)
int nRefType = nId ;
LuaGetParam( L, 4, nRefType) ;
LuaClearStack( L) ;
// eseguo calcolo intersezione
INTDBLVECTOR vInters ;
if ( ExeLineVolZmapInters( ptP, vtDir, nId, nRefType, vInters)) {
LuaSetParam( L, true) ;
INTVECTOR vType( vInters.size()) ;
DBLVECTOR vPar( vInters.size()) ;
for ( size_t i = 0 ; i < vInters.size() ; ++ i) {
vType[i] = vInters[i].first ;
vPar[i] = vInters[i].second ;
}
LuaSetParam( L, vType) ;
LuaSetParam( L, vPar) ;
}
else {
LuaSetParam( L) ;
LuaSetParam( L) ;
LuaSetParam( L) ;
}
return 3 ;
}
//----------------------------------------------------------------------------
static int
LuaPlaneCurveInters( lua_State* L)
{
// 4 o 5 parametri : ptOn, vtN, nId, nDestGrpId [, nRefType]
Point3d ptOn ;
LuaCheckParam( L, 1, ptOn)
Vector3d vtN ;
LuaCheckParam( L, 2, vtN)
int nId ;
LuaCheckParam( L, 3, nId)
int nDestGrpId ;
LuaCheckParam( L, 4, nDestGrpId) ;
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 5, nRefType) ;
LuaClearStack( L) ;
// eseguo l'intersezione
int nCount = 0 ;
int nNewId = ExePlaneCurveInters( ptOn, vtN, nId, nDestGrpId, nRefType, &nCount) ;
// restituisco il risultato
if ( nNewId != GDB_ID_NULL)
LuaSetParam( L, nNewId) ;
else
LuaSetParam( L) ;
LuaSetParam( L, nCount) ;
return 2 ;
}
//----------------------------------------------------------------------------
static int
LuaPlaneBoxInters( lua_State* L)
{
// 4 o 5 parametri : ptOn, vtN, b3Box, nDestGrpId [, nRefType]
Point3d ptOn ;
LuaCheckParam( L, 1, ptOn)
Vector3d vtN ;
LuaCheckParam( L, 2, vtN)
BBox3d b3Box ;
LuaCheckParam( L, 3, b3Box)
int nDestGrpId ;
LuaCheckParam( L, 4, nDestGrpId) ;
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 5, nRefType) ;
LuaClearStack( L) ;
// eseguo l'intersezione
int nPntCount = 0 ;
int nCrvCount = 0 ;
int nSrfCount = 0 ;
int nNewId = ExePlaneBoxInters( ptOn, vtN, b3Box, nDestGrpId, nRefType, &nPntCount, &nCrvCount, &nSrfCount) ;
// restituisco il risultato
if ( nNewId != GDB_ID_NULL)
LuaSetParam( L, nNewId) ;
else
LuaSetParam( L) ;
LuaSetParam( L, nPntCount) ;
LuaSetParam( L, nCrvCount) ;
LuaSetParam( L, nSrfCount) ;
return 4 ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static int static int
LuaPlaneSurfTmInters( lua_State* L) LuaPlaneSurfTmInters( lua_State* L)
@@ -186,6 +319,91 @@ LuaParPlanesSurfTmInters( lua_State* L)
return 2 ; return 2 ;
} }
//----------------------------------------------------------------------------
static int
LuaPlaneVolZmapInters( lua_State* L)
{
// 4 o 5 parametri : ptP, vtN, nId, nDestGrpId [, nRefType]
Point3d ptP ;
LuaCheckParam( L, 1, ptP)
Vector3d vtN ;
LuaCheckParam( L, 2, vtN)
int nId ;
LuaCheckParam( L, 3, nId)
int nDestGrpId ;
LuaCheckParam( L, 4, nDestGrpId)
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 5, nRefType) ;
LuaClearStack( L) ;
// eseguo calcolo intersezione
int nCount ;
int nFirstId = ExePlaneVolZmapInters( ptP, vtN, nId, nDestGrpId, nRefType, &nCount) ;
// restituisco il risultato
if ( nFirstId != GDB_ID_NULL) {
LuaSetParam( L, nFirstId) ;
LuaSetParam( L, nCount) ;
}
else {
LuaSetParam( L) ;
LuaSetParam( L) ;
}
return 2 ;
}
//----------------------------------------------------------------------------
static int
LuaCurveCurveInters( lua_State* L)
{
// 3 o 4 parametri : nId1, nId2, nDestGrpId [, bOnly3D]
int nId1 ;
LuaCheckParam( L, 1, nId1)
int nId2 ;
LuaCheckParam( L, 2, nId2)
int nDestGrpId ;
LuaCheckParam( L, 3, nDestGrpId) ;
bool bOnly3D = false ;
LuaGetParam( L, 4, bOnly3D) ;
LuaClearStack( L) ;
// eseguo l'intersezione
int nPntCount = 0 ;
int nCrvCount = 0 ;
int nNewId = ExeCurveCurveInters( nId1, nId2, nDestGrpId, &nPntCount, &nCrvCount, bOnly3D) ;
// restituisco il risultato
if ( nNewId != GDB_ID_NULL)
LuaSetParam( L, nNewId) ;
else
LuaSetParam( L) ;
LuaSetParam( L, nPntCount) ;
LuaSetParam( L, nCrvCount) ;
return 3 ;
}
//----------------------------------------------------------------------------
static int
LuaCurveSurfTmInters( lua_State* L)
{
// 3 parametri : nCrvId, nStmId, nDestGrpId
int nCrvId ;
LuaCheckParam( L, 1, nCrvId)
int nStmId ;
LuaCheckParam( L, 2, nStmId)
int nDestGrpId ;
LuaCheckParam( L, 3, nDestGrpId) ;
LuaClearStack( L) ;
// eseguo l'intersezione
int nPntCount = 0 ;
int nCrvCount = 0 ;
int nNewId = ExeCurveSurfTmInters( nCrvId, nStmId, nDestGrpId, &nPntCount, &nCrvCount) ;
// restituisco il risultato
if ( nNewId != GDB_ID_NULL)
LuaSetParam( L, nNewId) ;
else
LuaSetParam( L) ;
LuaSetParam( L, nPntCount) ;
LuaSetParam( L, nCrvCount) ;
return 3 ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static int static int
LuaSurfTmSurfTmInters( lua_State* L) LuaSurfTmSurfTmInters( lua_State* L)
@@ -218,96 +436,22 @@ LuaSurfTmSurfTmInters( lua_State* L)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static int static int
LuaPlaneCurveInters( lua_State* L) LuaBBoxOverlap( lua_State* L)
{ {
// 4 o 5 parametri : ptOn, vtN, nId, nDestGrpId [, nRefType] // 4 parametri : BBoxA, frA, BBoxB, frB
Point3d ptOn ; BBox3d bboxA ;
LuaCheckParam( L, 1, ptOn) LuaCheckParam( L, 1, bboxA)
Vector3d vtN ; Frame3d frA ;
LuaCheckParam( L, 2, vtN) LuaCheckParam( L, 2, frA)
int nId ; BBox3d bboxB ;
LuaCheckParam( L, 3, nId) LuaCheckParam( L, 3, bboxB) ;
int nDestGrpId ; Frame3d frB ;
LuaCheckParam( L, 4, nDestGrpId) ; LuaCheckParam( L, 4, frB) ;
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 5, nRefType) ;
LuaClearStack( L) ; LuaClearStack( L) ;
// eseguo l'intersezione bool bRes = ExeBBoxOverlap( bboxA, frA, bboxB, frB) ;
int nCount = 0 ;
int nNewId = ExePlaneCurveInters( ptOn, vtN, nId, nDestGrpId, nRefType, &nCount) ;
// restituisco il risultato // restituisco il risultato
if ( nNewId != GDB_ID_NULL) LuaSetParam( L, bRes) ;
LuaSetParam( L, nNewId) ; return 1 ;
else
LuaSetParam( L) ;
LuaSetParam( L, nCount) ;
return 2 ;
}
//----------------------------------------------------------------------------
static int
LuaLineVolZmapInters( lua_State* L)
{
// 3 o 4 parametri : ptP, vtDir, Id, [, nRefId]
Point3d ptP ;
LuaCheckParam( L, 1, ptP)
Vector3d vtDir ;
LuaCheckParam( L, 2, vtDir)
int nId ;
LuaCheckParam( L, 3, nId)
int nRefType = nId ;
LuaGetParam( L, 4, nRefType) ;
LuaClearStack( L) ;
// eseguo calcolo intersezione
INTDBLVECTOR vInters ;
if ( ExeLineVolZmapInters( ptP, vtDir, nId, nRefType, vInters)) {
LuaSetParam( L, true) ;
INTVECTOR vType( vInters.size()) ;
DBLVECTOR vPar( vInters.size()) ;
for ( size_t i = 0 ; i < vInters.size() ; ++ i) {
vType[i] = vInters[i].first ;
vPar[i] = vInters[i].second ;
}
LuaSetParam( L, vType) ;
LuaSetParam( L, vPar) ;
}
else {
LuaSetParam( L) ;
LuaSetParam( L) ;
LuaSetParam( L) ;
}
return 3 ;
}
//----------------------------------------------------------------------------
static int
LuaPlaneVolZmapInters( lua_State* L)
{
// 4 o 5 parametri : ptP, vtN, nId, nDestGrpId [, nRefType]
Point3d ptP ;
LuaCheckParam( L, 1, ptP)
Vector3d vtN ;
LuaCheckParam( L, 2, vtN)
int nId ;
LuaCheckParam( L, 3, nId)
int nDestGrpId ;
LuaCheckParam( L, 4, nDestGrpId)
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 5, nRefType) ;
LuaClearStack( L) ;
// eseguo calcolo intersezione
int nCount ;
int nFirstId = ExePlaneVolZmapInters( ptP, vtN, nId, nDestGrpId, nRefType, &nCount) ;
// restituisco il risultato
if ( nFirstId != GDB_ID_NULL) {
LuaSetParam( L, nFirstId) ;
LuaSetParam( L, nCount) ;
}
else {
LuaSetParam( L) ;
LuaSetParam( L) ;
}
return 2 ;
} }
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
@@ -315,14 +459,19 @@ bool
LuaInstallGeoInters( LuaMgr& luaMgr) LuaInstallGeoInters( LuaMgr& luaMgr)
{ {
bool bOk = ( &luaMgr != nullptr) ; bool bOk = ( &luaMgr != nullptr) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtLineCurveInters", LuaLineCurveInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtLineBoxInters", LuaLineBoxInters) ; bOk = bOk && luaMgr.RegisterFunction( "EgtLineBoxInters", LuaLineBoxInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtPlaneBoxInters", LuaPlaneBoxInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtLineSurfTmInters", LuaLineSurfTmInters) ; bOk = bOk && luaMgr.RegisterFunction( "EgtLineSurfTmInters", LuaLineSurfTmInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtLineSurfBzInters", LuaLineSurfBzInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtLineVolZmapInters", LuaLineVolZmapInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtPlaneCurveInters", LuaPlaneCurveInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtPlaneBoxInters", LuaPlaneBoxInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtPlaneSurfTmInters", LuaPlaneSurfTmInters) ; bOk = bOk && luaMgr.RegisterFunction( "EgtPlaneSurfTmInters", LuaPlaneSurfTmInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtParPlanesSurfTmInters", LuaParPlanesSurfTmInters) ; bOk = bOk && luaMgr.RegisterFunction( "EgtParPlanesSurfTmInters", LuaParPlanesSurfTmInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSurfTmInters", LuaSurfTmSurfTmInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtPlaneCurveInters", LuaPlaneCurveInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtLineVolZmapInters", LuaLineVolZmapInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtPlaneVolZmapInters", LuaPlaneVolZmapInters) ; bOk = bOk && luaMgr.RegisterFunction( "EgtPlaneVolZmapInters", LuaPlaneVolZmapInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCurveInters", LuaCurveCurveInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveSurfTmInters", LuaCurveSurfTmInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSurfTmInters", LuaSurfTmSurfTmInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtBBoxOverlap", LuaBBoxOverlap) ;
return bOk ; return bOk ;
} }
+10 -8
View File
@@ -312,16 +312,16 @@ LuaSaveFile( lua_State* L)
static int static int
LuaSaveObjToFile( lua_State* L) LuaSaveObjToFile( lua_State* L)
{ {
// 2 o 3 parametri : nId, path del file [, flag] // 2 o 3 parametri : vId, path del file [, flag]
int nId ; INTVECTOR vId ;
LuaCheckParam( L, 1, nId) LuaCheckParam( L, 1, vId)
string sFilePath ; string sFilePath ;
LuaCheckParam( L, 2, sFilePath) LuaCheckParam( L, 2, sFilePath)
int nFlag = GDB_SV_CMPTXT ; int nFlag = GDB_SV_CMPTXT ;
LuaGetParam( L, 3, nFlag) ; LuaGetParam( L, 3, nFlag) ;
LuaClearStack( L) ; LuaClearStack( L) ;
// copio il gruppo nel file // copio il gruppo nel file
bool bOk = ExeSaveObjToFile( nId, sFilePath, nFlag) ; bool bOk = ExeSaveObjToFile( vId, sFilePath, nFlag) ;
// restituisco il risultato // restituisco il risultato
LuaSetParam( L, bOk) ; LuaSetParam( L, bOk) ;
return 1 ; return 1 ;
@@ -331,16 +331,18 @@ LuaSaveObjToFile( lua_State* L)
static int static int
LuaSaveMachGroupToFile( lua_State* L) LuaSaveMachGroupToFile( lua_State* L)
{ {
// 2 o 3 parametri : nMGroupId, path del file [, flag] // 2, 3 o 4 parametri : nMGroupId, [ vPlusId,] sFilePath [, nFlag]
int nMGroupId ; int nMGroupId ;
LuaCheckParam( L, 1, nMGroupId) LuaCheckParam( L, 1, nMGroupId)
INTVECTOR vPlusId ;
int nOffs = ( LuaGetParam( L, 2, vPlusId) ?1 : 0) ;
string sFilePath ; string sFilePath ;
LuaCheckParam( L, 2, sFilePath) LuaCheckParam( L, 2 + nOffs, sFilePath)
int nFlag = GDB_SV_CMPTXT ; int nFlag = GDB_SV_CMPTXT ;
LuaGetParam( L, 3, nFlag) ; LuaGetParam( L, 3 + nOffs, nFlag) ;
LuaClearStack( L) ; LuaClearStack( L) ;
// copio il gruppo nel file // copio il gruppo nel file
bool bOk = ExeSaveMachGroupToFile( nMGroupId, sFilePath, nFlag) ; bool bOk = ExeSaveMachGroupToFile( nMGroupId, vPlusId, sFilePath, nFlag) ;
// restituisco il risultato // restituisco il risultato
LuaSetParam( L, bOk) ; LuaSetParam( L, bOk) ;
return 1 ; return 1 ;
+678 -67
View File
File diff suppressed because it is too large Load Diff
+306
View File
@@ -0,0 +1,306 @@
//----------------------------------------------------------------------------
// EgalTech 2025-2025
//----------------------------------------------------------------------------
// File : LUA_MachOpt.cpp Data : 02.04.25 Versione : 2.7c1
// Contenuto : Funzioni per Ottimizzare i tempi tra le lavorazioni per LUA.
//
//
//
// Modifiche : 02.04.25 RE Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "LUA.h"
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EGkLuaAux.h"
#include "/EgtDev/Include/EGnStringUtils.h"
using namespace std ;
//-------------------------------------------------------------------------------
static int
LuaOptMachInit( lua_State* L)
{
// Nessun parametro
LuaClearStack( L) ;
// Inizializzo il calcolatore per minimizzare i tempi tra le lavorazioni
bool bOk = ExeOptMachInit() ;
// Restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaOptMachTerminate( lua_State* L)
{
// Nessun parametro
LuaClearStack( L) ;
// Termino il calcolatore per minimizzare i tempi tra le lavorazioni
bool bOk = ExeOptMachTerminate() ;
// Restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaOptMachAddTool( lua_State* L)
{
// Definizione 9 parametri (3 obbligatori)
int nId ;
LuaCheckParam( L, 1, nId) ;
double dTLoad ;
LuaCheckParam( L, 2, dTLoad) ;
double dTUnload ;
LuaCheckParam( L, 3, dTUnload) ;
double dTC_X = 0. ;
bool bTC_X = LuaGetParam( L, 4, dTC_X) ;
double dTC_Y = 0. ;
bool bTC_Y = LuaGetParam( L, 5, dTC_Y) ;
double dTC_Z = 0. ;
bool bTC_Z = LuaGetParam( L, 6, dTC_Z) ;
double dTC_A = 0. ;
bool bTC_A = LuaGetParam( L, 7, dTC_A) ;
double dTC_B = 0. ;
bool bTC_B = LuaGetParam( L, 8, dTC_B) ;
double dTC_C = 0. ;
bool bTC_C = LuaGetParam( L, 9, dTC_C) ;
LuaClearStack( L) ;
// Aggiungo la Lavorazione
bool bOk = ExeOptMachAddTool( nId, dTC_X, dTC_Y, dTC_Z, dTC_A, dTC_B, dTC_C,
bTC_X, bTC_Y, bTC_Z, bTC_A, bTC_B, bTC_C,
dTLoad, dTUnload) ;
// Rstituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaOptMachAddMachining( lua_State* L)
{
// Definizione 5 parametri
int nId ;
LuaCheckParam( L, 1, nId) ;
int nToolId ;
LuaCheckParam( L, 2, nToolId) ;
int nGroup ;
LuaCheckParam( L, 3, nGroup) ;
DBLVECTOR vAxStart ;
LuaCheckParam( L, 4, vAxStart) ;
DBLVECTOR vAxEnd ;
LuaCheckParam( L, 5, vAxEnd) ;
LuaClearStack( L) ;
// Completamento valori assi
while ( vAxStart.size() < 6)
vAxStart.push_back( 0) ;
while ( vAxEnd.size() < 6)
vAxEnd.push_back( 0) ;
// Aggiungo la Lavorazione
bool bOk = ExeOptMachAddMachining( nId, nToolId, nGroup,
vAxStart[0], vAxStart[1], vAxStart[2], vAxStart[3], vAxStart[4], vAxStart[5],
vAxEnd[0], vAxEnd[1], vAxEnd[2], vAxEnd[3], vAxEnd[4], vAxEnd[5]) ;
// Rstituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaOptMachSetFirstMachining( lua_State* L)
{
// 1 parametro : nId
int nId = 0 ;
LuaCheckParam( L, 1, nId) ;
LuaClearStack( L) ;
// Imposto la prima lavorazione
bool bOk = ExeOptMachSetFirstMachining( nId) ;
// Restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//------------------------------------------------------------------------------
static int
LuaOptMachSetLastMachining( lua_State* L)
{
// 1 parametro : nId
int nId = 0 ;
LuaCheckParam( L, 1, nId) ;
LuaClearStack( L) ;
// Imposto la prima lavorazione
bool bOk = ExeOptMachSetLastMachining( nId) ;
// Restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//------------------------------------------------------------------------------
static int
LuaOptMachSetFeeds( lua_State* L)
{
// 2 Parametri : dFeedL, dFeedA
double dFeedL = 1. ;
LuaCheckParam( L, 1, dFeedL) ;
double dFeedA = 1. ;
LuaCheckParam( L, 2, dFeedA) ;
LuaClearStack( L) ;
// Imposto le Feeds
bool bOk = ExeOptMachSetFeeds( dFeedL, dFeedA) ;
// Restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaOptMachAddDependence( lua_State* L)
{
// 2 parametri : nIdPrev, nIdSucc
int nIdPrev = 0 ; int nIdNext = 0 ;
LuaCheckParam( L, 1, nIdPrev) ;
LuaCheckParam( L, 2, nIdNext) ;
LuaClearStack( L) ;
// Imposto Dipendenza obbligatoria
bool bOk = ExeOptMachAddDependence( nIdPrev, nIdNext) ;
// Restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaOptMachAddSuggestedDependence( lua_State* L)
{
// 2 parametri : nIdPrev, nIdSucc
int nIdPrev = 0 ; int nIdNext = 0 ;
LuaCheckParam( L, 1, nIdPrev) ;
LuaCheckParam( L, 2, nIdNext) ;
LuaClearStack( L) ;
// Imposto Dipendenza suggerita
bool bOk = ExeOptMachAddSuggestedDependence( nIdPrev, nIdNext) ;
// Restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaOptMachSetAllGroupDependencesAsMandatory( lua_State* L)
{
// 1 Parametro : bAllMendatory
bool bAllMendatory = false ;
LuaCheckParam( L, 1, bAllMendatory) ;
LuaClearStack( L) ;
// Imposto il Flag
bool bOk = ExeOptMachSetAllGroupDependencesAsMandatory( bAllMendatory) ;
// Restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaOptMachSetOptimizationForGroups( lua_State* L)
{
// 1 Parametro : bOptForGroups
bool bOptForGroups = false ;
LuaCheckParam( L, 1, bOptForGroups) ;
LuaClearStack( L) ;
// Imposto il Flag
bool bOk = ExeOptMachSetOptimizationForGroups( bOptForGroups) ;
// Restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaOptMachSetOpenBound( lua_State* L)
{
// 5 parametri : bStartVsEnd, nFlag, dX, dY, dZ
bool bStartVsEnd ;
LuaCheckParam( L, 1, bStartVsEnd) ;
int nFlag ;
LuaCheckParam( L, 2, nFlag) ;
double dX ;
LuaCheckParam( L, 3, dX) ;
double dY ;
LuaCheckParam( L, 4, dY) ;
double dZ ;
LuaCheckParam( L, 5, dZ) ;
LuaClearStack( L) ;
// Imposto la condizione
bool bOk = ExeOptMachSetOpenBound( bStartVsEnd, nFlag, dX, dY, dZ) ;
// Restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaOptMachSetOpenBoundForGroups( lua_State* L)
{
// 6 parametri : nGroup, bStartVsEnd, nFlag, dX, dY, dZ
int nGroup ;
LuaCheckParam( L, 1, nGroup) ;
bool bStartVsEnd ;
LuaCheckParam( L, 2, bStartVsEnd) ;
int nFlag ;
LuaCheckParam( L, 3, nFlag) ;
double dX ;
LuaCheckParam( L, 4, dX) ;
double dY ;
LuaCheckParam( L, 5, dY) ;
double dZ ;
LuaCheckParam( L, 6, dZ) ;
LuaClearStack( L) ;
// Imposto la condizione
bool bOk = ExeOptMachSetOpenBoundForGroups( nGroup, bStartVsEnd, nFlag, dX, dY, dZ) ;
// Restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaOptMachCalculate( lua_State* L)
{
// nessun parametro
LuaClearStack( L) ;
// eseguo calcolo di minimo percorso
INTVECTOR vOrder ;
bool bOk = ExeOptMachCalculate( vOrder) ;
// restituisco il risultato
if ( bOk)
LuaSetParam( L, vOrder) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
bool
LuaInstallMachiningOptimization( LuaMgr& luaMgr)
{
bool bOk = ( &luaMgr != nullptr) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtOptMachInit", LuaOptMachInit) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtOptMachTerminate", LuaOptMachTerminate) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtOptMachAddTool", LuaOptMachAddTool) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtOptMachAddMachining", LuaOptMachAddMachining) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtOptMachSetFirstMachining", LuaOptMachSetFirstMachining) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtOptMachSetLastMachining", LuaOptMachSetLastMachining) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtOptMachSetFeeds", LuaOptMachSetFeeds) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtOptMachAddDependence", LuaOptMachAddDependence) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtOptMachAddSuggestedDependence", LuaOptMachAddSuggestedDependence) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtOptMachSetAllGroupsDependencesAsMandatory", LuaOptMachSetAllGroupDependencesAsMandatory) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtOptMachSetOptimizationForGroups", LuaOptMachSetOptimizationForGroups) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtOptMachSetOpenBound", LuaOptMachSetOpenBound) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtOptMachSetOpenBoundForGroups", LuaOptMachSetOpenBoundForGroups) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtOptMachCalculate", LuaOptMachCalculate) ;
return bOk ;
}
+39
View File
@@ -340,6 +340,21 @@ LuaAutoNestSetInterpartGap( lua_State* L)
return 1 ; return 1 ;
} }
//-------------------------------------------------------------------------------
static int
LuaAutoNestSetShearGap( lua_State* L)
{
// 1 parametro : dShearGap
double dShearGap ;
LuaCheckParam( L, 1, dShearGap)
LuaClearStack( L) ;
// imposto shear gap
bool bOk = ExeAutoNestSetShearGap( dShearGap) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
static int static int
LuaAutoNestSetReportFile( lua_State* L) LuaAutoNestSetReportFile( lua_State* L)
@@ -466,6 +481,28 @@ LuaAutoNestGetOneResult( lua_State* L)
} }
} }
//-------------------------------------------------------------------------------
static int
LuaAutoNestCalcShearSequence( lua_State* L)
{
// 1 parametro : nNesting
int nNesting ;
LuaCheckParam( L, 1, nNesting)
LuaClearStack( L) ;
// calcolo shear sequence
PNTVECTOR vPtStart, vPtEnd ;
bool bOk = ExeAutoNestCalcShearSequence( nNesting, vPtStart, vPtEnd) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
if ( bOk) {
LuaSetParam( L, vPtStart) ;
LuaSetParam( L, vPtEnd) ;
return 3 ;
}
else
return 1 ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
bool bool
LuaInstallNesting( LuaMgr& luaMgr) LuaInstallNesting( LuaMgr& luaMgr)
@@ -488,6 +525,7 @@ LuaInstallNesting( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtAutoNestSetStripYconstraintToPart", LuaAutoNestSetStripYconstraintToPart) ; bOk = bOk && luaMgr.RegisterFunction( "EgtAutoNestSetStripYconstraintToPart", LuaAutoNestSetStripYconstraintToPart) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAutoNestSetStripXconstraintToPart", LuaAutoNestSetStripXconstraintToPart) ; bOk = bOk && luaMgr.RegisterFunction( "EgtAutoNestSetStripXconstraintToPart", LuaAutoNestSetStripXconstraintToPart) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAutoNestSetInterpartGap", LuaAutoNestSetInterpartGap) ; bOk = bOk && luaMgr.RegisterFunction( "EgtAutoNestSetInterpartGap", LuaAutoNestSetInterpartGap) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAutoNestSetShearGap", LuaAutoNestSetShearGap) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAutoNestSetReportFile", LuaAutoNestSetReportFile) ; bOk = bOk && luaMgr.RegisterFunction( "EgtAutoNestSetReportFile", LuaAutoNestSetReportFile) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAutoNestCompute", LuaAutoNestCompute) ; bOk = bOk && luaMgr.RegisterFunction( "EgtAutoNestCompute", LuaAutoNestCompute) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAutoNestCancelComputation", LuaAutoNestCancelComputation) ; bOk = bOk && luaMgr.RegisterFunction( "EgtAutoNestCancelComputation", LuaAutoNestCancelComputation) ;
@@ -495,6 +533,7 @@ LuaInstallNesting( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtAutoNestPrintResults", LuaAutoNestPrintResults) ; bOk = bOk && luaMgr.RegisterFunction( "EgtAutoNestPrintResults", LuaAutoNestPrintResults) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAutoNestGetResults", LuaAutoNestGetResults) ; bOk = bOk && luaMgr.RegisterFunction( "EgtAutoNestGetResults", LuaAutoNestGetResults) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAutoNestGetOneResult", LuaAutoNestGetOneResult) ; bOk = bOk && luaMgr.RegisterFunction( "EgtAutoNestGetOneResult", LuaAutoNestGetOneResult) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAutoNestCalcShearSequence", LuaAutoNestCalcShearSequence) ;
return bOk ; return bOk ;
} }
+234
View File
@@ -0,0 +1,234 @@
//----------------------------------------------------------------------------
// EgalTech 2025-2025
//----------------------------------------------------------------------------
// File : LUA_Redis.cpp Data : 17.09.25 Versione : 2.7i3
// Contenuto : Funzioni per interfacciarsi con server Redis.
//
//
//
// Modifiche : 17.09.25 RE Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "LUA.h"
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EGkLuaAux.h"
using namespace std ;
//-------------------------------------------------------------------------------
static int
LuaRedisConnect( lua_State* L)
{
// 1 parametro : sConnection
string sConnection ;
LuaCheckParam( L, 1, sConnection)
LuaClearStack( L) ;
// Imposto la connessione
int nIdConnection = 0 ;
bool bOk = ExeRedisConnect( sConnection, nIdConnection) ;
// Restituisco il risultato
LuaSetParam( L, bOk) ;
LuaSetParam( L, nIdConnection) ;
return 2 ;
}
//-------------------------------------------------------------------------------
static int
LuaRedisDisconnect( lua_State* L)
{
// 1 parametro : nIdConnection
int nIdConnection = 0 ;
LuaCheckParam( L, 1, nIdConnection) ;
LuaClearStack( L) ;
// Imposto la connessione
bool bOk = ExeRedisDisconnect( nIdConnection) ;
// Restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaRedisSetValFromKey( lua_State* L)
{
// 3 parametri : nIdConnection, sKey, sVal
int nIdConnection = 0 ;
LuaCheckParam( L, 1, nIdConnection) ;
string sKey ;
LuaCheckParam( L, 2, sKey) ;
string sVal ;
LuaCheckParam( L, 3, sVal) ;
LuaClearStack( L) ;
// Imposto il valore della chiave
bool bOk = ExeRedisSetValFromKey( nIdConnection, sKey, sVal) ;
// Restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaRedisGetValFromKey( lua_State* L)
{
// 2 parametri : nIdConnection, sKey
int nIdConnection = 0 ;
LuaCheckParam( L, 1, nIdConnection) ;
string sKey ;
LuaCheckParam( L, 2, sKey)
LuaClearStack( L) ;
// Recupero il valore della chiave
string sVal, sType ;
bool bOk = ExeRedisGetValFromKey( nIdConnection, sKey, sVal) ;
// Restituisco il risultato
LuaSetParam( L, bOk) ;
LuaSetParam( L, sVal) ;
return 2 ;
}
//-------------------------------------------------------------------------------
static int
LuaRedisAsyncConnect( lua_State* L)
{
// 2 parametri : sConnection
string sConnection ;
LuaCheckParam( L, 1, sConnection)
LuaClearStack( L) ;
// Imposto la connessione
int nIdConnection = -1 ;
bool bOk = ExeRedisAsyncConnect( sConnection, nIdConnection) ;
// Restituisco il risultato
LuaSetParam( L, bOk) ;
LuaSetParam( L, nIdConnection) ;
return 2 ;
}
//-------------------------------------------------------------------------------
static int
LuaRedisAsyncDiconnect( lua_State* L)
{
// 1 parametro : nIdConnection
int nIdConnection = 0 ;
LuaCheckParam( L, 1, nIdConnection) ;
LuaClearStack( L) ;
// Imposto la connessione
bool bOK = ExeRedisAsyncDisconnect( nIdConnection) ;
// Restituisco il risultato
LuaSetParam( L, bOK) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaRedisAsyncPublish( lua_State* L)
{
// 3 parametri : nIdConnection, sChannel, sMessage
int nIdConnection = 0 ;
LuaCheckParam( L, 1, nIdConnection) ;
string sChannel ;
LuaCheckParam( L, 2, sChannel) ;
string sMessage ;
LuaCheckParam( L, 3, sMessage) ;
LuaClearStack( L) ;
// Pubblico il messaggio sul canale
bool bOk = ExeRedisAsyncPublish( nIdConnection, sChannel, sMessage) ;
// Restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//--------------------------------------------------------------------------------
static int
LuaRedisAsyncSubscribe( lua_State* L)
{
// 2 parametri : nIdConnection, sChannel
int nIdConnection = 0 ;
LuaCheckParam( L, 1, nIdConnection) ;
string sChannel ;
LuaCheckParam( L, 2, sChannel) ;
LuaClearStack( L) ;
// Iscrizione al canale
bool bOk = ExeRedisAsyncSubscribe( nIdConnection, sChannel) ;
// Restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//--------------------------------------------------------------------------------
static int
LuaRedisAsyncUnsubscribe( lua_State* L)
{
// 2 parametri : nIdConnection, sChannel
int nIdConnection = 0 ;
LuaCheckParam( L, 1, nIdConnection) ;
string sChannel ;
LuaCheckParam( L, 2, sChannel) ;
LuaClearStack( L) ;
// Disiscrizione
bool bOk = ExeRedisAsyncUnsubscribe( nIdConnection, sChannel) ;
// Restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaRedisAsyncSubscribeOneMessage( lua_State* L)
{
// 3 parametri : nIdConnection, sChannel, dMaxTimeOut
int nIdConnection = 0 ;
LuaCheckParam( L, 1, nIdConnection) ;
string sChannel ;
LuaCheckParam( L, 2, sChannel) ;
double dMaxTimeOut = 0. ;
LuaCheckParam( L, 3, dMaxTimeOut) ;
LuaClearStack( L) ;
// Eseguo funzione speciale di iscrizione - attesa messaggio - disiscrizione
string sMessage ;
bool bOk = ExeRedisAsyncSubscribeOneMessage( nIdConnection, sChannel, dMaxTimeOut, sMessage) ;
// Restituisco il risultato
LuaSetParam( L, bOk) ;
LuaSetParam( L, sMessage) ;
return 2 ;
}
//-------------------------------------------------------------------------------
static int
LuaRedisAsyncGetMessage( lua_State* L)
{
int nIdConnection = 0 ;
LuaCheckParam( L, 1, nIdConnection) ;
string sChannel ;
LuaCheckParam( L, 2, sChannel) ;
// Eseguo la funzione per leggere il messaggio
int nCount = 0 ;
string sMessage ;
bool bOk = ExeRedisAsyncGetMessage( nIdConnection, sChannel, nCount, sMessage) ;
// Restituisco il risultato
LuaSetParam( L, bOk) ;
LuaSetParam( L, nCount) ;
LuaSetParam( L, sMessage) ;
return 3 ;
}
//-------------------------------------------------------------------------------
bool
LuaInstallRedis( LuaMgr& luaMgr)
{
bool bOk = ( &luaMgr != nullptr) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRedisConnect", LuaRedisConnect) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRedisDisconnect", LuaRedisDisconnect) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRedisSetValFromKey", LuaRedisSetValFromKey) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRedisGetValFromKey", LuaRedisGetValFromKey) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRedisAsyncConnect", LuaRedisAsyncConnect) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRedisAsyncDisconnect", LuaRedisAsyncDiconnect) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRedisAsyncPublish", LuaRedisAsyncPublish) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRedisAsyncSubscribe", LuaRedisAsyncSubscribe) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRedisAsyncUnsubscribe", LuaRedisAsyncUnsubscribe) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRedisAsyncSubscribeOneMessage", LuaRedisAsyncSubscribeOneMessage) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRedisAsyncGetMessage", LuaRedisAsyncGetMessage) ;
return bOk ;
}
+142 -1
View File
@@ -73,6 +73,19 @@ LuaDraw( lua_State* L)
return 1 ; return 1 ;
} }
//-------------------------------------------------------------------------------
static int
LuaRedraw( lua_State* L)
{
// nessun parametro
LuaClearStack( L) ;
// forzo ridisegno
bool bOk = ExeRedraw() ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
static int static int
LuaSetShowMode( lua_State* L) LuaSetShowMode( lua_State* L)
@@ -175,6 +188,21 @@ LuaZoomObject( lua_State* L)
return 1 ; return 1 ;
} }
//-------------------------------------------------------------------------------
static int
LuaSetViewOrizzOffsStep( lua_State* L)
{
// 1 parametro : nDirOffsStep
int nDirOffsStep ;
LuaCheckParam( L, 1, nDirOffsStep)
LuaClearStack( L) ;
// imposto offset angolare orizzontale a step di 90° per direzione di vista
bool bOk = ExeSetViewOrizzOffsStep( nDirOffsStep) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
static int static int
LuaSetView( lua_State* L) LuaSetView( lua_State* L)
@@ -228,6 +256,60 @@ LuaSetViewCenter( lua_State* L)
return 1 ; return 1 ;
} }
//-------------------------------------------------------------------------------
static int
LuaGetViewOrizzOffsStep( lua_State* L)
{
// nessun parametro
LuaClearStack( L) ;
// recupero offset angolare orizzontale a step di 90° per direzione di vista
int nDirOffsStep ;
bool bOk = ExeGetViewOrizzOffsStep( &nDirOffsStep) ;
// restituisco il risultato
if ( bOk)
LuaSetParam( L, nDirOffsStep) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaGetView( lua_State* L)
{
// nessun parametro
LuaClearStack( L) ;
// recupero direzione di vista
int nViewDir ;
bool bOk = ExeGetView( &nViewDir) ;
// restituisco il risultato
if ( bOk)
LuaSetParam( L, nViewDir) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaGetGenericView( lua_State* L)
{
// nessun parametro
LuaClearStack( L) ;
// recupero angoli della direzione di vista
double dAngVertDeg ;
double dAngHorizDeg ;
bool bOk = ExeGetGenericView( &dAngVertDeg, &dAngHorizDeg) ;
// restituisco il risultato
if ( bOk) {
LuaSetParam( L, dAngVertDeg) ;
LuaSetParam( L, dAngHorizDeg) ;
}
else
LuaSetParam( L) ;
return 2 ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
static int static int
LuaGetImage( lua_State* L) LuaGetImage( lua_State* L)
@@ -253,23 +335,82 @@ LuaGetImage( lua_State* L)
return 1 ; return 1 ;
} }
//-------------------------------------------------------------------------------
static int
LuaGetImageEx( lua_State* L)
{
// 11 argomenti : nDriver, b2Buff, nColorBits, nDepthBits, nShowMode, colBackTop, colBackBottom, nCameraDir, nWidth, nHeight, sFile
int nDriver ;
LuaCheckParam( L, 1, nDriver)
bool b2Buff ;
LuaCheckParam( L, 2, b2Buff)
int nColorBits ;
LuaCheckParam( L, 3, nColorBits)
int nDepthBits ;
LuaCheckParam( L, 4, nDepthBits)
int nShowMode ;
LuaCheckParam( L, 5, nShowMode)
Color colBackTop ;
LuaCheckParam( L, 6, colBackTop)
Color colBackBottom ;
LuaCheckParam( L, 7, colBackBottom)
int nCameraDir ;
LuaCheckParam( L, 8, nCameraDir)
int nWidth ;
LuaCheckParam( L, 9, nWidth)
int nHeight ;
LuaCheckParam( L, 10, nHeight)
string sFile ;
LuaCheckParam( L, 11, sFile)
LuaClearStack( L) ;
// creo e salvo una immagine della scena
bool bOk = ExeGetImageEx( nDriver, b2Buff, nColorBits, nDepthBits, nShowMode,
colBackTop, colBackBottom, nCameraDir, nWidth, nHeight, sFile) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaSetShowSurfBezierTol( lua_State* L)
{
// 1 o 2 argomenti : dLinTol [, bRedraw]
double dLinTol ;
LuaCheckParam( L, 1, dLinTol)
bool bRedraw = true ;
LuaCheckParam( L, 2, bRedraw)
bool bOk = ExeSetShowSurfBezierTol( dLinTol, bRedraw) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
bool bool
LuaInstallScene( LuaMgr& luaMgr) LuaInstallScene( LuaMgr& luaMgr)
{ {
bool bOk = ( &luaMgr != nullptr) ; bool bOk = true ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSetBackground", LuaSetBackground) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSetBackground", LuaSetBackground) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetBackground", LuaGetBackground) ; bOk = bOk && luaMgr.RegisterFunction( "EgtGetBackground", LuaGetBackground) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtDraw", LuaDraw) ; bOk = bOk && luaMgr.RegisterFunction( "EgtDraw", LuaDraw) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRedraw", LuaRedraw) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSetShowMode", LuaSetShowMode) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSetShowMode", LuaSetShowMode) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSetShowCurveDirection", LuaSetShowCurveDirection) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSetShowCurveDirection", LuaSetShowCurveDirection) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSetShowTriaAdv", LuaSetShowTriaAdv) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSetShowTriaAdv", LuaSetShowTriaAdv) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtZoomRadius", LuaZoomRadius) ; bOk = bOk && luaMgr.RegisterFunction( "EgtZoomRadius", LuaZoomRadius) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtZoom", LuaZoom) ; bOk = bOk && luaMgr.RegisterFunction( "EgtZoom", LuaZoom) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtZoomObject", LuaZoomObject) ; bOk = bOk && luaMgr.RegisterFunction( "EgtZoomObject", LuaZoomObject) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSetViewOrizzOffsStep", LuaSetViewOrizzOffsStep) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSetView", LuaSetView) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSetView", LuaSetView) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSetGenericView", LuaSetGenericView) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSetGenericView", LuaSetGenericView) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSetViewCenter", LuaSetViewCenter) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSetViewCenter", LuaSetViewCenter) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetViewOrizzOffsStep", LuaGetViewOrizzOffsStep) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetView", LuaGetView) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetGenericView", LuaGetGenericView) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetImage", LuaGetImage) ; bOk = bOk && luaMgr.RegisterFunction( "EgtGetImage", LuaGetImage) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetImageEx", LuaGetImageEx) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSetShowSurfBezierTol", LuaSetShowSurfBezierTol) ;
return bOk ; return bOk ;
} }
+1 -1
View File
@@ -160,7 +160,7 @@ LuaSpSetZzOwStep( lua_State* L)
LuaCheckParam( L, 1, dStep) LuaCheckParam( L, 1, dStep)
LuaClearStack( L) ; LuaClearStack( L) ;
// imposto lo step per tipologie ZigZag e OneWay // imposto lo step per tipologie ZigZag e OneWay
bool bOk = ExeSpSetZzOwStep( dStep) ; bool bOk = ExeSpSetZzOwStep( dStep) ;
// restituisco il risultato // restituisco il risultato
LuaSetParam( L, bOk) ; LuaSetParam( L, bOk) ;
return 1 ; return 1 ;
+204
View File
@@ -0,0 +1,204 @@
//----------------------------------------------------------------------------
// EgalTech 2024-2024
//----------------------------------------------------------------------------
// File : LUA_TestObjSurface.cpp Data : 24.03.24 Versione : 2.6c2
// Contenuto : Funzioni di verifica intersezione tra oggetti e superfici.
// Oggetti = Box, Sfere, Cilindri, Coni, RectPrismoid, SurfTriMesh
// Superfici = SurfTriMesh, ( Bezier).
//
// Modifiche : 24.03.24 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "LUA.h"
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EXeConst.h"
#include "/EgtDev/Include/EGkLuaAux.h"
#include "/EgtDev/Include/EGnStringUtils.h"
using namespace std ;
//-------------------------------------------------------------------------------
static int
LuaTestBoxSurface( lua_State* L)
{
// 4 o 5 parametri : frBox, vtDiag, nSurfId, dSafeDist [, nRefType]
Frame3d frBox ;
LuaCheckParam( L, 1, frBox)
Vector3d vtDiag ;
LuaCheckParam( L, 2, vtDiag)
int nSurfId ;
LuaCheckParam( L, 3, nSurfId)
double dSafeDist ;
LuaCheckParam( L, 4, dSafeDist)
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 5, nRefType) ;
LuaClearStack( L) ;
// eseguo verifica di collisione
int nRes = ExeTestBoxSurface( frBox, vtDiag, nSurfId, dSafeDist, nRefType) ;
// restituisco il risultato
if ( nRes >= 0)
LuaSetParam( L, ( nRes != 0)) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaTestRectPrismoidSurface( lua_State* L)
{
// 8 o 9 parametri : frBox, dBaseLenX, dBaseLenY, dTopLenX, dTopLenY, dHeight, nSurfId, dSafeDist [, nRefType]
Frame3d frBox ;
LuaCheckParam( L, 1, frBox)
double dBaseLenX ;
LuaCheckParam( L, 2, dBaseLenX)
double dBaseLenY ;
LuaCheckParam( L, 3, dBaseLenY)
double dTopLenX ;
LuaCheckParam( L, 4, dTopLenX)
double dTopLenY ;
LuaCheckParam( L, 5, dTopLenY)
double dHeight ;
LuaCheckParam( L, 6, dHeight)
int nSurfId ;
LuaCheckParam( L, 7, nSurfId)
double dSafeDist ;
LuaCheckParam( L, 8, dSafeDist)
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 9, nRefType) ;
LuaClearStack( L) ;
// eseguo verifica di collisione
int nRes = ExeTestRectPrismoidSurface( frBox, dBaseLenX, dBaseLenY, dTopLenX, dTopLenY, dHeight, nSurfId, dSafeDist, nRefType) ;
// restituisco il risultato
if ( nRes >= 0)
LuaSetParam( L, ( nRes != 0)) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaTestCylSurface( lua_State* L)
{
// 5 o 6 parametri : frCyl, dR, dH, nSurfId, dSafeDist [, nRefType]
Frame3d frCyl ;
LuaCheckParam( L, 1, frCyl)
double dR ;
LuaCheckParam( L, 2, dR)
double dH ;
LuaCheckParam( L, 3, dH)
int nSurfId ;
LuaCheckParam( L, 4, nSurfId)
double dSafeDist ;
LuaCheckParam( L, 5, dSafeDist)
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 6, nRefType) ;
LuaClearStack( L) ;
// eseguo verifica di collisione
int nRes = ExeTestCylSurface( frCyl, dR, dH, nSurfId, dSafeDist, nRefType) ;
// restituisco il risultato
if ( nRes >= 0)
LuaSetParam( L, ( nRes != 0)) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaTestConeSurface( lua_State* L)
{
// 6 o 7 parametri : frCone, dR1, dR2, dH, nSurfId, dSafeDist [, nRefType]
Frame3d frCone ;
LuaCheckParam( L, 1, frCone)
double dR1 ;
LuaCheckParam( L, 2, dR1)
double dR2 ;
LuaCheckParam( L, 3, dR2)
double dH ;
LuaCheckParam( L, 4, dH)
int nSurfId ;
LuaCheckParam( L, 5, nSurfId)
double dSafeDist ;
LuaCheckParam( L, 6, dSafeDist)
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 7, nRefType) ;
LuaClearStack( L) ;
// eseguo verifica di collisione
int nRes = ExeTestConeSurface( frCone, dR1, dR2, dH, nSurfId, dSafeDist, nRefType) ;
// restituisco il risultato
if ( nRes >= 0)
LuaSetParam( L, ( nRes != 0)) ;
else
LuaSetParam( L) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaTestSpheSurface( lua_State* L)
{
// 4 o 5 parametri : ptCen, dRad, nSurfId, dSafeDist [, nRefType]
Point3d ptCen ;
LuaCheckParam( L, 1, ptCen)
double dR ;
LuaCheckParam( L, 2, dR)
int nSurfId ;
LuaCheckParam( L, 3, nSurfId)
double dSafeDist ;
LuaCheckParam( L, 4, dSafeDist)
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 5, nRefType) ;
LuaClearStack( L) ;
// eseguo verifica di collisione
int nRes = ExeTestSpheSurface( ptCen, dR, nSurfId, dSafeDist, nRefType) ;
// restituisco il risultato
if ( nRes >= 0)
LuaSetParam( L, ( nRes != 0)) ;
else
LuaSetParam( L) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaTestSurfaceSurface( lua_State* L)
{
// 3 o 4 parametri : nSurf1Id, nSurf2Id, dSafeDist [, bTestEnclusion]
int nSurf1Id ;
LuaCheckParam( L, 1, nSurf1Id)
int nSurf2Id ;
LuaCheckParam( L, 2, nSurf2Id)
double dSafeDist ;
LuaCheckParam( L, 3, dSafeDist)
bool bTestEnclusion = false ;
LuaGetParam( L, 4, bTestEnclusion) ;
LuaClearStack( L) ;
// eseguo verifica di interferenza
int nRes = ExeTestSurfaceSurface( nSurf1Id, nSurf2Id, dSafeDist, bTestEnclusion) ;
// restituisco il risultato
if ( nRes >= 0)
LuaSetParam( L, ( nRes != 0)) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
bool
LuaInstallTestObjSurface( LuaMgr& luaMgr)
{
bool bOk = ( &luaMgr != nullptr) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtTestBoxSurface", LuaTestBoxSurface) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtTestRectPrismoidSurface", LuaTestRectPrismoidSurface) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtTestCylSurface", LuaTestCylSurface) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtTestConeSurface", LuaTestConeSurface) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtTestSpheSurface", LuaTestSpheSurface) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtTestSurfaceSurface", LuaTestSurfaceSurface) ;
return bOk ;
}
+328
View File
@@ -0,0 +1,328 @@
//----------------------------------------------------------------------------
// EgalTech 2025-2025
//----------------------------------------------------------------------------
// File : LUA_Trimming.cpp Data : 23.10.25 Versione : 2.7j3
// Contenuto : Funzioni per le lavorazioni di Trimming.
//
// Modifiche : 23.10.25 RE Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "LUA.h"
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EXeConst.h"
#include "/EgtDev/Include/EGkLuaAux.h"
#include "/EgtDev/Include/EGnStringUtils.h"
using namespace std ;
// ------------------------------------------------------------------------------
static int
LuaTrimmingGetHoleBorder( lua_State* L)
{
// 7 parametri : nPartId, vSurfIds, vOtherSurfIds, dSurfLinTol, dSurfAngTol, dEdgeLinTol, dEdgeAngTol, dEdgeThick
int nParentId ;
LuaCheckParam( L, 1, nParentId) ;
INTVECTOR vSurfIds ;
LuaCheckParam( L, 2, vSurfIds) ;
INTVECTOR vOtherSurfIds ;
LuaCheckParam( L, 3, vOtherSurfIds) ;
double dSurfLinTol ;
LuaCheckParam( L, 4, dSurfLinTol) ;
double dSurfAngTol ;
LuaCheckParam( L, 5, dSurfAngTol) ;
double dEdgeLinTol ;
LuaCheckParam( L, 6, dEdgeLinTol) ;
double dEdgeAngTol ;
LuaCheckParam( L, 7, dEdgeAngTol) ;
double dEdgeThick ;
LuaCheckParam( L, 8, dEdgeThick) ;
LuaClearStack( L) ;
// Recupero le Curve per Asole e Fori
int nFirstId = GDB_ID_NULL, nCount = 0 ;
bool bOk = ExeTrimmingGetHoleBorder( nParentId, vSurfIds, vOtherSurfIds, dSurfLinTol, dSurfAngTol, dEdgeLinTol,
dEdgeAngTol, dEdgeThick, nFirstId, nCount) ;
LuaSetParam( L, bOk) ;
LuaSetParam( L, nFirstId) ;
LuaSetParam( L, nCount) ;
return 3 ;
}
// ------------------------------------------------------------------------------
static int
LuaTrimmingGetSurfTmFaceAdj( lua_State* L)
{
// 7 parametri : nParentId, nSurfId, nTria, ptTria, dAngTol, dSize, dSizeTol
int nParentId ;
LuaCheckParam( L, 1, nParentId) ;
int nSurfId ;
LuaCheckParam( L, 2, nSurfId)
int nTria ;
LuaCheckParam( L, 3, nTria)
Point3d ptTria ;
LuaCheckParam( L, 4, ptTria)
double dAngTol ;
LuaCheckParam( L, 5, dAngTol)
double dSize ;
LuaCheckParam( L, 6, dSize)
double dSizeTol ;
LuaCheckParam( L, 7, dSizeTol)
LuaClearStack( L) ;
// Recupero le facce adiacenti in tolleranza angolare
INTVECTOR vOtherFaces ;
int nNewSurfId = ExeTrimmingGetSurfTmFaceAdj( nParentId, nSurfId, nTria, ptTria, dAngTol, dSize, dSizeTol) ;
LuaSetParam( L, nNewSurfId) ;
return 1 ;
}
// ------------------------------------------------------------------------------
static int
LuaTrimmingGetAdjSurfs( lua_State* L)
{
// 5 parametri : nRefSfrId, vAllSurfId, dLinTol, dAngTol, dAngFaceTol
INTVECTOR vRefSurfId ;
LuaCheckParam( L, 1, vRefSurfId)
INTVECTOR vOtherSurfId ;
LuaCheckParam( L, 2, vOtherSurfId)
double dLinTol ;
LuaCheckParam( L, 3, dLinTol)
double dAngTol ;
LuaCheckParam( L, 4, dAngTol)
double dAngFaceTol ;
LuaCheckParam( L, 5, dAngFaceTol)
LuaClearStack( L) ;
// Calcolo le facce adiacenti per tolleranza
INTVECTOR vOtherSurf ;
bool bOk = ExeTrimmingGetAdjSurfs( vRefSurfId, vOtherSurfId, dLinTol, dAngTol, dAngFaceTol, vOtherSurf) ;
// Restituisco il risultato
LuaSetParam( L, bOk) ;
LuaSetParam( L, vOtherSurf) ;
return 2 ;
}
// -------------------------------------------------------------------------------
static int
LuaTrimmingGetBorders( lua_State* L)
{
// 6 parametri : nParentId, vIds, dSurfLinTol, dSurfAngTol, dLinTol, dAngTol
int nParentId ;
LuaCheckParam( L, 1, nParentId)
SELVECTOR vIds ;
LuaCheckParam( L, 2, vIds)
double dSurfLinTol ;
LuaCheckParam( L, 3, dSurfLinTol) ;
double dSurfAngTol ;
LuaCheckParam( L, 4, dSurfAngTol) ;
double dLinTol ;
LuaCheckParam( L, 5, dLinTol)
double dAngTol ;
LuaCheckParam( L, 6, dAngTol)
LuaClearStack( L) ;
// Creo le curve di Edge grezze
int nFirstId = GDB_ID_NULL ;
int nCount = 0 ;
bool bOk = ExeTrimmingGetBorders( nParentId, vIds, dSurfLinTol, dSurfAngTol, dLinTol, dAngTol, nFirstId, nCount) ;
LuaSetParam( L, bOk) ;
LuaSetParam( L, nFirstId) ;
LuaSetParam( L, nCount) ;
return 3 ;
}
// -------------------------------------------------------------------------------
static int
LuaTrimmingGetBordersByNormals( lua_State* L)
{
// 7 o 8 parametri : nParentId, vIds, dSurfLinTol, dSurfAngTol, dThickness
int nParentId ;
LuaCheckParam( L, 1, nParentId)
SELVECTOR vIds ;
LuaCheckParam( L, 2, vIds)
double dSurfLinTol ;
LuaCheckParam( L, 3, dSurfLinTol) ;
double dSurfAngTol ;
LuaCheckParam( L, 4, dSurfAngTol) ;
double dLinTol ;
LuaCheckParam( L, 5, dLinTol)
double dAngTol ;
LuaCheckParam( L, 6, dAngTol)
double dThickness ;
LuaCheckParam( L, 7, dThickness)
LuaClearStack( L) ;
// Creo le curve di Edge grezze
int nFirstId = GDB_ID_NULL ;
int nCount = 0 ;
bool bOk = ExeTrimmingGetBordersByNormals( nParentId, vIds, dSurfLinTol, dSurfAngTol, dLinTol, dAngTol, dThickness, nFirstId, nCount) ;
LuaSetParam( L, bOk) ;
LuaSetParam( L, nFirstId) ;
LuaSetParam( L, nCount) ;
return 3 ;
}
// -------------------------------------------------------------------------------
static int
LuaTrimmingGetFinalBorders( lua_State* L)
{
// 4 o 5 o 6 o 7 parametri : nParentId, vCrvBezierId, dLinTol, dAngTol [,vBreakingPts] [,dThick [,dThickTol]]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
INTVECTOR vCrvBezierId ;
LuaCheckParam( L, 2, vCrvBezierId)
double dLinTol ;
LuaCheckParam( L, 3, dLinTol)
double dAngTol ;
LuaCheckParam( L, 4, dAngTol)
PNTVECTOR vBreakingPts ;
int nInd = 5 ;
if ( LuaGetParam( L, nInd, vBreakingPts))
++ nInd ;
double dThick = 0., dThickTol = EPS_SMALL ;
if ( LuaGetParam( L, nInd, dThick)) {
if ( ! LuaGetParam( L, nInd + 1, dThickTol)) {
LuaClearStack( L) ;
LuaSetParam( L, false) ;
return 1 ;
}
}
LuaClearStack( L) ;
// Creo le curve Edges
int nFirstId = GDB_ID_NULL ;
int nCount = 0 ;
bool bOk = ExeTrimmingGetFinalBorders( nParentId, vCrvBezierId, dLinTol, dAngTol, vBreakingPts, dThick, dThickTol,
nFirstId, nCount) ;
LuaSetParam( L, bOk) ;
LuaSetParam( L, nFirstId) ;
LuaSetParam( L, nCount) ;
return 3 ;
}
//-------------------------------------------------------------------------------
static int
LuaTrimmingGetRuledBezier( lua_State* L)
{
// 5 o 6 parametri : nParentId, vIds, nEdge1Id, nEdge2Id, dLinTol [,vnLineId]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
INTVECTOR vIds ;
LuaCheckParam( L, 2, vIds) ; // serve per orientare la superficie rigata ( Ids delle superfici)
int nEdge1Id ;
LuaCheckParam( L, 3, nEdge1Id)
int nEdge2Id ;
LuaCheckParam( L, 4, nEdge2Id)
double dLinTol ;
LuaCheckParam( L, 5, dLinTol)
INTVECTOR vnLineId ;
LuaGetParam( L, 6, vnLineId) ;
LuaClearStack( L) ;
// Calcolo la superficie di Bezier rigata
int nId = ExeTrimmingGetRuledBezier( nParentId, vIds, nEdge1Id, nEdge2Id, dLinTol, vnLineId) ;
LuaSetParam( L, nId) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaTrimmingInterpolateSyncLines( lua_State* L)
{
// 7 parametri : nParentId, nFirstSyncId, nSecondSyncId, nBorder1Id, nBorder2Id, dEdgeLinTol, dEdgeAngTol
int nParentId ;
LuaCheckParam( L, 1, nParentId) ;
int nSync1Id ;
LuaCheckParam( L, 2, nSync1Id) ;
int nSync2Id ;
LuaCheckParam( L, 3, nSync2Id) ;
int nBorder1Id ;
LuaCheckParam( L, 4, nBorder1Id) ;
int nBorder2Id ;
LuaCheckParam( L, 5, nBorder2Id) ;
double dEdgeLinTol ;
LuaCheckParam( L, 6, dEdgeLinTol) ;
double dEdgeAngTol ;
LuaCheckParam( L, 7, dEdgeAngTol) ;
LuaClearStack( L) ;
// Interpolo le curve di sincronizzazione
int nFirstId = GDB_ID_NULL ;
int nCount = 0 ;
bool bOk = ExeTrimmingInterpolateSyncLines( nParentId, nSync1Id, nSync2Id, nBorder1Id,
nBorder2Id, dEdgeLinTol, dEdgeAngTol, nFirstId, nCount) ;
LuaSetParam( L, bOk) ;
LuaSetParam( L, nFirstId) ;
LuaSetParam( L, nCount) ;
return 3 ;
}
//-------------------------------------------------------------------------------
static int
LuaTrimmingGetSurfBzSyncPoints( lua_State* L)
{
// 7 parametri : nParentId, nEdge1Id, nEdge2Id, dLinTol, dAngTol, nLinesNbr, bShowOnCorners
int nParentId ;
LuaCheckParam( L, 1, nParentId)
int nEdge1Id ;
LuaCheckParam( L, 2, nEdge1Id)
int nEdge2Id ;
LuaCheckParam( L, 3, nEdge2Id)
double dLinTol ;
LuaCheckParam( L, 4, dLinTol)
double dAngTol ;
LuaCheckParam( L, 5, dAngTol)
int nLineNbr ;
LuaCheckParam( L, 6, nLineNbr)
bool bShowOnCorners ;
LuaCheckParam( L, 7, bShowOnCorners)
LuaClearStack( L) ;
// Inserisco i tratti lineari associati ai punti di sincronizzazione
int nFirstId = GDB_ID_NULL ;
int nCount = 0 ;
bool bOk = ExeTrimmingGetSurfBzSyncPoints( nParentId, nEdge1Id, nEdge2Id, dLinTol, dAngTol, nLineNbr, bShowOnCorners, nFirstId, nCount) ;
LuaSetParam( L, bOk) ;
LuaSetParam( L, nFirstId) ;
LuaSetParam( L, nCount) ;
return 3 ;
}
//-------------------------------------------------------------------------------
static int
LuaRegolarizeSurfaceLocally( lua_State* L)
{
int nParentId = GDB_ID_NULL ;
LuaCheckParam( L, 1, nParentId)
int nSurfId = GDB_ID_NULL ;
LuaCheckParam( L, 2, nSurfId)
int nSyncStartId ;
LuaCheckParam( L, 3, nSyncStartId)
int nSyncEndId ;
LuaCheckParam( L, 4, nSyncEndId)
double dLinTol ;
LuaCheckParam( L, 5, dLinTol)
int nId = ExeRegolarizeSurfaceLocally( nParentId, nSurfId, nSyncStartId, nSyncEndId, dLinTol) ;
LuaSetParam( L, nId) ;
return 1 ;
}
//-------------------------------------------------------------------------------
bool
LuaInstallTrimming( LuaMgr& luaMgr)
{
bool bOk = ( &luaMgr != nullptr) ;
// --- Ricerca Fori e Asole
bOk = bOk && luaMgr.RegisterFunction( "EgtTrimmingGetHoleBorder", LuaTrimmingGetHoleBorder) ;
// --- Ricerca Superifici
bOk = bOk && luaMgr.RegisterFunction( "EgtTrimmingGetSurfTmFaceAdj", LuaTrimmingGetSurfTmFaceAdj) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtTrimmingGetAdjSurfs", LuaTrimmingGetAdjSurfs) ;
// --- Estrazione dei Bordi
bOk = bOk && luaMgr.RegisterFunction( "EgtTrimmingGetBorders", LuaTrimmingGetBorders) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtTrimmingGetBordersByNormals", LuaTrimmingGetBordersByNormals) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtTrimmingGetFinalBorders", LuaTrimmingGetFinalBorders) ;
// --- Recupero Surf Bezier Ruled
bOk = bOk && luaMgr.RegisterFunction( "EgtTrimmingGetRuledBezier", LuaTrimmingGetRuledBezier) ;
// --- Recupero linee di sincronizzazione
bOk = bOk && luaMgr.RegisterFunction( "EgtTrimmingInterpolateSyncLines", LuaTrimmingInterpolateSyncLines) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtTrimmingGetSurfBzSyncPoints", LuaTrimmingGetSurfBzSyncPoints) ;
// --- Modifica della superficie
bOk = bOk && luaMgr.RegisterFunction( "EgtRegolarizeSurfaceLocally", LuaRegolarizeSurfaceLocally) ;
return bOk ;
}
+15 -1
View File
@@ -163,8 +163,22 @@ PictureObj::Load( const STRVECTOR& vString, int nBaseGdbId)
string sOut = "Error loading image " + sOtherPath ; string sOut = "Error loading image " + sOtherPath ;
LOG_ERROR( GetLogger(), sOut.c_str()) LOG_ERROR( GetLogger(), sOut.c_str())
} }
return true ;
} }
else { // provo dalla path della macchina corrente
string sMachineDir ;
if ( ExeGetCurrMachineDir( sMachineDir)) {
string sOtherPath = sMachineDir + "\\" + GetFileName( m_sPath) ;
if ( ExistsFile( sOtherPath)) {
if ( ! ExeLoadTexture( m_sName, sOtherPath, 0, m_dDimX, m_dDimY, TXR_CLAMP)) {
string sOut = "Error loading image " + sOtherPath ;
LOG_ERROR( GetLogger(), sOut.c_str())
}
return true ;
}
}
// altrimenti errore
{
string sOut = "Error missing image " + sOtherPath ; string sOut = "Error missing image " + sOtherPath ;
LOG_ERROR( GetLogger(), sOut.c_str()) LOG_ERROR( GetLogger(), sOut.c_str())
} }
+71 -5
View File
@@ -1,9 +1,13 @@
//{{NO_DEPENDENCIES}} //{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file. // File di inclusione generato con Microsoft Visual C++.
// Used by EgtExecutor.rc // Utilizzato da EgtExecutor.rc
// //
#define VS_VERSION_INFO 1 #define VS_VERSION_INFO 1
#define IDD_LUADLG 101 #define IDD_LUADLG 101
#define IDD_LUASCENE 102
#define IDD_LUADLG_ML 103
#define IDC_TEXT1 1001 #define IDC_TEXT1 1001
#define IDC_TEXT2 1002 #define IDC_TEXT2 1002
#define IDC_TEXT3 1003 #define IDC_TEXT3 1003
@@ -12,6 +16,7 @@
#define IDC_TEXT6 1006 #define IDC_TEXT6 1006
#define IDC_TEXT7 1007 #define IDC_TEXT7 1007
#define IDC_TEXT8 1008 #define IDC_TEXT8 1008
#define IDC_EDIT1 1011 #define IDC_EDIT1 1011
#define IDC_EDIT2 1012 #define IDC_EDIT2 1012
#define IDC_EDIT3 1013 #define IDC_EDIT3 1013
@@ -20,6 +25,7 @@
#define IDC_EDIT6 1016 #define IDC_EDIT6 1016
#define IDC_EDIT7 1017 #define IDC_EDIT7 1017
#define IDC_EDIT8 1018 #define IDC_EDIT8 1018
#define IDC_COMBO1 1021 #define IDC_COMBO1 1021
#define IDC_COMBO2 1022 #define IDC_COMBO2 1022
#define IDC_COMBO3 1023 #define IDC_COMBO3 1023
@@ -28,6 +34,7 @@
#define IDC_COMBO6 1026 #define IDC_COMBO6 1026
#define IDC_COMBO7 1027 #define IDC_COMBO7 1027
#define IDC_COMBO8 1028 #define IDC_COMBO8 1028
#define IDC_CHECK1 1031 #define IDC_CHECK1 1031
#define IDC_CHECK2 1032 #define IDC_CHECK2 1032
#define IDC_CHECK3 1033 #define IDC_CHECK3 1033
@@ -37,13 +44,72 @@
#define IDC_CHECK7 1037 #define IDC_CHECK7 1037
#define IDC_CHECK8 1038 #define IDC_CHECK8 1038
#define IDC_COLOR1 1041
#define IDC_COLOR2 1042
#define IDC_COLOR3 1043
#define IDC_COLOR4 1044
#define IDC_COLOR5 1045
#define IDC_COLOR6 1046
#define IDC_COLOR7 1047
#define IDC_COLOR8 1048
#define IDC_PICTURE1 1101
#define IDC_TEXT_ML_1 2001
#define IDC_TEXT_ML_2 2002
#define IDC_TEXT_ML_3 2003
#define IDC_TEXT_ML_4 2004
#define IDC_TEXT_ML_5 2005
#define IDC_TEXT_ML_6 2006
#define IDC_TEXT_ML_7 2007
#define IDC_TEXT_ML_8 2008
#define IDC_EDIT_ML_1 2011
#define IDC_EDIT_ML_2 2012
#define IDC_EDIT_ML_3 2013
#define IDC_EDIT_ML_4 2014
#define IDC_EDIT_ML_5 2015
#define IDC_EDIT_ML_6 2016
#define IDC_EDIT_ML_7 2017
#define IDC_EDIT_ML_8 2018
#define IDC_COMBO_ML_1 2021
#define IDC_COMBO_ML_2 2022
#define IDC_COMBO_ML_3 2023
#define IDC_COMBO_ML_4 2024
#define IDC_COMBO_ML_5 2025
#define IDC_COMBO_ML_6 2026
#define IDC_COMBO_ML_7 2027
#define IDC_COMBO_ML_8 2028
#define IDC_CHECK_ML_1 2031
#define IDC_CHECK_ML_2 2032
#define IDC_CHECK_ML_3 2033
#define IDC_CHECK_ML_4 2034
#define IDC_CHECK_ML_5 2035
#define IDC_CHECK_ML_6 2036
#define IDC_CHECK_ML_7 2037
#define IDC_CHECK_ML_8 2038
#define IDC_BUTTON_ML_1 2041
#define IDC_BUTTON_ML_2 2042
#define IDC_BUTTON_ML_3 2043
#define IDC_BUTTON_ML_4 2044
#define IDC_BUTTON_ML_5 2045
#define IDC_BUTTON_ML_6 2046
#define IDC_BUTTON_ML_7 2047
#define IDC_BUTTON_ML_8 2048
#define IDOK_ML 2051
#define IDCANCEL_ML 2052
// Next default values for new objects // Next default values for new objects
// //
#ifdef APSTUDIO_INVOKED #ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS #ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 103 #define _APS_NEXT_RESOURCE_VALUE 105
#define _APS_NEXT_COMMAND_VALUE 40001 #define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1030 #define _APS_NEXT_CONTROL_VALUE 1072
#define _APS_NEXT_SYMED_VALUE 113 #define _APS_NEXT_SYMED_VALUE 115
#endif #endif
#endif #endif
+7 -5
View File
@@ -28,8 +28,10 @@
#include "/EgtDev/Include/EgtLibVer.h" #include "/EgtDev/Include/EgtLibVer.h"
#pragma comment(lib, EGTLIBDIR "EgtGeneral" EGTLIBVER ".lib") #pragma comment( lib, EGTLIBDIR "EgtGeneral" EGTLIBVER ".lib")
#pragma comment(lib, EGTLIBDIR "EgtNumKernel" EGTLIBVER ".lib") #pragma comment( lib, EGTLIBDIR "EgtNumKernel" EGTLIBVER ".lib")
#pragma comment(lib, EGTLIBDIR "EgtGeomKernel" EGTLIBVER ".lib") #pragma comment( lib, EGTLIBDIR "EgtGeomKernel" EGTLIBVER ".lib")
#pragma comment(lib, EGTEXTDIR "Lua/Lib/Lua53" EGTLIBVER ".lib") #pragma comment( lib, EGTEXTDIR "Lua/Lib/Lua54" EGTLIBVER ".lib")
#pragma comment(lib, EGTLIBDIR "SEgtLock" EGTLIBVER ".lib") #pragma comment( lib, EGTEXTDIR "hiredis/Lib/hiredis" EGTLIBVER ".lib")
#pragma comment( lib, EGTLIBDIR "SEgtLock" EGTLIBVER ".lib")
#pragma comment( lib, "ws2_32.lib")