Compare commits

...

217 Commits

Author SHA1 Message Date
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
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
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
49 changed files with 7087 additions and 1517 deletions
+48
View File
@@ -42,6 +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_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" ;
@@ -50,6 +51,8 @@ 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" ;
@@ -183,6 +186,21 @@ MySetBtlAuxDir( const string& sBtlAuxDir)
return pFun( sBtlAuxDir) ; return pFun( sBtlAuxDir) ;
} }
//-----------------------------------------------------------------------------
bool
MySetBtlLuaData( const string& sLuaLibsDir, const string& sLuaLastRequire)
{
// verifico caricamento libreria EgtExchange
if ( s_hEEx == nullptr)
return false ;
// recupero funzione creazione oggetto
typedef bool (* PF_SetBtlLuaData) ( const string& sLuaLibsDir, const string& sLuaLastRequire) ;
PF_SetBtlLuaData pFun = (PF_SetBtlLuaData)GetProcAddress( s_hEEx, EEX_SETBTLLUADATA) ;
if ( pFun == nullptr)
return false ;
return pFun( sLuaLibsDir, sLuaLastRequire) ;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
IBeamMgr* IBeamMgr*
MyCreateBeamMgr( void) MyCreateBeamMgr( void)
@@ -303,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)
+7 -2
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,6 +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 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) ;
@@ -49,6 +52,8 @@ 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) ;
+3 -2
View File
@@ -1,7 +1,7 @@
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// EgalTech 2014-2023 // EgalTech 2014-2024
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// File : EXE.h Data : 05.02.23 Versione : 2.5a6 // File : EXE.h Data : 15.05.24 Versione : 2.6e4
// Contenuto : Dichiarazioni locali per moduli EXE. // Contenuto : Dichiarazioni locali per moduli EXE.
// //
// //
@@ -26,6 +26,7 @@ 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) ; const std::string& ExeGetLockId( void) ;
bool ExeVerifyKeyOption( int nOptInd) ;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
ILogger* GetLogger( void) ; ILogger* GetLogger( void) ;
+14 -6
View File
@@ -175,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
@@ -198,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))
+21 -17
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.
@@ -49,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) ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -69,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, false) ? 0 : 1) ; return ( pVZM->CDeBox( frBoxL, vtDiag, dSafeDist, false) ? 1 : 0) ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -118,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) ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -140,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, false) ? 0 : 1) ; return ( pVZM->CDeRectPrismoid( frPrismoidL, dBaseLenX, dBaseLenY, dTopLenX, dTopLenY, dHeight, dSafeDist, false) ? 1 : 0) ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -193,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) ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -213,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, false) ? 0 : 1) ; return ( pVZM->CDeCylinder( frCylL, dR, dH, dSafeDist, false) ? 1 : 0) ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -261,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) ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -281,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, false) ? 0 : 1) ; return ( pVZM->CDeConeFrustum( frConeL, dR1, dR2, dH, dSafeDist, false) ? 1 : 0) ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -330,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) ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -350,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, false) ? 0 : 1) ; return ( pVZM->CDeSphere( ptCenL, dRad, dSafeDist, false) ? 1 : 0) ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -420,7 +420,7 @@ MyCDeClosedSurfTmVolZmap( int nSurfTmId, int nZmapId, double dSafeDist)
if ( pVZM == nullptr) if ( pVZM == nullptr)
return -1 ; return -1 ;
// verifico la collisione // verifico la collisione
return ( pVZM->AvoidSurfTm( *pStm, dSafeDist, false) ? 0 : 1) ; return ( pVZM->CDeSurfTm( *pStm, dSafeDist, false) ? 1 : 0) ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -429,10 +429,14 @@ ExeCDeSolidSolid( int nSolid1Id, int nSolid2Id, double dSafeDist)
{ {
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
int nRes = -1 ; int nRes = -1 ;
if ( pGeomDB != nullptr && pGeomDB->GetGeoType( nSolid1Id) == SRF_TRIMESH && pGeomDB->GetGeoType( nSolid2Id) == SRF_TRIMESH) if ( pGeomDB != nullptr) {
nRes = MyCDeClosedSurfTmClosedSurfTm( nSolid1Id, nSolid2Id, dSafeDist) ; if ( pGeomDB->GetGeoType( nSolid1Id) == SRF_TRIMESH && pGeomDB->GetGeoType( nSolid2Id) == SRF_TRIMESH)
else if ( pGeomDB != nullptr && pGeomDB->GetGeoType( nSolid1Id) == SRF_TRIMESH && pGeomDB->GetGeoType( nSolid2Id) == VOL_ZMAP) nRes = MyCDeClosedSurfTmClosedSurfTm( nSolid1Id, nSolid2Id, dSafeDist) ;
nRes = MyCDeClosedSurfTmVolZmap( 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 // se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) { if ( IsCmdLog()) {
string sLua = "EgtCDeSolidSolid({" + IdToString( nSolid1Id) + "," + string sLua = "EgtCDeSolidSolid({" + IdToString( nSolid1Id) + "," +
+99 -15
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 "LUA_Base.h"
#include "AuxTools.h" #include "AuxTools.h"
#include "DllExchange.h" #include "DllExchange.h"
#include "DllExch3dm.h" #include "DllExch3dm.h"
@@ -29,6 +30,8 @@
#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"
@@ -77,6 +80,10 @@ ExeGetFileType( const string& sFilePath)
return FT_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")
@@ -85,8 +92,6 @@ ExeGetFileType( const string& sFilePath)
return FT_BTL ; return FT_BTL ;
else if ( sFileExt == "BTLX") else if ( sFileExt == "BTLX")
return FT_BTLX ; return FT_BTLX ;
else if ( sFileExt == "3DM")
return FT_3DM ;
else if ( sFileExt == "PNG" || sFileExt == "JPG" || sFileExt == "JPEG" || sFileExt == "BMP") else if ( sFileExt == "PNG" || sFileExt == "JPG" || sFileExt == "JPEG" || sFileExt == "BMP")
return FT_IMG ; return FT_IMG ;
else if ( sFileExt == "PNT" || sFileExt == "XYZ") else if ( sFileExt == "PNT" || sFileExt == "XYZ")
@@ -125,7 +130,7 @@ ExeGetFileType( const string& sFilePath)
bool bool
ExeSetBtlAuxDir( const string& sBtlAuxDir) ExeSetBtlAuxDir( const string& sBtlAuxDir)
{ {
return MySetBtlAuxDir( sBtlAuxDir) ; return MySetBtlAuxDir( sBtlAuxDir) && MySetBtlLuaData( LuaGetLuaLibsDir(), LuaGetLastRequire()) ;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -369,20 +374,95 @@ ExeImportStl( const string& sFilePath, double dScaleFactor)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
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) {
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 // 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 ;
@@ -408,10 +488,11 @@ ExeImport3dm( const string& sFilePath)
{ {
GseContext* pGseCtx = GetCurrGseContext() ; GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_GEOMDB( pGseCtx, false) VERIFY_CTX_GEOMDB( pGseCtx, false)
bool bOk = true ; // se necessario, carico libreria exchange 3dm opzionale
if ( ! IsLoadedExch3dmDll() && LoadExch3dmDll( GetLogger(), ExeGetKey(), ExeGetNetHwKey()))
LOG_INFO( GetLogger(), MyGetEE3Version())
// importo il file 3dm // importo il file 3dm
// aggiungo un gruppo pezzo e un gruppo layer bool bOk = true ;
int nPartId = pGseCtx->m_pGeomDB->AddGroup( GDB_ID_NULL, GDB_ID_ROOT, Frame3d()) ;
// preparo l'importatore // preparo l'importatore
PtrOwner<IImport3dm> pImp3dm( MyCreateImport3dm()) ; PtrOwner<IImport3dm> pImp3dm( MyCreateImport3dm()) ;
bOk = bOk && ! IsNull( pImp3dm) ; bOk = bOk && ! IsNull( pImp3dm) ;
@@ -424,7 +505,7 @@ ExeImport3dm( const string& sFilePath)
int nDecDig = DimSt.nDecDigit ; int nDecDig = DimSt.nDecDigit ;
string sFont = DimSt.sFont ; string sFont = DimSt.sFont ;
double dTextHeight = DimSt.dTextHeight ; double dTextHeight = DimSt.dTextHeight ;
bOk = bOk && pImp3dm->Import( sFilePath, pGseCtx->m_pGeomDB, nPartId, bOk = bOk && pImp3dm->Import( sFilePath, pGseCtx->m_pGeomDB, GDB_ID_ROOT,
dTextHeight, dExtLine, dArrLen, dTextDist, bLenIsMM, nDecDig, sFont) ; dTextHeight, dExtLine, dArrLen, dTextDist, bLenIsMM, nDecDig, sFont) ;
// aggiorno stato file corrente // aggiorno stato file corrente
if ( pGseCtx->m_sFilePath.empty()) if ( pGseCtx->m_sFilePath.empty())
@@ -470,7 +551,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)
@@ -504,7 +585,7 @@ ExeAdvancedImport( const string& sFilePath, double dToler)
#endif #endif
string sCmdLine = "\"" + sExec + "\" \"" + sFilePath + "\" \"" + sFileOut + "\" \"" + string sCmdLine = "\"" + sExec + "\" \"" + sFilePath + "\" \"" + sFileOut + "\" \"" +
ToString( dToler, 3) + "\" \"" + ToString( ExeGetDebugLevel()) + "\" \"" + ToString( dToler, 3) + "\" \"" + ToString( ExeGetDebugLevel()) + "\" \"" +
ExeGetKey() + "\" \"" + ExeGetLockId() + "\"" ; ExeGetKey() + "\" \"" + ExeGetLockId() + "\" \"" + ToString( nFlag) + "\"" ;
STARTUPINFO si ; STARTUPINFO si ;
PROCESS_INFORMATION pi ; PROCESS_INFORMATION pi ;
ZeroMemory( &si, sizeof( si)) ; ZeroMemory( &si, sizeof( si)) ;
@@ -639,8 +720,11 @@ ExeExport3dm( int nId, const string& sFilePath, int nFilter)
{ {
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false) VERIFY_GEOMDB( pGeomDB, false)
bool bOk = true ; // se necessario, carico libreria exchange 3dm opzionale
if ( ! IsLoadedExch3dmDll() && LoadExch3dmDll( GetLogger(), ExeGetKey(), ExeGetNetHwKey()))
LOG_INFO( GetLogger(), MyGetEE3Version())
// esporto il file 3dm // esporto il file 3dm
bool bOk = true ;
// preparo l'esportatore // preparo l'esportatore
PtrOwner<IExport3dm> pExp3dm( MyCreateExport3dm()) ; PtrOwner<IExport3dm> pExp3dm( MyCreateExport3dm()) ;
bOk = bOk && ! IsNull( pExp3dm) ; bOk = bOk && ! IsNull( pExp3dm) ;
+131 -178
View File
@@ -480,7 +480,7 @@ MyCreateRadialDimension( int nParentId, int nCrvId, const Point3d& ptDim,
Point3d ptCenL = pArc->GetCenter() ; Point3d ptCenL = pArc->GetCenter() ;
ptCenL.LocToLoc( frArc, frLoc) ; ptCenL.LocToLoc( frArc, frLoc) ;
Vector3d vtNL = pArc->GetNormVersor() ; Vector3d vtNL = pArc->GetNormVersor() ;
vtNL.LocToLoc( frArc, frLoc) ; vtNL.LocToLoc( frArc, frLoc) ;
// porto ptDimL sulla circonferenza cui appartiene l'arco // porto ptDimL sulla circonferenza cui appartiene l'arco
Vector3d vtDir = ptDimL - ptCenL ; Vector3d vtDir = ptDimL - ptCenL ;
if ( ! vtDir.Normalize()) if ( ! vtDir.Normalize())
@@ -543,7 +543,7 @@ MyCreateDiametralDimension( int nParentId, int nCrvId, const Point3d& ptDim,
Point3d ptCenL = pArc->GetCenter() ; Point3d ptCenL = pArc->GetCenter() ;
ptCenL.LocToLoc( frArc, frLoc) ; ptCenL.LocToLoc( frArc, frLoc) ;
Vector3d vtNL = pArc->GetNormVersor() ; Vector3d vtNL = pArc->GetNormVersor() ;
vtNL.LocToLoc( frArc, frLoc) ; vtNL.LocToLoc( frArc, frLoc) ;
// porto ptDimL sulla circonferenza // porto ptDimL sulla circonferenza
Vector3d vtDir = ptDimL - ptCenL ; Vector3d vtDir = ptDimL - ptCenL ;
if ( ! vtDir.Normalize()) if ( ! vtDir.Normalize())
@@ -583,7 +583,7 @@ ExeCreateDiametralDimension( int nParentId, int nCrvId, const Point3d& ptDim,
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
static int static int
MyCreateAngularDimension( int nParentId, const Point3d& ptP1, const Point3d& ptP0, const Point3d& ptP2, MyCreateAngularDimension( int nParentId, const Point3d& ptV, const Point3d& ptP1, const Point3d& ptP2,
const Point3d& ptDim, const string& sText, int nRefType) const Point3d& ptDim, const string& sText, int nRefType)
{ {
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
@@ -594,7 +594,7 @@ MyCreateAngularDimension( int nParentId, const Point3d& ptP1, const Point3d& ptP
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 ptP0L = GetPointLocal( pGeomDB, ptP0, nRefType, frLoc) ; Point3d ptVL = GetPointLocal( pGeomDB, ptV, nRefType, frLoc) ;
Point3d ptP1L = GetPointLocal( pGeomDB, ptP1, nRefType, frLoc) ; Point3d ptP1L = GetPointLocal( pGeomDB, ptP1, nRefType, frLoc) ;
Point3d ptP2L = GetPointLocal( pGeomDB, ptP2, nRefType, frLoc) ; Point3d ptP2L = GetPointLocal( pGeomDB, ptP2, nRefType, frLoc) ;
Point3d ptDimL = GetPointLocal( pGeomDB, ptDim, nRefType, frLoc) ; Point3d ptDimL = GetPointLocal( pGeomDB, ptDim, nRefType, frLoc) ;
@@ -603,7 +603,7 @@ MyCreateAngularDimension( int nParentId, const Point3d& ptP1, const Point3d& ptP
PtrOwner<IExtDimension> pDim( CreateExtDimension()) ; PtrOwner<IExtDimension> pDim( CreateExtDimension()) ;
if ( IsNull( pDim) || if ( IsNull( pDim) ||
! MySetDimensionStyle( pDim ) || ! MySetDimensionStyle( pDim ) ||
! pDim->SetAngular( ptP1L, ptP0L, ptP2L, ptDimL, vtNL, sText)) ! pDim->SetAngular( ptVL, ptP1L, ptP2L, ptDimL, vtNL, 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)) ;
@@ -611,16 +611,16 @@ MyCreateAngularDimension( int nParentId, const Point3d& ptP1, const Point3d& ptP
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
int int
ExeCreateAngularDimension( int nParentId, const Point3d& ptP1, const Point3d& ptP0, const Point3d& ptP2, ExeCreateAngularDimension( int nParentId, const Point3d& ptV, const Point3d& ptP1, const Point3d& ptP2,
const Point3d& ptDim, const string& sText, int nRefType) const Point3d& ptDim, const string& sText, int nRefType)
{ {
// eseguo // eseguo
int nId = MyCreateAngularDimension( nParentId, ptP1, ptP0, ptP2, ptDim, sText, nRefType) ; int nId = MyCreateAngularDimension( nParentId, ptV, ptP1, ptP2, ptDim, sText, nRefType) ;
ExeSetModified() ; ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente // se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) { if ( IsCmdLog()) {
string sLua = "EgtAngularDimension(" + IdToString( nParentId) + ",{" + string sLua = "EgtAngularDimension(" + IdToString( nParentId) + ",{" +
ToString( ptP0) + "},{" + ToString( ptV) + "},{" +
ToString( ptP1) + "},{" + ToString( ptP1) + "},{" +
ToString( ptP2) + "},{" + ToString( ptP2) + "},{" +
ToString( ptDim) + "},'" + ToString( ptDim) + "},'" +
@@ -633,6 +633,62 @@ ExeCreateAngularDimension( int nParentId, const Point3d& ptP1, const Point3d& pt
return nId ; 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 static int
MyCreateAngularDimensionFromLines( int nParentId, INTVECTOR vLineIds, const Point3d& ptDim, MyCreateAngularDimensionFromLines( int nParentId, INTVECTOR vLineIds, const Point3d& ptDim,
@@ -645,27 +701,24 @@ MyCreateAngularDimensionFromLines( int nParentId, INTVECTOR vLineIds, const Poin
Frame3d frLoc ; Frame3d frLoc ;
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc)) if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
return GDB_ID_NULL ; return GDB_ID_NULL ;
// recupero le linee
//recupero le linee
ICurveLine* pCrv1 = GetCurveLine( pGeomDB->GetGeoObj( vLineIds[0])) ; ICurveLine* pCrv1 = GetCurveLine( pGeomDB->GetGeoObj( vLineIds[0])) ;
ICurveLine* pCrv2 = GetCurveLine( pGeomDB->GetGeoObj( vLineIds[1])) ; ICurveLine* pCrv2 = GetCurveLine( pGeomDB->GetGeoObj( vLineIds[1])) ;
if ( pCrv1 == nullptr || pCrv2 == nullptr) if ( pCrv1 == nullptr || pCrv2 == nullptr)
return GDB_ID_NULL ; return GDB_ID_NULL ;
PtrOwner<ICurveLine> pL1( pCrv1->Clone()) ; PtrOwner<ICurveLine> pL1( pCrv1->Clone()) ;
PtrOwner<ICurveLine> pL2( pCrv2->Clone()) ; PtrOwner<ICurveLine> pL2( pCrv2->Clone()) ;
if ( IsNull( pL1 ) || ! pL1->IsValid() || IsNull( pL2) || ! pL2->IsValid()) if ( IsNull( pL1 ) || ! pL1->IsValid() || IsNull( pL2) || ! pL2->IsValid())
return GDB_ID_NULL ; return GDB_ID_NULL ;
// porto tutto nel frLoc
//porto tutto nel frLoc
Frame3d frL1, frL2 ; Frame3d frL1, frL2 ;
if ( ! pGeomDB->GetGlobFrame( vLineIds[0], frL1) || ! pGeomDB->GetGlobFrame( vLineIds[1], frL2)) if ( ! pGeomDB->GetGlobFrame( vLineIds[0], frL1) || ! pGeomDB->GetGlobFrame( vLineIds[1], frL2))
return GDB_ID_NULL ; return GDB_ID_NULL ;
pL1->LocToLoc( frL1, frLoc) ; pL1->LocToLoc( frL1, frLoc) ;
pL2->LocToLoc( frL2, frLoc) ; pL2->LocToLoc( frL2, frLoc) ;
// recupero il punto lo porto nel riferimento locale
Point3d ptDimL = GetPointLocal( pGeomDB, ptDim, nRefType, frLoc) ; Point3d ptDimL = GetPointLocal( pGeomDB, ptDim, nRefType, frLoc) ;
Vector3d vtNL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ; // recupero i punti e le direzioni
//recupero i punti e le direzioni
Point3d ptP1L, ptP2L, ptP3L, ptP4L ; Point3d ptP1L, ptP2L, ptP3L, ptP4L ;
Vector3d vtL1, vtL2 ; Vector3d vtL1, vtL2 ;
pL1->GetStartPoint( ptP1L) ; pL1->GetStartPoint( ptP1L) ;
@@ -674,15 +727,12 @@ MyCreateAngularDimensionFromLines( int nParentId, INTVECTOR vLineIds, const Poin
pL2->GetEndPoint( ptP4L) ; pL2->GetEndPoint( ptP4L) ;
pL1->GetStartDir( vtL1) ; pL1->GetStartDir( vtL1) ;
pL2->GetStartDir( vtL2) ; pL2->GetStartDir( vtL2) ;
// controllo se le rette sono coincidenti o parallele // controllo se le rette sono coincidenti o parallele
if ( AreSameOrOppositeVectorApprox( vtL1, vtL2)) if ( AreSameOrOppositeVectorApprox( vtL1, vtL2))
return GDB_ID_NULL ; return GDB_ID_NULL ;
// verifico se le rette si intersecano già // verifico se le rette si intersecano già
Point3d ptP0L ; Point3d ptCenL ;
IntersCurveCurve pInters( *pL1, *pL2) ; IntersCurveCurve pInters( *pL1, *pL2) ;
IntCrvCrvInfo Info ;
int nNumeroInters = pInters.GetIntersCount() ; int nNumeroInters = pInters.GetIntersCount() ;
// se non ho intersezioni estendo // se non ho intersezioni estendo
if ( nNumeroInters == 0) { if ( nNumeroInters == 0) {
@@ -691,54 +741,54 @@ MyCreateAngularDimensionFromLines( int nParentId, INTVECTOR vLineIds, const Poin
pL2->ExtendStartByLen( dLen) ; pL2->ExtendStartByLen( dLen) ;
pL1->ExtendEndByLen( dLen) ; pL1->ExtendEndByLen( dLen) ;
pL2->ExtendEndByLen( dLen) ; pL2->ExtendEndByLen( dLen) ;
// faccio intersezione
//faccio intersezione
IntersCurveCurve pIntersExt( *pL1, *pL2) ; IntersCurveCurve pIntersExt( *pL1, *pL2) ;
nNumeroInters = pIntersExt.GetIntersCount() ; nNumeroInters = pIntersExt.GetIntersCount() ;
// le linee estese non si intersecano, quindi vuol dire che sono quasi parallele e lontanissime // le linee estese non si intersecano, quindi vuol dire che sono quasi parallele e lontanissime
if ( nNumeroInters == 0 ) if ( nNumeroInters == 0 )
return GDB_ID_NULL ; return GDB_ID_NULL ;
else { else {
IntCrvCrvInfo Info ;
pIntersExt.GetIntCrvCrvInfo( 0, Info) ; pIntersExt.GetIntCrvCrvInfo( 0, Info) ;
// controllo che non siano coincidenti // controllo che non siano coincidenti
if ( Info.bOverlap) if ( Info.bOverlap)
return false ; return false ;
else else
ptP0L = Info.IciA->ptI ; ptCenL = Info.IciA->ptI ;
} }
// seleziono i punti necessari // seleziono i punti necessari
// se ptDimL è più vicino a ptP0L rispetto agli estremi esterni delle linee, allora tengo gli estremi interni // se ptDimL è più vicino a ptCenL rispetto agli estremi esterni delle linee, allora tengo gli estremi interni
double dP1P0 = ( ptP1L - ptP0L ).Len() ; double dP1Cen = ( ptP1L - ptCenL).Len() ;
double dP2P0 = ( ptP2L - ptP0L ).Len() ; double dP2Cen = ( ptP2L - ptCenL).Len() ;
double dDimP0 = ( ptDimL - ptP0L ).Len() ; double dDimCen = ( ptDimL - ptCenL).Len() ;
if ( ( dDimP0 < dP1P0 || dDimP0 < dP2P0)) if ( ( dDimCen < dP1Cen || dDimCen < dP2Cen))
// se uno dei due punti è più vicino a ptP0L rispetto a ptDimL, allora tengo il punto più vicino a ptDimL // 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) ; ptP1L = ( ( ptDimL - ptP1L ).Len() < ( ptDimL - ptP2L ).Len() ? ptP1L : ptP2L) ;
else else
ptP1L = ( dP1P0 < dP2P0 ? ptP2L : ptP1L ) ; ptP1L = ( dP1Cen < dP2Cen ? ptP2L : ptP1L ) ;
// rifaccio anche per l'altro lato // rifaccio anche per l'altro lato
double dP3P0 = ( ptP3L - ptP0L).Len() ; double dP3Cen = ( ptP3L - ptCenL).Len() ;
double dP4P0 = ( ptP4L - ptP0L).Len() ; double dP4Cen = ( ptP4L - ptCenL).Len() ;
if ( dDimP0 < dP3P0 || dDimP0 < dP4P0 ) if ( dDimCen < dP3Cen || dDimCen < dP4Cen)
ptP3L = ( ( ptDimL - ptP3L).Len() < ( ptDimL - ptP4L).Len() ? ptP3L : ptP4L ) ; ptP3L = ( ( ptDimL - ptP3L).Len() < ( ptDimL - ptP4L).Len() ? ptP3L : ptP4L) ;
else else
ptP3L = ( dP3P0 < dP4P0 ? ptP4L : ptP3L) ; ptP3L = ( dP3Cen < dP4Cen ? ptP4L : ptP3L) ;
} }
// se ho già intesezioni devo capire in quale quadrante si trova ptDim // se ho già intesezioni devo capire in quale quadrante si trova ptDim
else { else {
// recupero l'intersezione // recupero l'intersezione
IntCrvCrvInfo Info ;
pInters.GetIntCrvCrvInfo( 0, Info) ; pInters.GetIntCrvCrvInfo( 0, Info) ;
// controllo che non siano coincidenti // controllo che non siano coincidenti
if ( Info.bOverlap) if ( Info.bOverlap)
return false ; return false ;
// se non coincidono restituisco l'intersezione
else else
ptP0L = Info.IciA->ptI ; // se non coincidono restituisco l'intersezione ptCenL = Info.IciA->ptI ;
// se le due linee hanno un estremo in comune, estendo le linee da quel lato
// se le due linee hanno un estremo in comune, estendo le linee quel lato if ( ( AreSamePointApprox( ptCenL, ptP1L) || AreSamePointApprox( ptCenL, ptP2L)) &&
if ( ( AreSamePointApprox( ptP0L, ptP1L) || AreSamePointApprox( ptP0L, ptP2L)) && ( AreSamePointApprox( ptCenL, ptP3L) || AreSamePointApprox( ptCenL, ptP4L))) {
( AreSamePointApprox( ptP0L, ptP3L) || AreSamePointApprox( ptP0L, ptP4L))) { if ( AreSamePointApprox( ptCenL, ptP1L)) {
if ( AreSamePointApprox( ptP0L, ptP1L)) {
pL1->ExtendStartByLen(Dist( ptP1L, ptP2L) / 2) ; pL1->ExtendStartByLen(Dist( ptP1L, ptP2L) / 2) ;
pL1->GetStartPoint( ptP1L) ; pL1->GetStartPoint( ptP1L) ;
} }
@@ -746,8 +796,8 @@ MyCreateAngularDimensionFromLines( int nParentId, INTVECTOR vLineIds, const Poin
pL1->ExtendEndByLen(Dist( ptP1L, ptP2L) / 2) ; pL1->ExtendEndByLen(Dist( ptP1L, ptP2L) / 2) ;
pL1->GetEndPoint( ptP2L) ; pL1->GetEndPoint( ptP2L) ;
} }
if ( AreSamePointApprox( ptP0L, ptP3L) ) { if ( AreSamePointApprox( ptCenL, ptP3L)) {
pL2->ExtendStartByLen(Dist( ptP3L, ptP4L) / 2); pL2->ExtendStartByLen( Dist( ptP3L, ptP4L) / 2);
pL2->GetStartPoint( ptP3L) ; pL2->GetStartPoint( ptP3L) ;
} }
else { else {
@@ -755,36 +805,42 @@ MyCreateAngularDimensionFromLines( int nParentId, INTVECTOR vLineIds, const Poin
pL2->GetEndPoint( ptP4L) ; pL2->GetEndPoint( ptP4L) ;
} }
} }
// seleziono i punti necessari // seleziono i punti necessari
// proietto pdDim su vtLine1 e su vtLine2 // proietto pdDim su vtLine1 e su vtLine2
Point3d ptDim1, ptDim2 ; Point3d ptDim1, ptDim2 ;
DistPointCurve distPL1( ptDimL, *pL1, true) ; DistPointCurve distPL1( ptDimL, *pL1, true) ;
DistPointCurve distPL2( ptDimL, *pL2, true) ; DistPointCurve distPL2( ptDimL, *pL2, true) ;
int nFlag1, nFlag2 ; int nFlag1, nFlag2 ;
if ( ! distPL1.GetMinDistPoint( 0, ptDim1, nFlag1) || ! distPL2.GetMinDistPoint( 0, ptDim2, nFlag2) ) if ( ! distPL1.GetMinDistPoint( 0, ptDim1, nFlag1) || ! distPL2.GetMinDistPoint( 0, ptDim2, nFlag2) )
return false ; return false ;
if ( abs(( ptDim1 - ptP1L).Len() + ( ptP0L - ptDim1).Len() - ( ptP0L - ptP1L).Len()) < EPS_SMALL || if ( abs(( ptDim1 - ptP1L).Len() + ( ptCenL - ptDim1).Len() - ( ptCenL - ptP1L).Len()) < EPS_SMALL ||
abs(( ptDim1 - ptP1L).Len() + ( ptP0L - ptP1L ).Len() - ( ptDim1 - ptP0L).Len()) < EPS_SMALL) abs(( ptDim1 - ptP1L).Len() + ( ptCenL - ptP1L ).Len() - ( ptDim1 - ptCenL).Len()) < EPS_SMALL)
// ptDim è dal lato di ptP1L, quindi tengo ptP1L // ptDim è dal lato di ptP1L, quindi tengo ptP1L
; ;
else else
// ptDim è dal lato di ptP2L // ptDim è dal lato di ptP2L
ptP1L = ptP2L ; ptP1L = ptP2L ;
if ( abs(( ptDim2 - ptP3L).Len() + ( ptP0L - ptDim2).Len() - ( ptP0L - ptP3L).Len()) < EPS_SMALL || if ( abs(( ptDim2 - ptP3L).Len() + ( ptCenL - ptDim2).Len() - ( ptCenL - ptP3L).Len()) < EPS_SMALL ||
abs(( ptDim2 - ptP3L).Len() + ( ptP0L - ptP3L).Len() - ( ptDim2 - ptP0L).Len()) < EPS_SMALL) abs(( ptDim2 - ptP3L).Len() + ( ptCenL - ptP3L).Len() - ( ptDim2 - ptCenL).Len()) < EPS_SMALL)
// ptDim è dal lato di ptP1L, quindi tengo ptP3L // ptDim è dal lato di ptP1L
; ;
else else
// ptDim è dal lato di ptP2L // ptDim è dal lato di ptP2L
ptP3L = ptP4L ; 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 // creo la quota
PtrOwner<IExtDimension> pDim( CreateExtDimension()) ; PtrOwner<IExtDimension> pDim( CreateExtDimension()) ;
if ( IsNull( pDim ) || if ( IsNull( pDim ) ||
! MySetDimensionStyle( pDim ) || ! MySetDimensionStyle( pDim ) ||
! pDim->SetAngular( ptP1L, ptP0L, ptP3L, ptDimL, vtNL, sText)) ! pDim->SetAngular( ptP1L, ptCenL, ptP3L, ptDimL, vtNL, 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)) ;
@@ -825,50 +881,36 @@ MyCreateAngularDimensionFromArc( int nParentId, int nCrvId, const Point3d& ptDim
Frame3d frLoc ; Frame3d frLoc ;
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc)) if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
return GDB_ID_NULL ; return GDB_ID_NULL ;
// recupero l'arco e il suo frame // recupero l'arco e il suo frame
ICurveArc* pCurve = GetCurveArc( pGeomDB->GetGeoObj( nCrvId)) ; ICurveArc* pArc = GetCurveArc( pGeomDB->GetGeoObj( nCrvId)) ;
if ( pCurve == nullptr) if ( pArc == nullptr)
return GDB_ID_NULL ; return GDB_ID_NULL ;
Frame3d frArc; Frame3d frArc ;
if ( ! pGeomDB->GetGlobFrame( nCrvId, frArc)) if ( ! pGeomDB->GetGlobFrame( nCrvId, frArc))
return GDB_ID_NULL ; return GDB_ID_NULL ;
// recupero i punti e la normale e li porto nel frame locale
PtrOwner<ICurveArc> pCrv( pCurve->Clone()) ;
if ( IsNull( pCrv ) || ! pCrv->IsValid())
return GDB_ID_NULL ;
// porto tutto nel frLoc
pCrv->LocToLoc( frArc, frLoc ) ;
Point3d ptDimL = GetPointLocal( pGeomDB, ptDim, nRefType, frLoc) ; Point3d ptDimL = GetPointLocal( pGeomDB, ptDim, nRefType, frLoc) ;
Vector3d vtNL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ; Vector3d vtNL = pArc->GetNormVersor() ;
vtNL.LocToLoc( frArc, frLoc) ;
//recupero i punti e i versori Point3d ptCenL, ptP1L, ptP2L ;
Point3d ptP0L, ptP1L, ptP2L ; pArc->GetStartPoint( ptP1L) ;
pCrv->GetStartPoint( ptP1L) ; ptP1L.LocToLoc( frArc, frLoc) ;
pCrv->GetEndPoint( ptP2L) ; pArc->GetEndPoint( ptP2L) ;
pCrv->GetCenterPoint( ptP0L) ; ptP2L.LocToLoc( frArc, frLoc) ;
pArc->GetCenterPoint( ptCenL) ;
ptCenL.LocToLoc( frArc, frLoc) ;
// porto ptDimL nell'area di influenza dell'arco // porto ptDimL nell'area di influenza dell'arco
Point3d ptDimNew ;
double dDist = ( ptDimL - ptP0L).Len() ;
Point3d ptMid ; Point3d ptMid ;
pCrv->GetMidPoint( ptMid) ; pArc->GetMidPoint( ptMid) ;
Vector3d vtDir = ( ptMid - ptP0L) ; Vector3d vtDir = ( ptMid - ptCenL) ;
vtDir.Normalize() ; if ( ! vtDir.Normalize())
ptDimNew = ptP0L + dDist * vtDir ; return GDB_ID_NULL ;
// proietto il punto sul piano XY della griglia ptDimL = ptCenL + Dist( ptDimL, ptCenL) * vtDir ;
Frame3d frGrid = pGeomDB->GetGridFrame() ;
if ( ! frGrid.IsValid())
return GDB_ID_NULL ;
Point3d ptOrig = frGrid.Orig() ;
ptDimNew -= ( ptDimNew - ptOrig) * vtNL * vtNL;
// 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->SetAngular( ptP1L, ptP0L, ptP2L, ptDimNew, vtNL, sText)) ! pDim->SetAngular( ptP1L, ptCenL, ptP2L, ptDimL, vtNL, 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)) ;
@@ -894,93 +936,4 @@ ExeCreateAngularDimensionFromArc( int nParentId, int nCrvId, const Point3d& ptDi
} }
// restituisco l'identificativo del oggetto // restituisco l'identificativo del oggetto
return nId ; return nId ;
} }
//-------------------------------------------------------------------------------
static int
MyCreateAngularDimensionFromCircle( int nParentId, int nCrvId, 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 ;
// recupero il cerchio e il suo frame
ICurveArc* pCurve = GetCurveArc( pGeomDB->GetGeoObj( nCrvId)) ;
if ( pCurve == nullptr)
return GDB_ID_NULL ;
Frame3d frCrv;
if ( ! pGeomDB->GetGlobFrame( nCrvId, frCrv))
return GDB_ID_NULL ;
PtrOwner<ICurveArc> pCrv( pCurve->Clone()) ;
if ( IsNull( pCrv ) || ! pCrv->IsValid())
return GDB_ID_NULL ;
// porto tutto nel frLoc
pCrv->LocToLoc( frCrv, 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) ;
// recupero il centro
Point3d ptP0L ;
pCrv->GetCenterPoint( ptP0L) ;
// verifico che i punti P1 e P2 siano sul cerchio, sennò prendo i più vicini
if ( ! pCrv->IsPointOn(ptP1L)) {
DistPointCurve distPC( ptP1L, *pCrv) ;
int nFlag ;
distPC.GetMinDistPoint(0,ptP1L,nFlag);
}
if ( ! pCrv->IsPointOn(ptP2L)) {
DistPointCurve distPC(ptP2L, *pCrv) ;
int nFlag ;
distPC.GetMinDistPoint(0, ptP2L, nFlag);
}
// proietto il punto sul piano XY della griglia
Frame3d frGrid = pGeomDB->GetGridFrame() ;
if ( ! frGrid.IsValid())
return GDB_ID_NULL ;
Point3d ptOrig = frGrid.Orig() ;
ptDimL -= ( ptDimL - ptOrig) * vtNL * vtNL;
// creo la quota
PtrOwner<IExtDimension> pDim( CreateExtDimension()) ;
if ( IsNull( pDim) ||
! MySetDimensionStyle( pDim) ||
! pDim->SetAngular( ptP1L, ptP0L, ptP2L, ptDimL, vtNL, sText))
return GDB_ID_NULL ;
// inserisco la quota nel DB
return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pDim)) ;
}
//-------------------------------------------------------------------------------
int
ExeCreateAngularDimensionFromCircle( int nParentId, int nCrvId, const Point3d& ptP1, const Point3d& ptP2, const Point3d& ptDim,
const string& sText, int nRefType)
{
// eseguo
int nId = MyCreateAngularDimensionFromCircle( nParentId, nCrvId, ptP1, ptP2, ptDim, sText, nRefType) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtAngularDimensionFromCircle(" + IdToString( nParentId) + "," +
IdToString( nCrvId) + ",{" +
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 ;
}
+111 -6
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,45 @@ 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 int
ExeCreateArc2PB( int nParentId, const Point3d& ptStart, const Point3d& ptEnd, ExeCreateArc2PB( int nParentId, const Point3d& ptStart, const Point3d& ptEnd,
@@ -2548,3 +2585,71 @@ CalcExtrusion( IGeomDB* pGeomDB, int nParentId, int nRefType)
vtExtr.LocToLoc( pGeomDB->GetGridFrame(), frEnt) ; vtExtr.LocToLoc( pGeomDB->GetGridFrame(), frEnt) ;
return vtExtr ; return vtExtr ;
} }
//-------------------------------------------------------------------------------
static int
MyCreateCurveBezierForm( int nParentId, int nCrvId)
{
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)) ;
//int nType = pCurve->GetType() ;
//switch ( nType ) {
//case CRV_LINE :
// pCrvBez.Set( LineToBezierCurve( GetCurveLine( pCurve))) ;
// break ;
//case CRV_ARC :
// pCrvBez.Set( ArcToBezierCurve( GetCurveArc( pCurve))) ;
// break ;
//case CRV_BEZIER :
// pCrvBez.Set( BezierToBasicBezierCurve( GetCurveBezier( pCurve))) ;
// break ;
//case CRV_COMPO :
// pCrvBez.Set( CompositeToBezierCurve( GetCurveComposite( pCurve))) ;
// break ;
//default :
// break ;
//}
// 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
ExeCreateCurveBezierForm( int nParentId, int nCrvId, int nDeg)
{
// eseguo
int nId = MyCreateCurveBezierForm( nParentId, nCrvId) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtCurveBezierForm(" + IdToString( nParentId) + "," +
IdToString( nCrvId) + "," +
ToString( nDeg) + ")"
" -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
return nId ;
}
+981 -77
View File
File diff suppressed because it is too large Load Diff
+101 -4
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
@@ -64,7 +64,50 @@ 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) ;
bOk = bOk && pVZM->CreateEmpty( ORIG, dDimX, dDimY, dDimZ, dPrec, bTriDex) ;
// 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 ;
} }
@@ -103,7 +146,7 @@ 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 ;
} }
@@ -141,6 +184,60 @@ ExeCreateVolZmapFromSurfTm( int nParentId, int nStmId, double dPrec, bool bTriDe
" -- 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 ;
} }
//-------------------------------------------------------------------------------
bool
ExeUpdateVolZmapByAddingSurfTm( int nVolZmapId, int nStmId)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// 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
ExeUniformVolZmap( int nVolZmapId, double dToler)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// 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) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtUniformZmap(" + ToString( nVolZmapId) + "," +
ToString( dToler) + ")"
" -- bOk =" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
+233 -4
View File
@@ -17,8 +17,11 @@
#include "EXE_Const.h" #include "EXE_Const.h"
#include "EXE_Macro.h" #include "EXE_Macro.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"
@@ -27,7 +30,6 @@
#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"
#include "EgtDev/Include/EGkVoronoi.h"
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
@@ -59,6 +61,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)
@@ -162,7 +179,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)) ;
} }
@@ -207,6 +224,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 ;
@@ -292,7 +311,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)) ;
} }
@@ -368,7 +387,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) ;
@@ -616,6 +635,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 ;
} }
@@ -645,6 +667,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 ;
} }
@@ -674,7 +699,211 @@ 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->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)) ;
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 ;
int nSubCrvs = pCompo->GetCurveCount() ;
if ( nSubCrvToCopy > nSubCrvs - 1)
return GDB_ID_NULL ;
// creo una copia e la porto nel frame della destinazione
const ICurve* pSubCrv = pCompo->GetCurve( nSubCrvToCopy) ;
ICurve* pSubCrvCopy = pSubCrv->Clone() ;
pSubCrvCopy->LocToLoc( frCrv, frDest) ;
int nSubCrvId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, pSubCrvCopy) ;
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) ;
pSubCrvCopy->LocToLoc( frCrv, frDest) ;
int nSubCrvId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, pSubCrvCopy) ;
return nSubCrvId ;
}
+29 -18
View File
@@ -1,7 +1,7 @@
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// EgalTech 2023-2023 // EgalTech 2023-2024
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// File : Exe_GdbGetPocketing.cpp Data : 28.11.23 Versione : 2.5k6 // File : Exe_GdbGetPocketing.cpp Data : 02.02.24 Versione : 2.6b1
// Contenuto : Funzioni di interrogazione di regioni piane del DBG per EXE. // Contenuto : Funzioni di interrogazione di regioni piane del DBG per EXE.
// //
// //
@@ -16,6 +16,7 @@
#include "EXE.h" #include "EXE.h"
#include "EXE_Macro.h" #include "EXE_Macro.h"
#include "/EgtDev/Include/EXeExecutor.h" #include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EGkSfrCreate.h"
#include "/EgtDev/Include/EGkCalcPocketing.h" #include "/EgtDev/Include/EGkCalcPocketing.h"
using namespace std ; using namespace std ;
@@ -25,14 +26,26 @@ bool
ExePocketing( const int nId, double dRad, double dStep, double dAngle, int nType, bool bSmooth, int nDestGrpId, ExePocketing( const int nId, double dRad, double dStep, double dAngle, int nType, bool bSmooth, int nDestGrpId,
int& nFirstId, int& nCrvCount) int& nFirstId, int& nCrvCount)
{ {
// databse geometrico // database geometrico
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false) ; VERIFY_GEOMDB( pGeomDB, false) ;
// recupero la FlatRegion per i percorsi // recupero la FlatRegion da svuotare
PtrOwner<ISurfFlatRegion> pMySfr ;
const ISurfFlatRegion* pSfr = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId)) ; const ISurfFlatRegion* pSfr = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId)) ;
if ( pSfr == nullptr) if ( pSfr == nullptr) {
return false ; // 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 // recupero il suo frame
Frame3d frSfr ; Frame3d frSfr ;
@@ -44,23 +57,21 @@ ExePocketing( const int nId, double dRad, double dStep, double dAngle, int nType
if ( ! pGeomDB->GetGroupGlobFrame( nDestGrpId, frDest)) if ( ! pGeomDB->GetGroupGlobFrame( nDestGrpId, frDest))
return false ; return false ;
// costruzione vettori di curve per Pocketing
ICRVCOMPOPOVECTOR vCrvCompoRes ;
// eseguo Pocketing // eseguo Pocketing
bool bOk = CalcPocketing( pSfr, dRad, dStep, dAngle, nType, bSmooth, vCrvCompoRes) ; ICRVCOMPOPOVECTOR vCrvCompoRes ;
nFirstId = GDB_ID_NULL ; // primo Id da restituire bool bOk = CalcPocketing( pSfr, dRad, 0, dStep, dAngle, 5., nType, bSmooth, false, false, false, true, P_INVALID, nullptr, false, vCrvCompoRes) ;
nFirstId = GDB_ID_NULL ;
nCrvCount = int( vCrvCompoRes.size()) ; nCrvCount = int( vCrvCompoRes.size()) ;
if ( bOk && int( vCrvCompoRes.size()) > 0) { if ( bOk && nCrvCount > 0) {
// scorro le curve di Pocketing ottenute // scorro le curve di Pocketing ottenute
for ( int u = 0 ; u < int( vCrvCompoRes.size()) ; ++ u) { for ( int nI = 0 ; nI < nCrvCount ; ++ nI) {
vCrvCompoRes[u]->LocToLoc( frSfr, frDest) ; vCrvCompoRes[nI]->LocToLoc( frSfr, frDest) ;
// inserisco la curva nel DB Geometrico // inserisco la curva nel DB Geometrico
int nCurrId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( vCrvCompoRes[u])) ; int nCurrId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( vCrvCompoRes[nI])) ;
if ( nCurrId == GDB_ID_NULL) if ( nCurrId == GDB_ID_NULL)
return false ; return false ;
if ( u == 0) if ( nI == 0)
nFirstId = nCurrId ; // memorizzo il primo Id da restituire nFirstId = nCurrId ;
} }
ExeSetModified() ; ExeSetModified() ;
} }
@@ -73,7 +84,7 @@ ExePocketing( const int nId, double dRad, double dStep, double dAngle, int nType
ToString( nType) + "," + ToString( nType) + "," +
ToString( bSmooth) + "," + ToString( bSmooth) + "," +
ToString( nDestGrpId) + ")" + ToString( nDestGrpId) + ")" +
" -- Ok=" + ToString( bOk) + " FirstId=" + ToString( nFirstId) + " CurveCount=" + ToString( nCrvCount) ; " FirstId=" + ToString( nFirstId) + " CurveCount=" + ToString( nCrvCount) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
return bOk ; return bOk ;
+342 -65
View File
@@ -29,10 +29,12 @@
#include "/EgtDev/Include/EGkSurfFlatRegion.h" #include "/EgtDev/Include/EGkSurfFlatRegion.h"
#include "/EgtDev/Include/EGkSurfTriMesh.h" #include "/EgtDev/Include/EGkSurfTriMesh.h"
#include "/EgtDev/Include/EGkSurfBezier.h" #include "/EgtDev/Include/EGkSurfBezier.h"
#include "/EgtDev/Include/EGkDistPointSurfFr.h"
#include "/EgtDev/Include/EGkDistPointSurfTm.h" #include "/EgtDev/Include/EGkDistPointSurfTm.h"
#include "/EgtDev/Include/EGkIntersCurves.h" #include "/EgtDev/Include/EGkIntersCurves.h"
#include "/EgtDev/Include/EGkIntersLineBox.h" #include "/EgtDev/Include/EGkIntersLineBox.h"
#include "/EgtDev/Include/EGkIntersLineSurfTm.h" #include "/EgtDev/Include/EGkIntersLineSurfTm.h"
#include "/EgtDev/Include/EGkCAvSilhouetteSurfTm.h"
#include "/EgtDev/Include/EGkCalcPocketing.h" #include "/EgtDev/Include/EGkCalcPocketing.h"
#include "/EgtDev/Include/EGkPolygonElevation.h" #include "/EgtDev/Include/EGkPolygonElevation.h"
#include "/EgtDev/Include/EGkSurfLocal.h" #include "/EgtDev/Include/EGkSurfLocal.h"
@@ -63,7 +65,7 @@ ExeSurfIsClosed( int nId)
VERIFY_GEOMDB( pGeomDB, false) VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie // recupero la superficie
ISurf* pSurf = GetSurf( pGeomDB->GetGeoObj( nId)) ; ISurf* pSurf = GetSurf( pGeomDB->GetGeoObj( nId)) ;
// verifico se è superficie chiusa // verifico se è superficie chiusa
return ( pSurf != nullptr && pSurf->IsClosed()) ; return ( pSurf != nullptr && pSurf->IsClosed()) ;
} }
@@ -78,7 +80,7 @@ ExeSurfVolume( int nId, double& dVol)
return false ; return false ;
// recupero la superficie // recupero la superficie
ISurf* pSurf = GetSurf( pGeomDB->GetGeoObj( nId)) ; ISurf* pSurf = GetSurf( pGeomDB->GetGeoObj( nId)) ;
// ne restituisco l'eventuale volume (se è chiusa) // ne restituisco l'eventuale volume (se è chiusa)
return ( pSurf != nullptr && pSurf->GetVolume( dVol)) ; return ( pSurf != nullptr && pSurf->GetVolume( dVol)) ;
} }
@@ -118,24 +120,26 @@ bool
ExeSurfFrTestExternal( int nId1, int nId2, double dMinDist) ExeSurfFrTestExternal( int nId1, int nId2, double dMinDist)
{ {
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)) ; const ISurfFlatRegion* pSfr1 = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId1)) ;
if ( pSfr1 == nullptr) if ( pSfr1 == nullptr)
return false ; return false ;
// se richiesta distanza di sicurezza, ne faccio l'offset // se richiesta distanza di sicurezza, ne faccio l'offset
PtrOwner<ISurfFlatRegion> pSfr1O( pSfr1->Clone()) ; PtrOwner<ISurfFlatRegion> pSfr1O ;
if ( IsNull( pSfr1O)) if ( abs( dMinDist) > 5 * EPS_SMALL) {
return false ; pSfr1O.Set( pSfr1->Clone()) ;
if ( dMinDist > 10 * EPS_SMALL) if ( IsNull( pSfr1O) || ! pSfr1O->Offset( dMinDist, ICurve::OFF_FILLET))
pSfr1O->Offset( dMinDist, ICurve::OFF_FILLET) ; return false ;
pSfr1 = Get( pSfr1O) ;
}
// recupero il riferimento della superficie // recupero il riferimento della superficie
Frame3d frSurf1 ; Frame3d frSurf1 ;
if ( ! pGeomDB->GetGlobFrame( nId1, frSurf1)) if ( ! pGeomDB->GetGlobFrame( nId1, frSurf1))
return false ; return false ;
// recupero il tipo della seconda entità // recupero il tipo della seconda entità
int nType2 = pGeomDB->GetGeoType( nId2) ; int nType2 = pGeomDB->GetGeoType( nId2) ;
// se seconda entità regione // se seconda entità regione
if ( nType2 == SRF_FLATRGN) { if ( nType2 == SRF_FLATRGN) {
// recupero la seconda superficie FlatRegion in locale alla prima // recupero la seconda superficie FlatRegion in locale alla prima
SurfLocal Surf2Loc( pGeomDB, nId2, frSurf1) ; SurfLocal Surf2Loc( pGeomDB, nId2, frSurf1) ;
@@ -143,9 +147,9 @@ ExeSurfFrTestExternal( int nId1, int nId2, double dMinDist)
if ( pSfr2L == nullptr) if ( pSfr2L == nullptr)
return false ; return false ;
// eseguo il test di intersezione tra le due regioni // eseguo il test di intersezione tra le due regioni
for ( int i = 0 ; i < pSfr1O->GetChunkCount() ; ++ i) { for ( int i = 0 ; i < pSfr1->GetChunkCount() ; ++ i) {
for ( int j = 0 ; j < pSfr2L->GetChunkCount() ; ++ j) { for ( int j = 0 ; j < pSfr2L->GetChunkCount() ; ++ j) {
if ( pSfr1O->GetChunkSimpleClassification( i, *pSfr2L, j) != REGC_OUT) if ( pSfr1->GetChunkSimpleClassification( i, *pSfr2L, j) != REGC_OUT)
return false ; return false ;
} }
} }
@@ -159,8 +163,8 @@ ExeSurfFrTestExternal( int nId1, int nId2, double dMinDist)
if ( pCrv2L == nullptr) if ( pCrv2L == nullptr)
return false ; return false ;
// eseguo il test di intersezione tra regione e curva // eseguo il test di intersezione tra regione e curva
for ( int i = 0 ; i < pSfr1O->GetChunkCount() ; ++ i) { for ( int i = 0 ; i < pSfr1->GetChunkCount() ; ++ i) {
PtrOwner<ICurve> pCrv1( pSfr1O->GetLoop( i, 0)) ; PtrOwner<ICurve> pCrv1( pSfr1->GetLoop( i, 0)) ;
if ( pCrv1 == nullptr) if ( pCrv1 == nullptr)
return false ; return false ;
IntersCurveCurve ccInt( *pCrv1, *pCrv2L) ; IntersCurveCurve ccInt( *pCrv1, *pCrv2L) ;
@@ -168,7 +172,8 @@ ExeSurfFrTestExternal( int nId1, int nId2, double dMinDist)
if ( ! ccInt.GetCurveClassification( 1, EPS_SMALL, vcClass) || vcClass.empty()) if ( ! ccInt.GetCurveClassification( 1, EPS_SMALL, vcClass) || vcClass.empty())
return false ; return false ;
for ( auto& cClass : vcClass) { for ( auto& cClass : vcClass) {
if ( cClass.nClass == CRVC_IN || cClass.nClass == CRVC_NULL) if ( cClass.nClass == CRVC_IN || cClass.nClass == CRVC_ON_M ||
cClass.nClass == CRVC_ON_P || cClass.nClass == CRVC_NULL)
return false ; return false ;
} }
} }
@@ -178,34 +183,17 @@ ExeSurfFrTestExternal( int nId1, int nId2, double dMinDist)
else if ( nType2 == GEO_PNT3D) { else if ( nType2 == GEO_PNT3D) {
// recupero il punto // recupero il punto
IGeoPoint3d* pGeoPt = GetGeoPoint3d( pGeomDB->GetGeoObj( nId2)) ; IGeoPoint3d* pGeoPt = GetGeoPoint3d( pGeomDB->GetGeoObj( nId2)) ;
Point3d pt = pGeoPt->GetPoint() ; Point3d ptP = pGeoPt->GetPoint() ;
// porto il punto in locale // porto il punto in locale
Frame3d frPt ; Frame3d frPt ;
if ( ! pGeomDB->GetGlobFrame( nId2, frPt)) if ( ! pGeomDB->GetGlobFrame( nId2, frPt))
return false ; return false ;
pt.LocToLoc( frPt, frSurf1) ; ptP.LocToLoc( frPt, frSurf1) ;
// determino se interno (comprende la frontiera)
for ( int i = 0 ; i < pSfr1O->GetChunkCount() ; i ++) { bool bInside ;
// verifico se è contenuto nel loop esterno if ( ! IsPointInsideSurfFr( ptP, pSfr1, 0, bInside))
PtrOwner<ICurve> pCrv( pSfr1O->GetLoop( i, 0)) ; return false ;
PolyLine PL ; return ( ! bInside) ;
pCrv->ApproxWithLines( 10 * EPS_SMALL, 15, ICurve::APL_STD, PL) ;
if ( IsPointInsidePolyLine( pt, PL, EPS_SMALL)) {
bool bInsideHole = false ;
// verifico se è contenuto in un loop interno
for ( int j = 1 ; j < pSfr1O->GetLoopCount( i) ; j ++) {
PtrOwner<ICurve> pCrv( pSfr1O->GetLoop( i, j)) ;
pCrv->ApproxWithLines( 10 * EPS_SMALL, 15, ICurve::APL_STD, PL) ;
PL.Invert() ;
if ( IsPointInsidePolyLine( pt, PL, EPS_SMALL))
bInsideHole = true ;
}
// se è contenuto nel loop esterno ma non è contenuto in nessuno dei loop interni allora il punto è interno
if ( ! bInsideHole)
return false ;
}
}
return true ;
} }
// altrimenti non valida // altrimenti non valida
else else
@@ -226,6 +214,20 @@ ExeSurfFrChunkCount( int nId)
return pSfr->GetChunkCount() ; return pSfr->GetChunkCount() ;
} }
//----------------------------------------------------------------------------
bool
ExeSurfFrChunkMaxOffset( int nId, int nChunk, double& dMaxOffset)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// verifico il parametro
if ( &dMaxOffset == nullptr)
return false ;
// recupero la Regione
const ISurfFlatRegion* pSfr = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId)) ;
return ( pSfr != nullptr && pSfr->GetChunkMaxOffset( nChunk, dMaxOffset)) ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
int int
ExeSurfFrChunkSimpleClassify( int nId1, int nChunk1, int nId2, int nChunk2, double dToler) ExeSurfFrChunkSimpleClassify( int nId1, int nChunk1, int nId2, int nChunk2, double dToler)
@@ -259,6 +261,25 @@ ExeSurfFrChunkSimpleClassify( int nId1, int nChunk1, int nId2, int nChunk2, doub
return nRes ; return nRes ;
} }
//----------------------------------------------------------------------------
bool
ExeSurfFrChunkCenter( int nId, int nChunk, int nRefId, Point3d& ptCen, Vector3d& vtN)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie FlatRegion
ISurfFlatRegion* pSfr = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId)) ;
if ( pSfr == nullptr)
return false ;
// recupero il centro della parte
if ( ! pSfr->GetChunkCentroid( nChunk, ptCen))
return false ;
// recupero la normale della regione
vtN = pSfr->GetNormVersor() ;
// gestione trasformazioni ( eventuali)
return TransformPoint( pGeomDB, nId, nRefId, ptCen) && TransformVector( pGeomDB, nId, nRefId, vtN) ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
int int
ExeExtractSurfFrChunkLoops( int nId, int nChunk, int nDestGrpId, int* pnCount) ExeExtractSurfFrChunkLoops( int nId, int nChunk, int nDestGrpId, int* pnCount)
@@ -380,11 +401,11 @@ ExeSurfTmGetNearestVertex( int nId, const Point3d& ptNear, int nRefId, int& nVer
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ; const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
if ( pStm == nullptr) if ( pStm == 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 ;
// recupero il vertice più vicino della superficie // recupero il vertice più vicino della superficie
nVert = GetSurfTmNearestVertex( ptNearL, *pStm) ; nVert = GetSurfTmNearestVertex( ptNearL, *pStm) ;
if ( ! pStm->GetVertex( nVert, ptVert)) if ( ! pStm->GetVertex( nVert, ptVert))
return false ; return false ;
@@ -392,6 +413,26 @@ ExeSurfTmGetNearestVertex( int nId, const Point3d& ptNear, int nRefId, int& nVer
return TransformPoint( pGeomDB, nId, nRefId, ptVert) ; return TransformPoint( pGeomDB, nId, nRefId, ptVert) ;
} }
//----------------------------------------------------------------------------
bool
ExeSurfTmTriangleNormVersor( int nId, int nTria, int nRefId, Vector3d& vtNorm)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie trimesh
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
if ( pStm == nullptr)
return false ;
// recupero il triangolo
Triangle3d Tria ;
if ( ! pStm->GetTriangle( nTria, Tria))
return false ;
// assegno la normale
vtNorm = Tria.GetN() ;
// gestione trasformazione ( eventuale)
return TransformVector( pGeomDB, nId, nRefId, vtNorm) ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
int int
ExeSurfTmFacetFromTria( int nId, int nT) ExeSurfTmFacetFromTria( int nId, int nT)
@@ -431,11 +472,11 @@ ExeSurfTmFacetNearestEndPoint( int nId, int nFacet, const Point3d& ptNear, int n
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ; const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
if ( pStm == nullptr) if ( pStm == 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 ;
// recupero il punto End più vicino della faccia // recupero il punto End più vicino della faccia
if ( ! pStm->GetFacetNearestEndPoint( nFacet, ptNearL, ptEnd, vtN)) if ( ! pStm->GetFacetNearestEndPoint( nFacet, ptNearL, ptEnd, vtN))
return false ; return false ;
// gestione trasformazioni ( eventuali) // gestione trasformazioni ( eventuali)
@@ -453,11 +494,11 @@ ExeSurfTmFacetNearestMidPoint( int nId, int nFacet, const Point3d& ptNear, int n
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ; const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
if ( pStm == nullptr) if ( pStm == 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 ;
// recupero il punto Mid più vicino della faccia // recupero il punto Mid più vicino della faccia
if ( ! pStm->GetFacetNearestMidPoint( nFacet, ptNearL, ptMid, vtN)) if ( ! pStm->GetFacetNearestMidPoint( nFacet, ptNearL, ptMid, vtN))
return false ; return false ;
// gestione trasformazioni ( eventuali) // gestione trasformazioni ( eventuali)
@@ -555,7 +596,7 @@ ExeSurfTmFacetElevationInBBox( int nId, int nFacet, const BBox3d& b3Box, bool bA
else if ( nRefId == GDB_ID_GRID) else if ( nRefId == GDB_ID_GRID)
frBox = pGeomDB->GetGridFrame() ; frBox = pGeomDB->GetGridFrame() ;
else { else {
// nRefId può essere un gruppo o una entità // nRefId può essere un gruppo o una entità
if ( ! pGeomDB->GetGroupGlobFrame( nRefId, frBox) && if ( ! pGeomDB->GetGroupGlobFrame( nRefId, frBox) &&
! pGeomDB->GetGlobFrame( nRefId, frBox)) ! pGeomDB->GetGlobFrame( nRefId, frBox))
return false ; return false ;
@@ -663,7 +704,7 @@ ExeSurfTmFacetOppositeSideEx( int nId, int nFacet, const Vector3d& vtDir, int nR
pCrvCompo->ToLoc( frSpec) ; pCrvCompo->ToLoc( frSpec) ;
// ne faccio una copia per usi successivi // ne faccio una copia per usi successivi
PtrOwner<ICurveComposite> pCrvCopy( pCrvCompo->Clone()) ; PtrOwner<ICurveComposite> pCrvCopy( pCrvCompo->Clone()) ;
// la direzione di riferimento è l'asse X, la sostituisco con quella perpendicolare alla curva più adatta // la direzione di riferimento è l'asse X, la sostituisco con quella perpendicolare alla curva più adatta
Vector3d vtRef = X_AX ; Vector3d vtRef = X_AX ;
double dCosMax = -1 ; double dCosMax = -1 ;
const ICurve* pCrv = pCrvCompo->GetFirstCurve() ; const ICurve* pCrv = pCrvCompo->GetFirstCurve() ;
@@ -913,6 +954,108 @@ ExeGetSurfTmSilhouette( int nId, const Vector3d& vtDir, double dToler, int nDest
return nFirstId ; return nFirstId ;
} }
//----------------------------------------------------------------------------
static int
MyGetSurfTmParSilhouettes( const INTVECTOR& vIds, const Point3d& ptOn, const Vector3d& vtN, const DBLVECTOR& vdDist,
double dToler, int nDestGrpId, int nRefType, int& nCount)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// inizializzo contatore a valore negativo (errore)
nCount = -1 ;
// se non ci sono superfici o quote di calcolo, non c'è niente da calcolare
if ( vIds.empty() || vdDist.empty())
return GDB_ID_NULL ;
// recupero il riferimento della prima superficie
Frame3d frSurf ;
if ( ! pGeomDB->GetGlobFrame( vIds[0], frSurf))
return GDB_ID_NULL ;
// recupero il riferimento di destinazione
Frame3d frDest ;
if ( ! pGeomDB->GetGroupGlobFrame( nDestGrpId, frDest))
return GDB_ID_NULL ;
// recupero le superfici TriMesh e le porto tutte in locale alla prima
SURFLOCALVECTOR vSurfL ; vSurfL.reserve( vIds.size()) ;
CISURFTMPVECTOR vpStm ; vpStm.reserve( vIds.size()) ;
for ( int i = 0 ; i < int( vIds.size()) ; ++ i) {
vSurfL.emplace_back( pGeomDB, vIds[i], frSurf) ;
if ( vSurfL[i].Get() == nullptr)
return GDB_ID_NULL ;
vpStm.emplace_back( GetSurfTriMesh( vSurfL[i].Get())) ;
}
// porto in locale alla superficie il punto e la normale e ne calcolo un riferimento
Point3d ptOnL = GetPointLocal( pGeomDB, ptOn, nRefType, frSurf) ;
Vector3d vtNL = GetVectorLocal( pGeomDB, vtN, nRefType, frSurf) ;
Frame3d frPlanes ;
if ( ! frPlanes.Set( ptOnL, vtNL))
return GDB_ID_NULL ;
// recupero i contorni delle varie silhouette
int nFirstId = GDB_ID_NULL ;
int nTempCount = 0 ;
PtrOwner<ICAvParSilhouettesSurfTm> pCavParSilh( CreateCAvParSilhouettesSurfTm()) ;
if ( IsNull( pCavParSilh) || ! pCavParSilh->SetData( vpStm, frPlanes, dToler))
return GDB_ID_NULL ;
for ( auto dDist : vdDist) {
// recupero i loop come polilinee
POLYLINEVECTOR vPL ;
if ( ! pCavParSilh->GetSilhouette( dDist, vPL))
return GDB_ID_NULL ;
// dalle polilinee creo le curve e le inserisco nel DB
for ( int i = 0 ; i < int( vPL.size()) ; ++ i) {
// creo la curva
PtrOwner<ICurveComposite> pCrvCompo( CreateCurveComposite()) ;
if ( ! pCrvCompo->FromPolyLine( vPL[i]))
return GDB_ID_NULL ;
// assegno direzione di estrusione
pCrvCompo->SetExtrusion( vtNL) ;
// la porto nel riferimento destinazione
pCrvCompo->LocToLoc( frSurf, frDest) ;
// la inserisco nel DB geometrico
int nNewId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( pCrvCompo)) ;
if ( nNewId == GDB_ID_NULL)
return GDB_ID_NULL ;
// copio il materiale
if ( ! pGeomDB->CopyMaterial( vIds[0], nNewId))
return GDB_ID_NULL ;
// aggiorno contatori
if ( nFirstId == GDB_ID_NULL)
nFirstId = nNewId ;
++ nTempCount ;
}
}
nCount = nTempCount ;
return nFirstId ;
}
//----------------------------------------------------------------------------
int
ExeGetSurfTmParSilhouettes( const INTVECTOR& vIds, const Point3d& ptOn, const Vector3d& vtN, const DBLVECTOR& vdDist,
double dToler, int nDestGrpId, int nRefType, int* pnCount)
{
// eseguo
int nCount = -1 ;
int nFirstId = MyGetSurfTmParSilhouettes( vIds, ptOn, vtN, vdDist, dToler, nDestGrpId, nRefType, nCount) ;
// aggiorno contatori
if ( nFirstId != GDB_ID_NULL)
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtGetSurfTmParSilhouettes({" + ToString( vIds) + "},{" +
ToString( ptOn) + "},{" +
ToString( vtN) + "},{" +
ToString( vdDist) + "}," +
ToString( dToler) + "," +
ToString( nDestGrpId) + "," +
RefTypeToString( nRefType) + ")" +
" -- Id1=" + ToString( nFirstId) + ",Nbr=" + ToString( nCount) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultati
if ( pnCount != nullptr)
*pnCount = nCount ;
return nFirstId ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
int int
ExeExtractSurfTmFacetLoops( int nId, int nFacet, int nDestGrpId, int* pnCount) ExeExtractSurfTmFacetLoops( int nId, int nFacet, int nDestGrpId, int* pnCount)
@@ -1081,6 +1224,98 @@ ExeSurfTmGetFacetBBoxRef( int nId, int nFacet, int nFlag, const Frame3d& frRef,
return pStm->GetFacetBBox( nFacet, frGlobL, b3Box, nFlag) ; return pStm->GetFacetBBox( nFacet, frGlobL, b3Box, nFlag) ;
} }
//-----------------------------------------------------------------------------
bool
ExeSurfTmGetFacetOutlineInfo( int nId, int nFacet, int nRefId,
int& nStatus, BOOLVECTOR& vbOpen, INTVECTOR& vnAdj, DBLVECTOR& vdLen, VCT3DVECTOR& vvtNorm, DBLVECTOR& vdElev)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie TriMesh
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
if ( pStm == nullptr)
return false ;
// recupero normale della faccia
Vector3d vtNorm ;
if ( ! pStm->GetFacetNormal( nFacet, vtNorm))
return false ;
// recupero i loop come polilinee
POLYLINEVECTOR vPL ;
if ( ! pStm->GetFacetLoops( nFacet, vPL) || vPL.empty())
return false ;
// calcolo lo stato
if ( vPL.size() == 1)
nStatus = 0 ;
else {
nStatus = -1 ;
for ( int i = 1 ; nStatus == -1 && i < int( vPL.size()) ; ++ i) {
double dIni, dFin ;
Point3d ptIni, ptFin ;
bool bFound = vPL[i].GetFirstULine( &dIni, &ptIni, &dFin, &ptFin) ;
while ( bFound) {
int nAdj = lround( dIni) ;
Vector3d vtNf ;
if ( nAdj >= 0 && pStm->GetFacetNormal( nAdj, vtNf)) {
Vector3d vtTg = ptFin - ptIni ;
vtTg.Normalize() ;
if ( ( vtTg ^ vtNf) * vtNorm > EPS_SMALL) {
nStatus = 1 ;
break ;
}
}
bFound = vPL[i].GetNextULine( &dIni, &ptIni, &dFin, &ptFin) ;
}
}
}
// pulisco e prealloco i vettori del risultato
int nDim = vPL[0].GetLineNbr() ;
vbOpen.clear() ; vbOpen.reserve( nDim) ;
vnAdj.clear() ; vnAdj.reserve( nDim) ;
vdLen.clear() ; vdLen.reserve( nDim) ;
vvtNorm.clear() ; vvtNorm.reserve( nDim) ;
vdElev.clear() ; vdElev.reserve( nDim) ;
// recupero riferimento alla lista dei punti
PNTULIST& lstPU = vPL[0].GetUPointList() ;
// ciclo sui lati del loop esterno (il primo)
double dIni, dFin ;
Point3d ptIni, ptFin ;
bool bFound = vPL[0].GetFirstULine( &dIni, &ptIni, &dFin, &ptFin) ;
while ( bFound) {
// faccia adiacente
int nAdj = lround( dIni) ;
// lunghezza lato
double dLen = Dist( ptIni, ptFin) ;
// aperto se senza adiacenza o con faccia adiacente che va da parte negativa (tipo foro)
bool bOpen = true ;
Vector3d vtTg = ptFin - ptIni ;
vtTg.Normalize() ;
Vector3d vtNf ;
if ( nAdj >= 0 && pStm->GetFacetNormal( nAdj, vtNf))
bOpen = ((vtTg ^ vtNf) * vtNorm < EPS_SMALL) ;
// normale al lato (verso interno se chiuso, verso esterno se aperto)
Vector3d vtN = vtTg ;
vtN.Rotate( vtNorm, 0, ( bOpen ? -1 : 1)) ;
// elevazione secondo direzione della normale al lato
double dElev = 0 ;
for ( const auto& PU : lstPU) {
double dDist = ( PU.first - ptIni) * vtN ;
dElev = ( bOpen ? min( dElev, dDist) : max( dElev, dDist)) ;
}
// porto normale nel riferimento desiderato
TransformVector( pGeomDB, nId, nRefId, vtN) ;
// inserisco dati nei parametri di ritorno
vbOpen.emplace_back( bOpen) ;
vnAdj.emplace_back( nAdj) ;
vdLen.emplace_back( dLen) ;
vvtNorm.emplace_back( vtN) ;
vdElev.emplace_back( dElev) ;
// passo al prossimo lato
bFound = vPL[0].GetNextULine( &dIni, &ptIni, &dFin, &ptFin) ;
}
return true ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
int int
ExeSurfTmGetEdges( int nId, int nDestGrpId, bool bSmoothAng, int* pnCount) ExeSurfTmGetEdges( int nId, int nDestGrpId, bool bSmoothAng, int* pnCount)
@@ -1260,7 +1495,7 @@ MySurfBezierGetCurveUV( int nSurfId, bool bIsU, double dPar, int nDestGrpId)
PtrOwner<ICurveComposite> pCrv( bIsU ? pSbz->GetCurveOnU( dPar) : pSbz->GetCurveOnV( dPar)) ; PtrOwner<ICurveComposite> pCrv( bIsU ? pSbz->GetCurveOnU( dPar) : pSbz->GetCurveOnV( dPar)) ;
if ( IsNull( pCrv)) if ( IsNull( pCrv))
return GDB_ID_NULL ; return GDB_ID_NULL ;
// se è una curva // se è una curva
if ( ! pCrv->IsAPoint()) { if ( ! pCrv->IsAPoint()) {
// porto la curva nel riferimento destinazione // porto la curva nel riferimento destinazione
pCrv->LocToLoc( frSurf, frDest) ; pCrv->LocToLoc( frSurf, frDest) ;
@@ -1270,7 +1505,7 @@ MySurfBezierGetCurveUV( int nSurfId, bool bIsU, double dPar, int nDestGrpId)
pGeomDB->CopyMaterial( nSurfId, nNewId) ; pGeomDB->CopyMaterial( nSurfId, nNewId) ;
return nNewId ; return nNewId ;
} }
// altrimenti è collassata in un punto // altrimenti è collassata in un punto
else { else {
Point3d ptP ; pCrv->GetStartPoint( ptP) ; Point3d ptP ; pCrv->GetStartPoint( ptP) ;
PtrOwner<IGeoPoint3d> pGeoPnt( CreateGeoPoint3d()) ; PtrOwner<IGeoPoint3d> pGeoPnt( CreateGeoPoint3d()) ;
@@ -1374,7 +1609,7 @@ MySurfBezierGetControlCurveUV( int nSurfId, bool bIsU, int nInd, int nDestGrpId)
pSbz->GetControlCurveOnU( nInd, PL) ; pSbz->GetControlCurveOnU( nInd, PL) ;
else else
pSbz->GetControlCurveOnV( nInd, PL) ; pSbz->GetControlCurveOnV( nInd, PL) ;
// se è una curva // se è una curva
if ( PL.GetPointNbr() > 1) { if ( PL.GetPointNbr() > 1) {
PtrOwner<ICurveComposite> pCrvCo( CreateCurveComposite()) ; PtrOwner<ICurveComposite> pCrvCo( CreateCurveComposite()) ;
if ( IsNull( pCrvCo) || ! pCrvCo->FromPolyLine( PL)) if ( IsNull( pCrvCo) || ! pCrvCo->FromPolyLine( PL))
@@ -1387,7 +1622,7 @@ MySurfBezierGetControlCurveUV( int nSurfId, bool bIsU, int nInd, int nDestGrpId)
pGeomDB->CopyMaterial( nSurfId, nNewId) ; pGeomDB->CopyMaterial( nSurfId, nNewId) ;
return nNewId ; return nNewId ;
} }
// se altrimenti è collassata in un punto // se altrimenti è collassata in un punto
else if ( PL.GetPointNbr() == 1) { else if ( PL.GetPointNbr() == 1) {
Point3d ptP ; PL.GetFirstPoint( ptP) ; Point3d ptP ; PL.GetFirstPoint( ptP) ;
PtrOwner<IGeoPoint3d> pGeoPnt( CreateGeoPoint3d()) ; PtrOwner<IGeoPoint3d> pGeoPnt( CreateGeoPoint3d()) ;
@@ -1401,7 +1636,7 @@ MySurfBezierGetControlCurveUV( int nSurfId, bool bIsU, int nInd, int nDestGrpId)
pGeomDB->CopyMaterial( nSurfId, nNewId) ; pGeomDB->CopyMaterial( nSurfId, nNewId) ;
return nNewId ; return nNewId ;
} }
// altrimenti è errore // altrimenti è errore
else else
return GDB_ID_NULL ; return GDB_ID_NULL ;
} }
@@ -1462,25 +1697,26 @@ ExeExtractSurfBezierLoops( int nId, int nDestGrpId, int* pnCount)
// richiedo i contorni della superficie e li inserisco nel DB // richiedo i contorni della superficie e li inserisco nel DB
int nFirstId = GDB_ID_NULL ; int nFirstId = GDB_ID_NULL ;
int nCount = 0 ; int nCount = 0 ;
int nL = 0 ; ICRVCOMPOPOVECTOR vCC ;
PtrOwner<ICurve> pCrv( bOk ? pSbz->GetLoop( nL) : nullptr) ; pSbz->GetLoops( vCC , true) ;
while ( ! IsNull( pCrv)) { for ( int i = 0 ; i < int( vCC.size()) ; ++i) {
// porto la curva nel riferimento destinazione if ( IsNull( vCC[i]) || ! vCC[i]->IsValid())
bOk = bOk && pCrv->LocToLoc( frSurf, frDest) ; continue ;
// la inserisco nel DB geometrico // porto la curva nel riferimento destinazione
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( pCrv)) : GDB_ID_NULL) ; bOk = bOk && vCC[i]->LocToLoc(frSurf, frDest) ;
// la inserisco nel DB geometrico
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( vCC[i])) : GDB_ID_NULL) ;
bOk = bOk && ( nNewId != GDB_ID_NULL) ; bOk = bOk && ( nNewId != GDB_ID_NULL) ;
// copio il materiale // copio il materiale
if ( ! pGeomDB->CopyMaterial( nId, nNewId)) if ( ! pGeomDB->CopyMaterial( nId, nNewId))
return GDB_ID_NULL ; return GDB_ID_NULL ;
// aggiorno contatori // aggiorno contatori
if ( bOk && nFirstId == GDB_ID_NULL) if ( bOk && nFirstId == GDB_ID_NULL)
nFirstId = nNewId ; nFirstId = nNewId ;
if ( bOk) if ( bOk)
++ nCount ; ++ nCount ;
// passo alla prossima curva
pCrv.Set( bOk ? pSbz->GetLoop( ++nL) : nullptr) ;
} }
ExeSetModified() ; ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente // se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) { if ( IsCmdLog()) {
@@ -1494,3 +1730,44 @@ ExeExtractSurfBezierLoops( int nId, int nDestGrpId, int* pnCount)
*pnCount = nCount ; *pnCount = nCount ;
return nFirstId ; return nFirstId ;
} }
//----------------------------------------------------------------------------
int
ExeShowSurfBezierControlPoints( int nSrfId, int nDestGrpId, int* pnCount)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie di bezier
IGeoObj* pGeoObj = pGeomDB->GetGeoObj( nSrfId) ;
if ( pGeoObj->GetType() != SRF_BEZIER)
return GDB_ID_NULL ;
// recupero il riferimento della superficie
Frame3d frSurf ;
bool bOk = true ;
bOk = bOk && pGeomDB->GetGlobFrame( nSrfId, frSurf) ;
// recupero il riferimento di destinazione
Frame3d frDest ;
bOk = bOk && pGeomDB->GetGroupGlobFrame( nDestGrpId, frDest) ;
if ( ! bOk)
return GDB_ID_NULL ;
int nDegU = - 1, nDegV = - 1, nSpanU = - 1, nSpanV = - 1 ;
bool bRat = false, bTrimmed = false ;
ISurfBezier* pSrfBez = GetSurfBezier( pGeoObj) ;
pSrfBez->GetInfo( nDegU, nDegV, nSpanU, nSpanV, bRat, bTrimmed) ;
int nFirstId = -1 ;
int nCount = 0 ;
for ( int i = 0 ; i < (nDegU * nSpanU + 1) * ( nDegV * nSpanV + 1) ; ++i) {
IGeoPoint3d* pGeoPt( CreateGeoPoint3d()) ;
pGeoPt->Set( pSrfBez->GetControlPoint( i, &bOk)) ;
pGeoPt->LocToLoc( frSurf, 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 ;
}
+553 -55
View File
@@ -20,6 +20,8 @@
#include "GeoTools.h" #include "GeoTools.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/EGkGeoVector3d.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"
@@ -27,21 +29,22 @@
#include "/EgtDev/Include/EGkIntersCurves.h" #include "/EgtDev/Include/EGkIntersCurves.h"
#include "/EgtDev/Include/EGkDistPointCurve.h" #include "/EgtDev/Include/EGkDistPointCurve.h"
#include "/EgtDev/Include/EGkCurveLocal.h" #include "/EgtDev/Include/EGkCurveLocal.h"
#include "/EgtDev/Include/EGkSurfLocal.h"
#include "/EgtDev/Include/EGkCurveAux.h" #include "/EgtDev/Include/EGkCurveAux.h"
#include "/EgtDev/Include/EGkOffsetCurve.h" #include "/EgtDev/Include/EGkOffsetCurve.h"
#include "/EgtDev/Include/EGkMedialAxis.h" #include "/EgtDev/Include/EGkMedialAxis.h"
#include "/EgtDev/Include/EGkChainCurves.h" #include "/EgtDev/Include/EGkChainCurves.h"
#include "/EgtDev/Include/EGkProjectCurveSurfTm.h" #include "/EgtDev/Include/EGkProjectCurveSurf.h"
#include "/EgtDev/Include/EGkSurfFlatRegion.h" #include "/EgtDev/Include/EGkSurfFlatRegion.h"
#include "/EgtDev/Include/EGkSfrCreate.h"
#include "/EgtDev/Include/EGkSurfBezier.h"
#include "/EgtDev/Include/EGkExtTExt.h" #include "/EgtDev/Include/EGkExtTExt.h"
#include "/EgtDev/Include/EGkGdbIterator.h" #include "/EgtDev/Include/EGkGdbIterator.h"
#include "/EgtDev/Include/EGkStringUtils3d.h" #include "/EgtDev/Include/EGkStringUtils3d.h"
#include "/EgtDev/Include/EGkIntervals.h" #include "/EgtDev/Include/EGkIntervals.h"
#include "/EgtDev/Include/EGkPolygon3d.h" #include "/EgtDev/Include/EGkPolygon3d.h"
#include "/EgtDev/Include/EGkGeoVector3d.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
#include "/EgtDev/Include/EGkCalcPocketing.h" #include "/EgtDev/Include/EGkCalcPocketing.h"
#include <EgtDev/Include/EGkSfrCreate.h> #include "/EgtDev/Include/EgtPointerOwner.h"
#include <functional> #include <functional>
@@ -186,7 +189,7 @@ ExeCurveMedialAxis( int nId)
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
bool bool
ExeApproxCurve( int nId, int nApprType, double dLinTol) ExeApproxCurve( int nId, int nApprType, double dLinTol, double dMaxSegmLen)
{ {
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
@@ -200,7 +203,8 @@ ExeApproxCurve( int nId, int nApprType, double dLinTol)
nApprType == APP_LEFT_LINES || nApprType == APP_LEFT_CONVEX_LINES || nApprType == APP_LEFT_LINES || nApprType == APP_LEFT_CONVEX_LINES ||
nApprType == APP_RIGHT_LINES || nApprType == APP_RIGHT_CONVEX_LINES) { nApprType == APP_RIGHT_LINES || nApprType == APP_RIGHT_CONVEX_LINES) {
PolyLine PL ; PolyLine PL ;
bOk = bOk && pCurve->ApproxWithLines( dLinTol, ANG_TOL_MAX_DEG, nApprType, PL) && pCC->FromPolyLine( PL) ; bOk = bOk && pCurve->ApproxWithLines( dLinTol, ANG_TOL_MAX_DEG, nApprType, PL) &&
PL.AdjustForMaxSegmentLen( dMaxSegmLen) && pCC->FromPolyLine( PL) ;
// eliminazione di small Z // eliminazione di small Z
bOk = bOk && pCC->RemoveSmallDefects( 0.5 * dLinTol, ANG_TOL_STD_DEG) ; bOk = bOk && pCC->RemoveSmallDefects( 0.5 * dLinTol, ANG_TOL_STD_DEG) ;
} }
@@ -330,10 +334,9 @@ ExeChangeClosedCurveStartPoint( int nId, const Point3d& ptP, int nRefType)
// porto in locale il punto vicino ad iniziale // porto in locale il punto vicino ad iniziale
Point3d ptPL = GetPointLocal( pGeomDB, ptP, nRefType, frLoc) ; Point3d ptPL = GetPointLocal( pGeomDB, ptP, nRefType, frLoc) ;
// recupero la posizione parametrica della proiezione di questo punto sulla curva // recupero la posizione parametrica della proiezione di questo punto sulla curva
DistPointCurve distPC( ptPL, *pCurve) ;
double dPar ; double dPar ;
int nFlag ; int nFlag ;
bOk = bOk && distPC.GetParamAtMinDistPoint( 0, dPar, nFlag) ; bOk = bOk && DistPointCurve( ptPL, *pCurve).GetParamAtMinDistPoint( 0, dPar, nFlag) ;
// cambio il punto iniziale // cambio il punto iniziale
if ( bOk && pCurve->GetType() == CRV_ARC) if ( bOk && pCurve->GetType() == CRV_ARC)
bOk = bOk && GetCurveArc(pCurve)->ChangeStartPoint(dPar) ; bOk = bOk && GetCurveArc(pCurve)->ChangeStartPoint(dPar) ;
@@ -873,7 +876,7 @@ ExeTrimExtendCurveByLen( int nId, double dLen, const Point3d& ptNear, int nRefTy
bOk = bOk && pGeomDB->GetGlobFrame( nId, frLoc) ; bOk = bOk && pGeomDB->GetGlobFrame( nId, frLoc) ;
// porto in locale il punto // porto in locale il punto
Point3d ptNearL = GetPointLocal( pGeomDB, ptNear, nRefType, frLoc) ; Point3d ptNearL = GetPointLocal( pGeomDB, ptNear, nRefType, frLoc) ;
// cerco l'estremo più vicino al punto passato // cerco l'estremo più vicino al punto passato
bool bStart ; bool bStart ;
if ( bOk && pCurve->GetNearestExtremityToPoint( ptNearL, bStart)) { if ( bOk && pCurve->GetNearestExtremityToPoint( ptNearL, bStart)) {
if ( bStart) { if ( bStart) {
@@ -968,7 +971,7 @@ MyTrimCurveWithRegion( int nCrvId, int nRegId, bool bInVsOut, bool bOn, int& nCo
// passo alla successiva divisione // passo alla successiva divisione
bFound = inOk.GetNext( dParS, dParE) ; bFound = inOk.GetNext( dParS, dParE) ;
} }
// cancello l'ultima copia (se non c'erano intervalli validi è l'originale) // cancello l'ultima copia (se non c'erano intervalli validi è l'originale)
pGeomDB->Erase( nCurrId) ; pGeomDB->Erase( nCurrId) ;
return nFirstId ; return nFirstId ;
} }
@@ -1013,7 +1016,7 @@ MyTrimFlatCurveWithBox( int nCrvId, const Frame3d& frBox, const Vector3d& vtDiag
Plane3d plPlane ; Plane3d plPlane ;
if ( ! pCrv->IsFlat( plPlane, false, 10 * EPS_SMALL)) if ( ! pCrv->IsFlat( plPlane, false, 10 * EPS_SMALL))
return GDB_ID_NULL ; return GDB_ID_NULL ;
// porto in locale alla curva il riferimento del box (il vettore è già in locale a questo stesso riferimento) // porto in locale alla curva il riferimento del box (il vettore è già in locale a questo stesso riferimento)
Frame3d frBoxL = GetFrameLocal( pGeomDB, frBox, nRefType, frCrv) ; Frame3d frBoxL = GetFrameLocal( pGeomDB, frBox, nRefType, frCrv) ;
// determino la parte di piano (poligono) compresa nel box (applicando le opportune trasformazioni di riferimento) // determino la parte di piano (poligono) compresa nel box (applicando le opportune trasformazioni di riferimento)
plPlane.ToLoc( frBoxL) ; plPlane.ToLoc( frBoxL) ;
@@ -1077,7 +1080,7 @@ MyTrimFlatCurveWithBox( int nCrvId, const Frame3d& frBox, const Vector3d& vtDiag
// passo alla successiva divisione // passo alla successiva divisione
bFound = inOk.GetNext( dParS, dParE) ; bFound = inOk.GetNext( dParS, dParE) ;
} }
// cancello l'ultima copia (se non c'erano intervalli validi è l'originale) // cancello l'ultima copia (se non c'erano intervalli validi è l'originale)
pGeomDB->Erase( nCurrId) ; pGeomDB->Erase( nCurrId) ;
return nFirstId ; return nFirstId ;
} }
@@ -1115,7 +1118,7 @@ ExeSplitCurve( int nId, int nParts)
// recupero la curva // recupero la curva
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ; ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pCurve != nullptr) ; bool bOk = ( pCurve != nullptr) ;
// il numero di parti non può essere inferiore a 1 // il numero di parti non può essere inferiore a 1
nParts = max( nParts, 1) ; nParts = max( nParts, 1) ;
// lunghezza totale della curva // lunghezza totale della curva
double dLenTot = 0 ; double dLenTot = 0 ;
@@ -1176,7 +1179,7 @@ ExeSplitCurveAtPoint( int nId, const Point3d& ptOn, int nRefType)
int nFlag ; int nFlag ;
if ( ! dstPC.GetParamAtMinDistPoint( 0, dU, nFlag) || nFlag != MDPCI_NORMAL) if ( ! dstPC.GetParamAtMinDistPoint( 0, dU, nFlag) || nFlag != MDPCI_NORMAL)
bOk = false ; bOk = false ;
// se sull'inizio, provo se c'è una soluzione successiva // se sull'inizio, provo se c'è una soluzione successiva
if ( bOk && dU < EPS_PARAM) if ( bOk && dU < EPS_PARAM)
dstPC.GetParamAtMinDistPoint( 1, dU, nFlag) ; dstPC.GetParamAtMinDistPoint( 1, dU, nFlag) ;
} }
@@ -1193,7 +1196,7 @@ ExeSplitCurveAtPoint( int nId, const Point3d& ptOn, int nRefType)
if ( bOk && dCutLen > EPS_SMALL && dLen - dCutLen > EPS_SMALL) if ( bOk && dCutLen > EPS_SMALL && dLen - dCutLen > EPS_SMALL)
bIsInside = true ; bIsInside = true ;
} }
// se il punto di taglio è interno, devo realmente tagliare // se il punto di taglio è interno, devo realmente tagliare
int nNewId = GDB_ID_NULL ; int nNewId = GDB_ID_NULL ;
if ( bIsInside) { if ( bIsInside) {
// copio la curva // copio la curva
@@ -1240,7 +1243,7 @@ ExeSplitCurveAtParam( int nId, double dParam)
if ( bOk && dCutLen > EPS_SMALL && dLen - dCutLen > EPS_SMALL) if ( bOk && dCutLen > EPS_SMALL && dLen - dCutLen > EPS_SMALL)
bIsInside = true ; bIsInside = true ;
} }
// se il punto di taglio è interno, devo realmente tagliare // se il punto di taglio è interno, devo realmente tagliare
int nNewId = GDB_ID_NULL ; int nNewId = GDB_ID_NULL ;
if ( bIsInside) { if ( bIsInside) {
// copio la curva // copio la curva
@@ -1462,7 +1465,7 @@ ExeGetCurveLinearConvexHullXY( int nId, double dLinTol, int nRefType)
" -- 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 ;
} }
@@ -1559,7 +1562,7 @@ MyModifyArcRadiusEx( IGeomDB* pGeomDB, int nId, double dRad)
// se angolo al centro maggiore o uguale ad un giro o estremi coincidenti, conservo il centro // se angolo al centro maggiore o uguale ad un giro o estremi coincidenti, conservo il centro
if ( abs( pArc->GetAngCenter()) >= ANG_FULL - EPS_ANG_ZERO || dPlaneDist < 2 * EPS_SMALL) if ( abs( pArc->GetAngCenter()) >= ANG_FULL - EPS_ANG_ZERO || dPlaneDist < 2 * EPS_SMALL)
return MyModifyArcRadius( pGeomDB, nId, dRad) ; return MyModifyArcRadius( pGeomDB, nId, dRad) ;
// mantengo i punti estremi (pertanto il nuovo raggio non può essere inferiore a metà della loro distanza nel piano) // mantengo i punti estremi (pertanto il nuovo raggio non può essere inferiore a metà della loro distanza nel piano)
if ( dRad < dPlaneDist / 2 - EPS_ZERO) if ( dRad < dPlaneDist / 2 - EPS_ZERO)
return false ; return false ;
// creo arco con gli stessi estremi, con identica normale e con nuovo raggio // creo arco con gli stessi estremi, con identica normale e con nuovo raggio
@@ -1762,7 +1765,7 @@ ExeAddCurveCompoCurve( int nId, int nAddCrvId, bool bEraseOrig, bool bEndVsStart
" -- Ok=" + ToString( bOk) ; " -- Ok=" + ToString( bOk) ;
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 bOk ; return bOk ;
} }
@@ -1976,7 +1979,7 @@ ExeGetCurveCompoJointCount( int nId)
ICurveComposite* pCompo = GetCurveComposite( pGeomDB->GetGeoObj( nId)) ; ICurveComposite* pCompo = GetCurveComposite( pGeomDB->GetGeoObj( nId)) ;
if ( pCompo == nullptr) if ( pCompo == nullptr)
return 0 ; return 0 ;
// calcolo il numero di giunzioni (se chiusa è uguale al numero delle curve altrimenti -1) // calcolo il numero di giunzioni (se chiusa è uguale al numero delle curve altrimenti -1)
if ( pCompo->IsClosed()) if ( pCompo->IsClosed())
return pCompo->GetCurveCount() ; return pCompo->GetCurveCount() ;
else else
@@ -2180,6 +2183,52 @@ ExeRemoveCurveCompoUndercutOnY( int nId, double dLinTol)
return bOk ; return bOk ;
} }
//----------------------------------------------------------------------------
bool
ExeCurveCompoSetTempProp( int nId, int nCrv, int nProp, int nPropInd)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la curva composita
ICurveComposite* pCompo = GetCurveComposite( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pCompo != nullptr) ;
// imposto il valore
bOk = bOk && pCompo->SetCurveTempProp( nCrv, nProp, nPropInd) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtCurveCompoSetTempProp(" + ToString( nId) + "," +
ToString( nCrv) + "," +
ToString( nProp) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
//----------------------------------------------------------------------------
bool
ExeCurveCompoSetTempParam( int nId, int nCrv, double dParam, int nParamInd)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la curva composita
ICurveComposite* pCompo = GetCurveComposite( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pCompo != nullptr) ;
// imposto il valore
bOk = bOk && pCompo->SetCurveTempParam( nCrv, dParam, nParamInd) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtCurveCompoSetTempParam(" + ToString( nId) + "," +
ToString( nCrv) + "," +
ToString( dParam) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
static bool static bool
MyChainCurvesInGroup( int nGroupId, const Point3d& ptNear, bool bAllowInvert, int nRefType) MyChainCurvesInGroup( int nGroupId, const Point3d& ptNear, bool bAllowInvert, int nRefType)
@@ -2270,7 +2319,8 @@ ExeReorderCurvesInGroup( int nGroupId, const Point3d& ptNear, int nRefType)
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
static bool static bool
MyProjectCurveOnSurfTm( int nCurveId, int nSurfTmId, const Vector3d& vtDir, int nDestGrpId, double dLinTol, int nRefType) MyProjectCurveOnSurf( int nCurveId, int nSurfTmId, const Vector3d& vtProj, int nDestGrpId,
double dLinTol, double dMaxSegmLen, bool bDirFromProj, int nRefType)
{ {
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false) VERIFY_GEOMDB( pGeomDB, false)
@@ -2281,9 +2331,9 @@ MyProjectCurveOnSurfTm( int nCurveId, int nSurfTmId, const Vector3d& vtDir, int
Frame3d frCrv ; Frame3d frCrv ;
if ( ! pGeomDB->GetGlobFrame( nCurveId, frCrv)) if ( ! pGeomDB->GetGlobFrame( nCurveId, frCrv))
return false ; return false ;
// recupero la superficie trimesh e il suo riferimento // recupero la superficie e il suo riferimento
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nSurfTmId)) ; const ISurf* pSurf = GetSurf( pGeomDB->GetGeoObj( nSurfTmId)) ;
if ( pStm == nullptr) if ( pSurf == nullptr)
return false ; return false ;
Frame3d frStm ; Frame3d frStm ;
if ( ! pGeomDB->GetGlobFrame( nSurfTmId, frStm)) if ( ! pGeomDB->GetGlobFrame( nSurfTmId, frStm))
@@ -2297,11 +2347,13 @@ MyProjectCurveOnSurfTm( int nCurveId, int nSurfTmId, const Vector3d& vtDir, int
CurveLocal CrvLoc( pCrv, frCrv, frStm) ; CurveLocal CrvLoc( pCrv, frCrv, frStm) ;
if ( CrvLoc.Get() == nullptr) if ( CrvLoc.Get() == nullptr)
return false ; return false ;
Vector3d vtDirL = GetVectorLocal( pGeomDB, vtDir, nRefType, frCrv) ; Vector3d vtProjL = GetVectorLocal( pGeomDB, vtProj, nRefType, frCrv) ;
vtDirL.LocToLoc( frCrv, frStm) ; vtProjL.LocToLoc( frCrv, frStm) ;
// vanno affilati gli spigoli solo se direzione non da proiezione
bool bSharpEdges = ( ! bDirFromProj) ;
// eseguo la proiezione // eseguo la proiezione
PNT5AXVECTOR vPt5ax ; PNT5AXVECTOR vPt5ax ;
if ( ! ProjectCurveOnSurfTm( *CrvLoc.Get(), *pStm, vtDirL, dLinTol, vPt5ax)) if ( ! ProjectCurveOnSurf( *CrvLoc.Get(), *pSurf, vtProjL, dLinTol, dMaxSegmLen, bSharpEdges, vPt5ax))
return false ; return false ;
// inserisco la composita nel gruppo destinazione // inserisco la composita nel gruppo destinazione
PtrOwner<ICurveComposite> pCompo ; PtrOwner<ICurveComposite> pCompo ;
@@ -2324,7 +2376,8 @@ MyProjectCurveOnSurfTm( int nCurveId, int nSurfTmId, const Vector3d& vtDir, int
PtrOwner<IGeoVector3d> pGeoVct( CreateGeoVector3d()) ; PtrOwner<IGeoVector3d> pGeoVct( CreateGeoVector3d()) ;
if ( IsNull( pGeoVct)) if ( IsNull( pGeoVct))
return false ; return false ;
pGeoVct->Set( 10 * GetLocToLoc( Pt5ax.vtDir, frStm, frDest), GetLocToLoc( Pt5ax.ptP, frStm, frDest)) ; Vector3d vtDir = ( bDirFromProj ? Pt5ax.vtDir2 : Pt5ax.vtDir1) ;
pGeoVct->Set( 10 * GetLocToLoc( vtDir, frStm, frDest), GetLocToLoc( Pt5ax.ptP, frStm, frDest)) ;
int nNewId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( pGeoVct)) ; int nNewId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( pGeoVct)) ;
if ( nNewId == GDB_ID_NULL) if ( nNewId == GDB_ID_NULL)
return false ; return false ;
@@ -2338,18 +2391,151 @@ MyProjectCurveOnSurfTm( int nCurveId, int nSurfTmId, const Vector3d& vtDir, int
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
bool bool
ExeProjectCurveOnSurfTm( int nCurveId, int nSurfTmId, const Vector3d& vtDir, int nDestGrpId, double dLinTol, int nRefType) ExeProjectCurveOnSurf( int nCurveId, int nSurfTmId, const Vector3d& vtProj, int nDestGrpId,
double dLinTol, double dMaxSegmLen, bool bDirFromProj, int nRefType)
{ {
bool bOk = MyProjectCurveOnSurfTm( nCurveId, nSurfTmId, vtDir, nDestGrpId, dLinTol, nRefType) ; bool bOk = MyProjectCurveOnSurf( nCurveId, nSurfTmId, vtProj, nDestGrpId, dLinTol, dMaxSegmLen, bDirFromProj, nRefType) ;
ExeSetModified() ; ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente // se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) { if ( IsCmdLog()) {
string sLua = "EgtProjectCurveOnSurfTm(" + ToString( nCurveId) + "," + string sLua = "EgtProjectCurveOnSurf(" + ToString( nCurveId) + "," +
ToString( nSurfTmId) + ",{" + ToString( nSurfTmId) + ",{" +
ToString( vtDir) + "}," + ToString( vtProj) + "}," +
ToString( nDestGrpId) + "," + ToString( nDestGrpId) + "," +
ToString( dLinTol) + "," + ToString( dLinTol) + "," +
RefTypeToString( nRefType) + ")" + ToString( dMaxSegmLen) + "," +
( bDirFromProj ? "true" : "false") + "," +
RefTypeToString( nRefType) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
//-------------------------------------------------------------------------------
static bool
MyProjectCurveOnSurfExt( int nCurveId, int nSurfTmId, int nGuideId, int nDestGrpId,
double dLinTol, double dMaxSegmLen, bool bDirFromGuide)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la curva e il suo riferimento
const ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nCurveId)) ;
if ( pCrv == nullptr)
return false ;
Frame3d frCrv ;
if ( ! pGeomDB->GetGlobFrame( nCurveId, frCrv))
return false ;
// recupero la superficie e il suo riferimento
const ISurf* pStm = GetSurf( pGeomDB->GetGeoObj( nSurfTmId)) ;
if ( pStm == nullptr)
return false ;
Frame3d frStm ;
if ( ! pGeomDB->GetGlobFrame( nSurfTmId, frStm))
return false ;
// recupero l'entità guida (punto, curva o superficie) e il suo riferimento
const IGeoPoint3d* pGdePnt = nullptr ;
const ICurve* pGdeCrv = nullptr ;
const ISurf* pGdeStm = nullptr ;
pGdePnt = GetGeoPoint3d( pGeomDB->GetGeoObj( nGuideId)) ;
if ( pGdePnt == nullptr) {
pGdeCrv = GetCurve( pGeomDB->GetGeoObj( nGuideId)) ;
if ( pGdeCrv == nullptr) {
pGdeStm = GetSurf( pGeomDB->GetGeoObj( nGuideId)) ;
if ( pGdeStm == nullptr)
return false ;
}
}
Frame3d frGde ;
if ( ! pGeomDB->GetGlobFrame( nGuideId, frGde))
return false ;
// recupero il riferimento del gruppo di destinazione
nDestGrpId = AdjustId( nDestGrpId) ;
Frame3d frDest ;
if ( ! pGeomDB->GetGroupGlobFrame( nDestGrpId, frDest))
return false ;
// porto la curva nel riferimento della superficie
CurveLocal CrvLoc( pCrv, frCrv, frStm) ;
if ( CrvLoc.Get() == nullptr)
return false ;
// vanno affilati gli spigoli solo se direzione non da guida
bool bSharpEdges = ( ! bDirFromGuide) ;
// eseguo l'opportuna proiezione dopo aver portato l'entità guida nel riferimento della superficie
PNT5AXVECTOR vPt5ax ;
if ( pGdePnt != nullptr) {
PtrOwner<IGeoPoint3d> pGdeLoc( pGdePnt->Clone()) ;
if ( pGdeLoc == nullptr)
return false ;
pGdeLoc->LocToLoc( frGde, frStm) ;
if ( ! ProjectCurveOnSurf( *CrvLoc.Get(), *pStm, *pGdeLoc, dLinTol, dMaxSegmLen, bSharpEdges, vPt5ax))
return false ;
}
else if ( pGdeCrv != nullptr) {
CurveLocal GdeLoc( pGdeCrv, frGde, frStm) ;
if ( GdeLoc.Get() == nullptr)
return false ;
if ( ! ProjectCurveOnSurf( *CrvLoc.Get(), *pStm, *GdeLoc.Get(), dLinTol, dMaxSegmLen, bSharpEdges, vPt5ax))
return false ;
}
else { // pGdeStm != nullptr
SurfLocal GdeLoc( pGdeStm, frGde, frStm) ;
const ISurf* pGdeLoc = GetSurf( GdeLoc.Get()) ;
if ( pGdeLoc == nullptr)
return false ;
if ( ! ProjectCurveOnSurf( *CrvLoc.Get(), *pStm, *pGdeLoc, dLinTol, dMaxSegmLen, bSharpEdges, vPt5ax))
return false ;
}
// inserisco la composita nel gruppo destinazione
PtrOwner<ICurveComposite> pCompo ;
for ( const auto& Pt5ax : vPt5ax) {
if ( IsNull( pCompo)) {
pCompo.Set( CreateCurveComposite()) ;
if ( IsNull( pCompo))
return false ;
pCompo->AddPoint( GetLocToLoc( Pt5ax.ptP, frStm, frDest)) ;
}
else
pCompo->AddLine( GetLocToLoc( Pt5ax.ptP, frStm, frDest)) ;
}
int nCompoId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( pCompo)) ;
if ( nCompoId == GDB_ID_NULL)
return false ;
// aggiungo i versori nel gruppo destinazione
int nInd = 0 ;
for ( const auto& Pt5ax : vPt5ax) {
PtrOwner<IGeoVector3d> pGeoVct( CreateGeoVector3d()) ;
if ( IsNull( pGeoVct))
return false ;
Vector3d vtDir = ( bDirFromGuide ? Pt5ax.vtDir2 : Pt5ax.vtDir1) ;
pGeoVct->Set( 10 * GetLocToLoc( vtDir, frStm, frDest), GetLocToLoc( Pt5ax.ptP, frStm, frDest)) ;
int nNewId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( pGeoVct)) ;
if ( nNewId == GDB_ID_NULL)
return false ;
pGeomDB->SetInfo( nNewId, "Ind", nInd ++) ;
pGeomDB->SetInfo( nNewId, "Par", Pt5ax.dPar) ;
pGeomDB->SetInfo( nNewId, "Flag", Pt5ax.nFlag) ;
}
return true ;
}
//-------------------------------------------------------------------------------
bool
ExeProjectCurveOnSurfExt( int nCurveId, int nSurfTmId, int nGuideId, int nDestGrpId,
double dLinTol, double dMaxSegmLen, bool bDirFromGuide)
{
bool bOk = MyProjectCurveOnSurfExt( nCurveId, nSurfTmId, nGuideId, nDestGrpId, dLinTol, dMaxSegmLen, bDirFromGuide) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtProjectCurveOnSurfExt(" + ToString( nCurveId) + "," +
ToString( nSurfTmId) + ",{" +
ToString( nGuideId) + "}," +
ToString( nDestGrpId) + "," +
ToString( dLinTol) + "," +
ToString( dMaxSegmLen) + "," +
( bDirFromGuide ? "true" : "false") + ")" +
" -- Ok=" + ToString( bOk) ; " -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
@@ -2359,17 +2545,17 @@ ExeProjectCurveOnSurfTm( int nCurveId, int nSurfTmId, const Vector3d& vtDir, int
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
int int
ExeCurveGetVoronoi( int nId, int nDestGrpId, int nBound, int* pnCount) ExeCurveGetVoronoi( const INTVECTOR& vIds, int nDestGrpId, int nBound, int* pnCount)
{ {
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// recupero la curva
const ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nId)) ; if ( vIds.empty())
if ( pCrv == nullptr) return false ;
return GDB_ID_NULL ;
// recupero il riferimento della curva // recupero il riferimento della prima curva che sarà utilizzato da Voronoi
Frame3d frCrv ; Frame3d frCrv ;
if ( ! pGeomDB->GetGlobFrame( nId, frCrv)) if ( ! pGeomDB->GetGlobFrame( vIds[0], frCrv))
return GDB_ID_NULL ; return GDB_ID_NULL ;
// recupero il riferimento di destinazione // recupero il riferimento di destinazione
Frame3d frDest ; Frame3d frDest ;
@@ -2378,7 +2564,32 @@ ExeCurveGetVoronoi( int nId, int nDestGrpId, int nBound, int* pnCount)
// Calcolo diagramma di Voronoi // Calcolo diagramma di Voronoi
ICURVEPOVECTOR vCrv ; ICURVEPOVECTOR vCrv ;
CalcCurveVoronoiDiagram( *pCrv, vCrv, nBound) ; if ( int( vIds.size()) == 1) {
// recupero la curva
const ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( vIds[0])) ;
if ( pCrv == nullptr)
return GDB_ID_NULL ;
// calcolo
CalcCurveVoronoiDiagram( *pCrv, vCrv, nBound) ;
}
else {
// recupero le curve e le porto in locale al frame della prima curva
CICURVEPVECTOR vOrigCrvs ;
for ( int i = 0 ; i < int( vIds.size()) ; i ++) {
CurveLocal CrvLoc( pGeomDB, vIds[i], frCrv) ;
if ( CrvLoc.Get() == nullptr) {
for ( auto pCrv : vOrigCrvs)
delete( pCrv) ;
return GDB_ID_NULL ;
}
vOrigCrvs.emplace_back( CrvLoc->Clone()) ;
}
// calcolo
CalcCurvesVoronoiDiagram( vOrigCrvs, vCrv, nBound) ;
// libero la memoria
for ( auto pCrv : vOrigCrvs)
delete( pCrv) ;
}
// inserisco i risultati nel DB geometrico // inserisco i risultati nel DB geometrico
int nFirstId = GDB_ID_NULL ; int nFirstId = GDB_ID_NULL ;
@@ -2395,7 +2606,7 @@ ExeCurveGetVoronoi( int nId, int nDestGrpId, int nBound, int* pnCount)
ExeSetModified() ; ExeSetModified() ;
if ( IsCmdLog()) { if ( IsCmdLog()) {
string sLua = "EgtCurveGetVoronoi(" + ToString( nId) + "," + string sLua = "EgtCurveGetVoronoi(" + ToString( vIds[0]) + "," +
ToString( nDestGrpId) + ")" + ToString( nDestGrpId) + ")" +
" FirstId=" + ToString( nFirstId) + " nCurveCount=" + ToString( nCount) ; " FirstId=" + ToString( nFirstId) + " nCurveCount=" + ToString( nCount) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
@@ -2409,26 +2620,51 @@ ExeCurveGetVoronoi( int nId, int nDestGrpId, int nBound, int* pnCount)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
int int
ExeCurveGetMedialAxis( int nId, int nDestGrpId, int nSide, int* pnCount) ExeCurveGetMedialAxis( const INTVECTOR& vIds, int nDestGrpId, int nSide, int* pnCount)
{ {
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// recupero la curva
const ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nId)) ; if ( vIds.empty())
if ( pCrv == nullptr) return false ;
return GDB_ID_NULL ;
// recupero il riferimento della curva // recupero il riferimento della prima curva che sarà utilizzato da Voronoi
Frame3d frCrv ; Frame3d frCrv ;
if ( ! pGeomDB->GetGlobFrame( nId, frCrv)) if ( ! pGeomDB->GetGlobFrame( vIds[0], frCrv))
return GDB_ID_NULL ; return GDB_ID_NULL ;
// recupero il riferimento di destinazione // recupero il riferimento di destinazione
Frame3d frDest ; Frame3d frDest ;
if ( ! pGeomDB->GetGroupGlobFrame( nDestGrpId, frDest)) if ( ! pGeomDB->GetGroupGlobFrame( nDestGrpId, frDest))
return GDB_ID_NULL ; return GDB_ID_NULL ;
// Calcolo il Medial Axis // Calcolo il Medial Axis
ICURVEPOVECTOR vCrv ; ICURVEPOVECTOR vCrv ;
CalcCurveMedialAxis( *pCrv, vCrv, nSide) ; if ( int( vIds.size()) == 1) {
// recupero la curva
const ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( vIds[0])) ;
if ( pCrv == nullptr)
return GDB_ID_NULL ;
// calcolo
CalcCurveMedialAxis( *pCrv, vCrv, nSide) ;
}
else {
// recupero le curve e le porto in locale al frame della prima curva
CICURVEPVECTOR vOrigCrvs ;
for ( int i = 0 ; i < int( vIds.size()) ; i ++) {
CurveLocal CrvLoc( pGeomDB, vIds[i], frCrv) ;
if ( CrvLoc.Get() == nullptr) {
for ( auto pCrv : vOrigCrvs)
delete( pCrv) ;
return GDB_ID_NULL ;
}
vOrigCrvs.emplace_back( CrvLoc->Clone()) ;
}
// calcolo
CalcCurvesMedialAxis( vOrigCrvs, vCrv, nSide) ;
// libero la memoria
for ( auto pCrv : vOrigCrvs)
delete( pCrv) ;
}
// inserisco i risultati nel DB geometrico // inserisco i risultati nel DB geometrico
int nFirstId = GDB_ID_NULL ; int nFirstId = GDB_ID_NULL ;
@@ -2445,7 +2681,7 @@ ExeCurveGetMedialAxis( int nId, int nDestGrpId, int nSide, int* pnCount)
ExeSetModified() ; ExeSetModified() ;
if ( IsCmdLog()) { if ( IsCmdLog()) {
string sLua = "EgtCurveMedialAxisAdv(" + ToString( nId) + "," + string sLua = "EgtCurveMedialAxisAdv(" + ToString( vIds[0]) + "," +
ToString( nSide) + "," + ToString( nSide) + "," +
ToString( nDestGrpId) + ")" + ToString( nDestGrpId) + ")" +
" FirstId=" + ToString( nFirstId) + " nCurveCount=" + ToString( nCount) ; " FirstId=" + ToString( nFirstId) + " nCurveCount=" + ToString( nCount) ;
@@ -2507,3 +2743,265 @@ ExeCurveGetFatCurve( int nId, int nDestGrpId, double dRad, bool bSquareEnds, boo
*pnCount = nCount ; *pnCount = nCount ;
return nFirstId ; return nFirstId ;
} }
//----------------------------------------------------------------------------
bool
ExeCurveBezierIncreaseDegree( int nCrvId)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// recupero la curva
const ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nCrvId)) ;
if ( pCrv == nullptr)
return false ;
//// recupero il riferimento della curva
//Frame3d frCrv ;
//if ( ! pGeomDB->GetGlobFrame( nCrvId, frCrv))
// return GDB_ID_NULL ;
if( pCrv->GetType() != CRV_BEZIER)
return false ;
// aumento il grado della curva
bool bOk = true ;
PtrOwner<ICurveBezier> pCrvBezierNew ( BezierIncreaseDegree( GetCurveBezier( pCrv))) ;
Vector3d vtExtr ;
if ( bOk && pCrv->GetExtrusion( vtExtr))
pCrvBezierNew->SetExtrusion( vtExtr) ;
double dThick = 0 ;
if ( bOk && pCrv->GetThickness( dThick))
pCrvBezierNew->SetThickness(dThick) ;
// sostituisco la vecchia curva con la nuova
bOk = bOk && pGeomDB->ReplaceGeoObj( nCrvId, Release( pCrvBezierNew)) ;
ExeSetModified() ;
if ( IsCmdLog()) {
string sLua = "EgtCurveBezierIncreaseDegree(" + ToString( nCrvId) + ")"
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
//----------------------------------------------------------------------------
bool
ExeCurveBezierDecreaseDegree( int nCrvId, double dTol)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// recupero la curva
const ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nCrvId)) ;
if ( pCrv == nullptr)
return false ;
//// recupero il riferimento della curva
//Frame3d frCrv ;
//if ( ! pGeomDB->GetGlobFrame( nCrvId, frCrv))
// return GDB_ID_NULL ;
if( pCrv->GetType() != CRV_BEZIER)
return false ;
// riduco il grado della curva
bool bOk = true ;
PtrOwner<ICurveBezier> pCrvBezierNew ( BezierDecreaseDegree( GetCurveBezier( pCrv), dTol)) ;
bOk = bOk && ! IsNull( pCrvBezierNew) && pCrvBezierNew->IsValid() ;
Vector3d vtExtr ;
if ( bOk && pCrv->GetExtrusion( vtExtr))
pCrvBezierNew->SetExtrusion( vtExtr) ;
double dThick = 0 ;
if ( bOk && pCrv->GetThickness( dThick))
pCrvBezierNew->SetThickness(dThick) ;
// sostituisco la vecchia curva con la nuova
bOk = bOk && pGeomDB->ReplaceGeoObj( nCrvId, Release( pCrvBezierNew)) ;
ExeSetModified() ;
if ( IsCmdLog()) {
string sLua = "EgtCurveBezierDecreaseDegree(" + ToString( nCrvId) + ")"
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
//----------------------------------------------------------------------------
bool
ExeCurveBezierApproxToNonRat( int nCrvId, double dTol)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// recupero la curva
const ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nCrvId)) ;
if ( pCrv == nullptr)
return false ;
//// recupero il riferimento della curva
//Frame3d frCrv ;
//if ( ! pGeomDB->GetGlobFrame( nCrvId, frCrv))
// return GDB_ID_NULL ;
// controllo che il tipo sia giusto
if( pCrv->GetType() != CRV_BEZIER) {
if( pCrv->GetType() != CRV_COMPO)
return false ;
else {
const ICurveComposite* pCC = GetCurveComposite( pCrv) ;
for ( int i = 0 ; i < pCC->GetCurveCount() ; ++i) {
const ICurve* pSubCrv = pCC->GetCurve( i) ;
if( pSubCrv->GetType() != CRV_BEZIER)
return false ;
}
}
}
bool bOk = true ;
if( pCrv->GetType() == CRV_BEZIER) {
const ICurveBezier* pCrvBez = GetCurveBezier( pCrv) ;
if( ! pCrvBez->IsRational())
return true ;
// approssimo la curva con una corrispettiva non razionale
PtrOwner<ICurveBezier> pCrvBezierNew ( pCrvBez->Clone()) ;
bOk = bOk && pCrvBezierNew->MakeNonRational( dTol) ;
PtrOwner<ICurve> pCrvNew ;
if ( ! bOk) {
pCrvNew.Set( ApproxBezierWithCubics( pCrvBezierNew, dTol)) ;
bOk = bOk && ! IsNull( pCrvNew) && pCrvNew->IsValid() ;
}
else
pCrvNew.Set( Release( pCrvBezierNew)) ;
bOk = bOk && ! IsNull( pCrvNew) && pCrvNew->IsValid() ;
Vector3d vtExtr ;
if ( bOk && pCrv->GetExtrusion( vtExtr))
pCrvNew->SetExtrusion( vtExtr) ;
double dThick = 0 ;
if ( bOk && pCrv->GetThickness( dThick))
pCrvNew->SetThickness(dThick) ;
// sostituisco la vecchia curva con la nuova
bOk = bOk && pGeomDB->ReplaceGeoObj( nCrvId, Release( pCrvNew)) ;
}
else {
const ICurveComposite* pCC = GetCurveComposite( pCrv) ;
PtrOwner<ICurveComposite> pCCNew( CreateCurveComposite()) ;
for( int i = 0 ; i < pCC->GetCurveCount() ; ++i) {
const ICurveBezier* pCrvBez = GetCurveBezier( pCC->GetCurve( i)) ;
if( ! pCrvBez->IsRational()) {
continue ;
}
// approssimo la curva con una corrispettiva non razionale
PtrOwner<ICurveBezier> pCrvBezierNew ( pCrvBez->Clone()) ;
bOk = bOk && pCrvBezierNew->MakeNonRational( dTol) ;
PtrOwner<ICurve> pCrvNew ;
if ( ! bOk) {
pCrvNew.Set( ApproxBezierWithCubics( pCrvBezierNew, dTol)) ;
bOk = bOk && ! IsNull( pCrvNew) && pCrvNew->IsValid() ;
}
else
pCrvNew.Set( Release( pCrvBezierNew)) ;
bOk = bOk && ! IsNull( pCrvNew) && pCrvNew->IsValid() ;
Vector3d vtExtr ;
if ( bOk && pCrv->GetExtrusion( vtExtr))
pCrvNew->SetExtrusion( vtExtr) ;
double dThick = 0 ;
if ( bOk && pCrv->GetThickness( dThick))
pCrvNew->SetThickness(dThick) ;
if( bOk)
pCCNew->AddCurve( Release(pCrvNew)) ;
else
break ;
}
// sostituisco la vecchia curva con la nuova
bOk = bOk && pGeomDB->ReplaceGeoObj( nCrvId, Release( pCCNew)) ;
}
ExeSetModified() ;
if ( IsCmdLog()) {
string sLua = "EgtCurveBezierApproxToNonRat(" + ToString( nCrvId) + ", "
+ ToString( dTol) + ")"
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
//----------------------------------------------------------------------------
bool
ExeCurveBezierApproxWithCubicBeziers( int nCrvId, double dTol)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// recupero la curva
const ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nCrvId)) ;
if ( pCrv == nullptr)
return false ;
// controllo che il tipo sia giusto
if( pCrv->GetType() != CRV_BEZIER) {
if( pCrv->GetType() != CRV_COMPO)
return false ;
else {
const ICurveComposite* pCC = GetCurveComposite( pCrv) ;
for ( int i = 0 ; i < pCC->GetCurveCount() ; ++i) {
const ICurve* pSubCrv = pCC->GetCurve( i) ;
if( pSubCrv->GetType() != CRV_BEZIER)
return false ;
}
}
}
// converto in bezier cubiche
bool bOk = true ;
if( pCrv->GetType() == CRV_BEZIER) {
const ICurveBezier* pCrvBez = GetCurveBezier( pCrv) ;
// approssimo la curva con una serie di bezier
PtrOwner<ICurve> pCrvBezierNew ( ApproxBezierWithCubics( pCrvBez, dTol)) ;
bOk = bOk && ! IsNull( pCrvBezierNew) && pCrvBezierNew->IsValid() ;
Vector3d vtExtr ;
if ( bOk && pCrv->GetExtrusion( vtExtr))
pCrvBezierNew->SetExtrusion( vtExtr) ;
double dThick = 0 ;
if ( bOk && pCrv->GetThickness( dThick))
pCrvBezierNew->SetThickness(dThick) ;
// sostituisco la vecchia curva con la nuova
bOk = bOk && pGeomDB->ReplaceGeoObj( nCrvId, Release( pCrvBezierNew)) ;
}
else {
const ICurveComposite* pCC = GetCurveComposite( pCrv) ;
PtrOwner<ICurveComposite> pCCNew( CreateCurveComposite()) ;
for( int i = 0 ; i < pCC->GetCurveCount() ; ++i) {
const ICurveBezier* pCrvBez = GetCurveBezier( pCC->GetCurve( i)) ;
if( ! pCrvBez->IsRational()) {
continue ;
}
// approssimo la curva con una serie di bezier
PtrOwner<ICurve> pCrvBezierNew ( ApproxBezierWithCubics( pCrvBez, dTol)) ;
bOk = bOk && ! IsNull( pCrvBezierNew) && pCrvBezierNew->IsValid() ;
Vector3d vtExtr ;
if ( bOk && pCrv->GetExtrusion( vtExtr))
pCrvBezierNew->SetExtrusion( vtExtr) ;
double dThick = 0 ;
if ( bOk && pCrv->GetThickness( dThick))
pCrvBezierNew->SetThickness(dThick) ;
if( bOk)
pCCNew->AddCurve( Release(pCrvBezierNew)) ;
else
break ;
}
// sostituisco la vecchia curva con la nuova
bOk = bOk && pGeomDB->ReplaceGeoObj( nCrvId, Release( pCCNew)) ;
}
ExeSetModified() ;
if ( IsCmdLog()) {
string sLua = "EgtCurveBezierApproxWithCubicBeziers(" + ToString( nCrvId) + ", "
+ ToString( dTol) + ")"
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
+294 -40
View File
@@ -77,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 ;
@@ -102,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 ;
@@ -130,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 ;
} }
@@ -147,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 ;
@@ -209,7 +236,7 @@ ExeExplodeSurface( int nId, int* pnCount)
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
bool bool
ExeApproxSurface( int nId, double dLinTol) ExeApproxSurface( int nId, double dLinTol, double dTriaMinSide)
{ {
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false) VERIFY_GEOMDB( pGeomDB, false)
@@ -230,8 +257,7 @@ ExeApproxSurface( int nId, double dLinTol)
else if ( nType == SRF_BEZIER) { else if ( nType == SRF_BEZIER) {
// recupero la superficie ausiliaria della Bezier // recupero la superficie ausiliaria della Bezier
const ISurfBezier* pSbez = GetSurfBezier( pGeomDB->GetGeoObj( nId)) ; const ISurfBezier* pSbez = GetSurfBezier( pGeomDB->GetGeoObj( nId)) ;
const ISurfTriMesh* pAuxSurf = ( pSbez != nullptr ? pSbez->GetAuxSurf() : nullptr) ; pStm.Set( ( pSbez != nullptr ? pSbez->GetApproxSurf( dLinTol, dTriaMinSide) : nullptr)) ;
pStm.Set( pAuxSurf != nullptr ? pAuxSurf->Clone() : nullptr) ;
} }
bool bOk = ( ! IsNull( pStm)) ; bool bOk = ( ! IsNull( pStm)) ;
// semplificazione della trimesh // semplificazione della trimesh
@@ -242,7 +268,8 @@ ExeApproxSurface( int nId, double dLinTol)
// se richiesto, salvo il comando Lua equivalente // se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) { if ( IsCmdLog()) {
string sLua = "EgtApproxSurf(" + ToString( nId) + "," + string sLua = "EgtApproxSurf(" + ToString( nId) + "," +
ToString( dLinTol) + ")" + ToString( dLinTol) + "," +
ToString( dTriaMinSide) + ")" +
" -- Ok=" + ToString( bOk) ; " -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
@@ -296,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
@@ -328,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
@@ -353,8 +380,8 @@ ExeSurfFrOffset( int nId, double dDist, int nType)
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
@@ -368,6 +395,58 @@ 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)
@@ -417,11 +496,11 @@ bool
ExeSurfTmMoveVertex( int nId, int nVert, const Point3d& ptNewVert, int nRefType, bool bUpdate) ExeSurfTmMoveVertex( int nId, int nVert, const Point3d& ptNewVert, int nRefType, bool bUpdate)
{ {
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie // recupero la superficie
ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ; ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pStm != nullptr) ; bool bOk = ( pStm != nullptr) ;
// recupero il riferimento in cui immersa la superficie // recupero il riferimento in cui è immersa la superficie
Frame3d frStm ; Frame3d frStm ;
bOk = bOk && pGeomDB->GetGlobFrame( nId, frStm) ; bOk = bOk && pGeomDB->GetGlobFrame( nId, frStm) ;
// eseguo la modifica // eseguo la modifica
@@ -449,6 +528,50 @@ ExeSurfTmMoveVertex( int nId, int nVert, const Point3d& ptNewVert, int nRefType,
return bOk ; 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 static int
MySurfTmToTriangles( int nId, int& nCount) MySurfTmToTriangles( int nId, int& nCount)
@@ -461,7 +584,7 @@ MySurfTmToTriangles( int nId, int& nCount)
return GDB_ID_NULL ; return GDB_ID_NULL ;
// recupero il numero di triangoli // recupero il numero di triangoli
int nTria = pStm->GetTriangleCount() ; int nTria = pStm->GetTriangleCount() ;
// se ci sono pi triangoli, li separo // se ci sono più triangoli, li separo
if ( nTria > 1) { if ( nTria > 1) {
// copio tutti triangoli // copio tutti triangoli
int nFirstId = GDB_ID_NULL ; int nFirstId = GDB_ID_NULL ;
@@ -487,7 +610,7 @@ MySurfTmToTriangles( 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 ;
} }
@@ -622,6 +745,41 @@ ExeCutSurfTmPlane( int nId, const Point3d& ptOn, const Vector3d& vtN, bool bSave
return bOk ; return bOk ;
} }
//-------------------------------------------------------------------------------
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 ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
bool bool
ExeCutSurfTmClosedCurve( int nSurfId, int nCurveId, bool bSaveOnEq) ExeCutSurfTmClosedCurve( int nSurfId, int nCurveId, bool bSaveOnEq)
@@ -758,27 +916,6 @@ ExeSurfTmIntersect( int nId1, int nId2, bool bTwoColors)
return bOk ; return bOk ;
} }
//----------------------------------------------------------------------------
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 ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static ISurfTriMesh* static ISurfTriMesh*
MyCreateSubSurfTm( const ISurfTriMesh* pStm, const INTVECTOR& vTria, const INTVECTOR& vTria2) MyCreateSubSurfTm( const ISurfTriMesh* pStm, const INTVECTOR& vTria, const INTVECTOR& vTria2)
@@ -990,6 +1127,102 @@ ExeSurfTmSubtractProjectedFacesOnFace( int nSurfId, int nFaceInd, int nDestGrpId
return bOk ; 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
bShow = ( bOk && pStm->GetShowEdges()) ;
return bOk ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static bool static bool
@@ -1027,10 +1260,31 @@ ExeSurfBzTrim( int nId, int nCutterId)
ExeSetModified() ; ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente // se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) { if ( IsCmdLog()) {
string sLua = "EgtSurfTmCut(" + ToString( nId) + "," + string sLua = "EgtSurfBzCut(" + ToString( nId) + "," +
ToString( nCutterId) + "," + ToString( nCutterId) + "," +
" -- Ok=" + ToString( bOk) ; " -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
} }
return bOk ; 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 ;
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 ;
}
+53 -3
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,29 @@ 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 bool
ExeRemoveVolZmapPart( int nId, int nPart) ExeRemoveVolZmapPart( int nId, int nPart)
@@ -315,6 +337,34 @@ ExeVolZmapSetChiselTool( const INTVECTOR& vIds, const string& sToolName,
return bOk ; return bOk ;
} }
//----------------------------------------------------------------------------
bool
ExeVolZmapSetAdditiveTool( const INTVECTOR& vIds, const string& sToolName,
double dLen, double dDiam, double dCornR, int nFlag, bool bFirst)
{
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 = ( 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 bool
ExeVolZmapResetTools( const INTVECTOR& vIds) ExeVolZmapResetTools( const INTVECTOR& vIds)
+12 -2
View File
@@ -232,12 +232,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 ;
} }
@@ -826,3 +826,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) ;
}
+37
View File
@@ -219,6 +219,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)
+50 -6
View File
@@ -35,6 +35,7 @@
#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>
@@ -52,6 +53,7 @@ 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_sLockId ;
@@ -116,9 +118,8 @@ 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())
// carico libreria exchange 3dm opzionale // la libreria exchange 3dm opzionale viene caricata solo al momento del bisogno
if ( LoadExch3dmDll( s_pGenLog, s_sKey, s_bNetHwKey)) // (è molto lento il caricamento di OpenNurbs)
LOG_INFO( s_pGenLog, MyGetEE3Version())
// 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))
@@ -344,6 +345,41 @@ ExeSetNetHwKey( bool bNetHwKey, int nUserId, const string& sAddrPort)
return SetNetHwKey( s_bNetHwKey, nUserId, sAddrPort) ; 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)
@@ -519,7 +555,7 @@ 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) ; 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) + ")" ;
@@ -527,7 +563,6 @@ ExeGetKeyLevel( int nProd, int nVer, int nLev, int& nKLev)
nKLev = - nRet ; nKLev = - nRet ;
return false ; return false ;
} }
return true ; return true ;
} }
@@ -551,7 +586,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 ;
} }
@@ -565,6 +599,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)
+825 -654
View File
File diff suppressed because it is too large Load Diff
+252 -24
View File
@@ -21,9 +21,11 @@
#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/EgtPointerOwner.h" #include "/EgtDev/Include/EgtPointerOwner.h"
@@ -284,6 +286,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)
@@ -975,7 +997,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) ;
} }
@@ -999,6 +1021,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)
@@ -1010,10 +1090,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()) ;
} }
@@ -1116,13 +1196,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()) ;
} }
@@ -1136,7 +1236,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
@@ -1150,6 +1250,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
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -1452,6 +1572,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)
@@ -2331,6 +2466,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
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -2614,12 +2759,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) ;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -2672,6 +2827,16 @@ ExeGetMachiningGeometry( SELVECTOR& vIds)
return pMachMgr->GetMachiningGeometry( vIds) ; return pMachMgr->GetMachiningGeometry( vIds) ;
} }
//-----------------------------------------------------------------------------
bool
ExeGetMachiningSkippedGeometry( SELVECTOR& vIds)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// recupero la geometria non lavorata della lavorazione corrente
return pMachMgr->GetMachiningSkippedGeometry( vIds) ;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool bool
ExeIsMachiningEmpty( void) ExeIsMachiningEmpty( void)
@@ -2894,6 +3059,26 @@ ExeGetClEntIndex( int nEntId, int& nIndex)
return pMachMgr->GetClEntIndex( nEntId, nIndex) ; return pMachMgr->GetClEntIndex( nEntId, nIndex) ;
} }
//-----------------------------------------------------------------------------
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 bool
ExeGetClEntAxesVal( int nEntId, DBLVECTOR& vAxes) ExeGetClEntAxesVal( int nEntId, DBLVECTOR& vAxes)
@@ -3094,7 +3279,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
@@ -3156,7 +3343,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) ;
} }
@@ -3182,16 +3370,6 @@ ExeSetCalcTool( const string& sTool, const string& sHead, int nExit)
return pMachMgr->SetCalcTool( sTool, sHead, nExit) ; return pMachMgr->SetCalcTool( sTool, sHead, nExit) ;
} }
//-----------------------------------------------------------------------------
bool
ExeGetAllCurrAxesName( STRVECTOR& vAxName)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// recupero gli assi correnti derivanti dalla scelta di tavola e utensile
return pMachMgr->GetAllCurrAxesName( vAxName) ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
ExeSetRotAxisBlock( const string& sAxis, double dVal) ExeSetRotAxisBlock( const string& sAxis, double dVal)
@@ -3202,6 +3380,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)
@@ -3212,6 +3400,16 @@ 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
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)
@@ -3381,6 +3579,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)
@@ -3411,6 +3619,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)
@@ -3441,6 +3659,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)
+77 -9
View File
@@ -1613,6 +1613,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 +1727,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 +1741,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 +1769,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 +1777,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 +1832,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 +1865,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) {
+4 -4
View File
@@ -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
+58 -2
View File
@@ -109,12 +109,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)) ;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -228,6 +228,7 @@ ExeDraw( void)
// se interfaccia disabilitata, esco subito // se interfaccia disabilitata, esco subito
if ( ! ExeGetEnableUI()) if ( ! ExeGetEnableUI())
return true ; return true ;
GseContext* pGseCtx = GetCurrGseContext() ; GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, false) VERIFY_CTX_SCENE( pGseCtx, false)
// eseguo disegno // eseguo disegno
@@ -493,6 +494,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)
@@ -640,10 +645,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
@@ -709,6 +727,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)
@@ -865,3 +896,28 @@ 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) ;
} }
//-----------------------------------------------------------------------------
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 ;
}
+316
View File
@@ -0,0 +1,316 @@
//----------------------------------------------------------------------------
// 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'a collisione'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)
{
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'a collisione'interferenza
return ( TestSurfTmSurfTm( *pStm1, *pStm2, dSafeDist) ? 1 : 0) ;
}
//----------------------------------------------------------------------------
int
ExeTestSurfaceSurface( int nSurf1Id, int nSurf2Id, double dSafeDist)
{
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) ;
// è 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) + ")" +
" -- Res=" + ToString( nRes) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultato
return nRes ;
}
BIN
View File
Binary file not shown.
+5 -3
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.20348.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>
@@ -293,6 +293,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClCompile Include="EXE_Picture.cpp" /> <ClCompile Include="EXE_Picture.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_TscExec.cpp" /> <ClCompile Include="EXE_TscExec.cpp" />
<ClCompile Include="AuxTools.cpp" /> <ClCompile Include="AuxTools.cpp" />
<ClCompile Include="DllExchange.cpp" /> <ClCompile Include="DllExchange.cpp" />
@@ -316,6 +317,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<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_TestObjSurface.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" />
+6
View File
@@ -401,6 +401,12 @@
<ClCompile Include="LUA_GdbGetPocketing.cpp"> <ClCompile Include="LUA_GdbGetPocketing.cpp">
<Filter>File di origine\LUA</Filter> <Filter>File di origine\LUA</Filter>
</ClCompile> </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>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ResourceCompile Include="EgtExecutor.rc"> <ResourceCompile Include="EgtExecutor.rc">
+5 -2
View File
@@ -1,7 +1,7 @@
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// EgalTech 2014-2015 // EgalTech 2014-2024
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// File : LUA.h Data : 16.01.15 Versione : 1.6a3 // File : LUA.h Data : 24.03.24 Versione : 2.6c2
// Contenuto : Dichiarazioni locali per moduli LUA. // Contenuto : Dichiarazioni locali per moduli LUA.
// //
// //
@@ -93,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) ;
+4
View File
@@ -130,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 ;
+45 -5
View File
@@ -156,14 +156,50 @@ LuaImportStl( lua_State* L)
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
static int static int
LuaImport3MF( lua_State* L) LuaImportOff( lua_State* L)
{ {
// 1 parametro : path del file da importare // 1 o 2 parametri : path del file da importare [, Fattore di scala]
string sFilePath ; string sFilePath ;
LuaCheckParam( L, 1, sFilePath) LuaCheckParam( L, 1, sFilePath)
double dScaleFactor = 1.0 ;
LuaGetParam( L, 2, dScaleFactor) ;
LuaClearStack( L) ; LuaClearStack( L) ;
// apro il file // apro il file
bool bOk = ExeImport3MF( sFilePath) ; 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
LuaImport3MF( lua_State* L)
{
// 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 // restituisco il risultato
LuaSetParam( L, bOk) ; LuaSetParam( L, bOk) ;
return 1 ; return 1 ;
@@ -188,14 +224,16 @@ LuaImport3dm( 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 ;
@@ -330,6 +368,8 @@ 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( "EgtImport3dm", LuaImport3dm) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAdvancedImport", LuaAdvancedImport) ; bOk = bOk && luaMgr.RegisterFunction( "EgtAdvancedImport", LuaAdvancedImport) ;
+39 -37
View File
@@ -400,13 +400,13 @@ LuaCreateDiametralDimension( lua_State* L )
static int static int
LuaCreateAngularDimension(lua_State* L) LuaCreateAngularDimension(lua_State* L)
{ {
// 6 o 7 parametri : ParentId, ptP1, ptP0, ptP2, ptDim, Text [, nRefType] // 6 o 7 parametri : ParentId, ptV, ptP1, ptP2, ptDim, Text [, nRefType]
int nParentId ; int nParentId ;
LuaCheckParam( L, 1, nParentId) LuaCheckParam( L, 1, nParentId)
Point3d ptV ;
LuaCheckParam( L, 2, ptV) ;
Point3d ptP1 ; Point3d ptP1 ;
LuaCheckParam( L, 2, ptP1) ; LuaCheckParam( L, 3, ptP1) ;
Point3d ptP0 ;
LuaCheckParam( L, 3, ptP0) ;
Point3d ptP2 ; Point3d ptP2 ;
LuaCheckParam( L, 4, ptP2) ; LuaCheckParam( L, 4, ptP2) ;
Point3d ptDim ; Point3d ptDim ;
@@ -417,7 +417,39 @@ LuaCreateAngularDimension(lua_State* L)
LuaGetParam( L, 7, nRefType) ; LuaGetParam( L, 7, nRefType) ;
LuaClearStack( L) ; LuaClearStack( L) ;
// creo la quota angolare // creo la quota angolare
int nId = ExeCreateAngularDimension( nParentId, ptP1, ptP0, ptP2, ptDim, sText, nRefType) ; 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 // restituisco il risultato
if ( nId != GDB_ID_NULL) if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ; LuaSetParam( L, nId) ;
@@ -478,36 +510,6 @@ LuaCreateAngularDimensionFromArc( lua_State* L)
return 1 ; return 1 ;
} }
//-------------------------------------------------------------------------------
static int
LuaCreateAngularDimensionFromCircle( lua_State* L)
{
// 6 o 7 parametri : nParentId, nCrvId, ptP1, ptP2, ptDim, Text [, nRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
int nCrvId ;
LuaCheckParam( L, 2, nCrvId) ;
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 allineata
int nId = ExeCreateAngularDimensionFromCircle( nParentId, nCrvId, ptP1, ptP2, 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)
@@ -527,9 +529,9 @@ LuaInstallGdbCreate( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtAlignedDimension", LuaCreateAlignedDimension) ; bOk = bOk && luaMgr.RegisterFunction( "EgtAlignedDimension", LuaCreateAlignedDimension) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRadialDimension", LuaCreateRadialDimension) ; bOk = bOk && luaMgr.RegisterFunction( "EgtRadialDimension", LuaCreateRadialDimension) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtDiametralDimension", LuaCreateDiametralDimension) ; bOk = bOk && luaMgr.RegisterFunction( "EgtDiametralDimension", LuaCreateDiametralDimension) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAngularDimension", LuaCreateAngularDimension); bOk = bOk && luaMgr.RegisterFunction( "EgtAngularDimension", LuaCreateAngularDimension) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAngularDimensionEx", LuaCreateAngularDimensionEx) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAngularDimensionFromLines", LuaCreateAngularDimensionFromLines) ; bOk = bOk && luaMgr.RegisterFunction( "EgtAngularDimensionFromLines", LuaCreateAngularDimensionFromLines) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAngularDimensionFromArc", LuaCreateAngularDimensionFromArc) ; bOk = bOk && luaMgr.RegisterFunction( "EgtAngularDimensionFromArc", LuaCreateAngularDimensionFromArc) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAngularDimensionFromCircle", LuaCreateAngularDimensionFromCircle) ;
return bOk ; return bOk ;
} }
+51
View File
@@ -425,6 +425,34 @@ 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 static int
LuaCreateArc2PB( lua_State* L) LuaCreateArc2PB( lua_State* L)
@@ -1063,6 +1091,27 @@ LuaCreateCirclesAlongCurve( lua_State* L)
return 2 ; return 2 ;
} }
//-------------------------------------------------------------------------------
static int
LuaCreateCurveBezierForm( lua_State* L)
{
// 2 o 3 parametri : ParentId, nCrvId [, nDeg]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
int nCrvId ;
LuaCheckParam( L, 2, nCrvId)
int nDeg = 3 ;
LuaGetParam( L, 3, nDeg) ;
// creo la versione bezier della curva
int nId = ExeCreateCurveBezierForm( nParentId, nCrvId, nDeg) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
bool bool
LuaInstallGdbCreateCurve( LuaMgr& luaMgr) LuaInstallGdbCreateCurve( LuaMgr& luaMgr)
@@ -1083,6 +1132,7 @@ 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( "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) ;
@@ -1106,5 +1156,6 @@ LuaInstallGdbCreateCurve( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtPolygonFromApothem", LuaCreatePolygonFromApothem) ; bOk = bOk && luaMgr.RegisterFunction( "EgtPolygonFromApothem", LuaCreatePolygonFromApothem) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtPolygonFromSide", LuaCreatePolygonFromSide) ; bOk = bOk && luaMgr.RegisterFunction( "EgtPolygonFromSide", LuaCreatePolygonFromSide) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCirclesAlongCurve", LuaCreateCirclesAlongCurve) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCirclesAlongCurve", LuaCreateCirclesAlongCurve) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveBezierForm", LuaCreateCurveBezierForm) ;
return bOk ; return bOk ;
} }
+434 -27
View File
@@ -171,6 +171,24 @@ LuaCreateSurfFrFatCurve( lua_State* L)
return 1 ; 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
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
static int static int
LuaCreateSurfTmPlaneInBBox( lua_State* L) LuaCreateSurfTmPlaneInBBox( lua_State* L)
@@ -509,11 +527,9 @@ LuaCreateSurfTmByExtrusion( lua_State* L)
Vector3d vtExtr ; Vector3d vtExtr ;
LuaCheckParam( L, 3, vtExtr) LuaCheckParam( L, 3, vtExtr)
double dLinTol = LIN_TOL_SRF ; 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,
@@ -659,6 +675,41 @@ LuaCreateSurfTmRectSwept( lua_State* L)
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
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 ;
@@ -672,8 +723,8 @@ LuaCreateSurfTmSwept( lua_State* L)
double dLinTol = LIN_TOL_SRF ; double dLinTol = LIN_TOL_SRF ;
LuaGetParam( L, 5, dLinTol) ; LuaGetParam( 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) ;
@@ -761,26 +812,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)
@@ -903,6 +934,369 @@ LuaCreateSurfBezierLeaves( lua_State* L)
return 2 ; 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 STM estrudendo uno o più percorsi, se piani si possono mettere i tappi
int nId = ExeCreateSurfBzByExtrusion( nParentId, nCrvId, vtExtr, bCapEnds, dLinTol, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
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 STM riempiendo un contorno piano
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
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)
@@ -914,6 +1308,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) ;
@@ -932,13 +1327,25 @@ LuaInstallGdbCreateSurf( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByScrewing", LuaCreateSurfTmByScrewing) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByScrewing", LuaCreateSurfTmByScrewing) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmRectSwept", LuaCreateSurfTmRectSwept) ; 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( "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( "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( "EgtSurfBzSkinned", LuaCreateSurfBzSkinned) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBzSwept", LuaCreateSurfBzSwept) ;
return bOk ; return bOk ;
} }
+70
View File
@@ -54,6 +54,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)
@@ -104,13 +140,47 @@ LuaCreateVolZmapFromSurfTm( lua_State* L)
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
LuaUniformVolZmap( lua_State* L)
{
// 1 o 2 parametri : nVolZmapId [, dToler]
int nVolZmapId ;
LuaCheckParam( L, 1, nVolZmapId) ;
double dToler = EPS_SMALL ;
LuaGetParam( L, 2, dToler) ;
LuaClearStack( L) ;
bool bOk = ExeUniformVolZmap( nVolZmapId, dToler) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
bool bool
LuaInstallGdbCreateVol( LuaMgr& luaMgr) 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) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtUpdateVolZmapByAddingSurfTm", LuaUpdateVolZmapByAddingSurfTm ) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtUniformZmap", LuaUniformVolZmap) ;
return bOk ; return bOk ;
} }
+148 -4
View File
@@ -18,7 +18,6 @@
#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"
#include "/EgtDev/Include/EGkVoronoi.h"
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static int static int
@@ -58,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)
@@ -143,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 ;
@@ -167,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 ;
@@ -189,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 ;
@@ -243,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)
@@ -532,6 +567,108 @@ LuaCurveCompoNormVersor( lua_State* L)
return 1 ; return 1 ;
} }
//----------------------------------------------------------------------------
static int
LuaCurveCompoGetTempProp( lua_State* L)
{
// 1 parametro : Id
int nId ;
LuaCheckParam( L, 1, nId)
LuaClearStack( L) ;
// recupero l'angolo al centro della curva semplice indicizzata
INTVECTOR vProp ;
if ( ExeCurveCompoGetTempProp( nId, vProp, 0))
LuaSetParam( L, vProp) ;
else
LuaSetParam( L) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaCurveCompoGetTempParam( lua_State* L)
{
// 1 parametro : Id
int nId ;
LuaCheckParam( L, 1, nId)
LuaClearStack( L) ;
// recupero l'angolo al centro della curva semplice indicizzata
DBLVECTOR vParam ;
if ( ExeCurveCompoGetTempParam( nId, vParam, 0))
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)
@@ -539,6 +676,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) ;
@@ -548,6 +686,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) ;
@@ -563,5 +702,10 @@ LuaInstallGdbGetCurve( LuaMgr& luaMgr)
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 ;
} }
+1 -1
View File
@@ -21,7 +21,7 @@ using namespace std ;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static int static int
LuaPocketing( lua_State* L) { LuaPocketing( lua_State* L) {
// 7 parametri : vId, dRad, dStep, dAngle, nType, bSmooth, nDestGrpId // 7 parametri : nId, dRad, dStep, dAngle, nType, bSmooth, nDestGrpId
int nId ; int nId ;
LuaCheckParam( L, 1, nId) ; LuaCheckParam( L, 1, nId) ;
double dRad ; double dRad ;
+137
View File
@@ -121,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)
@@ -331,6 +350,27 @@ LuaSurfTmGetNearestVertex( lua_State* L)
return 2 ; 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)
@@ -443,6 +483,42 @@ 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 ;
VCT3DVECTOR vvtNorm ;
DBLVECTOR vdElev ;
DBLVECTOR vdLen ;
bool bOk = ExeSurfTmGetFacetOutlineInfo( nId, nFacet, nRefId, nStatus, vbOpen, vnAdj, vdLen, vvtNorm, vdElev) ;
// restituisco il risultato
if ( bOk) {
LuaSetParam( L, nStatus) ;
LuaSetParam( L, vbOpen) ;
LuaSetParam( L, vnAdj) ;
LuaSetParam( L, vdLen) ;
LuaSetParam( L, vvtNorm) ;
LuaSetParam( L, vdElev) ;
return 6 ;
}
else {
LuaSetParam( L) ;
return 1 ;
}
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static int static int
LuaSurfTmFacetAdjacencies( lua_State* L) LuaSurfTmFacetAdjacencies( lua_State* L)
@@ -772,6 +848,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)
@@ -1080,6 +1188,30 @@ 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)
@@ -1091,6 +1223,7 @@ LuaInstallGdbGetSurf( LuaMgr& luaMgr)
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) ;
@@ -1101,11 +1234,13 @@ LuaInstallGdbGetSurf( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmPartCount", LuaSurfTmPartCount) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmPartCount", LuaSurfTmPartCount) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetVertex", LuaSurfTmGetVertex) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetVertex", LuaSurfTmGetVertex) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetNearestVertex", LuaSurfTmGetNearestVertex) ; 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( "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) ;
@@ -1118,6 +1253,7 @@ LuaInstallGdbGetSurf( LuaMgr& luaMgr)
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( "EgtCopySurfTmFacet", LuaCopySurfTmFacet) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCopySurfTmFacet", LuaCopySurfTmFacet) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetEdges", LuaSurfTmGetEdges) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetEdges", LuaSurfTmGetEdges) ;
@@ -1130,5 +1266,6 @@ LuaInstallGdbGetSurf( LuaMgr& luaMgr)
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 ;
} }
+159 -20
View File
@@ -105,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 ;
} }
@@ -911,6 +913,42 @@ LuaRemoveCurveCompoUndercutOnY( lua_State* L)
return 1 ; return 1 ;
} }
//-------------------------------------------------------------------------------
static int
LuaCurveCompoSetTempProp( lua_State* L)
{
// 3 parametri : Id, nCrv, nProp
int nId ;
LuaCheckParam( L, 1, nId)
int nCrv ;
LuaCheckParam( L, 2, nCrv)
int nProp ;
LuaCheckParam( L, 3, nProp)
LuaClearStack( L) ;
// imposto sulla curva della composita la proprietà temporanea
bool bOk = ExeCurveCompoSetTempProp( nId, nCrv, nProp) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCurveCompoSetTempParam( lua_State* L)
{
// 3 parametri : Id, nCrv, dParam
int nId ;
LuaCheckParam( L, 1, nId)
int nCrv ;
LuaCheckParam( L, 2, nCrv)
double dParam ;
LuaCheckParam( L, 3, dParam)
LuaClearStack( L) ;
// imposto sulla curva della composita il parametro temporaneo
bool bOk = ExeCurveCompoSetTempParam( nId, nCrv, dParam) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static int static int
LuaChainCurvesInGroup( lua_State* L) LuaChainCurvesInGroup( lua_State* L)
@@ -949,9 +987,9 @@ LuaReorderCurvesInGroup( lua_State* L)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static int static int
LuaProjectCurveOnSurfTm( lua_State* L) LuaProjectCurveOnSurf( lua_State* L)
{ {
// 4, 5 o 6 parametri : nCurveId, nSurfTmId, vtDir, nDestGrpId [, dLinTol [, nRefType]] // 4, 5, 6, 7 o 8 parametri : nCurveId, nSurfTmId, vtDir, nDestGrpId [, dLinTol [, dMaxSegmLen] [, bDirFromProj] [, nRefType]]
int nCurveId ; int nCurveId ;
LuaCheckParam( L, 1, nCurveId) LuaCheckParam( L, 1, nCurveId)
int nSurfTmId ; int nSurfTmId ;
@@ -961,12 +999,42 @@ LuaProjectCurveOnSurfTm( lua_State* L)
int nDestGrpId ; int nDestGrpId ;
LuaCheckParam( L, 4, nDestGrpId) LuaCheckParam( L, 4, nDestGrpId)
double dLinTol = 0.01 ; double dLinTol = 0.01 ;
double dMaxSegmLen = INFINITO ;
bool bDirFromProj = false ;
int nRefType = RTY_DEFAULT ; int nRefType = RTY_DEFAULT ;
if ( LuaGetParam( L, 5, dLinTol)) if ( LuaGetParam( L, 5, dLinTol) &&
LuaGetParam( L, 6, nRefType) ; LuaGetParam( L, 6, dMaxSegmLen) &&
LuaGetParam( L, 7, bDirFromProj))
LuaGetParam( L, 8, nRefType) ;
LuaClearStack( L) ; LuaClearStack( L) ;
// proietto la curva su una trimesh secondo la direzione data // proietto la curva su una superficie secondo la direzione data
bool bOk = ExeProjectCurveOnSurfTm( nCurveId, nSurfTmId, vtDir, nDestGrpId, dLinTol, nRefType) ; bool bOk = ExeProjectCurveOnSurf( nCurveId, nSurfTmId, vtDir, nDestGrpId, dLinTol, dMaxSegmLen, bDirFromProj, nRefType) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaProjectCurveOnSurfExt( lua_State* L)
{
// 4, 5, 6 o 7 parametri : nCurveId, nSurfTmId, nGuideId, nDestGrpId [, dLinTol [, dMaxSegmLen] [, bDirFromGuide]]
int nCurveId ;
LuaCheckParam( L, 1, nCurveId)
int nSurfTmId ;
LuaCheckParam( L, 2, nSurfTmId)
int nGuideId ;
LuaCheckParam( L, 3, nGuideId)
int nDestGrpId ;
LuaCheckParam( L, 4, nDestGrpId)
double dLinTol = 0.01 ;
double dMaxSegmLen = INFINITO ;
bool bDirFromGuide = false ;
if ( LuaGetParam( L, 5, dLinTol) &&
LuaGetParam( L, 6, dMaxSegmLen))
LuaGetParam( L, 7, bDirFromGuide) ;
LuaClearStack( L) ;
// proietto la curva su una superficie secondo la direzione verso la guida
bool bOk = ExeProjectCurveOnSurfExt( nCurveId, nSurfTmId, nGuideId, nDestGrpId, dLinTol, dMaxSegmLen, bDirFromGuide) ;
LuaSetParam( L, bOk) ; LuaSetParam( L, bOk) ;
return 1 ; return 1 ;
} }
@@ -975,17 +1043,17 @@ LuaProjectCurveOnSurfTm( lua_State* L)
static int static int
LuaCurveGetVoronoi( lua_State* L) LuaCurveGetVoronoi( lua_State* L)
{ {
// 2 o 3 parametri : Id, nDestGrpId [, nBound] // 2 o 3 parametri : Id/s, nDestGrpId [, nBound]
int nId ; INTVECTOR vIds ;
LuaCheckParam( L, 1, nId) LuaCheckParam( L, 1, vIds)
int nDestGrpId ; int nDestGrpId ;
LuaCheckParam( L, 2, nDestGrpId) LuaCheckParam( L, 2, nDestGrpId)
int nBound = VORONOI_STD_BOUND ; int nBound = 3 ; // VORONOI_STD_BOUND
LuaGetParam( L, 3, nBound) ; LuaGetParam( L, 3, nBound) ;
LuaClearStack( L) ; LuaClearStack( L) ;
// eseguo // eseguo
int nCount = 0 ; int nCount = 0 ;
int nNewId = ExeCurveGetVoronoi( nId, nDestGrpId, nBound, &nCount) ; int nNewId = ExeCurveGetVoronoi( vIds, nDestGrpId, nBound, &nCount) ;
if ( nNewId != GDB_ID_NULL) if ( nNewId != GDB_ID_NULL)
LuaSetParam( L, nNewId) ; LuaSetParam( L, nNewId) ;
else else
@@ -999,17 +1067,17 @@ LuaCurveGetVoronoi( lua_State* L)
static int static int
LuaCurveMedialAxisAdv( lua_State* L) LuaCurveMedialAxisAdv( lua_State* L)
{ {
// 2 o 3 parametri : Id, nDestGrpId [, nSide] // 2 o 3 parametri : Id/s, nDestGrpId [, nSide]
int nId ; INTVECTOR vIds ;
LuaCheckParam( L, 1, nId) LuaCheckParam( L, 1, vIds)
int nDestGrpId ; int nDestGrpId ;
LuaCheckParam( L, 2, nDestGrpId) LuaCheckParam( L, 2, nDestGrpId)
int nSide = Voronoi::WMAT_LEFT ; int nSide = 1 ; // WMAT_LEFT
LuaGetParam( L, 3, nSide) ; LuaGetParam( L, 3, nSide) ;
LuaClearStack( L) ; LuaClearStack( L) ;
// eseguo // eseguo
int nCount = 0 ; int nCount = 0 ;
int nNewId = ExeCurveGetMedialAxis( nId, nDestGrpId, nSide, &nCount) ; int nNewId = ExeCurveGetMedialAxis( vIds, nDestGrpId, nSide, &nCount) ;
if ( nNewId != GDB_ID_NULL) if ( nNewId != GDB_ID_NULL)
LuaSetParam( L, nNewId) ; LuaSetParam( L, nNewId) ;
else else
@@ -1047,6 +1115,70 @@ LuaCurveGetFatCurve( lua_State* L)
return 2 ; 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)
@@ -1100,11 +1232,18 @@ 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( "EgtProjectCurveOnSurfTm", LuaProjectCurveOnSurfTm) ; bOk = bOk && luaMgr.RegisterFunction( "EgtProjectCurveOnSurf", LuaProjectCurveOnSurf) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtProjectCurveOnSurfExt", LuaProjectCurveOnSurfExt) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveGetVoronoi", LuaCurveGetVoronoi) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCurveGetVoronoi", LuaCurveGetVoronoi) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveMedialAxisAdv", LuaCurveMedialAxisAdv) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCurveMedialAxisAdv", LuaCurveMedialAxisAdv) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveGetFatCurve", LuaCurveGetFatCurve) ; 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 ;
} }
+207 -22
View File
@@ -23,7 +23,6 @@
using namespace std ; using namespace std ;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static int static int
LuaInvertSurf( lua_State* L) LuaInvertSurf( lua_State* L)
@@ -62,14 +61,16 @@ LuaExplodeSurf( lua_State* L)
static int static int
LuaApproxSurf( lua_State* L) LuaApproxSurf( lua_State* L)
{ {
// 1 o 2 parametri : Id [, dLinTol] // 1 o 2 parametri : Id [, dLinTol [, dTriaMinSide]]
int nId ; int nId ;
LuaCheckParam( L, 1, nId) LuaCheckParam( L, 1, nId)
double dLinTol = LIN_TOL_SRF ; double dLinTol = LIN_TOL_SRF ;
LuaGetParam( L, 2, dLinTol) ; double dTriaMinSide = 100 * EPS_SMALL ;
if ( LuaGetParam( L, 2, dLinTol))
LuaGetParam( L, 3, dTriaMinSide) ;
LuaClearStack( L) ; LuaClearStack( L) ;
// approssimazione della superficie // approssimazione della superficie
bool bOk = ExeApproxSurface( nId, dLinTol) ; bool bOk = ExeApproxSurface( nId, dLinTol, dTriaMinSide) ;
// restituisco il risultato // restituisco il risultato
LuaSetParam( L, bOk) ; LuaSetParam( L, bOk) ;
return 1 ; return 1 ;
@@ -141,6 +142,46 @@ 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 static int
LuaSurfTmMoveVertex( lua_State* L) LuaSurfTmMoveVertex( lua_State* L)
@@ -165,6 +206,30 @@ LuaSurfTmMoveVertex( lua_State* L)
return 1 ; 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 static int
LuaSurfTmToTriangles( lua_State* L) LuaSurfTmToTriangles( lua_State* L)
@@ -260,6 +325,29 @@ LuaCutSurfTmPlane( lua_State* L)
return 1 ; 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 static int
LuaCutSurfTmClosedCurve( lua_State* L) LuaCutSurfTmClosedCurve( lua_State* L)
@@ -333,20 +421,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)
@@ -422,23 +496,125 @@ LuaSurfTmSubtractProjectedFacesOnFace( lua_State* L)
return 4 ; 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 static int
LuaSurfBzTrim( lua_State* L) LuaSurfBzTrim( lua_State* L)
{ {
// 2 parametri : nId, nCutterId // 2 parametri : nId, nCutterId
int nId ; int nId ;
LuaCheckParam( L, 1, nId) LuaCheckParam( L, 1, nId)
int nCutterId ; int nCutterId ;
LuaCheckParam( L, 2, nCutterId) LuaCheckParam( L, 2, nCutterId)
LuaClearStack( L) ; LuaClearStack( L) ;
// taglio la prima superficie in base alla seconda // taglio la prima superficie in base alla seconda
//bool bOk = ExeSurfTmCut( nId, nCutterId, bInVsOut, bOn) ;
bool bOk = ExeSurfBzTrim( nId, nCutterId) ; bool bOk = ExeSurfBzTrim( nId, nCutterId) ;
LuaSetParam( L, bOk) ; LuaSetParam( L, bOk) ;
return 1 ; return 1 ;
} }
//-------------------------------------------------------------------------------
static int
LuaSurfTmSetSmoothAng( lua_State* L)
{
// 2 parametri : nId, nCutterId
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 ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
bool bool
LuaInstallGdbModifySurf( LuaMgr& luaMgr) LuaInstallGdbModifySurf( LuaMgr& luaMgr)
@@ -451,20 +627,29 @@ LuaInstallGdbModifySurf( LuaMgr& luaMgr)
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( "EgtSurfTmMoveVertex", LuaSurfTmMoveVertex) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmMoveFacet", LuaSurfTmMoveFacet) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmToTriangles", LuaSurfTmToTriangles) ; 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) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCutSurfTmPlane", LuaCutSurfTmPlane) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCutSurfTmPlane", LuaCutSurfTmPlane) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCutSurfBzPlane", LuaCutSurfBzPlane) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCutSurfTmClosedCurve", LuaCutSurfTmClosedCurve) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCutSurfTmClosedCurve", LuaCutSurfTmClosedCurve) ;
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( "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( "EgtSurfBzTrim", LuaSurfBzTrim) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBzTrim", LuaSurfBzTrim) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSetSmoothAng", LuaSurfTmSetSmoothAng) ;
return bOk ; return bOk ;
} }
+48 -4
View File
@@ -56,6 +56,23 @@ 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 static int
LuaRemoveVolZmapPart( lua_State* L) LuaRemoveVolZmapPart( lua_State* L)
@@ -135,7 +152,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 ;
@@ -164,7 +181,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 ;
@@ -185,7 +202,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 ;
@@ -212,7 +229,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 ;
@@ -233,6 +250,31 @@ LuaVolZmapSetChiselTool( lua_State* L)
return 1 ; 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
LuaSetParam( L, bOk) ;
return 1 ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static int static int
LuaVolZmapResetTool( lua_State* L) LuaVolZmapResetTool( lua_State* L)
@@ -350,6 +392,7 @@ 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( "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,6 +400,7 @@ 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) ;
+24 -2
View File
@@ -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 ;
@@ -782,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)
@@ -824,5 +845,6 @@ LuaInstallGdbObjAttribs( LuaMgr& luaMgr)
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 ;
} }
+44 -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)
@@ -632,11 +649,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) ;
+97
View File
@@ -31,6 +31,7 @@
#include "/EgtDev/Include/EgtNumUtils.h" #include "/EgtDev/Include/EgtNumUtils.h"
#include "/EgtDev/Include/EgtStringConverter.h" #include "/EgtDev/Include/EgtStringConverter.h"
#include "Windowsx.h" #include "Windowsx.h"
#include "shlobj.h"
using namespace std ; using namespace std ;
@@ -106,6 +107,24 @@ LuaPause( lua_State* L)
return 1 ; return 1 ;
} }
//-------------------------------------------------------------------------------
static int
LuaGetKeyPressed( lua_State* L)
{
// 1 parametro : nKeyCode
int nKeyCode ;
LuaCheckParam( L, 1, nKeyCode)
LuaClearStack( L) ;
// se abilitata UI, controllo se il tasto indicato è premuto
bool bPressed = false ;
if ( ExeGetEnableUI()) {
bPressed = (( GetAsyncKeyState( nKeyCode) & 0x8000) != 0) ;
}
// restituisco il risultato
LuaSetParam( L, bPressed) ;
return 1 ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
static int static int
LuaStartCounter( lua_State* L) LuaStartCounter( lua_State* L)
@@ -756,6 +775,67 @@ LuaCompareFilesLastWriteTime( lua_State* L)
return 1 ; return 1 ;
} }
//-------------------------------------------------------------------------------
int
CALLBACK DirectoryBoxProc( HWND hwndDlg, UINT uMsg, LPARAM lParam, LPARAM lpData)
{
if ( uMsg == BFFM_INITIALIZED)
SendMessage( hwndDlg, BFFM_SETSELECTION, TRUE, lpData) ;
return 0 ;
}
//-------------------------------------------------------------------------------
static int
LuaDirectoryDialog( lua_State* L)
{
// 2 parametri : sText, sDir
string sText ;
LuaCheckParam( L, 1, sText)
string sDir ;
LuaCheckParam( L, 2, sDir)
LuaClearStack( L) ;
// se abilitata UI, emetto la finestra di dialogo
if ( ExeGetEnableUI()) {
// Converto i parametri nel formato wide
AtoWEX<MAX_PATH> wsText( sText.c_str()) ;
AtoWEX<MAX_PATH> wsDirName( sDir.c_str()) ;
// Converto L'/' in L'\\' nel nome directory proposto
for ( wchar_t* pC = wsDirName.m_psz ; *pC != L'\0' ; ++ pC) {
if ( *pC == L'/')
*pC = L'\\' ;
}
// Riempio la struttura dati per il dialogo
BROWSEINFO bi = { 0} ;
bi.hwndOwner = ExeGetMainWindowHandle() ;
bi.lpszTitle = LPWSTR( wsText) ;
bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_USENEWUI ;
bi.lpfn = DirectoryBoxProc ;
bi.lParam = (LPARAM) LPWSTR( wsDirName) ;
// Visualizzo il dialogo
LPITEMIDLIST pIdl = SHBrowseForFolder( &bi) ;
if ( pIdl != NULL) {
// recupero la path della directory
WCHAR wPath[MAX_PATH] ;
if ( SHGetPathFromIDList( pIdl, wPath) != FALSE)
LuaSetParam( L, wstrztoA( wPath)) ;
else
LuaSetParam( L) ;
// free memory used
IMalloc* pImalloc = NULL ;
if ( SUCCEEDED( SHGetMalloc( &pImalloc))) {
pImalloc->Free( pIdl) ;
pImalloc->Release() ;
}
}
else
LuaSetParam( L) ;
}
else
LuaSetParam( L) ;
return 1 ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
static int static int
LuaExistsDirectory( lua_State* L) LuaExistsDirectory( lua_State* L)
@@ -1003,6 +1083,20 @@ LuaGetMsg( lua_State* L)
return 1 ; return 1 ;
} }
//-------------------------------------------------------------------------------
static int
LuaVerifyKeyOption( lua_State* L)
{
// 1 parametro : nOptInd
int nOptInd ;
LuaCheckParam( L, 1, nOptInd)
LuaClearStack( L) ;
// verifico l'abilitazione dell'opzione (da chiave + licenza)
bool bOk = ExeVerifyKeyOption( nOptInd) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
static int static int
LuaWinExec( lua_State* L) LuaWinExec( lua_State* L)
@@ -1260,6 +1354,7 @@ LuaInstallGeneral( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "print", MyPrint) ; bOk = bOk && luaMgr.RegisterFunction( "print", MyPrint) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtEvalNumExpr", LuaEvalNumExpr) ; bOk = bOk && luaMgr.RegisterFunction( "EgtEvalNumExpr", LuaEvalNumExpr) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtPause", LuaPause) ; bOk = bOk && luaMgr.RegisterFunction( "EgtPause", LuaPause) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetKeyPressed", LuaGetKeyPressed) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtStartCounter", LuaStartCounter) ; bOk = bOk && luaMgr.RegisterFunction( "EgtStartCounter", LuaStartCounter) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtStopCounter", LuaStopCounter) ; bOk = bOk && luaMgr.RegisterFunction( "EgtStopCounter", LuaStopCounter) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtNumToString", LuaNumToString) ; bOk = bOk && luaMgr.RegisterFunction( "EgtNumToString", LuaNumToString) ;
@@ -1287,6 +1382,7 @@ LuaInstallGeneral( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtEraseFile", LuaEraseFile) ; bOk = bOk && luaMgr.RegisterFunction( "EgtEraseFile", LuaEraseFile) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtFindAllFiles", LuaFindAllFiles) ; bOk = bOk && luaMgr.RegisterFunction( "EgtFindAllFiles", LuaFindAllFiles) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCompareFilesLastWriteTime", LuaCompareFilesLastWriteTime) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCompareFilesLastWriteTime", LuaCompareFilesLastWriteTime) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtDirectoryDialog", LuaDirectoryDialog) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtExistsDirectory", LuaExistsDirectory) ; bOk = bOk && luaMgr.RegisterFunction( "EgtExistsDirectory", LuaExistsDirectory) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCreateDirectory", LuaCreateDirectory) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCreateDirectory", LuaCreateDirectory) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtEmptyDirectory", LuaEmptyDirectory) ; bOk = bOk && luaMgr.RegisterFunction( "EgtEmptyDirectory", LuaEmptyDirectory) ;
@@ -1302,6 +1398,7 @@ LuaInstallGeneral( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtIs64bit", LuaIs64bit) ; bOk = bOk && luaMgr.RegisterFunction( "EgtIs64bit", LuaIs64bit) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetLanguage", LuaGetLanguage) ; bOk = bOk && luaMgr.RegisterFunction( "EgtGetLanguage", LuaGetLanguage) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtMsg", LuaGetMsg) ; bOk = bOk && luaMgr.RegisterFunction( "EgtMsg", LuaGetMsg) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVerifyKeyOption", LuaVerifyKeyOption) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtDialogBox", LuaDialogBox) ; bOk = bOk && luaMgr.RegisterFunction( "EgtDialogBox", LuaDialogBox) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtWinExec", LuaWinExec) ; bOk = bOk && luaMgr.RegisterFunction( "EgtWinExec", LuaWinExec) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCloseExe", LuaCloseExe) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCloseExe", LuaCloseExe) ;
+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 ;
} }
+228 -129
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)
@@ -188,59 +321,32 @@ LuaParPlanesSurfTmInters( lua_State* L)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static int static int
LuaSurfTmSurfTmInters( lua_State* L) LuaPlaneVolZmapInters( lua_State* L)
{ {
// 3 o 4 parametri : Id1, nId2, nDestGrpId [, dToler] // 4 o 5 parametri : ptP, vtN, nId, nDestGrpId [, nRefType]
int nId1 ; Point3d ptP ;
LuaCheckParam( L, 1, nId1) LuaCheckParam( L, 1, ptP)
int nId2 ;
LuaCheckParam( L, 2, nId2)
int nDestGrpId ;
LuaCheckParam( L, 3, nDestGrpId) ;
double dToler = 20 * EPS_SMALL ;
LuaGetParam( L, 4, dToler) ;
LuaClearStack( L) ;
// eseguo l'intersezione
int nPntCount = 0 ;
int nCrvCount = 0 ;
int nSrfCount = 0 ;
int nNewId = ExeSurfTmSurfTmInters( nId1, nId2, nDestGrpId, dToler, &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
LuaPlaneCurveInters( lua_State* L)
{
// 4 o 5 parametri : ptOn, vtN, nId, nDestGrpId [, nRefType]
Point3d ptOn ;
LuaCheckParam( L, 1, ptOn)
Vector3d vtN ; Vector3d vtN ;
LuaCheckParam( L, 2, vtN) LuaCheckParam( L, 2, vtN)
int nId ; int nId ;
LuaCheckParam( L, 3, nId) LuaCheckParam( L, 3, nId)
int nDestGrpId ; int nDestGrpId ;
LuaCheckParam( L, 4, nDestGrpId) ; LuaCheckParam( L, 4, nDestGrpId)
int nRefType = RTY_DEFAULT ; int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 5, nRefType) ; LuaGetParam( L, 5, nRefType) ;
LuaClearStack( L) ; LuaClearStack( L) ;
// eseguo l'intersezione // eseguo calcolo intersezione
int nCount = 0 ; int nCount ;
int nNewId = ExePlaneCurveInters( ptOn, vtN, nId, nDestGrpId, nRefType, &nCount) ; int nFirstId = ExePlaneVolZmapInters( ptP, vtN, nId, nDestGrpId, nRefType, &nCount) ;
// restituisco il risultato // restituisco il risultato
if ( nNewId != GDB_ID_NULL) if ( nFirstId != GDB_ID_NULL) {
LuaSetParam( L, nNewId) ; LuaSetParam( L, nFirstId) ;
else LuaSetParam( L, nCount) ;
}
else {
LuaSetParam( L) ; LuaSetParam( L) ;
LuaSetParam( L, nCount) ; LuaSetParam( L) ;
}
return 2 ; return 2 ;
} }
@@ -272,68 +378,58 @@ LuaCurveCurveInters( lua_State* L)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static int static int
LuaLineVolZmapInters( lua_State* L) LuaCurveSurfTmInters( lua_State* L)
{ {
// 3 o 4 parametri : ptP, vtDir, Id, [, nRefId] // 3 parametri : nCrvId, nStmId, nDestGrpId
Point3d ptP ; int nCrvId ;
LuaCheckParam( L, 1, ptP) LuaCheckParam( L, 1, nCrvId)
Vector3d vtDir ; int nStmId ;
LuaCheckParam( L, 2, vtDir) LuaCheckParam( L, 2, nStmId)
int nId ; int nDestGrpId ;
LuaCheckParam( L, 3, nId) LuaCheckParam( L, 3, nDestGrpId) ;
int nRefType = nId ;
LuaGetParam( L, 4, nRefType) ;
LuaClearStack( L) ; LuaClearStack( L) ;
// eseguo calcolo intersezione // eseguo l'intersezione
INTDBLVECTOR vInters ; int nPntCount = 0 ;
if ( ExeLineVolZmapInters( ptP, vtDir, nId, nRefType, vInters)) { int nCrvCount = 0 ;
LuaSetParam( L, true) ; int nNewId = ExeCurveSurfTmInters( nCrvId, nStmId, nDestGrpId, &nPntCount, &nCrvCount) ;
INTVECTOR vType( vInters.size()) ; // restituisco il risultato
DBLVECTOR vPar( vInters.size()) ; if ( nNewId != GDB_ID_NULL)
for ( size_t i = 0 ; i < vInters.size() ; ++ i) { LuaSetParam( L, nNewId) ;
vType[i] = vInters[i].first ; else
vPar[i] = vInters[i].second ;
}
LuaSetParam( L, vType) ;
LuaSetParam( L, vPar) ;
}
else {
LuaSetParam( L) ; LuaSetParam( L) ;
LuaSetParam( L) ; LuaSetParam( L, nPntCount) ;
LuaSetParam( L) ; LuaSetParam( L, nCrvCount) ;
}
return 3 ; return 3 ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static int static int
LuaPlaneVolZmapInters( lua_State* L) LuaSurfTmSurfTmInters( lua_State* L)
{ {
// 4 o 5 parametri : ptP, vtN, nId, nDestGrpId [, nRefType] // 3 o 4 parametri : Id1, nId2, nDestGrpId [, dToler]
Point3d ptP ; int nId1 ;
LuaCheckParam( L, 1, ptP) LuaCheckParam( L, 1, nId1)
Vector3d vtN ; int nId2 ;
LuaCheckParam( L, 2, vtN) LuaCheckParam( L, 2, nId2)
int nId ;
LuaCheckParam( L, 3, nId)
int nDestGrpId ; int nDestGrpId ;
LuaCheckParam( L, 4, nDestGrpId) LuaCheckParam( L, 3, nDestGrpId) ;
int nRefType = RTY_DEFAULT ; double dToler = 20 * EPS_SMALL ;
LuaGetParam( L, 5, nRefType) ; LuaGetParam( L, 4, dToler) ;
LuaClearStack( L) ; LuaClearStack( L) ;
// eseguo calcolo intersezione // eseguo l'intersezione
int nCount ; int nPntCount = 0 ;
int nFirstId = ExePlaneVolZmapInters( ptP, vtN, nId, nDestGrpId, nRefType, &nCount) ; int nCrvCount = 0 ;
int nSrfCount = 0 ;
int nNewId = ExeSurfTmSurfTmInters( nId1, nId2, nDestGrpId, dToler, &nPntCount, &nCrvCount, &nSrfCount) ;
// restituisco il risultato // restituisco il risultato
if ( nFirstId != GDB_ID_NULL) { if ( nNewId != GDB_ID_NULL)
LuaSetParam( L, nFirstId) ; LuaSetParam( L, nNewId) ;
LuaSetParam( L, nCount) ; else
}
else {
LuaSetParam( L) ; LuaSetParam( L) ;
LuaSetParam( L) ; LuaSetParam( L, nPntCount) ;
} LuaSetParam( L, nCrvCount) ;
return 2 ; LuaSetParam( L, nSrfCount) ;
return 4 ;
} }
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
@@ -341,15 +437,18 @@ 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( "EgtCurveCurveInters", LuaCurveCurveInters) ;
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) ;
return bOk ; return bOk ;
} }
+328 -42
View File
@@ -262,6 +262,24 @@ LuaRemoveMachGroup( lua_State* L)
return 1 ; return 1 ;
} }
//-------------------------------------------------------------------------------
static int
LuaChangeMachGroupName( lua_State* L)
{
// 2 parametri : identificativo del gruppo, nuovo nome
int nMGroupInd ;
LuaCheckParam( L, 1, nMGroupInd)
string sNewName ;
LuaCheckParam( L, 2, sNewName)
LuaClearStack( L) ;
// cambio il nome della macchinata
string sName ;
bool bOk = ExeChangeMachGroupName( nMGroupInd, sNewName) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
static int static int
LuaGetMachGroupName( lua_State* L) LuaGetMachGroupName( lua_State* L)
@@ -1062,6 +1080,53 @@ LuaChangeTable( lua_State* L)
return 1 ; return 1 ;
} }
//-------------------------------------------------------------------------------
static int
LuaMoveDispAxis( lua_State* L)
{
// 2 parametri : sName, dPos
string sName ;
LuaCheckParam( L, 1, sName)
double dPos ;
LuaCheckParam( L, 2, dPos)
LuaClearStack( L) ;
// muovo l'asse nella nuova posizione
bool bOk = ExeMoveDispAxis( sName, dPos) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaRemoveDispAxis( lua_State* L)
{
// 1 parametro : sName
string sName ;
LuaCheckParam( L, 1, sName)
LuaClearStack( L) ;
// rimuovo il movimento dell'asse
bool bOk = ExeRemoveDispAxis( sName) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaKeepAllDispAxes( lua_State* L)
{
// 1 parametro : nSouPhase
int nSouPhase ;
LuaCheckParam( L, 1, nSouPhase) ;
LuaClearStack( L) ;
// confermo i movimenti degli assi di disposizione nella fase corrente della macchinata corrente
bool bOk = ExeKeepAllDispAxes( nSouPhase) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
static int static int
LuaAddFixture( lua_State* L) LuaAddFixture( lua_State* L)
@@ -1076,7 +1141,7 @@ LuaAddFixture( lua_State* L)
if ( LuaGetParam( L, 3, dAngRotDeg)) if ( LuaGetParam( L, 3, dAngRotDeg))
LuaGetParam( L, 4, dMov) ; LuaGetParam( L, 4, dMov) ;
LuaClearStack( L) ; LuaClearStack( L) ;
// metto l'asse nella nuova posizione // aggiungo la ventosa nella posizione indicata
int nId = ExeAddFixture( sName, ptPos, dAngRotDeg, dMov) ; int nId = ExeAddFixture( sName, ptPos, dAngRotDeg, dMov) ;
// restituisco il risultato // restituisco il risultato
if ( nId != GDB_ID_NULL) if ( nId != GDB_ID_NULL)
@@ -1186,6 +1251,23 @@ LuaRotateFixture( lua_State* L)
return 1 ; return 1 ;
} }
//-------------------------------------------------------------------------------
static int
LuaSetFixtureLink( lua_State* L)
{
// 2 parametri : nFxtId, sTaLink
int nFxtId ;
LuaCheckParam( L, 1, nFxtId)
string sTaLink ;
LuaCheckParam( L, 2, sTaLink)
LuaClearStack( L) ;
// aggancio il bloccaggio ad asse tavola
bool bOk= ExeSetFixtureLink( nFxtId, sTaLink) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
static int static int
LuaMoveFixtureMobile( lua_State* L) LuaMoveFixtureMobile( lua_State* L)
@@ -1203,6 +1285,23 @@ LuaMoveFixtureMobile( lua_State* L)
return 1 ; return 1 ;
} }
//-------------------------------------------------------------------------------
static int
LuaSetFixtureMobile( lua_State* L)
{
// 2 parametri : nFxtId, dMov
int nFxtId ;
LuaCheckParam( L, 1, nFxtId)
double dMov ;
LuaCheckParam( L, 2, dMov)
LuaClearStack( L) ;
// imposto il movimento della parte mobile del bloccaggio
bool bOk= ExeSetFixtureMobile( nFxtId, dMov) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
// Tools database // Tools database
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
@@ -1611,6 +1710,22 @@ LuaTdbGetCurrToolThLength( lua_State* L)
return 1 ; return 1 ;
} }
//-------------------------------------------------------------------------------
static int
LuaTdbIsCurrToolStandardDraw( lua_State* L)
{
// nessun parametro
LuaClearStack( L) ;
// recupero lo stato
bool bStandard ;
bool bOk = ExeTdbCurrToolIsStandardDraw( bStandard) ;
if ( bOk)
LuaSetParam( L, bStandard) ;
else
LuaSetParam( L) ;
return 1 ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
static int static int
LuaTdbGetCurrToolDraw( lua_State* L) LuaTdbGetCurrToolDraw( lua_State* L)
@@ -2578,6 +2693,34 @@ LuaSpecialUpdateDisposition( lua_State* L)
return 1 ; return 1 ;
} }
//-------------------------------------------------------------------------------
static int
LuaGetDispositionToolData( lua_State* L)
{
// 1 parametro : nId
int nId ;
LuaCheckParam( L, 1, nId)
LuaClearStack( L) ;
// recupero dati dell'eventuale utensile associato alla disposizione
string sName ;
string sHead ;
int nExit ;
string sTcPos ;
bool bOk = ExeGetDispositionToolData( nId, sName, sHead, nExit, sTcPos) ;
// restituisco il risultato
if ( bOk) {
LuaSetParam( L, sName) ;
LuaSetParam( L, sHead) ;
LuaSetParam( L, nExit) ;
LuaSetParam( L, sTcPos) ;
return 4 ;
}
else {
LuaSetParam( L) ;
return 1 ;
}
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
// Machinings // Machinings
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
@@ -2864,6 +3007,23 @@ LuaGetMachiningGeometry( lua_State* L)
return 1 ; return 1 ;
} }
//-------------------------------------------------------------------------------
static int
LuaGetMachiningSkippedGeometry( lua_State* L)
{
// nessun parametro
LuaClearStack( L) ;
// recupero gli indici della geometria non lavorata della lavorazione corrente
SELVECTOR vSel ;
bool bOk = ExeGetMachiningSkippedGeometry( vSel) ;
// restituisco il risultato
if ( bOk)
LuaSetParam( L, vSel) ;
else
LuaSetParam( L) ;
return 1 ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
static int static int
LuaIsMachiningEmpty( lua_State* L) LuaIsMachiningEmpty( lua_State* L)
@@ -3012,6 +3172,44 @@ LuaGetClEntIndex( lua_State* L)
return 1 ; return 1 ;
} }
//-----------------------------------------------------------------------------
static int
LuaGetClEntAxesStatus( lua_State* L)
{
// 1 parametro : nEntId
int nEntId ;
LuaGetParam( L, 1, nEntId) ;
LuaClearStack( L) ;
// recupero lo stato del movimento assi
int nStatus ;
bool bOk = ExeGetClEntAxesStatus( nEntId, nStatus) ;
// restituisco il risultato
if ( bOk)
LuaSetParam( L, nStatus) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-----------------------------------------------------------------------------
static int
LuaGetClEntAxesMask( lua_State* L)
{
// 1 parametro : nEntId
int nEntId ;
LuaGetParam( L, 1, nEntId) ;
LuaClearStack( L) ;
// recupero la mascheratura del movimento assi (valida solo in rapido)
int nMask ;
bool bOk = ExeGetClEntAxesMask( nEntId, nMask) ;
// restituisco il risultato
if ( bOk)
LuaSetParam( L, nMask) ;
else
LuaSetParam( L) ;
return 1 ;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
static int static int
LuaGetClEntAxesVal( lua_State* L) LuaGetClEntAxesVal( lua_State* L)
@@ -3317,23 +3515,6 @@ LuaSetCalcTool( lua_State* L)
return 1 ; return 1 ;
} }
//-------------------------------------------------------------------------------
static int
LuaGetAllCurrAxesName( lua_State* L)
{
// nessun parametro
LuaClearStack( L) ;
// imposto l'utensile corrente per il calcolo
STRVECTOR vAxName ;
bool bOk = ExeGetAllCurrAxesName( vAxName) ;
// restituisco il risultato
if ( bOk)
LuaSetParam( L, vAxName) ;
else
LuaSetParam( L) ;
return 1 ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
static int static int
LuaSetRotAxisBlock( lua_State* L) LuaSetRotAxisBlock( lua_State* L)
@@ -3353,26 +3534,19 @@ LuaSetRotAxisBlock( lua_State* L)
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
static int static int
LuaGetRotAxisBlocked( lua_State* L) LuaGetCalcTable( lua_State* L)
{ {
// 1 parametro : nInd ( 0-based) // nessun parametro
int nInd ;
LuaCheckParam( L, 1, nInd)
LuaClearStack( L) ; LuaClearStack( L) ;
// recupero dati bloccaggio asse in posizione nInd // recupero la tavola correnti
string sAxis ; string sTable ;
double dVal ; bool bOk = ExeGetCalcTable( sTable) ;
bool bOk = ExeGetRotAxisBlocked( nInd, sAxis, dVal) ;
// restituisco il risultato // restituisco il risultato
if ( bOk) { if ( bOk)
LuaSetParam( L, sAxis) ; LuaSetParam( L, sTable) ;
LuaSetParam( L, dVal) ; else
}
else {
LuaSetParam( L) ; LuaSetParam( L) ;
LuaSetParam( L) ; return 1 ;
}
return 2 ;
} }
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
@@ -3400,6 +3574,47 @@ LuaGetCalcTool( lua_State* L)
return 3 ; return 3 ;
} }
//-------------------------------------------------------------------------------
static int
LuaGetAllCurrAxesNames( lua_State* L)
{
// nessun parametro
LuaClearStack( L) ;
// imposto l'utensile corrente per il calcolo
STRVECTOR vAxName ;
bool bOk = ExeGetAllCurrAxesNames( vAxName) ;
// restituisco il risultato
if ( bOk)
LuaSetParam( L, vAxName) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaGetRotAxisBlocked( lua_State* L)
{
// 1 parametro : nInd ( 0-based)
int nInd ;
LuaCheckParam( L, 1, nInd)
LuaClearStack( L) ;
// recupero dati bloccaggio asse in posizione nInd
string sAxis ;
double dVal ;
bool bOk = ExeGetRotAxisBlocked( nInd, sAxis, dVal) ;
// restituisco il risultato
if ( bOk) {
LuaSetParam( L, sAxis) ;
LuaSetParam( L, dVal) ;
}
else {
LuaSetParam( L) ;
LuaSetParam( L) ;
}
return 2 ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
static int static int
LuaGetCalcAngles( lua_State* L) LuaGetCalcAngles( lua_State* L)
@@ -3467,7 +3682,7 @@ LuaGetCalcPositions( lua_State* L)
static int static int
LuaGetCalcTipFromPositions( lua_State* L) LuaGetCalcTipFromPositions( lua_State* L)
{ {
// da 5 a 8 parametri : dX, dY, dZ, dAngA [, dAngB] [, dAngC] [, dAngD], bBottom // da 5 a 10 parametri : dX, dY, dZ, dAngR1[, dAngR2][, dAngR3][, dAngR4][, dAngR5][, dAngR6], bBottom
double dX ; double dX ;
LuaCheckParam( L, 1, dX) LuaCheckParam( L, 1, dX)
double dY ; double dY ;
@@ -3476,7 +3691,7 @@ LuaGetCalcTipFromPositions( lua_State* L)
LuaCheckParam( L, 3, dZ) LuaCheckParam( L, 3, dZ)
DBLVECTOR vAng ; DBLVECTOR vAng ;
int i ; int i ;
for ( i = 4 ; i <= 7 ; ++ i) { for ( i = 4 ; i <= 9 ; ++ i) {
double dAng ; double dAng ;
if ( LuaGetParam( L, i, dAng)) if ( LuaGetParam( L, i, dAng))
vAng.emplace_back( dAng) ; vAng.emplace_back( dAng) ;
@@ -3501,9 +3716,9 @@ LuaGetCalcTipFromPositions( lua_State* L)
static int static int
LuaGetCalcToolDirFromAngles( lua_State* L) LuaGetCalcToolDirFromAngles( lua_State* L)
{ {
// da 1 a 4 parametri : dAngA, dAngB, dAngC, dAngD // da 1 a 6 parametri : dAngR1, dAngR2, dAngR3, dAngR4, dAngR5, dAngR6
DBLVECTOR vAng ; DBLVECTOR vAng ;
for ( int i = 1 ; i <= 4 ; ++ i) { for ( int i = 1 ; i <= 6 ; ++ i) {
double dAng ; double dAng ;
if ( LuaGetParam( L, i, dAng)) if ( LuaGetParam( L, i, dAng))
vAng.emplace_back( dAng) ; vAng.emplace_back( dAng) ;
@@ -3526,9 +3741,9 @@ LuaGetCalcToolDirFromAngles( lua_State* L)
static int static int
LuaGetCalcAuxDirFromAngles( lua_State* L) LuaGetCalcAuxDirFromAngles( lua_State* L)
{ {
// da 1 a 4 parametri : dAngA, dAngB, dAngC, dAngD // da 1 a 6 parametri : dAngR1, dAngR2, dAngR3, dAngR4, dAngR5, dAngR6
DBLVECTOR vAng ; DBLVECTOR vAng ;
for ( int i = 1 ; i <= 4 ; ++ i) { for ( int i = 1 ; i <= 6 ; ++ i) {
double dAng ; double dAng ;
if ( LuaGetParam( L, i, dAng)) if ( LuaGetParam( L, i, dAng))
vAng.emplace_back( dAng) ; vAng.emplace_back( dAng) ;
@@ -3683,6 +3898,26 @@ LuaGetHeadExitCount( lua_State* L)
return 1 ; return 1 ;
} }
//-------------------------------------------------------------------------------
static int
LuaGetExitId( lua_State* L)
{
// 2 parametri : sHead, nExit
string sHead ;
LuaCheckParam( L, 1, sHead)
int nExit ;
LuaCheckParam( L, 2, nExit)
LuaClearStack( L) ;
// recupero l'identificativo dell'Uscita della Testa indicata della macchina
int nId = ExeGetExitId( sHead, nExit) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
static int static int
LuaGetTcPosId( lua_State* L) LuaGetTcPosId( lua_State* L)
@@ -3739,6 +3974,25 @@ LuaGetAxisType( lua_State* L)
return 1 ; return 1 ;
} }
//-------------------------------------------------------------------------------
static int
LuaGetAxisDir( lua_State* L)
{
// 1 parametro : sAxis
string sAxis ;
LuaCheckParam( L, 1, sAxis)
LuaClearStack( L) ;
// recupero la direzione dell'asse
Vector3d vtDir ;
bool bOk = ExeGetAxisDir( sAxis, vtDir) ;
// restituisco il risultato
if ( bOk)
LuaSetParam( L, vtDir) ;
else
LuaSetParam( L) ;
return 1 ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
static int static int
LuaGetAxisInvert( lua_State* L) LuaGetAxisInvert( lua_State* L)
@@ -3794,6 +4048,23 @@ LuaGetAllTablesNames( lua_State* L)
return 1 ; return 1 ;
} }
//-------------------------------------------------------------------------------
static int
LuaGetAllAxesNames( lua_State* L)
{
// nessun parametro
LuaClearStack( L) ;
// recupero l'elenco degli assi della macchina corrente
STRVECTOR vNames ;
bool bOk = ExeGetAllAxesNames( vNames) ;
// restituisco il risultato
if ( bOk)
LuaSetParam( L, vNames) ;
else
LuaSetParam( L) ;
return 1 ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
static int static int
LuaGetAllHeadsNames( lua_State* L) LuaGetAllHeadsNames( lua_State* L)
@@ -4047,6 +4318,7 @@ LuaInstallMachMgr( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtAddMachGroup", LuaAddMachGroup) ; bOk = bOk && luaMgr.RegisterFunction( "EgtAddMachGroup", LuaAddMachGroup) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCopyMachGroup", LuaCopyMachGroup) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCopyMachGroup", LuaCopyMachGroup) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRemoveMachGroup", LuaRemoveMachGroup) ; bOk = bOk && luaMgr.RegisterFunction( "EgtRemoveMachGroup", LuaRemoveMachGroup) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtChangeMachGroupName", LuaChangeMachGroupName) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetMachGroupName", LuaGetMachGroupName) ; bOk = bOk && luaMgr.RegisterFunction( "EgtGetMachGroupName", LuaGetMachGroupName) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetMachGroupMachineName", LuaGetMachGroupMachineName) ; bOk = bOk && luaMgr.RegisterFunction( "EgtGetMachGroupMachineName", LuaGetMachGroupMachineName) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetMachGroupId", LuaGetMachGroupId) ; bOk = bOk && luaMgr.RegisterFunction( "EgtGetMachGroupId", LuaGetMachGroupId) ;
@@ -4095,6 +4367,9 @@ LuaInstallMachMgr( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtGetTableArea", LuaGetTableArea) ; bOk = bOk && luaMgr.RegisterFunction( "EgtGetTableArea", LuaGetTableArea) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetTableAreaOffset", LuaGetTableAreaOffset) ; bOk = bOk && luaMgr.RegisterFunction( "EgtGetTableAreaOffset", LuaGetTableAreaOffset) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtChangeTable", LuaChangeTable) ; bOk = bOk && luaMgr.RegisterFunction( "EgtChangeTable", LuaChangeTable) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtMoveDispAxis", LuaMoveDispAxis) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRemoveDispAxis", LuaRemoveDispAxis) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtKeepAllDispAxes", LuaKeepAllDispAxes) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAddFixture", LuaAddFixture) ; bOk = bOk && luaMgr.RegisterFunction( "EgtAddFixture", LuaAddFixture) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtKeepFixture", LuaKeepFixture) ; bOk = bOk && luaMgr.RegisterFunction( "EgtKeepFixture", LuaKeepFixture) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRemoveFixture", LuaRemoveFixture) ; bOk = bOk && luaMgr.RegisterFunction( "EgtRemoveFixture", LuaRemoveFixture) ;
@@ -4102,7 +4377,9 @@ LuaInstallMachMgr( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtGetNextFixture", LuaGetNextFixture) ; bOk = bOk && luaMgr.RegisterFunction( "EgtGetNextFixture", LuaGetNextFixture) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtMoveFixture", LuaMoveFixture) ; bOk = bOk && luaMgr.RegisterFunction( "EgtMoveFixture", LuaMoveFixture) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRotateFixture", LuaRotateFixture) ; bOk = bOk && luaMgr.RegisterFunction( "EgtRotateFixture", LuaRotateFixture) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSetFixtureLink", LuaSetFixtureLink) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtMoveFixtureMobile", LuaMoveFixtureMobile) ; bOk = bOk && luaMgr.RegisterFunction( "EgtMoveFixtureMobile", LuaMoveFixtureMobile) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSetFixtureMobile", LuaSetFixtureMobile) ;
// Tools database // Tools database
bOk = bOk && luaMgr.RegisterFunction( "EgtTdbGetToolNewName", LuaTdbGetToolNewName) ; bOk = bOk && luaMgr.RegisterFunction( "EgtTdbGetToolNewName", LuaTdbGetToolNewName) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtTdbAddTool", LuaTdbAddTool) ; bOk = bOk && luaMgr.RegisterFunction( "EgtTdbAddTool", LuaTdbAddTool) ;
@@ -4122,6 +4399,7 @@ LuaInstallMachMgr( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtTdbGetCurrToolMaxDepth", LuaTdbGetCurrToolMaxDepth) ; bOk = bOk && luaMgr.RegisterFunction( "EgtTdbGetCurrToolMaxDepth", LuaTdbGetCurrToolMaxDepth) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtTdbGetCurrToolThDiam", LuaTdbGetCurrToolThDiam) ; bOk = bOk && luaMgr.RegisterFunction( "EgtTdbGetCurrToolThDiam", LuaTdbGetCurrToolThDiam) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtTdbGetCurrToolThLength", LuaTdbGetCurrToolThLength) ; bOk = bOk && luaMgr.RegisterFunction( "EgtTdbGetCurrToolThLength", LuaTdbGetCurrToolThLength) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtTdbIsCurrToolStandardDraw", LuaTdbIsCurrToolStandardDraw) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtTdbGetCurrToolDraw", LuaTdbGetCurrToolDraw) ; bOk = bOk && luaMgr.RegisterFunction( "EgtTdbGetCurrToolDraw", LuaTdbGetCurrToolDraw) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtTdbReload", LuaTdbReload) ; bOk = bOk && luaMgr.RegisterFunction( "EgtTdbReload", LuaTdbReload) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtTdbSave", LuaTdbSave) ; bOk = bOk && luaMgr.RegisterFunction( "EgtTdbSave", LuaTdbSave) ;
@@ -4180,6 +4458,7 @@ LuaInstallMachMgr( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtGetPhaseDisposition", LuaGetPhaseDisposition) ; bOk = bOk && luaMgr.RegisterFunction( "EgtGetPhaseDisposition", LuaGetPhaseDisposition) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSpecialApplyDisposition", LuaSpecialApplyDisposition) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSpecialApplyDisposition", LuaSpecialApplyDisposition) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSpecialUpdateDisposition", LuaSpecialUpdateDisposition) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSpecialUpdateDisposition", LuaSpecialUpdateDisposition) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetDispositionToolData", LuaGetDispositionToolData) ;
// Machinings // Machinings
bOk = bOk && luaMgr.RegisterFunction( "EgtAddMachining", LuaAddMachining) ; bOk = bOk && luaMgr.RegisterFunction( "EgtAddMachining", LuaAddMachining) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCreateMachining", LuaCreateMachining) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCreateMachining", LuaCreateMachining) ;
@@ -4194,6 +4473,7 @@ LuaInstallMachMgr( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtUpdateMachining", LuaUpdateMachining) ; bOk = bOk && luaMgr.RegisterFunction( "EgtUpdateMachining", LuaUpdateMachining) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetMachiningParam", LuaGetMachiningParam) ; bOk = bOk && luaMgr.RegisterFunction( "EgtGetMachiningParam", LuaGetMachiningParam) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetMachiningGeometry", LuaGetMachiningGeometry) ; bOk = bOk && luaMgr.RegisterFunction( "EgtGetMachiningGeometry", LuaGetMachiningGeometry) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetMachiningSkippedGeometry", LuaGetMachiningSkippedGeometry) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtIsMachiningEmpty", LuaIsMachiningEmpty) ; bOk = bOk && luaMgr.RegisterFunction( "EgtIsMachiningEmpty", LuaIsMachiningEmpty) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetMachiningStartPoint", LuaGetMachiningStartPoint) ; bOk = bOk && luaMgr.RegisterFunction( "EgtGetMachiningStartPoint", LuaGetMachiningStartPoint) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetMachiningEndPoint", LuaGetMachiningEndPoint) ; bOk = bOk && luaMgr.RegisterFunction( "EgtGetMachiningEndPoint", LuaGetMachiningEndPoint) ;
@@ -4203,6 +4483,8 @@ LuaInstallMachMgr( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtGetClEntMove", LuaGetClEntMove) ; bOk = bOk && luaMgr.RegisterFunction( "EgtGetClEntMove", LuaGetClEntMove) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetClEntFlag", LuaGetClEntFlag) ; bOk = bOk && luaMgr.RegisterFunction( "EgtGetClEntFlag", LuaGetClEntFlag) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetClEntIndex", LuaGetClEntIndex) ; bOk = bOk && luaMgr.RegisterFunction( "EgtGetClEntIndex", LuaGetClEntIndex) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetClEntAxesStatus", LuaGetClEntAxesStatus) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetClEntAxesMask", LuaGetClEntAxesMask) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetClEntAxesVal", LuaGetClEntAxesVal) ; bOk = bOk && luaMgr.RegisterFunction( "EgtGetClEntAxesVal", LuaGetClEntAxesVal) ;
// Simulation // Simulation
bOk = bOk && luaMgr.RegisterFunction( "EgtSimInit", LuaSimInit) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSimInit", LuaSimInit) ;
@@ -4226,21 +4508,25 @@ LuaInstallMachMgr( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAxisId", LuaGetAxisId) ; bOk = bOk && luaMgr.RegisterFunction( "EgtGetAxisId", LuaGetAxisId) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetHeadId", LuaGetHeadId) ; bOk = bOk && luaMgr.RegisterFunction( "EgtGetHeadId", LuaGetHeadId) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetHeadExitCount", LuaGetHeadExitCount) ; bOk = bOk && luaMgr.RegisterFunction( "EgtGetHeadExitCount", LuaGetHeadExitCount) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetExitId", LuaGetExitId) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetTcPosId", LuaGetTcPosId) ; bOk = bOk && luaMgr.RegisterFunction( "EgtGetTcPosId", LuaGetTcPosId) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAxisToken", LuaGetAxisToken) ; bOk = bOk && luaMgr.RegisterFunction( "EgtGetAxisToken", LuaGetAxisToken) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAxisType", LuaGetAxisType) ; bOk = bOk && luaMgr.RegisterFunction( "EgtGetAxisType", LuaGetAxisType) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAxisDir", LuaGetAxisDir) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAxisInvert", LuaGetAxisInvert) ; bOk = bOk && luaMgr.RegisterFunction( "EgtGetAxisInvert", LuaGetAxisInvert) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAxisOffset", LuaGetAxisOffset) ; bOk = bOk && luaMgr.RegisterFunction( "EgtGetAxisOffset", LuaGetAxisOffset) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAllTablesNames", LuaGetAllTablesNames) ; bOk = bOk && luaMgr.RegisterFunction( "EgtGetAllTablesNames", LuaGetAllTablesNames) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAllAxesNames", LuaGetAllAxesNames) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAllHeadsNames", LuaGetAllHeadsNames) ; bOk = bOk && luaMgr.RegisterFunction( "EgtGetAllHeadsNames", LuaGetAllHeadsNames) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAllTcPosNames", LuaGetAllTcPosNames) ; bOk = bOk && luaMgr.RegisterFunction( "EgtGetAllTcPosNames", LuaGetAllTcPosNames) ;
// Machine Calc // Machine Calc
bOk = bOk && luaMgr.RegisterFunction( "EgtSetCalcTable", LuaSetCalcTable) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSetCalcTable", LuaSetCalcTable) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSetCalcTool", LuaSetCalcTool) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSetCalcTool", LuaSetCalcTool) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAllCurrAxesName", LuaGetAllCurrAxesName) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSetRotAxisBlock", LuaSetRotAxisBlock) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSetRotAxisBlock", LuaSetRotAxisBlock) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetRotAxisBlocked", LuaGetRotAxisBlocked) ; bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcTable", LuaGetCalcTable) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcTool", LuaGetCalcTool) ; bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcTool", LuaGetCalcTool) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAllCurrAxesNames", LuaGetAllCurrAxesNames) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetRotAxisBlocked", LuaGetRotAxisBlocked) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcAngles", LuaGetCalcAngles) ; bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcAngles", LuaGetCalcAngles) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcPositions", LuaGetCalcPositions) ; bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcPositions", LuaGetCalcPositions) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcTipFromPositions", LuaGetCalcTipFromPositions) ; bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcTipFromPositions", LuaGetCalcTipFromPositions) ;
+73
View File
@@ -175,6 +175,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 +243,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)
@@ -267,9 +336,13 @@ LuaInstallScene( LuaMgr& luaMgr)
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) ;
return bOk ; return bOk ;
} }
+202
View File
@@ -0,0 +1,202 @@
//----------------------------------------------------------------------------
// 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 parametri : nSurf1Id, nSurf2Id, dSafeDist
int nSurf1Id ;
LuaCheckParam( L, 1, nSurf1Id)
int nSurf2Id ;
LuaCheckParam( L, 2, nSurf2Id)
double dSafeDist ;
LuaCheckParam( L, 3, dSafeDist)
LuaClearStack( L) ;
// eseguo verifica di interferenza
int nRes = ExeTestSurfaceSurface( nSurf1Id, nSurf2Id, dSafeDist) ;
// 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 ;
}