Compare commits

...

189 Commits

Author SHA1 Message Date
Riccardo Elitropi 6b5dc3fc30 Merge commit '9e1f151bbc90bc257749d8df7cbabefa679163e1' into VmillAdditivo 2024-04-30 08:38:44 +02:00
Dario Sassi 9e1f151bbc EgtExecutor :
- adattamenti per Zmap con virtual additive.
2024-04-26 11:33:16 +02:00
Dario Sassi ed6c8fb11d Merge commit '22774303af440f13f3db243c23798652b2fa7cc4' 2024-04-22 19:07:16 +02:00
Dario Sassi 9ef30272b4 EgtExecutor :
- aggiunta funzione Exe/Lua GetExitId.
2024-04-22 15:30:00 +02:00
Riccardo Elitropi 22774303af EgtExecutor :
- aggiunte funzioni per Vmill additivo.
2024-04-22 13:23:59 +02:00
Dario Sassi a3c905c33a EgtExecutor :
- adattamenti per Surf Bezier
- aggiunta funzione Exe/Lua CreateArc2PR.
2024-04-19 17:51:00 +02:00
Dario Sassi 66a72c92b2 EgtExecutor :
- nelle funzioni Lua EgtGetCalcTipFromPositions, EgtGetCalcToolDirFromAngles e EgtGetCalcAuxDirFromAngles ammessi sino a 6 assi rotanti (per robot).
2024-04-17 06:55:09 +02:00
Daniele Bariletti 8c0b0a97b8 EgtExecutor :
- corretto bug.
2024-04-15 12:35:17 +02:00
Daniele Bariletti f444c189d4 EgtExecutor :
- aggiunto anche alla funzione LUA dell' AdvancedImport il parametro nFlag.
2024-04-15 12:21:07 +02:00
Dario Sassi 4f79e4baf9 EgtExecutor 2.6d4 :
- aggiunta di alcune funzioni lua per i Quaternion.
2024-04-14 18:18:13 +02:00
Dario Sassi e66cfb74c0 EgtExecutor :
- eliminate funzioni Exe e Lua CreateSurfTmBySurfBezier perchè doppioni di ApproxSurface a cui è stato aggiunto il parametro dTriaMinSide.
2024-04-13 17:20:57 +02:00
Daniele Bariletti 2d2954f983 EgtExecutor :
- cambio versione.
2024-04-12 10:34:47 +02:00
Daniele Bariletti bea2a9f938 EgtExecutor :
- aggiunti i default per la chiamata della SurfTmByBezier.
2024-04-12 10:32:23 +02:00
Daniele Bariletti bcc44a5592 EgtExecutor :
- modificata l'importazione layer da file 3dm.
2024-04-12 10:31:55 +02:00
Daniele Bariletti e587f23dad EgtExecutor :
- aggiunti parametri per ottenere la trimesh di una Bezier con precisione richiesta.
2024-04-11 17:39:20 +02:00
Dario Sassi f4542dd7db Merge branch 'master' of https://gitlab.steamware.net/egaltech/EgtExecutor 2024-04-11 00:19:37 +02:00
Dario Sassi 1f66473764 EgtExecutor :
- aggiunto parametro Flag in AdvancedImport.
2024-04-11 00:18:34 +02:00
Daniele Bariletti b98e4ea359 EgtExecutor :
- errato commit precedente.
2024-04-10 18:34:16 +02:00
Daniele Bariletti 504e1d5472 EgtExecutor :
- modifica della funzione per l'estrazione dei loop aperti di una superficie di Bezier.
2024-04-10 18:08:54 +02:00
Dario Sassi f8bc7083a9 EgtExecutor 2.6d2 :
- estensione gestione chiave di rete per meglio identificare l'eventuale problema
- migliorie a proiezione di curva su superficie
- ricompilazione per modifiche a EgtLock.
2024-04-09 14:49:24 +02:00
Dario Sassi c4b4a12b9a EgtExecutor :
- aggiunta funzione Exe/Lua ProjectCurveOnSurfTmExt.
2024-04-08 09:42:02 +02:00
Dario Sassi 9473e5813d EgtExecutor :
aggiunta la funzione Lua EgtDirectoryDialog per la scelta di un direttorio.
2024-04-05 19:24:04 +02:00
Dario Sassi fd9e53711b EgtExecutor :
- modifiche a Exe e Lua CreateSurfTmSwept.
2024-04-05 16:56:41 +02:00
Dario Sassi 6c153c3db4 Merge commit '824e6e3ba1ff03936d2150d5660a8e1ff27b24e6' 2024-04-04 14:49:51 +02:00
Dario Sassi 841c0f6cfc EgtExecutor :
- aggiunta funzione Exe/Lua GetClEntAxesMask.
2024-04-03 08:12:19 +02:00
Dario Sassi 3990934446 EgtExecutor 2.6d1 :
- aggiunta funzione Exe e Lua GetAllAxesName.
2024-04-02 15:38:40 +02:00
Dario Sassi 399556a9a6 EgtExecutor 2.6c3 :
- cambio versione.
2024-03-27 16:43:26 +01:00
Daniele Bariletti 69f2c3d029 Merge branch 'CmdCreateSurfBezier' 2024-03-27 11:06:29 +01:00
Dario Sassi f1f23a3cf4 EgtExecutor :
- aggiunte funzioni Exe e Lua TestBoxSurface, TestRectPrismoidSurface, TestCylSurface, TestConeSurface, TestSpheSurface, TestSurfaceSurface.
2024-03-25 09:05:21 +01:00
Daniele Bariletti 73db521008 Merge branch 'master' into CmdCreateSurfBezier 2024-03-21 15:07:08 +01:00
Daniele Bariletti 82d1465ecd EgtExecutor :
- modificata la funzione per richiedere gli edge di una Bezier.
2024-03-21 15:01:35 +01:00
Riccardo Elitropi 824e6e3ba1 EgtExecutor :
- correzione codice.
2024-03-18 13:21:21 +01:00
Riccardo Elitropi 88fa7ef54c EgtExecutor :
- rimozione codici di test.
- modifiche parametri LuaCreateSurfTmSwept.
2024-03-15 13:18:48 +01:00
Dario Sassi 047bff2f11 EgtExecutor :
- aggiunta funzione exe e lua CreateAngularDimensionEx.
2024-03-14 20:02:39 +01:00
Dario Sassi 611c08bb4c EgtExecutor :
- aggiunta funzione Exe e Lua SurfTmMoveFacet.
2024-03-13 09:24:16 +01:00
Riccardo Elitropi 82633bf725 EgtExecutor :
- migliorie al codice.
2024-03-11 13:21:29 +01:00
Dario Sassi c69036ef2c EgtExecutor 2.6c2 :
- aggiunte funzioni Exe e Lua SurfTmSetShowEdges e VolZmapSetShowEdges.
2024-03-10 10:25:36 +01:00
Daniele Bariletti b0c1ba14e8 Merge branch 'master' into CmdCreateSurfBezier 2024-03-08 16:37:46 +01:00
Riccardo Elitropi a27dfd2b54 EgtExecutor :
- Codice di test per RMF aggiornato.
2024-03-07 10:52:39 +01:00
Riccardo Elitropi 2a106c4263 EgtExecutor :
- Codice di test per RMF.
2024-03-06 16:28:48 +01:00
Dario Sassi 66a232a6a0 EgtExecutor 2.6c1 :
- ricompilazione con cambio versione.
2024-03-05 08:56:19 +01:00
Daniele Bariletti 89e8b02316 EgtExecutor :
- spostato il filtro delle intersezioni line-SurfBz in GeomKernel.
2024-02-28 10:31:54 +01:00
Daniele Bariletti d1cb3d7de7 Merge branch 'master' into CmdCreateSurfBezier 2024-02-28 09:33:06 +01:00
Dario Sassi 6c640b902f EgtExecuter :
- aggiunta funzione Exe/Lua CreateSurfTmTransSwept.
2024-02-27 18:18:52 +01:00
Daniele Bariletti 49d2600cc7 EgtExecutor :
- correzione del merge.
2024-02-27 17:30:38 +01:00
Daniele Bariletti ce92c8f6c9 Merge branch 'master' into CmdCreateSurfBezier 2024-02-27 17:06:46 +01:00
Daniele Bariletti 303b7d8f0e EgtExecutor :
- aggiunta della funzione per disegnare i triangoli nello spazio parametrico di una superifcie Bezier
- aggiunto il calcolo dei punti di polo nelle funzioni che creano superfici di Bezier.
2024-02-27 16:36:08 +01:00
Dario Sassi 308e50549d EgtExecutor :
- aggiunta funzione Exe e Lua CurveSurfTmInters
- filtri su intersezioni portati in GeomKernel.
2024-02-26 15:09:35 +01:00
Daniele Bariletti 5f2c538ab8 EgtExecutor :
- correzione della chiamata di conversione da bezier a trimesh in caso di con bezier nulla.
2024-02-21 15:37:35 +01:00
SaraP 8e85070df1 EgtExecutor :
- modifiche a  AdjustLayerForSideAngle per gestire la creazione della regione anche nel caso di raccordi in tangenza.
2024-02-20 15:53:59 +01:00
Daniele Bariletti 95ec7a83ef EgtExecutor :
- aggiunta funzione per tagliare una superficie bezier con un piano.
2024-02-20 12:30:43 +01:00
Dario Sassi ed1ba0543b EgtExecutor 2.6b4 :
- aggiunta funzioni Exe e Lua Set/GetViewOrizzOffsStep
- aggiunte funzioni Lua EgtGetView e EgtGetGenericView.
2024-02-19 14:52:24 +01:00
Dario Sassi 26544984ad EgtExecutor 2.6b3 :
- adattamenti per modifiche a funzioni Collision Detection.
2024-02-16 08:46:02 +01:00
Daniele Bariletti e82c7417b6 Merge branch 'Dist-Inters_Bezier' into CmdCreateSurfBezier 2024-02-14 14:43:33 +01:00
Daniele Bariletti a3fa91244d EgtExecutor :
- aggiunta la funzione per creare una sfera come superficie bezier.
2024-02-14 14:42:16 +01:00
Dario Sassi e06dd65888 EgtExecutor 2.6b2 :
- a ApproxCurve e ProjectCurveOnSurfTm aggiunto parametro dMaxSegmLen.
2024-02-13 14:35:43 +01:00
Daniele Bariletti abbc5415ab Merge branch 'master' into Dist-Inters_Bezier 2024-02-12 13:00:08 +01:00
Daniele Bariletti 603cb083cc EgtExecutor :
- aggiunte le funzioni per l'intersezione tra linea e sup. Bezier.
2024-02-12 12:59:43 +01:00
Dario Sassi d9cfc375a9 Merge branch 'master' of https://gitlab.steamware.net/egaltech/EgtExecutor 2024-02-05 19:58:31 +01:00
Dario Sassi cce5e6ae76 EgtExecutor 2.6b1 :
- modifiche a ExePocketing per accettare percorso piano e chiuso oltre che regione piana.
2024-02-05 19:56:31 +01:00
Daniele Bariletti 407ca752ab Merge branch 'ExtDimension_angular' 2024-02-05 15:55:46 +01:00
Daniele Bariletti 41c50a776e Merge branch 'master' into ExtDimension_angular 2024-02-05 15:44:46 +01:00
SaraP f28da6d9e3 EgtExecutor 2.6a4 :
- aggiunte funzioni Exe e Lua SurfFrOffsetAdv per calcolare offset di una flat region creando una nuova superficie senza modificare quella di partenza.
2024-01-29 14:44:06 +01:00
Dario Sassi c5b2121bd5 EgtExecutor 2.6a3 :
- modifiche per Voronoi non più direttamente accessibile.
2024-01-29 09:30:19 +01:00
Dario Sassi 03785dcca3 EgtExecutor 2.6a2 :
- aggiunta ExeGetKeyAssLeftDays per avere il numero di giorni mancanti al termine dell'assistenza.
2024-01-25 18:20:31 +01:00
Dario Sassi b4eccf1f18 EgtExecutor :
- aggiunta funzione Exe e Lua LineCurveInters.
2024-01-17 13:22:34 +01:00
Dario Sassi c169329660 EgtExecutor :
- aggiunta funzione Exe e Lua ChangeMachGroupName.
2024-01-16 19:42:12 +01:00
Dario Sassi 94d76d3a68 EgtExecutor 2.6a1 :
- ricompilazione con cambio versione.
2024-01-16 15:14:05 +01:00
SaraP 511e74a4d9 EgtExecutor 2.5l7 :
- nelle funzioni Exe e Lua di OffsetCurveAdv e CreateSurfFatCurve aggiunto parametro opzionale di tolleranza lineare per gli offset.
2024-01-10 10:11:14 +01:00
Dario Sassi 24616b55b9 EgtExecutor 2.5l6 :
- aggiunta funzione ExeSetGridGeoAdv.
2024-01-09 18:30:50 +01:00
Dario Sassi 1a961a19af EgtExecutor 2.5l5 :
- aggiunta funzione Exe e Lua CAvToolPosBox
- agli import aggiunto log.
2024-01-02 15:58:34 +01:00
Dario Sassi 80a9b3a7bb EgtExecutor 2.5l4 :
- si scrive il log con le operazioni sui file di progetto (nuovo, apri, salva).
2023-12-29 13:04:57 +01:00
Dario Sassi b7bdbb41a7 EgtExecutor :
- aggiunta funzione lua EgtSurfTmFacetElevationInClosedSurfTm.
2023-12-18 09:30:27 +01:00
Dario Sassi 6fed5204ca EgtExecutor :
- funzione ExeDuploCountInRaw rinominata ExeDuploInRawCount
- aggiunta funzione lua EgtDuploInRawCount
- aggiunte funzioni Exe e Lua DuploWithoutRawList.
2023-12-14 20:25:24 +01:00
Dario Sassi 318529688d EgtExecutor 2.5l3 :
- aggiunta funzione Exe e Lua IsGhostPart
- aggiunta versione preliminare della funzione ExeDuploCountInRaw
- correzione su alcuni valori di ritorno di funzioni relative a MachMgr nel caso non ci sia il CurrMachMgr.
2023-12-14 12:00:30 +01:00
Dario Sassi d7711c3ec6 EgtExecutor :
- piccola miglioria a SurfTmGetEdges.
2023-12-11 14:58:40 +01:00
Dario Sassi 589a58e8db EgtExecutor 2.5l2 :
- aggiunta funzione Exe e Lua SurfTmGetEdges.
2023-12-11 10:24:34 +01:00
Dario Sassi 7a0e3ad388 EgtExecutor 2.5l1 :
- ricompilazione con cambio versione.
2023-12-01 16:49:54 +01:00
SaraP 55f695da98 EgtExecutor :
- piccola correzione nella gestione vettori di LuaSetInfo.
2023-11-30 16:00:24 +01:00
Riccardo Elitropi cac3224ff8 EgtExecutor :
- spostate le funzioni EgtPocketing e EgtGetSurfFrZigZagInfill in un documento a parte (EXE_GdbGetPocketing.cpp)
- aggiornati i parametri della funzione GetSurfFrZigZagInfill.
2023-11-29 12:00:25 +01:00
Dario Sassi 13bfd1a9ac Merge remote-tracking branch 'origin/master' 2023-11-28 10:58:52 +01:00
Dario Sassi b522f4cea2 EgtExecutor :
- a funzione ExeSurfTmFacetElevationInBBox aggiunto parametro bAcceptOutFacet (anche a corrispondente funzione lua come opzionale)
2023-11-28 10:57:40 +01:00
Riccardo Elitropi 7f2a8377bf EgtExecutor :
- modifica alla funzione EgtGetSurfFrZigZagInfill
- modificati i valori di ritorno per LuaPocketing.
2023-11-27 12:39:50 +01:00
Dario Sassi 68af08cf32 EgtExecutor :
- ExeCurveGetVoronoi e ExeCurveGetFatCurve spostate in Modify Curve
- aggiunta funzione ExeCurveGetMedialAxis usata da funzione Lua EgtCurveMedialAxisAdv.
2023-11-24 15:38:24 +01:00
Dario Sassi c200868c89 EgtExecutor :
- piccole sistemazioni post Vroni.
2023-11-24 12:52:56 +01:00
SaraP 688fc7ff89 EgtExecutor 2.5k6 :
- aggiunte funzioni Exe e Lua CurveGetVoronoi e CurveGetFatCurve.
2023-11-23 13:02:04 +01:00
Dario Sassi b82d9fa522 EgtExecutor 2.5k5 :
- aggiunta funzione ExeSetOnTerminateProcess per installare funzione di callback chiamata prima di terminare il processo con comando lua EgtCloseExe.
2023-11-23 10:49:13 +01:00
Dario Sassi 2a077e9102 EgtExecutor :
- in ExeProjectCurveOnSurfTm ai Vettori risultato aggiunta info Ind (indice di collegamento con gli estremi della curva risultato).
2023-11-22 20:26:51 +01:00
Riccardo Elitropi 7b3f8a02f9 EgtExecutor 2.5k4 :
- aggiunta funzione Exe e Lua Pocketing.
2023-11-20 11:57:28 +01:00
Dario Sassi de3cdb8a7f EgtExecutor :
- correzione alla funzione ExeSurfTmFacetElevationInBBox per il caso sia dato da un vertice.
2023-11-17 18:42:55 +01:00
Dario Sassi 16b8763c64 EgtExecutor :
- corretto commento.
2023-11-16 19:29:32 +01:00
Dario Sassi 5c4f32a6e8 EgtExecutor :
- aggiunta funzione Exe/Lua SurfTmFacetElevationInBBox.
2023-11-16 18:57:18 +01:00
Dario Sassi 15633ec6d7 EgtExecutor :
- modifiche per spostamento import/export da dll Exchange a dll Exch3dm.
2023-11-14 18:58:01 +01:00
SaraP e2c401cc4a EgtExecutor 2.5k3 :
- in CreateSurfFrFatCurve aggiunto parametro opzionale per distinguere squadratura cambi di direzione da squadratura estremi.
2023-11-14 15:08:04 +01:00
Dario Sassi 4f97c95a8d EgtExecutor :
- piccolo ritocco a scrittura funzione lua in log.
2023-11-14 09:36:59 +01:00
Daniele Bariletti 8723dab473 Merge branch 'master' of https://gitlab.steamware.net/egaltech/EgtExecutor 2023-11-13 17:13:04 +01:00
Daniele Bariletti af798840a5 EgtExecutor :
- correzione nella gestione dei layer nell'Import3dm.
2023-11-13 17:12:52 +01:00
Dario Sassi 51b388db06 EgtExecutor :
- piccole migliorie a Exe/Lua CreateSurfBezierLeaves.
2023-11-13 08:49:49 +01:00
Daniele Bariletti 246aa6e3ed EgtExecutor :
- rimosso l'argomento dScaleFactor da Import3dm.
2023-11-08 10:58:28 +01:00
Daniele Bariletti 26111453ee EgtExecutor 2.5k2 :
- cambio versione.
2023-11-08 08:49:06 +01:00
Daniele Bariletti 8dd2972a4b Merge branch '3dm_import+trim&mesh' 2023-11-08 08:48:41 +01:00
Dario Sassi ef75a2f912 EgtExecutor 2.5k1 :
- ricompilazione con cambio versione.
2023-11-03 17:24:07 +01:00
Dario Sassi 3d564e1be7 EgtExecutor 2.5j6 :
- aggiunte funzioni Exe/Lua GetClEntAxesVal e GetAllCurrAxesName
- modificate funzioni Exe/Lua FindToolInCurrSetup e GetClEntFlag.
2023-10-28 18:16:31 +02:00
Daniele Bariletti 91e3e1d370 EgtExecutor 2.5j5 :
- correzioni e aggiornamento dal master.
2023-10-25 09:58:28 +02:00
Dario Sassi bd1861ade0 EgtExecutor :
- sistemazione indentazione.
2023-10-24 14:43:13 +02:00
Dario Sassi 01c2b26a1e EgtExecutor :
- aggiornata ExeGetFileType per gestire estensione 3dm (file Rhino OpenNurbs).
2023-10-24 13:10:40 +02:00
SaraP 641566cd42 EgtExecutor :
- piccola correzione agli esportatori.
2023-10-24 11:31:45 +02:00
Daniele Bariletti 8c9544595d EgtExecutor 2.5j5 :
- aggiornamento versione.
2023-10-23 16:00:21 +02:00
Daniele Bariletti 84993c293a EgtExecutor :
- correzione minore.
2023-10-23 15:09:14 +02:00
Daniele Bariletti af2c3d0e7b EgtExecutor :
- formattazione del testo.
2023-10-23 15:01:41 +02:00
Daniele Bariletti f69116ea09 EgtExecutor :
- aggiunta dell'Export 3dm.
2023-10-23 14:32:57 +02:00
Daniele Bariletti 29a643e640 EgtExecutor :
- aggiunta la possibilità di mostrare la curva di trim sullo spazio
parametrico per una superficie di bezier.
2023-10-23 10:29:02 +02:00
Dario Sassi c0d456b6fb EgtExecutor 2.5j4 :
- aggiunta funzione lua EgtReplaceString.
2023-10-22 15:56:23 +02:00
SaraP 4d038461a1 EgtExecutor 2.5j3 :
- corretta gestione filtro in Export3MF.
2023-10-20 12:16:54 +02:00
SaraP 55184afcb5 EgtExecutor :
- corretto errore in CurveCurveInters nel caso di curva inesistente.
2023-10-17 14:39:26 +02:00
Daniele Bariletti 854d93eaec EgtExecutor :
- correzione minore a export 3dm.
2023-10-17 11:21:51 +02:00
Dario Sassi 8e11114e4f EgtExecutor 2.5j2 :
- modifica none EgtSurfTmSubtractProjectedFacesOnFace.
2023-10-11 08:31:56 +02:00
Riccardo Elitropi 06c5d68d8b EgtExecutor :
- rimozione parametro da ExeSurfTmSubtractProjectedFacesOnFace.
2023-10-10 13:36:28 +02:00
Dario Sassi 5ec4ed439f EgtExecutor 2.5j1 :
- riallineamento
- sistemazioni per chiave di rete esposta su Internet.
2023-10-09 13:07:33 +02:00
Riccardo Elitropi 206f3bdf61 EgtExecutor 2.5j1 :
- aggiunta funzione Exe e Lua SubtractProjectedFacesOnStmFace
- aggiunta di un parametro opzionale per Exe e Lua GetSilhouette.
2023-10-04 12:19:48 +02:00
Daniele Bariletti 8602b78f21 EgtExecutor :
- aggiunte funzioni per l'Export 3dm.
2023-10-02 09:33:44 +02:00
Daniele Bariletti 626e24e150 EgtExecutor :
- aggiunta del 3dm Export.
2023-09-21 17:05:04 +02:00
Dario Sassi 2b65121551 EgtExecutor 2.5i5 :
- ricompilazione a 64bit con Enable Enhanced Instruction Set = Not Set.
2023-09-21 15:24:31 +02:00
Daniele Bariletti 6b3ab7e9b0 EgtExecutor :
- introdotto l'uso della grafica di default per gli ExtDim
importati da 3dm.
2023-09-21 14:41:51 +02:00
Daniele Bariletti 9e725f3feb EgtExecutor :
- correzione minore.
2023-09-18 11:47:19 +02:00
Daniele Bariletti d7db0a2d45 Merge branch 'master' into ExtDimension_angular 2023-09-18 11:46:26 +02:00
Dario Sassi 2794f35805 EgtExecutor :
- aggiunte funzioni Exe e Lua CreateSurfTmTriangle e CreateSurfTmRectangle
- in Copy, CopyGlob, Relocate e RelocateGlob RefId ora accetta anche valori simbolici (layer corrente, ..).
2023-09-18 08:14:36 +02:00
Dario Sassi 1259955522 EgtExecutor 2.5i1 :
- aggiunta funzione Exe e Lua ProjectCurveOnSurfTm.
2023-09-11 10:44:47 +02:00
Daniele Bariletti 7eb557ad32 Merge branch 'Bezier_trim&mesh' into 3dm_import 2023-09-05 09:07:04 +02:00
Daniele Bariletti 4de367395a Merge remote-tracking branch 'origin/master' into 3dm_import 2023-08-29 13:00:21 +02:00
Dario Sassi d9cf624458 EgtExecutor 2.5h3 :
- aggiunte funzioni Exe e Lua CopyMachGroup.
2023-08-27 18:30:48 +02:00
Dario Sassi eedd2068fa EgtExecutor 2.5h2 :
- aggiunta funzione lua EgtPointCurveDistSide.
2023-08-11 11:29:21 +02:00
Dario Sassi cf2b1742a0 EgtExecutor 2.5h1 :
- aggiunta funzione ExeCreateArc2PB e Lua EgtArc2PB (per costruzione arco con 2 punti e bulge).
2023-08-04 13:22:23 +02:00
Daniele Bariletti 29462e9536 Merge branch 'master' into 3dm_import 2023-08-03 11:24:56 +02:00
Daniele Bariletti 7e7975c622 EgtExecutor :
- aggiunto l'import dei file 3dm.
2023-08-03 11:24:02 +02:00
DarioS 85c4af98ce EgtExecutor 2.5g3 :
- piccole sistemazioni varie.
2023-07-28 11:23:20 +02:00
DarioS 382138e6c5 EgtExecutor :
- piccola miglioria.
2023-07-19 09:53:40 +02:00
DarioS 749830aba9 EgtExecutor :
- aggiunto Dump di Stipple (quando presente).
2023-07-10 11:16:59 +02:00
DarioS 90449cad40 EgtExecutor 2.5g1 :
- aggiunte funzioni Exe e Lua SurfTmVertexCount, SurfTmGetVertex, SurfTmGetNearestVertex, SurfTmGetAllVertInFacet e SurfTmMoveVertex.
2023-07-07 17:07:16 +02:00
DarioS 3d3900b39a EgtExecutor 2.5f3 :
- dove possibile e sicuro sostituiti dynamic_cast con static_cast.
2023-06-30 11:55:16 +02:00
Daniele Bariletti e989b88dd4 Merge remote-tracking branch 'origin/HEAD' into Bezier_trim&mesh 2023-06-21 09:36:55 +02:00
Daniele Bariletti 4b58f4f522 EgtExecutor :
- aggiunta funzione per il trim delle superfici di Bezier
- aggiunta funzione per vedere la divione di in celle di una superficie
di Bezier durante la costruzione della trimesh (per debug).
2023-06-21 09:36:41 +02:00
DarioS 1620054970 EgtExecutor 2.5f2 :
- aggiunte funzioni Exe e Lua CDeSolidSolid.
2023-06-19 08:10:17 +02:00
DarioS 7d3bec9f44 EgtExecutor 2.6f1 :
- estesa gestione LockId
- passato nuovo parametro LockId a EgtConverter.
2023-06-05 08:11:36 +02:00
DarioS 150b35bb9e EgtExecutor :
- alla chiusura di Executor si rilascia eventuale chiave di rete.
2023-05-30 17:09:20 +02:00
DarioS 173728605d EgtExecutor 2.5e5 :
- migliorato controllo gestione chiave di rete.
2023-05-30 10:28:53 +02:00
DarioS d069b33424 EgtExecutor 2.5e3 :
- il SerialNumber della chiave è ricavato solo per chiavi USB.
2023-05-26 08:42:05 +02:00
DarioS 4642188fd6 EgtExecutor 2.5e2 :
- se disabilitato UI esco subito da ExeDraw (evito verificare esistenza scena che poi non uso).
2023-05-04 17:05:22 +02:00
DarioS e3530f6e90 EgtExecutor 2.5e1 :
- ricompilazione per aggiornamento lua.
2023-05-03 09:46:05 +02:00
Daniele Bariletti fb388799ea EgtExecutor :
- modifica minore alle quote angolari.
2023-04-19 17:21:53 +02:00
Daniele Bariletti f6915d80fa EgtExecutor :
- modifica minore alle quote angolari.
2023-04-14 10:06:08 +02:00
Daniele Bariletti d412ce65cd EgtExecutor :
- aggiustamenti alle quote angolari.
2023-04-14 09:46:03 +02:00
Daniele Bariletti 61824a24ab Merge remote-tracking branch 'origin/master' into ExtDimension_angular 2023-04-12 10:43:11 +02:00
DarioS 88fc7e6eee EgtExecutor 2.5d3 :
- sistemate quote radiali e anolari, rimangono da sistemare quelle angolari.
2023-04-11 19:37:42 +02:00
DarioS 964a02eae4 Merge remote-tracking branch 'origin/ExtDimension_angular' 2023-04-08 11:42:53 +02:00
Daniele Bariletti dd5c8ebdd1 EgtExecutor :
- aggiunte funzioni Exe e Lua per quotature angolari, radiali e diametrali.
2023-03-31 14:55:45 +02:00
Daniele Bariletti 34885e1f2a Merge remote-tracking branch 'origin/master' into ExtDimension_angular 2023-03-31 14:53:43 +02:00
DarioS 8000a9d3a5 EgtExecutor 2.5c2 :
- aggiunti file Icarus con estensione .icrs alla famiglia dei file Nge.
2023-03-30 10:38:40 +02:00
DarioS 7963b9befe EgtExecutor 2.5c1 :
- ricompilazione con cambio versione.
2023-03-23 10:04:07 +01:00
DarioS 2394dfc404 EgtExecutor :
- a ExeLuaExecFile aggiunto parametro opzionale bLogInfo = true.
2023-02-27 17:04:53 +01:00
DarioS 081c3fcb78 EgtExecutor 2.5b4 :
- ricompilazione con cambio versione.
2023-02-27 08:17:18 +01:00
DarioS 002e736ec4 EgtExecutor 2.5b3 :
- ricompilazione con cambio versione.
2023-02-20 09:16:18 +01:00
DarioS 415a761039 EgtExecutor 2.5b2 :
- aggiunta funzione Lua EgtCloseExe per terminare l'eseguibile.
2023-02-18 09:52:32 +01:00
DarioS 8f596cab5a EgtExecutor 2.5b1 :
- ricompilazione con cambio versione.
2023-02-10 11:27:04 +01:00
DarioS 37dc8b8a7b EgtExecutor 2.5a6 :
- aggiunte funzioni Lua EgtCreateMutex e EgtReleaseMutex.
2023-02-06 08:13:01 +01:00
SaraP 06e9f85a4b EgtExecutor :
- modifica funzione CurveCurveInters per renderla analoga alle altre funzioni di intersezione.
2023-02-01 09:36:20 +01:00
SaraP 4f42606cd3 EgtExecutor 2.5a5 :
- aggiunta funzione Exe e Lua CurveCurveInters.
2023-01-31 15:35:43 +01:00
DarioS baa8eb42b6 EgtExecutor 2.5a4 :
- aggiunta funzione Exe e Lua GetAllInfo.
2023-01-30 09:39:29 +01:00
DarioS b1a11c4eaf EgtExecutor 2.5a3 :
- aggiunta funzione ExeMessageBox.
2023-01-17 11:29:59 +01:00
DarioS 553efdec1b EgtExecutor 2.5a2 :
- aggiunto parametro nFilter a tutte le funzioni di esportazione.
2023-01-11 14:51:16 +01:00
DarioS bc8171c4ba EgtExecutor :
- aggiornamenti per lua 5.4.
2023-01-09 10:11:47 +01:00
DarioS 63b82fe556 EgtExecutor 2.5a1 :
- ricompilazione con cambio versione.
2023-01-03 08:53:11 +01:00
DarioS 9d4b181e1b EgtExecutor :
- modifiche per più utensili in virtual milling di Zmap.
2022-12-28 19:39:37 +01:00
SaraP 65cf39c56a EgtExecutor 2.4l3 :
- migliorie alla funzione SpiralizeCurveAlongGuide.
2022-12-28 14:19:33 +01:00
DarioS 2ba94e5dc1 EgtExecutor 2.4l2 :
- aggiunte funzioni Exe e Lua CurveCompoLength.
2022-12-12 14:42:45 +01:00
DarioS 617023edb6 EgtExecutor 2.4l1 :
- ricompilazione con cambio versione.
2022-12-05 08:13:44 +01:00
SaraP e2405d10c5 EgtExecutor 2.4k4 :
- aggiunte funzioni Exe e Lua SpiralizeCurveAlongGuide
- rinominate funzioni SpiralizeCurve in SpiralizeCurveAlongExtrusion.
2022-12-01 11:25:30 +01:00
DarioS 432810452c EgtExecutor 2.4k3 :
- in ExeApproxCurve aggiunta eliminazione difetti di tipo SmallZ.
2022-11-14 08:38:23 +01:00
DarioS 0a7369bfcc EgtExecutor :
- aggiunte funzioni ExeBeamShowFacesName e ExeBeamShowLoadingSide.
2022-11-08 16:42:07 +01:00
DarioS 3c0d89e3ab EgtExecutor :
- in ExeApproxSurface per semplificare la trimesh inserita DoCompacting (da migliorare con vere funzioni di semplificazione).
2022-11-06 20:08:56 +01:00
DarioS 00c0e216b7 EgtExecutor 2.4k2 :
- aggiunta funzione Exe e Lua ApproxSurface.
2022-11-04 19:21:17 +01:00
DarioS a200549542 EgtExecutor 2.4k1 :
- aggiunte funzioni Exe e Lua CreateSurfTmRectSwept.
2022-11-02 15:13:23 +01:00
DarioS d4cfe31b6f EgtExecutor :
- in ExeApplyAllMachiningsEx ora si forza sempre il ricalcolo di DispositionSpecialApply (equivalente di PostApply delle lavorazioni).
2022-10-27 11:02:26 +02:00
DarioS ad6673330d EgtExecutor 2.4j4 :
- aggiunte funzioni Exe e Lua SurfIsClosed e SurfTmPartCount.
2022-10-26 18:05:17 +02:00
DarioS 00f52ca6ab EgtExecutor 2.4j3 :
- modifiche per export ThreeJS.
2022-10-24 08:38:57 +02:00
Riccardo Elitropi 8dc6cce243 Merge commit '7f1861b2e979654f1a0cc4f35ca12c3fd04bd332' 2022-10-20 16:23:13 +02:00
DarioS 3309939aed EgtExecutor 2.4j2 :
- in ImportAdvanced si aggiorna FilePath solo se vuota (come con altri formati).
2022-10-14 19:00:24 +02:00
SaraP d646331746 EgtExecutor 2.4j1 :
- aggiunte funzioni Exe e Lua SpiralizeCurve.
2022-10-11 16:07:08 +02:00
DarioS 8192bd0feb EgtExecutor 2.4i7 :
- aggiunta funzione Exe e Lua SurfTmToTriangles.
2022-10-11 12:28:47 +02:00
64 changed files with 7362 additions and 1308 deletions
+181
View File
@@ -0,0 +1,181 @@
//----------------------------------------------------------------------------
// EgalTech 2023-2023
//----------------------------------------------------------------------------
// File : DllExch3dm.cpp Data : 14.11.23 Versione : 2.5k2
// Contenuto : Funzioni di gestione della libreria opzionale EgtExch3dme.
//
//
//
// Modifiche : 14.11.23 DS Creazione modulo.
//
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "EXE.h"
#include "DllExch3dm.h"
#include "/EgtDev/Include/EE3DllMain.h"
#define NOMINMAX
#include <windows.h>
using namespace std ;
//-----------------------------------------------------------------------------
// Nome della libreria
#if defined( _WIN64) && defined( _DEBUG)
static const wchar_t* EE3_NAME = L"EgtExch3dmD64.dll" ;
#elif defined( _WIN64)
static const wchar_t* EE3_NAME = L"EgtExch3dmR64.dll" ;
#elif defined( _WIN32) && defined( _DEBUG)
static const wchar_t* EE3_NAME = L"EgtExch3dmD32.dll" ;
#else
static const wchar_t* EE3_NAME = L"EgtExch3dmR32.dll" ;
#endif
// Nome delle funzioni caricate
static const char* EE3_SETEE3LOGGER = "SetEE3Logger" ;
static const char* EE3_GETEE3VERSION = "GetEE3Version" ;
static const char* EE3_SETEE3KEY = "SetEE3Key" ;
static const char* EE3_SETEE3NETHWKEY = "SetEE3NetHwKey" ;
static const char* EE3_CREATEIMPORT3DM = "CreateImport3dm" ;
static const char* EE3_CREATEEXPORT3DM = "CreateExport3dm" ;
//-----------------------------------------------------------------------------
HMODULE s_hEE3 = nullptr ;
//-----------------------------------------------------------------------------
bool
LoadExch3dmDll( ILogger* pLogger, const string& sKey, bool bNetHwKey)
{
// verifico la chiave
if ( ! TestKeyForEE3( sKey, 0, pLogger)) {
FreeExch3dmDll() ;
return false ;
}
// se già caricata
if ( s_hEE3 != nullptr)
return true ;
// carico la libreria EgtExch3dm
s_hEE3 = LoadLibrary( EE3_NAME) ;
if ( s_hEE3 == nullptr)
return false ;
// imposto logger
MySetEE3Logger( pLogger) ;
// imposto i codici della chiave
MySetEE3Key( sKey) ;
// imposto eventuale chiave di rete
MySetEE3NetHwKey( bNetHwKey) ;
return true ;
}
//-----------------------------------------------------------------------------
bool
FreeExch3dmDll( void)
{
// se non è già caricata
if ( s_hEE3 == nullptr)
return true ;
// libero la libreria EgtExch3dm
FreeLibrary( s_hEE3) ;
s_hEE3 = nullptr ;
return true ;
}
//-----------------------------------------------------------------------------
bool
IsLoadedExch3dmDll( void)
{
return ( s_hEE3 != nullptr) ;
}
//-----------------------------------------------------------------------------
void
MySetEE3Logger( ILogger* pLogger)
{
// verifico caricamento libreria EgtExch3dm
if ( s_hEE3 == nullptr)
return ;
// recupero funzione che imposta il logger
typedef void (* PF_SetEE3Logger) ( ILogger* pLogger) ;
PF_SetEE3Logger pFun = (PF_SetEE3Logger)GetProcAddress( s_hEE3, EE3_SETEE3LOGGER) ;
if ( pFun == nullptr)
return ;
pFun( pLogger) ;
}
//-----------------------------------------------------------------------------
const char*
MyGetEE3Version( void)
{
// verifico caricamento libreria EgtExch3dm
if ( s_hEE3 == nullptr)
return "" ;
// recupero funzione che restituisce la versione della libreria
typedef const char* (* PF_GetEE3Version) ( void) ;
PF_GetEE3Version pFun = (PF_GetEE3Version)GetProcAddress( s_hEE3, EE3_GETEE3VERSION) ;
if ( pFun == nullptr)
return "" ;
return pFun() ;
}
//-----------------------------------------------------------------------------
void
MySetEE3Key( const string& sKey)
{
// verifico caricamento libreria EgtExch3dm
if ( s_hEE3 == nullptr)
return ;
// recupero funzione che imposta i codici di protezione
typedef void (* PF_SetEE3Key) ( const string& sKey) ;
PF_SetEE3Key pFun = (PF_SetEE3Key)GetProcAddress( s_hEE3, EE3_SETEE3KEY) ;
if ( pFun == nullptr)
return ;
pFun( sKey) ;
}
//-----------------------------------------------------------------------------
void
MySetEE3NetHwKey( bool bNetHwKey)
{
// verifico caricamento libreria EgtExch3dm
if ( s_hEE3 == nullptr)
return ;
// recupero funzione che imposta il flag per chiave di rete
typedef void (* PF_SetEE3NetHwKey) ( bool bNetHwKey) ;
PF_SetEE3NetHwKey pFun = (PF_SetEE3NetHwKey)GetProcAddress( s_hEE3, EE3_SETEE3NETHWKEY) ;
if ( pFun == nullptr)
return ;
pFun( bNetHwKey) ;
}
//-----------------------------------------------------------------------------
IImport3dm*
MyCreateImport3dm( void)
{
// verifico caricamento libreria EgtExch3dm
if ( s_hEE3 == nullptr)
return nullptr ;
// recupero funzione creazione oggetto
typedef IImport3dm* (* PF_CreateImport3dm) ( void) ;
PF_CreateImport3dm pFun = (PF_CreateImport3dm)GetProcAddress( s_hEE3, EE3_CREATEIMPORT3DM) ;
if ( pFun == nullptr)
return nullptr ;
return pFun() ;
}
//-----------------------------------------------------------------------------
IExport3dm*
MyCreateExport3dm( void)
{
// verifico caricamento libreria EgtExch3dm
if ( s_hEE3 == nullptr)
return nullptr ;
// recupero funzione creazione oggetto
typedef IExport3dm* (* PF_CreateExport3dm) ( void) ;
PF_CreateExport3dm pFun = (PF_CreateExport3dm)GetProcAddress( s_hEE3, EE3_CREATEEXPORT3DM) ;
if ( pFun == nullptr)
return nullptr ;
return pFun() ;
}
+31
View File
@@ -0,0 +1,31 @@
//----------------------------------------------------------------------------
// EgalTech 2023-2023
//----------------------------------------------------------------------------
// File : DllExch3dm.h Data : 14.11.23 Versione : 2.5k3
// Contenuto : Dichiarazioni funzioni per libreria opzionale EgtExchange.
//
//
//
// Modifiche : 14.11.23 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
#pragma once
#include <string>
class ILogger ;
class IImport3dm ;
class IExport3dm ;
//----------------------------------------------------------------------------
bool LoadExch3dmDll( ILogger* pLogger, const std::string& sKey, bool bNetHwKey) ;
bool FreeExch3dmDll( void) ;
bool IsLoadedExch3dmDll( void) ;
void MySetEE3Logger( ILogger* pLogger) ;
void MySetEE3Key( const std::string& sKey) ;
void MySetEE3NetHwKey( bool bNetHwKey) ;
const char* MyGetEE3Version( void) ;
IImport3dm* MyCreateImport3dm( void) ;
IExport3dm* MyCreateExport3dm( void) ;
+36 -35
View File
@@ -10,6 +10,8 @@
// 03.07.18 DS Aggiunto ImportPnt.
// 15.09.19 DS Aggiunto ExportSvg.
// 14.12.20 DS Aggiunto ImportBtlx.
// 23.10.23 DB Aggiunto Export3dm.
// 07.11.23 DB Aggiunto Import3dm.
//
//----------------------------------------------------------------------------
@@ -40,7 +42,6 @@ static const char* EEX_GETEEXVERSION = "GetEExVersion" ;
static const char* EEX_SETEEXKEY = "SetEExKey" ;
static const char* EEX_SETEEXNETHWKEY = "SetEExNetHwKey" ;
static const char* EEX_SETBTLAUXDIR = "SetBtlAuxDir" ;
static const char* EEX_SETTHREEJSAUXDIR = "SetThreeJSAuxDir" ;
static const char* EEX_CREATEBEAMMGR = "CreateBeamMgr" ;
static const char* EEX_CREATEIMPORTBTL = "CreateImportBtl" ;
static const char* EEX_CREATEIMPORTBTLX = "CreateImportBtlx" ;
@@ -53,8 +54,9 @@ static const char* EEX_CREATEIMPORT3MF = "CreateImport3MF" ;
static const char* EEX_CREATEEXPORTDXF = "CreateExportDxf" ;
static const char* EEX_CREATEEXPORTSTL = "CreateExportStl" ;
static const char* EEX_CREATEEXPORT3MF = "CreateExport3MF" ;
static const char* EEX_CREATEEXPORTTHREEJS = "CreateExportThreeJS" ;
static const char* EEX_CREATEEXPORTSVG = "CreateExportSvg" ;
static const char* EEX_SETTHREEJSLIBDIR = "SetThreeJSLibDir" ;
static const char* EEX_CREATEEXPORTTHREEJS = "CreateExportThreeJS" ;
static const char* EEX_CREATEEEXEXECUTOR = "CreateExcExecutor" ;
@@ -70,7 +72,7 @@ LoadExchangeDll( ILogger* pLogger, const string& sKey, bool bNetHwKey)
FreeExchangeDll() ;
return false ;
}
// se già caricata
// se già caricata
if ( s_hEEx != nullptr)
return true ;
// carico la libreria EgtExchange
@@ -90,7 +92,7 @@ LoadExchangeDll( ILogger* pLogger, const string& sKey, bool bNetHwKey)
bool
FreeExchangeDll( void)
{
// se non è già caricata
// se non è già caricata
if ( s_hEEx == nullptr)
return true ;
// libero la libreria EgtExchange
@@ -181,22 +183,6 @@ MySetBtlAuxDir( const string& sBtlAuxDir)
return pFun( sBtlAuxDir) ;
}
//-----------------------------------------------------------------------------
bool
MySetThreeJSAuxDir( const string& sThreeJSAuxDir )
{
// verifico caricamento libreria EgtExchange
if ( s_hEEx == nullptr)
return false ;
// recupero funzione creazione oggetto
typedef bool ( *PF_SetThreeJSAuxDir)( const string& sThreeJSAuxDir) ;
PF_SetThreeJSAuxDir pFun = ( PF_SetThreeJSAuxDir) GetProcAddress( s_hEEx, EEX_SETTHREEJSAUXDIR) ;
if ( pFun == nullptr)
return false ;
return pFun( sThreeJSAuxDir) ;
}
//-----------------------------------------------------------------------------
IBeamMgr*
MyCreateBeamMgr( void)
@@ -377,21 +363,6 @@ MyCreateExport3MF( void)
return pFun() ;
}
//-----------------------------------------------------------------------------
IExportThreeJS*
MyCreateExportThreeJS( void)
{
// verifico caricamento libreria EgtExchange
if ( s_hEEx == nullptr)
return nullptr ;
// recupero funzione creazione oggetto
typedef IExportThreeJS* (* PF_CreateExportThreeJS) ( void) ;
PF_CreateExportThreeJS pFun = (PF_CreateExportThreeJS)GetProcAddress( s_hEEx, EEX_CREATEEXPORTTHREEJS) ;
if ( pFun == nullptr)
return nullptr ;
return pFun() ;
}
//-----------------------------------------------------------------------------
IExportSvg*
MyCreateExportSvg( void)
@@ -407,6 +378,36 @@ MyCreateExportSvg( void)
return pFun() ;
}
//-----------------------------------------------------------------------------
bool
MySetThreeJSLibDir( const string& sThreeJSLibDir)
{
// verifico caricamento libreria EgtExchange
if ( s_hEEx == nullptr)
return false ;
// recupero funzione creazione oggetto
typedef bool ( *PF_SetThreeJSLibDir)( const string& sThreeJSLibDir) ;
PF_SetThreeJSLibDir pFun = ( PF_SetThreeJSLibDir) GetProcAddress( s_hEEx, EEX_SETTHREEJSLIBDIR) ;
if ( pFun == nullptr)
return false ;
return pFun( sThreeJSLibDir) ;
}
//-----------------------------------------------------------------------------
IExportThreeJS*
MyCreateExportThreeJS( void)
{
// verifico caricamento libreria EgtExchange
if ( s_hEEx == nullptr)
return nullptr ;
// recupero funzione creazione oggetto
typedef IExportThreeJS* (* PF_CreateExportThreeJS) ( void) ;
PF_CreateExportThreeJS pFun = (PF_CreateExportThreeJS)GetProcAddress( s_hEEx, EEX_CREATEEXPORTTHREEJS) ;
if ( pFun == nullptr)
return nullptr ;
return pFun() ;
}
//-----------------------------------------------------------------------------
IExcExecutor*
MyCreateExcExecutor( void)
+1 -1
View File
@@ -41,7 +41,6 @@ void MySetEExKey( const std::string& sKey) ;
void MySetEExNetHwKey( bool bNetHwKey) ;
const char* MyGetEExVersion( void) ;
bool MySetBtlAuxDir( const std::string& sBtlAuxDir) ;
bool MySetThreeJSAuxDir( const std::string& sThreeJSAuxDir) ;
IBeamMgr* MyCreateBeamMgr( void) ;
IImportBtl* MyCreateImportBtl( void) ;
IImportBtlx* MyCreateImportBtlx( void) ;
@@ -54,6 +53,7 @@ IImport3MF* MyCreateImport3MF( void) ;
IExportDxf* MyCreateExportDxf( void) ;
IExportStl* MyCreateExportStl( void) ;
IExport3MF* MyCreateExport3MF( void) ;
bool MySetThreeJSLibDir( const std::string& sThreeJSLibDir) ;
IExportThreeJS* MyCreateExportThreeJS( void) ;
IExportSvg* MyCreateExportSvg( void) ;
IExcExecutor* MyCreateExcExecutor(void) ;
+8 -1
View File
@@ -45,8 +45,15 @@ HMODULE s_hENs = nullptr ;
//-----------------------------------------------------------------------------
bool
LoadNestingDll( ILogger* pLogger, const string& sKey, const string& sKey2)
LoadNestingDll( ILogger* pLogger, const string& sKey, const string& sKey2, bool bNetHwKey)
{
// non ammessa con chiave di rete
if ( bNetHwKey) {
std::string sErr = "Warning on Key (ENS/NET)" ;
LOG_ERROR( pLogger, sErr.c_str()) ;
FreeNestingDll() ;
return false ;
}
// verifico la chiave
if ( ! TestKeyForENs( sKey, 0, pLogger)) {
FreeNestingDll() ;
+1 -1
View File
@@ -19,7 +19,7 @@ class ILogger ;
class IAutoNester ;
//----------------------------------------------------------------------------
bool LoadNestingDll( ILogger* pLogger, const std::string& sKey, const std::string& sKey2) ;
bool LoadNestingDll( ILogger* pLogger, const std::string& sKey, const std::string& sKey2, bool bNetHwKey) ;
bool FreeNestingDll( void) ;
bool IsLoadedNestingDll( void) ;
void MySetENsLogger( ILogger* pLogger) ;
+7 -2
View File
@@ -1,7 +1,7 @@
//----------------------------------------------------------------------------
// EgalTech 2014-2015
// EgalTech 2014-2023
//----------------------------------------------------------------------------
// File : EXE.h Data : 05.05.15 Versione : 1.6e2
// File : EXE.h Data : 05.02.23 Versione : 2.5a6
// Contenuto : Dichiarazioni locali per moduli EXE.
//
//
@@ -25,6 +25,7 @@ const std::string& ExeGetIniFile( void) ;
//----------------------------------------------------------------------------
const std::string& ExeGetKey( void) ;
const std::string& ExeGetNestKey( void) ;
const std::string& ExeGetLockId( void) ;
//----------------------------------------------------------------------------
ILogger* GetLogger( void) ;
@@ -38,3 +39,7 @@ bool ExeInsertMachMgr( int nInsGrp) ;
//----------------------------------------------------------------------------
bool ExeIsDuploBase( IGeomDB* pGeomDB, int nId) ;
bool ExeInsertDuplo( int nInsGrp) ;
//----------------------------------------------------------------------------
bool ExeCreateMutex( const std::string& sMutexName) ;
bool ExeReleaseMutex( void) ;
+20
View File
@@ -148,6 +148,26 @@ ExeBeamGetSideData( int nSide, Frame3d& frRef, double& dLength, double& dWidth,
return pBeamMgr->GetSideData( nSide, frRef, dLength, dWidth, dHeight) ;
}
//-----------------------------------------------------------------------------
bool
ExeBeamShowFacesName( bool bShow)
{
IBeamMgr* pBeamMgr = GetCurrBeamMgr() ;
VERIFY_BEAMMGR( pBeamMgr, false)
// imposto la visualizzazione delle facce sul pezzo corrente
return pBeamMgr->ShowFacesName( bShow) ;
}
//-----------------------------------------------------------------------------
bool
ExeBeamShowLoadingSide( bool bShow, bool bFromLeft)
{
IBeamMgr* pBeamMgr = GetCurrBeamMgr() ;
VERIFY_BEAMMGR( pBeamMgr, false)
// imposto la visualizzazione del lato di carico sotto il pezzo corrente
return pBeamMgr->ShowLoadingSide( bShow, bFromLeft) ;
}
//-----------------------------------------------------------------------------
int
ExeBeamAddProcess( int nGroup, int nProc, int nSide, const string& sDes, int nProcId,
+23
View File
@@ -22,6 +22,7 @@
#include "/EgtDev/Include/EXeConst.h"
#include "/EgtDev/Include/EGkCurve.h"
#include "/EgtDev/Include/EGkCurveComposite.h"
#include "/EgtDev/Include/EGkStmStandard.h"
#include "/EgtDev/Include/EGkCAvToolSurfTm.h"
#include "/EgtDev/Include/EgtNumUtils.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
@@ -98,6 +99,28 @@ ExeCAvGetToolOutline( int nDestGrpId, bool bApprox)
return nId ;
}
//----------------------------------------------------------------------------
double
ExeCAvToolPosBox( const Point3d& ptP, const Vector3d& vtAx, const BBox3d& b3Box, const Vector3d& vtMove)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// creo la superficie TriMesh
PtrOwner<ISurfTriMesh> pStm( GetSurfTriMeshBox( b3Box.GetDimX(), b3Box.GetDimY(), b3Box.GetDimZ())) ;
if ( IsNull( pStm))
return -1 ;
pStm->Translate( b3Box.GetMin() - ORIG) ;
// verifico oggetto per evitare collisioni
if ( IsNull( s_pCAvTlStm))
return -1 ;
// imposto dati
s_pCAvTlStm->SetSurfTm( *pStm) ;
double dMove ;
if ( ! s_pCAvTlStm->TestPosition( ptP, vtAx, vtMove, dMove))
return -1 ;
return dMove ;
}
//----------------------------------------------------------------------------
double
ExeCAvToolPosStm( const Point3d& ptP, const Vector3d& vtAx, int nSurfTmId, const Vector3d& vtMove, int nRefType)
+86 -12
View File
@@ -1,9 +1,9 @@
//----------------------------------------------------------------------------
// 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
// Objects e Closed SurftriMesh.
// Objects e Solidi (Closed SurftriMesh e Zmap).
//
//
// Modifiche : 09.01.20 DS Creazione modulo.
@@ -25,7 +25,9 @@
#include "/EgtDev/Include/EGkCDeCylClosedSurfTm.h"
#include "/EgtDev/Include/EGkCDeConeFrustumClosedSurfTm.h"
#include "/EgtDev/Include/EGkCDeSpheClosedSurfTm.h"
#include "/EgtDev/Include/EGkCDeClosedSurfTmClosedSurfTm.h"
#include "/EgtDev/Include/EGkVolZmap.h"
#include "/EgtDev/Include/EGkSurfLocal.h"
#include "/EgtDev/Include/EGkStringUtils3d.h"
using namespace std ;
@@ -47,7 +49,7 @@ MyCDeBoxClosedSurfTm( const Frame3d& frBox, const Vector3d& vtDiag, int nSurfTmI
// porto in locale alla superficie il riferimento del box (il vettore è già in questo stesso riferimento)
Frame3d frBoxL = GetFrameLocal( pGeomDB, frBox, nRefType, frSurf) ;
// verifico la collisione
return ( CDeBoxClosedSurfTm( frBoxL, vtDiag, dSafeDist, *pStm) ? 1 : 0) ;
return ( CDeBoxClosedSurfTm( frBoxL, vtDiag, *pStm, dSafeDist) ? 1 : 0) ;
}
//----------------------------------------------------------------------------
@@ -67,7 +69,7 @@ MyCDeBoxVolZmap( const Frame3d& frBox, const Vector3d& vtDiag, int nZmapId, doub
// porto in locale il riferimento (il vettore è già in locale a questo stesso riferimento)
Frame3d frBoxL = GetFrameLocal( pGeomDB, frBox, nRefType, frLoc) ;
// verifico la collisione
return ( pVZM->AvoidBox( frBoxL, vtDiag, dSafeDist) ? 0 : 1) ;
return ( pVZM->CDeBox( frBoxL, vtDiag, dSafeDist, false) ? 1 : 0) ;
}
//----------------------------------------------------------------------------
@@ -116,7 +118,7 @@ MyCDeRectPrismoidClosedSurfTm( const Frame3d& frPrismoid, double dBaseLenX, doub
// porto in locale alla superficie il riferimento del prismoide rettangolare
Frame3d frPrismoidL = GetFrameLocal( pGeomDB, frPrismoid, nRefType, frSurf) ;
// verifico la collisione
return ( CDeRectPrismoidClosedSurfTm( frPrismoidL, dBaseLenX, dBaseLenY, dTopLenX, dTopLenY, dHeight, dSafeDist, *pStm) ? 1 : 0) ;
return ( CDeRectPrismoidClosedSurfTm( frPrismoidL, dBaseLenX, dBaseLenY, dTopLenX, dTopLenY, dHeight, *pStm, dSafeDist) ? 1 : 0) ;
}
//----------------------------------------------------------------------------
@@ -138,7 +140,7 @@ MyCDeRectPrismoidVolZmap( const Frame3d& frPrismoid, double dBaseLenX, double dB
// porto in locale il riferimento (il vettore è già in locale a questo stesso riferimento)
Frame3d frPrismoidL = GetFrameLocal( pGeomDB, frPrismoid, nRefType, frLoc) ;
// verifico la collisione
return ( pVZM->AvoidRectPrismoid( frPrismoidL, dBaseLenX, dBaseLenY, dTopLenX, dTopLenY, dHeight, dSafeDist) ? 0 : 1) ;
return ( pVZM->CDeRectPrismoid( frPrismoidL, dBaseLenX, dBaseLenY, dTopLenX, dTopLenY, dHeight, dSafeDist, false) ? 1 : 0) ;
}
//----------------------------------------------------------------------------
@@ -191,7 +193,7 @@ MyCDeCylClosedSurfTm( const Frame3d& frCyl, double dR, double dH, int nSurfTmId,
// porto in locale alla superficie il riferimento del cilindro
Frame3d frCylL = GetFrameLocal( pGeomDB, frCyl, nRefType, frSurf) ;
// verifico la collisione
return ( CDeCylClosedSurfTm( frCylL, dR, dH, dSafeDist, *pStm) ? 1 : 0) ;
return ( CDeCylClosedSurfTm( frCylL, dR, dH, *pStm, dSafeDist) ? 1 : 0) ;
}
//----------------------------------------------------------------------------
@@ -211,7 +213,7 @@ MyCDeCylVolZmap( const Frame3d& frCyl, double dR, double dH, int nZmapId, double
// porto in locale il riferimento
Frame3d frCylL = GetFrameLocal( pGeomDB, frCyl, nRefType, frLoc) ;
// verifico la collisione
return ( pVZM->AvoidCylinder( frCylL, dR, dH, dSafeDist) ? 0 : 1) ;
return ( pVZM->CDeCylinder( frCylL, dR, dH, dSafeDist, false) ? 1 : 0) ;
}
//----------------------------------------------------------------------------
@@ -259,7 +261,7 @@ MyCDeConeClosedSurfTm( const Frame3d& frCone, double dR1, double dR2, double dH,
// porto in locale alla superficie il riferimento del cilindro
Frame3d frConeL = GetFrameLocal( pGeomDB, frCone, nRefType, frSurf) ;
// verifico la collisione
return ( CDeConeFrustumClosedSurfTm( frConeL, dR1, dR2, dH, dSafeDist, *pStm) ? 1 : 0) ;
return ( CDeConeFrustumClosedSurfTm( frConeL, dR1, dR2, dH, *pStm, dSafeDist) ? 1 : 0) ;
}
//----------------------------------------------------------------------------
@@ -279,7 +281,7 @@ MyCDeConeVolZmap( const Frame3d& frCone, double dR1, double dR2, double dH, int
// porto in locale il riferimento
Frame3d frConeL = GetFrameLocal( pGeomDB, frCone, nRefType, frLoc) ;
// verifico la collisione
return ( pVZM->AvoidConeFrustum( frConeL, dR1, dR2, dH, dSafeDist) ? 0 : 1) ;
return ( pVZM->CDeConeFrustum( frConeL, dR1, dR2, dH, dSafeDist, false) ? 1 : 0) ;
}
//----------------------------------------------------------------------------
@@ -328,7 +330,7 @@ MyCDeSpheClosedSurfTm( const Point3d& ptCen, double dR, int nSurfTmId, double dS
// porto in locale alla superficie il centro della sfera
Point3d ptCenL = GetPointLocal( pGeomDB, ptCen, nRefType, frSurf) ;
// verifico la collisione
return ( CDeSpheClosedSurfTm( ptCenL, dR, dSafeDist, *pStm) ? 1 : 0) ;
return ( CDeSpheClosedSurfTm( ptCenL, dR, *pStm, dSafeDist) ? 1 : 0) ;
}
//----------------------------------------------------------------------------
@@ -348,7 +350,7 @@ MyCDeSpheVolZmap( const Point3d& ptCen, double dRad, int nZmapId, double dSafeDi
// porto in locale il centro della sfera
Point3d ptCenL = GetPointLocal( pGeomDB, ptCen, nRefType, frLoc) ;
// verifico la collisione
return ( pVZM->AvoidSphere( ptCenL, dRad, dSafeDist) ? 0 : 1) ;
return ( pVZM->CDeSphere( ptCenL, dRad, dSafeDist, false) ? 1 : 0) ;
}
//----------------------------------------------------------------------------
@@ -374,3 +376,75 @@ ExeCDeSpheSolid( const Point3d& ptCen, double dR, int nSolidId, double dSafeDist
// restituisco risultato
return nRes ;
}
//----------------------------------------------------------------------------
static int
MyCDeClosedSurfTmClosedSurfTm( int nSurfTm1Id, int nSurfTm2Id, double dSafeDist)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, -1)
// recupero il riferimento della seconda superficie
Frame3d frSurf2 ;
if ( ! pGeomDB->GetGlobFrame( nSurfTm2Id, frSurf2))
return -1 ;
// recupero la prima superficie in locale alla seconda
SurfLocal Surf1Loc( pGeomDB, nSurfTm1Id, frSurf2) ;
const ISurfTriMesh* pStm1 = GetSurfTriMesh( Surf1Loc) ;
if ( pStm1 == nullptr)
return -1 ;
// recupero la seconda superficie TriMesh
const ISurfTriMesh* pStm2 = GetSurfTriMesh( pGeomDB->GetGeoObj( nSurfTm2Id)) ;
if ( pStm2 == nullptr)
return -1 ;
// verifico la collisione
return ( CDeClosedSurfTmClosedSurfTm( *pStm1, *pStm2, dSafeDist) ? 1 : 0) ;
}
//----------------------------------------------------------------------------
static int
MyCDeClosedSurfTmVolZmap( int nSurfTmId, int nZmapId, double dSafeDist)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, -1)
// recupero il riferimento dello Zmap
Frame3d frZmap ;
if ( ! pGeomDB->GetGlobFrame( nZmapId, frZmap))
return -1 ;
// recupero la superficie in locale allo Zmap
SurfLocal SurfLoc( pGeomDB, nSurfTmId, frZmap) ;
const ISurfTriMesh* pStm = GetSurfTriMesh( SurfLoc) ;
if ( pStm == nullptr)
return -1 ;
// recupero lo Zmap
const IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nZmapId)) ;
if ( pVZM == nullptr)
return -1 ;
// verifico la collisione
return ( pVZM->CDeSurfTm( *pStm, dSafeDist, false) ? 1 : 0) ;
}
//----------------------------------------------------------------------------
int
ExeCDeSolidSolid( int nSolid1Id, int nSolid2Id, double dSafeDist)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
int nRes = -1 ;
if ( pGeomDB != nullptr) {
if ( pGeomDB->GetGeoType( nSolid1Id) == SRF_TRIMESH && pGeomDB->GetGeoType( nSolid2Id) == SRF_TRIMESH)
nRes = MyCDeClosedSurfTmClosedSurfTm( nSolid1Id, nSolid2Id, dSafeDist) ;
else if ( pGeomDB->GetGeoType( nSolid1Id) == SRF_TRIMESH && pGeomDB->GetGeoType( nSolid2Id) == VOL_ZMAP)
nRes = MyCDeClosedSurfTmVolZmap( nSolid1Id, nSolid2Id, dSafeDist) ;
else if ( pGeomDB->GetGeoType( nSolid1Id) == VOL_ZMAP && pGeomDB->GetGeoType( nSolid2Id) == SRF_TRIMESH)
nRes = MyCDeClosedSurfTmVolZmap( nSolid2Id, nSolid1Id, dSafeDist) ;
}
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtCDeSolidSolid({" + IdToString( nSolid1Id) + "," +
IdToString( nSolid2Id) + "," +
ToString( dSafeDist) + ")" +
" -- Res=" + ToString( nRes) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultato
return nRes ;
}
+1
View File
@@ -18,6 +18,7 @@
//----------------------------------------------------------------------------
// Costanti per tolleranze di appossimazione
const double LIN_TOL_STD = 0.1 ;
const double LIN_TOL_SRF = 0.05 ;
const double LIN_TOL_FINE = 0.01 ;
const double LIN_FEA_STD = 20 ;
const double LIN_FEA_MAX = 400 ;
+160 -34
View File
@@ -17,13 +17,13 @@
#include "EXE_Macro.h"
#include "AuxTools.h"
#include "DllExchange.h"
#include "DllExch3dm.h"
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EXeConst.h"
#include "/EgtDev/Include/EXeCmdLogOff.h"
#include "/EgtDev/Include/EExImportDxf.h"
#include "/EgtDev/Include/EExImportStl.h"
#include "/EgtDev/Include/EExImport3MF.h"
#include "/EgtDev/Include/EExExportThreeJS.h"
#include "/EgtDev/Include/EExImportCnc.h"
#include "/EgtDev/Include/EExImportCsf.h"
#include "/EgtDev/Include/EExImportPnt.h"
@@ -33,6 +33,9 @@
#include "/EgtDev/Include/EExExportStl.h"
#include "/EgtDev/Include/EExExport3MF.h"
#include "/EgtDev/Include/EExExportSvg.h"
#include "/EgtDev/Include/EExExportThreeJS.h"
#include "/EgtDev/Include/EE3Import3dm.h"
#include "/EgtDev/Include/EE3Export3dm.h"
#include "/EgtDev/Include/EGnStringUtils.h"
#include "/EgtDev/Include/EGnFileUtils.h"
#include "/EgtDev/Include/EgtStringConverter.h"
@@ -60,7 +63,7 @@ ExeGetFileType( const string& sFilePath)
SplitLast( sFileName, ".", sFileTitle, sFileExt) ;
ToUpper( sFileExt) ;
if ( sFileExt == "NGE" || sFileExt == "VME" || sFileExt == "NHE" || sFileExt == "BWE")
if ( sFileExt == "NGE" || sFileExt == "VME" || sFileExt == "NHE" || sFileExt == "BWE" || sFileExt == "ICRS")
return FT_NGE ;
else if ( sFileExt == "NFE")
return FT_NFE ;
@@ -70,6 +73,8 @@ ExeGetFileType( const string& sFilePath)
return FT_STL ;
else if ( sFileExt == "3MF")
return FT_3MF ;
else if ( sFileExt == "3DM")
return FT_3DM ;
else if ( sFileExt == "OBJ")
return FT_OBJ ;
else if ( sFileExt == "CNC" || sFileExt == "XPI" || sFileExt == "MPF" || sFileExt == "ISO" || sFileExt == "EIA")
@@ -80,6 +85,8 @@ ExeGetFileType( const string& sFilePath)
return FT_BTL ;
else if ( sFileExt == "BTLX")
return FT_BTLX ;
else if ( sFileExt == "3DM")
return FT_3DM ;
else if ( sFileExt == "PNG" || sFileExt == "JPG" || sFileExt == "JPEG" || sFileExt == "BMP")
return FT_IMG ;
else if ( sFileExt == "PNT" || sFileExt == "XYZ")
@@ -100,6 +107,8 @@ ExeGetFileType( const string& sFilePath)
return FT_VRML ;
else if ( sFileExt == "C3D")
return FT_C3D ;
else if ( sFileExt == "HTML")
return FT_HTML ;
else if ( sFileExt == "TSC")
return FT_TSC ;
else if ( sFileExt == "LUA")
@@ -119,14 +128,6 @@ ExeSetBtlAuxDir( const string& sBtlAuxDir)
return MySetBtlAuxDir( sBtlAuxDir) ;
}
//-----------------------------------------------------------------------------
bool
ExeSetThreeJSAuxDir( const string & sThreeJSAuxDir )
{
return MySetThreeJSAuxDir( sThreeJSAuxDir) ;
}
//-----------------------------------------------------------------------------
bool
ExeImportBtl( const string& sFilePath, int nFlag)
@@ -151,6 +152,11 @@ ExeImportBtl( const string& sFilePath, int nFlag)
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// scrivo il log
if ( ! IsNull( pImpBtl)) {
string sLog = "Import File " + sFilePath ;
LOG_INFO( GetLogger(), sLog.c_str()) ;
}
// restituisco il risultato
return bOk ;
}
@@ -179,6 +185,11 @@ ExeImportBtlx( const string& sFilePath, int nFlag)
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// scrivo il log
if ( ! IsNull( pImpBtlx)) {
string sLog = "Import File " + sFilePath ;
LOG_INFO( GetLogger(), sLog.c_str()) ;
}
// restituisco il risultato
return bOk ;
}
@@ -209,6 +220,11 @@ ExeImportCnc( const string& sFilePath, int nFlag)
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// scrivo il log
if ( ! IsNull( pImpCnc)) {
string sLog = "Import File " + sFilePath ;
LOG_INFO( GetLogger(), sLog.c_str()) ;
}
// restituisco il risultato
return bOk ;
}
@@ -236,6 +252,11 @@ ExeImportCsf( const string& sFilePath)
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// scrivo il log
if ( ! IsNull( pImpCsf)) {
string sLog = "Import File " + sFilePath ;
LOG_INFO( GetLogger(), sLog.c_str()) ;
}
// restituisco il risultato
return bOk ;
}
@@ -266,6 +287,11 @@ ExeImportDxf( const string& sFilePath, double dScaleFactor)
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// scrivo il log
if ( ! IsNull( pImpDxf)) {
string sLog = "Import File " + sFilePath ;
LOG_INFO( GetLogger(), sLog.c_str()) ;
}
// restituisco il risultato
return bOk ;
}
@@ -296,6 +322,11 @@ ExeImportPnt( const string& sFilePath, int nFlag)
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// scrivo il log
if ( ! IsNull( pImpPnt)) {
string sLog = "Import File " + sFilePath ;
LOG_INFO( GetLogger(), sLog.c_str()) ;
}
// restituisco il risultato
return bOk ;
}
@@ -311,10 +342,10 @@ ExeImportStl( const string& sFilePath, double dScaleFactor)
// 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
// preparo l'importatore
PtrOwner<IImportStl> pImpStl( MyCreateImportStl()) ;
bOk = bOk && ! IsNull( pImpStl) ;
// eseguo l'importazione
// eseguo l'importazione
bOk = bOk && pImpStl->Import( sFilePath, pGseCtx->m_pGeomDB, nLayerId, dScaleFactor) ;
// aggiorno stato file corrente
if ( pGseCtx->m_sFilePath.empty())
@@ -327,6 +358,11 @@ ExeImportStl( const string& sFilePath, double dScaleFactor)
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// scrivo il log
if ( ! IsNull( pImpStl)) {
string sLog = "Import File " + sFilePath ;
LOG_INFO( GetLogger(), sLog.c_str()) ;
}
// restituisco il risultato
return bOk ;
}
@@ -339,13 +375,13 @@ ExeImport3MF( const string& sFilePath)
VERIFY_CTX_GEOMDB( pGseCtx, false)
bool bOk = true ;
// importo il file 3MF
// aggiungo un gruppo pezzo e un gruppo layer
// aggiungo un gruppo pezzo e un gruppo layer
int nPartId = pGseCtx->m_pGeomDB->AddGroup( GDB_ID_NULL, GDB_ID_ROOT, Frame3d()) ;
int nLayerId = pGseCtx->m_pGeomDB->AddGroup( GDB_ID_NULL, nPartId, Frame3d()) ;
// preparo l'importatore
// preparo l'importatore
PtrOwner<IImport3MF> pImp3MF( MyCreateImport3MF()) ;
bOk = bOk && ! IsNull( pImp3MF) ;
// eseguo l'importazione
// eseguo l'importazione
bOk = bOk && pImp3MF->Import( sFilePath, pGseCtx->m_pGeomDB, nLayerId) ;
// aggiorno stato file corrente
if ( pGseCtx->m_sFilePath.empty())
@@ -357,6 +393,54 @@ ExeImport3MF( const string& sFilePath)
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// scrivo il log
if ( ! IsNull( pImp3MF)) {
string sLog = "Import File " + sFilePath ;
LOG_INFO( GetLogger(), sLog.c_str()) ;
}
// restituisco il risultato
return bOk ;
}
//-----------------------------------------------------------------------------
bool
ExeImport3dm( const string& sFilePath)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_GEOMDB( pGseCtx, false)
bool bOk = true ;
// importo il file 3dm
//// aggiungo un gruppo pezzo e un gruppo layer
// int nPartId = pGseCtx->m_pGeomDB->AddGroup( GDB_ID_NULL, GDB_ID_ROOT, Frame3d()) ;
// preparo l'importatore
PtrOwner<IImport3dm> pImp3dm( MyCreateImport3dm()) ;
bOk = bOk && ! IsNull( pImp3dm) ;
// eseguo l'importazione
const DimensionStyle& DimSt = pGseCtx->m_dsCurr ;
double dExtLine = DimSt.dExtLineLen ;
double dArrLen = DimSt.dArrowLen ;
double dTextDist = DimSt.dTextDist ;
bool bLenIsMM = ( DimSt.nLenIsMM == 2 ? ExeUiUnitsAreMM() : ( DimSt.nLenIsMM != 0 )) ;
int nDecDig = DimSt.nDecDigit ;
string sFont = DimSt.sFont ;
double dTextHeight = DimSt.dTextHeight ;
bOk = bOk && pImp3dm->Import( sFilePath, pGseCtx->m_pGeomDB, GDB_ID_ROOT,
dTextHeight, dExtLine, dArrLen, dTextDist, bLenIsMM, nDecDig, sFont) ;
// aggiorno stato file corrente
if ( pGseCtx->m_sFilePath.empty())
pGseCtx->m_sFilePath = sFilePath ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtImport3dm('" + StringToLuaString( sFilePath) + "')" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// scrivo il log
if ( ! IsNull( pImp3dm)) {
string sLog = "Import File " + sFilePath ;
LOG_INFO( GetLogger(), sLog.c_str()) ;
}
// restituisco il risultato
return bOk ;
}
@@ -386,7 +470,7 @@ ExeAdvancedImportIsEnabled( void)
//-----------------------------------------------------------------------------
bool
ExeAdvancedImport( const string& sFilePath, double dToler)
ExeAdvancedImport( const string& sFilePath, double dToler, int nFlag)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_GEOMDB( pGseCtx, false)
@@ -419,7 +503,8 @@ ExeAdvancedImport( const string& sFilePath, double dToler)
sExec = "EgtConverterR32.exe" ;
#endif
string sCmdLine = "\"" + sExec + "\" \"" + sFilePath + "\" \"" + sFileOut + "\" \"" +
ToString( dToler, 3) + "\" \"" + ToString( ExeGetDebugLevel()) +"\" \"" + ExeGetKey() + "\"" ;
ToString( dToler, 3) + "\" \"" + ToString( ExeGetDebugLevel()) + "\" \"" +
ExeGetKey() + "\" \"" + ExeGetLockId() + "\" \"" + ToString( nFlag) + "\"" ;
STARTUPINFO si ;
PROCESS_INFORMATION pi ;
ZeroMemory( &si, sizeof( si)) ;
@@ -453,7 +538,8 @@ ExeAdvancedImport( const string& sFilePath, double dToler)
if ( ExeGetDebugLevel() < 5)
EraseFile( sFileOut) ;
// aggiorno stato file corrente
pGseCtx->m_sFilePath = sFilePath ;
if ( pGseCtx->m_sFilePath.empty())
pGseCtx->m_sFilePath = sFilePath ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
@@ -462,23 +548,28 @@ ExeAdvancedImport( const string& sFilePath, double dToler)
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// scrivo il log
{
string sLog = "Advanced Import File " + sFilePath ;
LOG_INFO( GetLogger(), sLog.c_str()) ;
}
// restituisco il risultato
return bOk ;
}
//-----------------------------------------------------------------------------
bool
ExeExportDxf( int nId, const string& sFilePath, int nFlag)
ExeExportDxf( int nId, const string& sFilePath, int nFlag, int nFilter)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
bool bOk = true ;
// esporto il file DXF
// preparo l'esportatore
// preparo l'esportatore
PtrOwner<IExportDxf> pExpDxf( MyCreateExportDxf()) ;
bOk = bOk && ! IsNull( pExpDxf) ;
// eseguo l'esportazione
pExpDxf->SetOptions( EEXFLT_DEFAULT, nFlag) ;
bOk = bOk && pExpDxf->SetOptions( nFilter, nFlag) ;
bOk = bOk && pExpDxf->Export( pGeomDB, nId, sFilePath) ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
@@ -494,16 +585,17 @@ ExeExportDxf( int nId, const string& sFilePath, int nFlag)
//-----------------------------------------------------------------------------
bool
ExeExportStl( int nId, const string& sFilePath)
ExeExportStl( int nId, const string& sFilePath, int nFilter)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
bool bOk = true ;
// esporto il file STL
// preparo l'esportatore
// preparo l'esportatore
PtrOwner<IExportStl> pExpStl( MyCreateExportStl()) ;
bOk = bOk && ! IsNull( pExpStl) ;
// eseguo l'esportazione
bOk = bOk && pExpStl->SetOptions( nFilter) ;
bOk = bOk && pExpStl->Export( pGeomDB, nId, sFilePath) ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
@@ -518,16 +610,17 @@ ExeExportStl( int nId, const string& sFilePath)
//-----------------------------------------------------------------------------
bool
ExeExport3MF( int nId, const string& sFilePath)
ExeExport3MF( int nId, const string& sFilePath, int nFilter)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
bool bOk = true ;
// esporto il file STL
// preparo l'esportatore
// esporto il file 3MF
// preparo l'esportatore
PtrOwner<IExport3MF> pExp3MF( MyCreateExport3MF()) ;
bOk = bOk && ! IsNull( pExp3MF) ;
// eseguo l'esportazione
// eseguo l'esportazione
bOk = bOk && pExp3MF->SetOptions( nFilter) ;
bOk = bOk && pExp3MF->Export( pGeomDB, nId, sFilePath) ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
@@ -540,6 +633,31 @@ ExeExport3MF( int nId, const string& sFilePath)
return bOk ;
}
//-----------------------------------------------------------------------------
bool
ExeExport3dm( int nId, const string& sFilePath, int nFilter)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
bool bOk = true ;
// esporto il file 3dm
// preparo l'esportatore
PtrOwner<IExport3dm> pExp3dm( MyCreateExport3dm()) ;
bOk = bOk && ! IsNull( pExp3dm) ;
// eseguo l'esportazione
bOk = bOk && pExp3dm->SetOptions( nFilter) ;
bOk = bOk && pExp3dm->Export( pGeomDB, nId, sFilePath) ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtExport3dm(" + ToString( nId) + ",'" +
StringToLuaString( sFilePath) + "')" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco il risultato
return bOk ;
}
//-----------------------------------------------------------------------------
bool
ExeExportSvg( int nId, const string& sFilePath, int nFilter)
@@ -547,12 +665,12 @@ ExeExportSvg( int nId, const string& sFilePath, int nFilter)
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
bool bOk = true ;
// esporto il file SVG
// preparo l'esportatore
// esporto il file SVG
// preparo l'esportatore
PtrOwner<IExportSvg> pExpSvg( MyCreateExportSvg()) ;
bOk = bOk && ! IsNull( pExpSvg) ;
// eseguo l'esportazione
pExpSvg->SetOptions( nFilter) ;
// eseguo l'esportazione
bOk = bOk && pExpSvg->SetOptions( nFilter) ;
bOk = bOk && pExpSvg->Export( pGeomDB, nId, sFilePath) ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
@@ -566,6 +684,13 @@ ExeExportSvg( int nId, const string& sFilePath, int nFilter)
return bOk ;
}
//-----------------------------------------------------------------------------
bool
ExeSetThreeJSLibDir( const string& sThreeJSLibDir)
{
return MySetThreeJSLibDir( sThreeJSLibDir) ;
}
//-----------------------------------------------------------------------------
bool
ExeExportThreeJS( int nId, const string& sFilePath, int nFilter)
@@ -582,12 +707,13 @@ ExeExportThreeJS( int nId, const string& sFilePath, int nFilter)
// eseguo l'esportazione
bOk = bOk && pExpThreeJS->SetOptions( nFilter) ;
bOk = bOk && pExpThreeJS->Export( pGeomDB, nId, sFilePath, pScene, ExeUiUnitsAreMM()) ;
bOk = bOk && pExpThreeJS->Export( pGeomDB, nId, pScene, ExeUiUnitsAreMM(), sFilePath) ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtExportThreeJS(" + ToString( nId) + ",'" +
StringToLuaString( sFilePath) + "')" +
" -- Ok=" + ToString( bOk) ;
StringToLuaString( sFilePath) + "'," +
ToString( nFilter) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco il risultato
+530 -42
View File
@@ -26,6 +26,11 @@
#include "/EgtDev/Include/EGkStringUtils3d.h"
#include "/EgtDev/Include/EgtStringConverter.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
#include "/EgtDev/Include/EGkIntersCurves.h"
#include "/EgtDev/Include/EGkCurveLine.h"
#include "/EgtDev/Include/EGkCurveArc.h"
#include "/EgtDev/Include/EGkDistPointCurve.h"
#include "/EgtDev/Include/EGkCurveComposite.h"
using namespace std ;
@@ -35,11 +40,11 @@ ExeCreateGroup( int nParentId, const Frame3d& frFrame, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
nParentId = AdjustId( nParentId) ;
bool bOk = true ;
// recupero il riferimento locale
// recupero il riferimento locale
Frame3d frLoc ;
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc ) ;
// porto in locale l'origine e i versori
Point3d ptOrigL = GetPointLocal( pGeomDB, frFrame.Orig(), nRefType, frLoc) ;
Vector3d vtXL = GetVectorLocal( pGeomDB, frFrame.VersX(), nRefType, frLoc) ;
@@ -73,7 +78,7 @@ ExeCreateGroup( int nParentId, const Frame3d& frFrame, int nRefType)
" -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo del nuovo gruppo
// restituisco l'identificativo del nuovo gruppo
return nId ;
}
@@ -83,7 +88,7 @@ ExeCreateGeoPoint( int nParentId, const Point3d& ptP, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
nParentId = AdjustId( nParentId) ;
bool bOk = true ;
// recupero il riferimento locale
Frame3d frLoc ;
@@ -92,9 +97,9 @@ ExeCreateGeoPoint( int nParentId, const Point3d& ptP, int nRefType)
Point3d ptPL = GetPointLocal( pGeomDB, ptP, nRefType, frLoc) ;
// creo il punto
PtrOwner<IGeoPoint3d> pGeoPnt( CreateGeoPoint3d()) ;
bOk = bOk && ! IsNull( pGeoPnt) ;
bOk = bOk && !IsNull( pGeoPnt) ;
// setto il punto
bOk = bOk && pGeoPnt->Set( ptPL) ;
bOk = bOk && pGeoPnt->Set( ptPL) ;
// inserisco il punto nel DB
int nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pGeoPnt)) : GDB_ID_NULL) ;
ExeSetModified() ;
@@ -106,7 +111,7 @@ ExeCreateGeoPoint( int nParentId, const Point3d& ptP, int nRefType)
" -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entit
return nId ;
}
@@ -116,7 +121,7 @@ ExeCreateGeoVector( int nParentId, const Vector3d& vtV, const Point3d& ptB, int
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
nParentId = AdjustId( nParentId) ;
bool bOk = true ;
// recupero il riferimento locale
Frame3d frLoc ;
@@ -128,7 +133,7 @@ ExeCreateGeoVector( int nParentId, const Vector3d& vtV, const Point3d& ptB, int
PtrOwner<IGeoVector3d> pGeoVct( CreateGeoVector3d()) ;
bOk = bOk && ! IsNull( pGeoVct) ;
// setto il vettore (con il punto base)
bOk = bOk && pGeoVct->Set( vtVL, ptBL) ;
bOk = bOk && pGeoVct->Set( vtVL, ptBL) ;
// inserisco il vettore nel DB
int nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pGeoVct)) : GDB_ID_NULL) ;
ExeSetModified() ;
@@ -148,7 +153,7 @@ ExeCreateGeoVector( int nParentId, const Vector3d& vtV, const Point3d& ptB, int
" -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entit
return nId ;
}
@@ -158,11 +163,11 @@ ExeCreateGeoFrame( int nParentId, const Frame3d& frFrame, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
nParentId = AdjustId( nParentId) ;
bool bOk = true ;
// recupero il riferimento locale
Frame3d frLoc ;
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc ) ;
// porto in locale l'origine e i versori
Point3d ptOrigL = GetPointLocal( pGeomDB, frFrame.Orig(), nRefType, frLoc) ;
Vector3d vtXL = GetVectorLocal( pGeomDB, frFrame.VersX(), nRefType, frLoc) ;
@@ -170,8 +175,8 @@ ExeCreateGeoFrame( int nParentId, const Frame3d& frFrame, int nRefType)
Vector3d vtZL = GetVectorLocal( pGeomDB, frFrame.VersZ(), nRefType, frLoc) ;
// creo e setto il riferimento
PtrOwner<IGeoFrame3d> pGeoFrm( CreateGeoFrame3d()) ;
bOk = bOk && ! IsNull( pGeoFrm) ;
bOk = bOk && pGeoFrm->Set( ptOrigL, vtXL, vtYL, vtZL) ;
bOk = bOk && !IsNull( pGeoFrm) ;
bOk = bOk && pGeoFrm->Set( ptOrigL, vtXL, vtYL, vtZL) ;
// inserisco il riferimento nel DB
int nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pGeoFrm)) : GDB_ID_NULL) ;
ExeSetModified() ;
@@ -183,7 +188,7 @@ ExeCreateGeoFrame( int nParentId, const Frame3d& frFrame, int nRefType)
ToString( frFrame.VersY()) + "},{" +
ToString( frFrame.VersZ()) + "}}," +
RefTypeToString( nRefType) + ")" +
" -- Id=" + ToString( nId) ;
" -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo del nuovo gruppo
@@ -197,7 +202,7 @@ ExeCreateText( int nParentId, const Point3d& ptP,
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
nParentId = AdjustId( nParentId) ;
bool bOk = true ;
// recupero il riferimento locale
Frame3d frLoc ;
@@ -208,7 +213,7 @@ ExeCreateText( int nParentId, const Point3d& ptP,
Vector3d vtDL = GetVectorLocal( pGeomDB, X_AX, nRefType, frLoc) ;
// creo il testo e lo riempio
PtrOwner<IExtText> pTXT( CreateExtText()) ;
bOk = bOk && ! IsNull( pTXT) ;
bOk = bOk && !IsNull( pTXT) ;
bOk = bOk && pTXT->Set( ptPL, vtNL, vtDL, sText, "", false, dH) ;
// inserisco il testo nel DB
int nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pTXT)) : GDB_ID_NULL) ;
@@ -234,7 +239,7 @@ ExeCreateTextEx( int nParentId, const Point3d& ptP, double dAngRotDeg,
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
nParentId = AdjustId( nParentId) ;
bool bOk = true ;
// recupero il riferimento locale
Frame3d frLoc ;
@@ -242,10 +247,10 @@ ExeCreateTextEx( int nParentId, const Point3d& ptP, double dAngRotDeg,
// porto in locale l'origine e i versori
Point3d ptPL = GetPointLocal( pGeomDB, ptP, nRefType, frLoc) ;
Vector3d vtNL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ;
Vector3d vtDL = GetVectorLocal( pGeomDB, FromPolar(1, dAngRotDeg), nRefType, frLoc) ;
Vector3d vtDL = GetVectorLocal( pGeomDB, FromPolar( 1, dAngRotDeg), nRefType, frLoc) ;
// creo il testo e lo riempio
PtrOwner<IExtText> pTXT( CreateExtText()) ;
bOk = bOk && ! IsNull( pTXT) ;
bOk = bOk && !IsNull( pTXT) ;
bOk = bOk && pTXT->Set( ptPL, vtNL, vtDL, sText, sFont, bItalic, dH) ;
// inserisco il testo nel DB
int nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pTXT)) : GDB_ID_NULL) ;
@@ -263,7 +268,7 @@ ExeCreateTextEx( int nParentId, const Point3d& ptP, double dAngRotDeg,
" -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo del oggetto
// restituisco l'identificativo del oggetto
return nId ;
}
@@ -275,7 +280,7 @@ ExeCreateTextAdv( int nParentId, const Point3d& ptP, double dAngRotDeg,
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
nParentId = AdjustId( nParentId) ;
bool bOk = true ;
// recupero il riferimento locale
Frame3d frLoc ;
@@ -283,10 +288,10 @@ ExeCreateTextAdv( int nParentId, const Point3d& ptP, double dAngRotDeg,
// porto in locale l'origine e i versori
Point3d ptPL = GetPointLocal( pGeomDB, ptP, nRefType, frLoc) ;
Vector3d vtNL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ;
Vector3d vtDL = GetVectorLocal( pGeomDB, FromPolar(1, dAngRotDeg), nRefType, frLoc) ;
Vector3d vtDL = GetVectorLocal( pGeomDB, FromPolar( 1, dAngRotDeg), nRefType, frLoc) ;
// creo il testo e lo imposto
PtrOwner<IExtText> pTXT( CreateExtText()) ;
bOk = bOk && ! IsNull( pTXT) ;
bOk = bOk && !IsNull( pTXT) ;
bOk = bOk && pTXT->Set( ptPL, vtNL, vtDL, sText, sFont, nW, bItalic, dH, dRat, dAddAdv, nInsPos) ;
// inserisco il testo nel DB
int nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pTXT)) : GDB_ID_NULL) ;
@@ -315,12 +320,12 @@ ExeCreateTextAdv( int nParentId, const Point3d& ptP, double dAngRotDeg,
//-------------------------------------------------------------------------------
bool
ExeSetCurrDimensionStyle( double dExtLineLen, double dArrowLen, double dTextDist,
int nLenIsMM, int nDecDigit, const string& sFont, double dTextHeight)
int nLenIsMM, int nDecDigit, const string& sFont, double dTextHeight)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX( pGseCtx, false)
// aggiorno lo stile di quotatura corrente
pGseCtx->m_dsCurr.Set( dExtLineLen, dArrowLen, dTextDist, nLenIsMM, nDecDigit, sFont, dTextHeight) ;
// aggiorno lo stile di quotatura corrente
pGseCtx->m_dsCurr.Set( dExtLineLen, dArrowLen, dTextDist, nLenIsMM, nDecDigit, sFont, dTextHeight) ;
return true ;
}
@@ -330,8 +335,8 @@ ExeResetCurrDimensionStyle( void)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX( pGseCtx, false)
// aggiorno lo stile di quotatura corrente
pGseCtx->m_dsCurr.Reset() ;
// aggiorno lo stile di quotatura corrente
pGseCtx->m_dsCurr.Reset() ;
return true ;
}
@@ -341,16 +346,16 @@ MySetDimensionStyle( IExtDimension* pDim)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX( pGseCtx, false)
// verifico validità quotatura
if ( pDim == nullptr)
return false ;
// verifico validit quotatura
if ( pDim == nullptr)
return false ;
// recupero lo stile di quotatura
const DimensionStyle& DimSt = pGseCtx->m_dsCurr ;
// recupero l'unità di misura lineare per la quotatura
bool bLenIsMM = ( DimSt.nLenIsMM == 2 ? ExeUiUnitsAreMM() : ( DimSt.nLenIsMM != 0)) ;
// recupero l'unit di misura lineare per la quotatura
bool bLenIsMM = ( DimSt.nLenIsMM == 2 ? ExeUiUnitsAreMM() : ( DimSt.nLenIsMM != 0 )) ;
// imposto lo stile
return pDim->SetStyle( DimSt.dExtLineLen, DimSt.dArrowLen, DimSt.dTextDist,
bLenIsMM, DimSt.nDecDigit, DimSt.sFont, DimSt.dTextHeight) ;
bLenIsMM, DimSt.nDecDigit, DimSt.sFont, DimSt.dTextHeight) ;
}
//-------------------------------------------------------------------------------
@@ -360,10 +365,10 @@ MyCreateLinearDimension( int nParentId, const Point3d& ptP1, const Point3d& ptP2
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
nParentId = AdjustId( nParentId) ;
// recupero il riferimento locale
Frame3d frLoc ;
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc ))
return GDB_ID_NULL ;
// porto in locale i punti e assegno i versori
Point3d ptP1L = GetPointLocal( pGeomDB, ptP1, nRefType, frLoc) ;
@@ -373,9 +378,9 @@ MyCreateLinearDimension( int nParentId, const Point3d& ptP1, const Point3d& ptP2
Vector3d vtDL = GetVectorLocal( pGeomDB, vtDir, nRefType, frLoc) ;
// creo la quota
PtrOwner<IExtDimension> pDim( CreateExtDimension()) ;
if ( IsNull( pDim) ||
! MySetDimensionStyle( pDim) ||
! pDim->SetLinear( ptP1L, ptP2L, ptDimL, vtNL, vtDL, sText))
if ( IsNull( pDim ) ||
! MySetDimensionStyle( pDim ) ||
! pDim->SetLinear( ptP1L, ptP2L, ptDimL, vtNL, vtDL, sText ))
return GDB_ID_NULL ;
// inserisco la quota nel DB
return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pDim)) ;
@@ -414,7 +419,7 @@ ExeCreateVerticalDimension( int nParentId, const Point3d& ptP1, const Point3d& p
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtVerticalDimension(" + IdToString( nParentId) + ",{" +
string sLua = "EgtVerticalDimension(" + IdToString( nParentId ) + ",{" +
ToString( ptP1) + "},{" +
ToString( ptP2) + "},{" +
ToString( ptDim) + "},'" +
@@ -449,3 +454,486 @@ ExeCreateAlignedDimension( int nParentId, const Point3d& ptP1, const Point3d& pt
// restituisco l'identificativo del oggetto
return nId ;
}
//-------------------------------------------------------------------------------
static int
MyCreateRadialDimension( int nParentId, int nCrvId, const Point3d& ptDim,
const string& sText, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
// recupero il riferimento locale
Frame3d frLoc ;
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
return GDB_ID_NULL ;
// recupero l'arco di circonferenza e il suo frame
ICurveArc* pArc = GetCurveArc( pGeomDB->GetGeoObj( nCrvId)) ;
if ( pArc == nullptr)
return GDB_ID_NULL ;
Frame3d frArc ;
if ( ! pGeomDB->GetGlobFrame( nCrvId, frArc))
return GDB_ID_NULL ;
// porto il punto nel riferimento locale
Point3d ptDimL = GetPointLocal( pGeomDB, ptDim, nRefType, frLoc) ;
// recupero il centro e la normale e li porto nel riferimento locale
Point3d ptCenL = pArc->GetCenter() ;
ptCenL.LocToLoc( frArc, frLoc) ;
Vector3d vtNL = pArc->GetNormVersor() ;
vtNL.LocToLoc( frArc, frLoc) ;
// porto ptDimL sulla circonferenza cui appartiene l'arco
Vector3d vtDir = ptDimL - ptCenL ;
if ( ! vtDir.Normalize())
return GDB_ID_NULL ;
ptDimL = ptCenL + pArc->GetRadius() * vtDir ;
// creo la quota
PtrOwner<IExtDimension> pDim( CreateExtDimension()) ;
if ( IsNull( pDim) ||
! MySetDimensionStyle( pDim) ||
! pDim->SetRadial( ptCenL, ptDimL, vtNL, sText))
return GDB_ID_NULL ;
// inserisco la quota nel DB
return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pDim)) ;
}
//-------------------------------------------------------------------------------
int
ExeCreateRadialDimension( int nParentId, int nCrvId, const Point3d& ptDim,
const string& sText, int nRefType)
{
// eseguo
int nId = MyCreateRadialDimension( nParentId, nCrvId, ptDim, sText, nRefType) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtRadialDimension(" + IdToString( nParentId) + "," +
IdToString( nCrvId) + ",{" +
ToString( ptDim) + "},'" +
StringToLuaString( sText) + "'," +
RefTypeToString( nRefType) + ")" +
" -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo del oggetto
return nId ;
}
//-------------------------------------------------------------------------------
static int
MyCreateDiametralDimension( int nParentId, int nCrvId, const Point3d& ptDim,
const string& sText, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
// recupero il riferimento locale
Frame3d frLoc ;
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
return GDB_ID_NULL ;
// recupero l'arco e il suo frame
ICurveArc* pArc = GetCurveArc( pGeomDB->GetGeoObj( nCrvId)) ;
if ( pArc == nullptr)
return GDB_ID_NULL ;
Frame3d frArc ;
if ( ! pGeomDB->GetGlobFrame( nCrvId, frArc))
return GDB_ID_NULL ;
// porto il punto nel riferimento locale
Point3d ptDimL = GetPointLocal( pGeomDB, ptDim, nRefType, frLoc) ;
// recupero il centro e la normale e li porto nel riferimento locale
Point3d ptCenL = pArc->GetCenter() ;
ptCenL.LocToLoc( frArc, frLoc) ;
Vector3d vtNL = pArc->GetNormVersor() ;
vtNL.LocToLoc( frArc, frLoc) ;
// porto ptDimL sulla circonferenza
Vector3d vtDir = ptDimL - ptCenL ;
if ( ! vtDir.Normalize())
return GDB_ID_NULL ;
ptDimL = ptCenL + pArc->GetRadius() * vtDir ;
// creo la quota
PtrOwner<IExtDimension> pDim( CreateExtDimension()) ;
if ( IsNull( pDim) ||
! MySetDimensionStyle( pDim) ||
! pDim->SetDiametral( ptCenL, ptDimL, vtNL, sText))
return GDB_ID_NULL ;
// inserisco la quota nel DB
return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pDim)) ;
}
//-------------------------------------------------------------------------------
int
ExeCreateDiametralDimension( int nParentId, int nCrvId, const Point3d& ptDim,
const string& sText, int nRefType)
{
// eseguo
int nId = MyCreateDiametralDimension( nParentId, nCrvId, ptDim, sText, nRefType) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtDiametralDimension(" + IdToString( nParentId) + "," +
IdToString( nCrvId) + ",{" +
ToString( ptDim) + "},'" +
StringToLuaString( sText) + "'," +
RefTypeToString( nRefType) + ")" +
" -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo del oggetto
return nId ;
}
//-------------------------------------------------------------------------------
static int
MyCreateAngularDimension( int nParentId, const Point3d& ptV, const Point3d& ptP1, const Point3d& ptP2,
const Point3d& ptDim, const string& sText, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
// recupero il riferimento locale
Frame3d frLoc ;
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
return GDB_ID_NULL ;
// porto in locale i punti e assegno i versori
Point3d ptVL = GetPointLocal( pGeomDB, ptV, nRefType, frLoc) ;
Point3d ptP1L = GetPointLocal( pGeomDB, ptP1, nRefType, frLoc) ;
Point3d ptP2L = GetPointLocal( pGeomDB, ptP2, nRefType, frLoc) ;
Point3d ptDimL = GetPointLocal( pGeomDB, ptDim, nRefType, frLoc) ;
Vector3d vtNL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ;
// creo la quota
PtrOwner<IExtDimension> pDim( CreateExtDimension()) ;
if ( IsNull( pDim) ||
! MySetDimensionStyle( pDim ) ||
! pDim->SetAngular( ptVL, ptP1L, ptP2L, ptDimL, vtNL, sText))
return GDB_ID_NULL ;
// inserisco la quota nel DB
return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pDim)) ;
}
//-------------------------------------------------------------------------------
int
ExeCreateAngularDimension( int nParentId, const Point3d& ptV, const Point3d& ptP1, const Point3d& ptP2,
const Point3d& ptDim, const string& sText, int nRefType)
{
// eseguo
int nId = MyCreateAngularDimension( nParentId, ptV, ptP1, ptP2, ptDim, sText, nRefType) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtAngularDimension(" + IdToString( nParentId) + ",{" +
ToString( ptV) + "},{" +
ToString( ptP1) + "},{" +
ToString( ptP2) + "},{" +
ToString( ptDim) + "},'" +
StringToLuaString( sText) + "'," +
RefTypeToString( nRefType) + ")" +
" -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo del oggetto
return nId ;
}
//-------------------------------------------------------------------------------
static int
MyCreateAngularDimensionEx( int nParentId, const Point3d& ptV1, const Point3d& ptP1,
const Point3d& ptV2,const Point3d& ptP2, const Point3d& ptDim,
const string& sText, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
// recupero il riferimento locale
Frame3d frLoc ;
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
return GDB_ID_NULL ;
// porto in locale i punti e assegno i versori
Point3d ptV1L = GetPointLocal( pGeomDB, ptV1, nRefType, frLoc) ;
Point3d ptP1L = GetPointLocal( pGeomDB, ptP1, nRefType, frLoc) ;
Point3d ptV2L = GetPointLocal( pGeomDB, ptV2, nRefType, frLoc) ;
Point3d ptP2L = GetPointLocal( pGeomDB, ptP2, nRefType, frLoc) ;
Point3d ptDimL = GetPointLocal( pGeomDB, ptDim, nRefType, frLoc) ;
Vector3d vtNL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ;
// creo la quota
PtrOwner<IExtDimension> pDim( CreateExtDimension()) ;
if ( IsNull( pDim) ||
! MySetDimensionStyle( pDim ) ||
! pDim->SetAngularEx( ptV1L, ptP1L, ptV2L, ptP2L, ptDimL, vtNL, sText))
return GDB_ID_NULL ;
// inserisco la quota nel DB
return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pDim)) ;
}
//-------------------------------------------------------------------------------
int
ExeCreateAngularDimensionEx( int nParentId, const Point3d& ptV1, const Point3d& ptP1,
const Point3d& ptV2, const Point3d& ptP2, const Point3d& ptDim,
const string& sText, int nRefType)
{
// eseguo
int nId = MyCreateAngularDimensionEx( nParentId, ptV1, ptP1, ptV2, ptP2, ptDim, sText, nRefType) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtAngularDimensionEx(" + IdToString( nParentId) + ",{" +
ToString( ptV1) + "},{" +
ToString( ptP1) + "},{" +
ToString( ptV2) + "},{" +
ToString( ptP2) + "},{" +
ToString( ptDim) + "},'" +
StringToLuaString( sText) + "'," +
RefTypeToString( nRefType) + ")" +
" -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo del oggetto
return nId ;
}
//-------------------------------------------------------------------------------
static int
MyCreateAngularDimensionFromLines( int nParentId, INTVECTOR vLineIds, const Point3d& ptDim,
const string& sText, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
// recupero il riferimento locale
Frame3d frLoc ;
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
return GDB_ID_NULL ;
// recupero le linee
ICurveLine* pCrv1 = GetCurveLine( pGeomDB->GetGeoObj( vLineIds[0])) ;
ICurveLine* pCrv2 = GetCurveLine( pGeomDB->GetGeoObj( vLineIds[1])) ;
if ( pCrv1 == nullptr || pCrv2 == nullptr)
return GDB_ID_NULL ;
PtrOwner<ICurveLine> pL1( pCrv1->Clone()) ;
PtrOwner<ICurveLine> pL2( pCrv2->Clone()) ;
if ( IsNull( pL1 ) || ! pL1->IsValid() || IsNull( pL2) || ! pL2->IsValid())
return GDB_ID_NULL ;
// porto tutto nel frLoc
Frame3d frL1, frL2 ;
if ( ! pGeomDB->GetGlobFrame( vLineIds[0], frL1) || ! pGeomDB->GetGlobFrame( vLineIds[1], frL2))
return GDB_ID_NULL ;
pL1->LocToLoc( frL1, frLoc) ;
pL2->LocToLoc( frL2, frLoc) ;
// recupero il punto lo porto nel riferimento locale
Point3d ptDimL = GetPointLocal( pGeomDB, ptDim, nRefType, frLoc) ;
// recupero i punti e le direzioni
Point3d ptP1L, ptP2L, ptP3L, ptP4L ;
Vector3d vtL1, vtL2 ;
pL1->GetStartPoint( ptP1L) ;
pL1->GetEndPoint( ptP2L) ;
pL2->GetStartPoint( ptP3L) ;
pL2->GetEndPoint( ptP4L) ;
pL1->GetStartDir( vtL1) ;
pL2->GetStartDir( vtL2) ;
// controllo se le rette sono coincidenti o parallele
if ( AreSameOrOppositeVectorApprox( vtL1, vtL2))
return GDB_ID_NULL ;
// verifico se le rette si intersecano già
Point3d ptCenL ;
IntersCurveCurve pInters( *pL1, *pL2) ;
int nNumeroInters = pInters.GetIntersCount() ;
// se non ho intersezioni estendo
if ( nNumeroInters == 0) {
double dLen = pow( 10, 5) ;
pL1->ExtendStartByLen( dLen) ;
pL2->ExtendStartByLen( dLen) ;
pL1->ExtendEndByLen( dLen) ;
pL2->ExtendEndByLen( dLen) ;
// faccio intersezione
IntersCurveCurve pIntersExt( *pL1, *pL2) ;
nNumeroInters = pIntersExt.GetIntersCount() ;
// le linee estese non si intersecano, quindi vuol dire che sono quasi parallele e lontanissime
if ( nNumeroInters == 0 )
return GDB_ID_NULL ;
else {
IntCrvCrvInfo Info ;
pIntersExt.GetIntCrvCrvInfo( 0, Info) ;
// controllo che non siano coincidenti
if ( Info.bOverlap)
return false ;
else
ptCenL = Info.IciA->ptI ;
}
// seleziono i punti necessari
// se ptDimL è più vicino a ptCenL rispetto agli estremi esterni delle linee, allora tengo gli estremi interni
double dP1Cen = ( ptP1L - ptCenL).Len() ;
double dP2Cen = ( ptP2L - ptCenL).Len() ;
double dDimCen = ( ptDimL - ptCenL).Len() ;
if ( ( dDimCen < dP1Cen || dDimCen < dP2Cen))
// se uno dei due punti è più vicino a ptCenL rispetto a ptDimL, allora tengo il punto più vicino a ptDimL
ptP1L = ( ( ptDimL - ptP1L ).Len() < ( ptDimL - ptP2L ).Len() ? ptP1L : ptP2L) ;
else
ptP1L = ( dP1Cen < dP2Cen ? ptP2L : ptP1L ) ;
// rifaccio anche per l'altro lato
double dP3Cen = ( ptP3L - ptCenL).Len() ;
double dP4Cen = ( ptP4L - ptCenL).Len() ;
if ( dDimCen < dP3Cen || dDimCen < dP4Cen)
ptP3L = ( ( ptDimL - ptP3L).Len() < ( ptDimL - ptP4L).Len() ? ptP3L : ptP4L) ;
else
ptP3L = ( dP3Cen < dP4Cen ? ptP4L : ptP3L) ;
}
// se ho già intesezioni devo capire in quale quadrante si trova ptDim
else {
// recupero l'intersezione
IntCrvCrvInfo Info ;
pInters.GetIntCrvCrvInfo( 0, Info) ;
// controllo che non siano coincidenti
if ( Info.bOverlap)
return false ;
// se non coincidono restituisco l'intersezione
else
ptCenL = Info.IciA->ptI ;
// se le due linee hanno un estremo in comune, estendo le linee da quel lato
if ( ( AreSamePointApprox( ptCenL, ptP1L) || AreSamePointApprox( ptCenL, ptP2L)) &&
( AreSamePointApprox( ptCenL, ptP3L) || AreSamePointApprox( ptCenL, ptP4L))) {
if ( AreSamePointApprox( ptCenL, ptP1L)) {
pL1->ExtendStartByLen(Dist( ptP1L, ptP2L) / 2) ;
pL1->GetStartPoint( ptP1L) ;
}
else {
pL1->ExtendEndByLen(Dist( ptP1L, ptP2L) / 2) ;
pL1->GetEndPoint( ptP2L) ;
}
if ( AreSamePointApprox( ptCenL, ptP3L)) {
pL2->ExtendStartByLen( Dist( ptP3L, ptP4L) / 2);
pL2->GetStartPoint( ptP3L) ;
}
else {
pL2->ExtendEndByLen(Dist( ptP3L, ptP4L) / 2);
pL2->GetEndPoint( ptP4L) ;
}
}
// seleziono i punti necessari
// proietto pdDim su vtLine1 e su vtLine2
Point3d ptDim1, ptDim2 ;
DistPointCurve distPL1( ptDimL, *pL1, true) ;
DistPointCurve distPL2( ptDimL, *pL2, true) ;
int nFlag1, nFlag2 ;
if ( ! distPL1.GetMinDistPoint( 0, ptDim1, nFlag1) || ! distPL2.GetMinDistPoint( 0, ptDim2, nFlag2) )
return false ;
if ( abs(( ptDim1 - ptP1L).Len() + ( ptCenL - ptDim1).Len() - ( ptCenL - ptP1L).Len()) < EPS_SMALL ||
abs(( ptDim1 - ptP1L).Len() + ( ptCenL - ptP1L ).Len() - ( ptDim1 - ptCenL).Len()) < EPS_SMALL)
// ptDim è dal lato di ptP1L, quindi tengo ptP1L
;
else
// ptDim è dal lato di ptP2L
ptP1L = ptP2L ;
if ( abs(( ptDim2 - ptP3L).Len() + ( ptCenL - ptDim2).Len() - ( ptCenL - ptP3L).Len()) < EPS_SMALL ||
abs(( ptDim2 - ptP3L).Len() + ( ptCenL - ptP3L).Len() - ( ptDim2 - ptCenL).Len()) < EPS_SMALL)
// ptDim è dal lato di ptP1L
;
else
// ptDim è dal lato di ptP2L
ptP3L = ptP4L ;
}
// recupero la normale al piano dell'angolo da quotare
Frame3d frArc;
frArc.Set(ptCenL, ptP1L, ptP3L);
Vector3d vtNL = frArc.VersZ() ;
if ( vtNL * Z_AX < - EPS_SMALL) {
frArc.Set(ptCenL, ptP3L, ptP1L);
vtNL = frArc.VersZ() ;
}
// creo la quota
PtrOwner<IExtDimension> pDim( CreateExtDimension()) ;
if ( IsNull( pDim ) ||
! MySetDimensionStyle( pDim ) ||
! pDim->SetAngular( ptP1L, ptCenL, ptP3L, ptDimL, vtNL, sText))
return GDB_ID_NULL ;
// inserisco la quota nel DB
return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pDim)) ;
}
//-------------------------------------------------------------------------------
int
ExeCreateAngularDimensionFromLines( int nParentId, const INTVECTOR vLineIds, const Point3d& ptDim,
const string& sText, int nRefType)
{
// eseguo
int nId = MyCreateAngularDimensionFromLines( nParentId, vLineIds, ptDim, sText, nRefType) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtAngularDimensionFromLines(" + IdToString( nParentId) + "," +
ToString( vLineIds[0]) + "," +
ToString( vLineIds[1]) + ",{" +
ToString( ptDim) + "},'" +
StringToLuaString( sText) + "'," +
RefTypeToString( nRefType) + ")" +
" -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo del oggetto
return nId ;
}
//-------------------------------------------------------------------------------
static int
MyCreateAngularDimensionFromArc( int nParentId, int nCrvId, const Point3d& ptDim,
const string& sText, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
// recupero il riferimento locale
Frame3d frLoc ;
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
return GDB_ID_NULL ;
// recupero l'arco e il suo frame
ICurveArc* pArc = GetCurveArc( pGeomDB->GetGeoObj( nCrvId)) ;
if ( pArc == nullptr)
return GDB_ID_NULL ;
Frame3d frArc ;
if ( ! pGeomDB->GetGlobFrame( nCrvId, frArc))
return GDB_ID_NULL ;
// recupero i punti e la normale e li porto nel frame locale
Point3d ptDimL = GetPointLocal( pGeomDB, ptDim, nRefType, frLoc) ;
Vector3d vtNL = pArc->GetNormVersor() ;
vtNL.LocToLoc( frArc, frLoc) ;
Point3d ptCenL, ptP1L, ptP2L ;
pArc->GetStartPoint( ptP1L) ;
ptP1L.LocToLoc( frArc, frLoc) ;
pArc->GetEndPoint( ptP2L) ;
ptP2L.LocToLoc( frArc, frLoc) ;
pArc->GetCenterPoint( ptCenL) ;
ptCenL.LocToLoc( frArc, frLoc) ;
// porto ptDimL nell'area di influenza dell'arco
Point3d ptMid ;
pArc->GetMidPoint( ptMid) ;
Vector3d vtDir = ( ptMid - ptCenL) ;
if ( ! vtDir.Normalize())
return GDB_ID_NULL ;
ptDimL = ptCenL + Dist( ptDimL, ptCenL) * vtDir ;
// creo la quota
PtrOwner<IExtDimension> pDim( CreateExtDimension()) ;
if ( IsNull( pDim ) ||
! MySetDimensionStyle( pDim) ||
! pDim->SetAngular( ptP1L, ptCenL, ptP2L, ptDimL, vtNL, sText))
return GDB_ID_NULL ;
// inserisco la quota nel DB
return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pDim)) ;
}
//-------------------------------------------------------------------------------
int
ExeCreateAngularDimensionFromArc( int nParentId, int nCrvId, const Point3d& ptDim,
const string& sText, int nRefType)
{
// eseguo
int nId = MyCreateAngularDimensionFromArc( nParentId, nCrvId, ptDim, sText, nRefType) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtAngularDimensionFromArc(" + IdToString( nParentId) + "," +
IdToString( nCrvId) + ",{" +
ToString( ptDim) + "},'" +
StringToLuaString( sText) + "'," +
RefTypeToString( nRefType) + ")" +
" -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo del oggetto
return nId ;
}
+83 -12
View File
@@ -362,16 +362,13 @@ CreateLineTgTwoCurves( IGeomDB* pGeomDB, int nParentId,
if ( pCrv2 == nullptr)
return nullptr ;
// porto la seconda curva nel riferimento della prima
PtrOwner<ICurve> pCrv2Loc( pCrv2->Clone()) ;
if ( IsNull( pCrv2Loc))
return nullptr ;
pCrv2Loc->LocToLoc( frCrv2, frCrv1) ;
CurveLocal Crv2Loc( pGeomDB, nIdF, frCrv1) ;
// porto il punto vicino al finale nel riferimento della prima curva
Point3d ptN2loc( ptFin) ;
ptN2loc.LocToLoc( frDest, frCrv1) ;
// calcolo la retta tangente alle due curve
PtrOwner<ICurveLine> pCrvLine ;
pCrvLine.Set( GetLineTgTwoCurves( *pCrv1, ptN1loc, *pCrv2Loc, ptN2loc)) ;
pCrvLine.Set( GetLineTgTwoCurves( *pCrv1, ptN1loc, *Crv2Loc, ptN2loc)) ;
if ( IsNull( pCrvLine))
return nullptr ;
// porto la linea nel riferimento del gruppo destinazione
@@ -1091,6 +1088,83 @@ ExeCreateArc3P( int nParentId, const Point3d& ptP1,
return nId ;
}
//-------------------------------------------------------------------------------
int
ExeCreateArc2PR( int nParentId, const Point3d& ptStart, const Point3d& ptEnd,
double dRad, bool bCCW, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
// recupero il riferimento locale
Frame3d frLoc ;
bool bOk = pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
// porto in locale i punti, il versore normale e quelloe estrusione
Point3d ptStartL = GetPointLocal( pGeomDB, ptStart, nRefType, frLoc) ;
Point3d ptEndL = GetPointLocal( pGeomDB, ptEnd, nRefType, frLoc) ;
Vector3d vtNormL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ;
Vector3d vtExtrL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ;
// creo l'arco
PtrOwner<ICurveArc> pCrvArc( CreateCurveArc()) ;
bOk = bOk && ( ! IsNull( pCrvArc) &&
pCrvArc->Set2PNRS( ptStartL, ptEndL, vtNormL, dRad, bCCW)) ;
// assegno il versore estrusione
bOk = bOk && pCrvArc->SetExtrusion( vtExtrL) ;
// inserisco l'arco nel DB
int nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pCrvArc)) : GDB_ID_NULL) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtArc2PR(" + IdToString( nParentId) + ",{" +
ToString( ptStart) + "},{" +
ToString( ptEnd) + "}," +
ToString( dRad) + "," +
RefTypeToString( nRefType) + ")" +
" -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
return nId ;
}
//-------------------------------------------------------------------------------
int
ExeCreateArc2PB( int nParentId, const Point3d& ptStart, const Point3d& ptEnd,
double dBulge, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
// recupero il riferimento locale
Frame3d frLoc ;
bool bOk = pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
// porto in locale i punti, il versore normale e quelloe estrusione
Point3d ptStartL = GetPointLocal( pGeomDB, ptStart, nRefType, frLoc) ;
Point3d ptEndL = GetPointLocal( pGeomDB, ptEnd, nRefType, frLoc) ;
Vector3d vtNormL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ;
Vector3d vtExtrL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ;
// creo l'arco (in casi particolari retta)
PtrOwner<ICurve> pCrv( bOk ? GetArc2PNB( ptStartL, ptEndL, vtNormL, dBulge) : nullptr) ;
bOk = bOk && ! IsNull( pCrv) ;
// assegno il versore estrusione
bOk = bOk && pCrv->SetExtrusion( vtExtrL) ;
// inserisco l'arco nel DB
int nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pCrv)) : GDB_ID_NULL) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtArc2PB(" + IdToString( nParentId) + ",{" +
ToString( ptStart) + "},{" +
ToString( ptEnd) + "}," +
ToString( dBulge) + "," +
RefTypeToString( nRefType) + ")" +
" -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
return nId ;
}
//-------------------------------------------------------------------------------
int
ExeCreateArc2PD( int nParentId, const Point3d& ptStart, const Point3d& ptEnd,
@@ -1099,20 +1173,17 @@ ExeCreateArc2PD( int nParentId, const Point3d& ptStart, const Point3d& ptEnd,
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
// creo l'arco (in casi particolari retta)
PtrOwner<ICurve> pCrv ;
bool bOk = true ;
// recupero il riferimento locale
Frame3d frLoc ;
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
bool bOk = pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
// porto in locale i punti, il versore iniziale, quello normale e il versore estrusione
Point3d ptStartL = GetPointLocal( pGeomDB, ptStart, nRefType, frLoc) ;
Point3d ptEndL = GetPointLocal( pGeomDB, ptEnd, nRefType, frLoc) ;
Vector3d vtDirSL = GetVectorLocal( pGeomDB, FromPolar( 1, dDirSDeg), nRefType, frLoc) ;
Vector3d vtNormL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ;
Vector3d vtExtrL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ;
// setto l'arco
pCrv.Set( GetArc2PVN( ptStartL, ptEndL, vtDirSL, vtNormL)) ;
// creo l'arco (in casi particolari retta)
PtrOwner<ICurve> pCrv( bOk ? GetArc2PVN( ptStartL, ptEndL, vtDirSL, vtNormL) : nullptr) ;
bOk = bOk && ! IsNull( pCrv) ;
// assegno il versore estrusione
bOk = bOk && pCrv->SetExtrusion( vtExtrL) ;
@@ -1948,7 +2019,7 @@ ExeCreateCurveCompoByInterpolation( int nParentId, const PolyLine& PL, int nType
bFound ;
bFound = PL.GetNextPoint( ptP))
crvByInterp.AddPoint( ptP) ;
PtrOwner<ICurve> pCrvCompo( crvByInterp.GetCurve( nMethod, nType)) ;
PtrOwner<ICurve> pCrvCompo( crvByInterp.GetCurve( nMethod, nCrvType)) ;
bOk = bOk && ! IsNull( pCrvCompo) ;
// assegno il versore estrusione
bOk = bOk && pCrvCompo->SetExtrusion( Z_AX) ;
+402 -79
View File
@@ -1,4 +1,4 @@
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
// EgalTech 2014-2015
//----------------------------------------------------------------------------
// File : EXE_GdbCreateSurf.cpp Data : 04.05.15 Versione : 1.6e1
@@ -31,7 +31,10 @@
#include "/EgtDev/Include/EGkStringUtils3d.h"
#include "/EgtDev/Include/EGkGeoPoint3d.h"
#include "/EgtDev/Include/EGkCurveLocal.h"
#include "/EgtDev/Include/EGkSurfLocal.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
#include "/EgtDev/Include/EGkExtText.h"
#include "/EgtDev/Include/EGkSbzStandard.h"
using namespace std ;
@@ -56,8 +59,7 @@ ExeCreateSurfFrRectangle( int nParentId, const Point3d& ptIni, const Point3d& pt
if ( ( frEnt.VersZ() * vtZL) < 0)
frEnt.PseudoMirror( frEnt.Orig(), frEnt.VersZ()) ;
// ricavo le dimensioni della base
Point3d ptCrossI = ptCrossL ;
ptCrossI.ToLoc( frEnt) ;
Point3d ptCrossI = GetToLoc( ptCrossL, frEnt) ;
double dWidth = ptCrossI.x ;
double dLen = ptCrossI.y ;
// creo il rettangolo nel suo riferimento intrinseco
@@ -80,7 +82,7 @@ ExeCreateSurfFrRectangle( int nParentId, const Point3d& ptIni, const Point3d& pt
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
@@ -131,7 +133,7 @@ ExeCreateSurfFrRectangle3P( int nParentId, const Point3d& ptIni,
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
@@ -180,7 +182,7 @@ ExeCreateSurfFrStadium( int nParentId, const Point3d& ptIni, const Point3d& ptCr
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
@@ -197,7 +199,7 @@ ExeCreateSurfFrDisk( int nParentId, const Point3d& ptOrig, double dRad, int nRef
// porto in locale il punto e calcolo la normale in locale
Point3d ptOrigL = GetPointLocal( pGeomDB, ptOrig, nRefType, frLoc) ;
Vector3d vtNL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ;
// calcolo riferimento per l'entità
// calcolo riferimento per l'entità
Frame3d frEnt ;
bOk = bOk && frEnt.Set( ptOrigL, vtNL) ;
// creo il disco nel suo riferimento intrinseco
@@ -217,13 +219,13 @@ ExeCreateSurfFrDisk( int nParentId, const Point3d& ptOrig, double dRad, int nRef
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
//-------------------------------------------------------------------------------
int
ExeCreateSurfFrFatCurve( int nParentId, int nCrvId, double dRad, bool bSquared)
ExeCreateSurfFrFatCurve( int nParentId, int nCrvId, double dRad, bool bSquaredEnds, bool bSquaredMids, double dLinTol)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
@@ -246,7 +248,7 @@ ExeCreateSurfFrFatCurve( int nParentId, int nCrvId, double dRad, bool bSquared)
// eseguo la trasformazione (viene eseguita solo se i riferimenti sono diversi
pCopCrv->LocToLoc( frCrv, frLoc) ;
// creo la regione
PtrOwner<ISurfFlatRegion> pSfr( GetSurfFlatRegionFromFatCurve( Release( pCopCrv), dRad, bSquared, bSquared)) ;
PtrOwner<ISurfFlatRegion> pSfr( GetSurfFlatRegionFromFatCurve( Release( pCopCrv), dRad, bSquaredEnds, bSquaredMids, dLinTol)) ;
bOk = bOk && ! IsNull( pSfr) ;
// inserisco la superficie nel DB
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pSfr)) : GDB_ID_NULL) ;
@@ -256,11 +258,12 @@ ExeCreateSurfFrFatCurve( int nParentId, int nCrvId, double dRad, bool bSquared)
string sLua = "EgtSurfFrFatCurve(" + IdToString( nParentId) + "," +
ToString( nCrvId) + "," +
ToString( dRad) + "," +
ToString( bSquared) + ")" +
ToString( bSquaredEnds) + "," +
ToString( bSquaredMids) + ")" +
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
@@ -316,7 +319,7 @@ MyCreateSurfFlatRegion( int nParentId, const INTVECTOR& vCrvIds, int* pnCount)
// recupero la prossima superficie
pSfr = SfrCntr.GetSurf() ;
}
// restituisco l'identificativo della prima nuova entità
// restituisco l'identificativo della prima nuova entità
if ( pnCount != nullptr)
*pnCount = nCount ;
return nFirstId ;
@@ -339,7 +342,7 @@ ExeCreateSurfFlatRegion( int nParentId, const INTVECTOR& vCrvIds, int* pnCount)
" -- Id=" + ToString( nFirstId) + ",Nbr=" + ToString( nCount) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nFirstId ;
}
@@ -388,7 +391,7 @@ ExeCreateSurfTmPlaneInBBox( int nParentId, const Point3d& ptP, const Vector3d& v
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
@@ -449,7 +452,7 @@ MyCreateSewPolygon( ISurfTriMesh* pStm, const Polygon3d& Polyg)
// verifico esistenza superficie
if ( pStm == nullptr)
return false ;
// se poligono vuoto, non devo fare alcunché
// se poligono vuoto, non devo fare alcunché
if ( Polyg.GetSideCount() == 0)
return true ;
// creo la superficie trimesh del poligono
@@ -579,7 +582,7 @@ ExeCreateSurfTmConvexHullInBBox( int nParentId, int nId, const BBox3d& b3Box, in
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
@@ -627,7 +630,7 @@ ExeCreateSurfTmBBox( int nParentId, const BBox3d& b3Box, bool bRegular, int nRef
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
@@ -682,7 +685,7 @@ ExeCreateSurfTmBox( int nParentId, const Point3d& ptIni, const Point3d& ptCross,
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
@@ -739,7 +742,7 @@ ExeCreateSurfTmPyramid( int nParentId, const Point3d& ptIni, const Point3d& ptCr
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
@@ -781,7 +784,7 @@ ExeCreateSurfTmCylinder( int nParentId, const Point3d& ptOrig, const Vector3d& v
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
@@ -823,7 +826,7 @@ ExeCreateSurfTmCone( int nParentId, const Point3d& ptOrig, const Vector3d& vtN,
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
@@ -859,7 +862,98 @@ ExeCreateSurfTmSphere( int nParentId, const Point3d& ptOrig,
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
//-------------------------------------------------------------------------------
int
ExeCreateSurfTmTriangle( int nParentId, const Point3d& ptP1, const Point3d& ptP2, const Point3d& ptP3, 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 ptP1L = GetPointLocal( pGeomDB, ptP1, nRefType, frLoc) ;
Point3d ptP2L = GetPointLocal( pGeomDB, ptP2, nRefType, frLoc) ;
Point3d ptP3L = GetPointLocal( pGeomDB, ptP3, nRefType, frLoc) ;
// creo la superficie trimesh
PtrOwner<ISurfTriMesh> pStm( CreateSurfTriMesh()) ;
bOk = bOk && ! IsNull( pStm) ;
// assegno il triangolo
if ( bOk) {
pStm->Init( 3, 1, 1) ;
int vV[3]{ pStm->AddVertex( ptP1L),
pStm->AddVertex( ptP2L),
pStm->AddVertex( ptP3L)} ;
bOk = ( pStm->AddTriangle( vV) != SVT_NULL) && pStm->AdjustTopology() ;
}
// inserisco la superficie nel DB
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pStm)) : GDB_ID_NULL) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfTmTriangle(" + IdToString( nParentId) + ",{" +
ToString( ptP1) + "},{" +
ToString( ptP2) + "},{" +
ToString( ptP3) + "}," +
RefTypeToString( nRefType) + ")" +
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
return nNewId ;
}
//-------------------------------------------------------------------------------
int
ExeCreateSurfTmRectangle( int nParentId, const Point3d& ptO, const Point3d& ptL, const Point3d& ptT, 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 ptOL = GetPointLocal( pGeomDB, ptO, nRefType, frLoc) ;
Point3d ptLL = GetPointLocal( pGeomDB, ptL, nRefType, frLoc) ;
Point3d ptTL = GetPointLocal( pGeomDB, ptT, nRefType, frLoc) ;
// modifico il punto trasversale per metterlo perpendicolare al lato Lungo
ptTL -= ParallCompo( ptTL - ptOL, ptLL - ptOL) ;
// calcolo il quarto punto
Point3d ptVL = ptTL + ( ptLL - ptOL) ;
// creo la superficie trimesh
PtrOwner<ISurfTriMesh> pStm( CreateSurfTriMesh()) ;
bOk = bOk && ! IsNull( pStm) ;
// assegno il triangolo
if ( bOk) {
pStm->Init( 4, 2, 1) ;
int vV[4]{ pStm->AddVertex( ptOL),
pStm->AddVertex( ptLL),
pStm->AddVertex( ptTL),
pStm->AddVertex( ptVL)} ;
int vV1[3]{ vV[0], vV[1], vV[2] } ;
int vV2[3]{ vV[2], vV[1], vV[3] } ;
bOk = ( pStm->AddTriangle( vV1) != SVT_NULL) && ( pStm->AddTriangle( vV2) != SVT_NULL) && pStm->AdjustTopology() ;
}
// inserisco la superficie nel DB
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pStm)) : GDB_ID_NULL) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfTmRectangle(" + IdToString( nParentId) + ",{" +
ToString( ptO) + "},{" +
ToString( ptL) + "},{" +
ToString( ptT) + "}," +
RefTypeToString( nRefType) + ")" +
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
return nNewId ;
}
@@ -890,7 +984,7 @@ ExeCreateSurfTmByFlatContour( int nParentId, int nCrvId, double dLinTol)
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
@@ -936,7 +1030,7 @@ ExeCreateSurfTmByRegion( int nParentId, const INTVECTOR& vCrvIds, double dLinTol
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
@@ -991,7 +1085,7 @@ ExeCreateSurfTmByExtrusion( int nParentId, const INTVECTOR& vCrvIds, const Vecto
" -- Id=" + ToString( nFirstId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nFirstId ;
}
@@ -1035,7 +1129,7 @@ ExeCreateSurfTmByRegionExtrusion( int nParentId, const INTVECTOR& vCrvIds, const
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
@@ -1075,7 +1169,7 @@ ExeCreateSurfTmByRevolve( int nParentId, int nCrvId,
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
@@ -1117,13 +1211,113 @@ ExeCreateSurfTmByScrewing( int nParentId, int nCrvId,
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
//-------------------------------------------------------------------------------
int
ExeCreateSurfTmSwept( int nParentId, int nSectId, int nGuideId, bool bCapEnds, double dLinTol)
ExeCreateSurfTmRectSwept( int nParentId, double dDimH, double dDimV, double dBevelH, double dBevelV,
int nGuideId, int nCapType, double dLinTol)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
bool bOk = true ;
// recupero il riferimento locale
Frame3d frLoc ;
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
// recupero la guida in locale
CurveLocal CrvGuide( pGeomDB, nGuideId, frLoc) ;
bOk = bOk && ( CrvGuide.Get() != nullptr) ;
// creo la superficie trimesh
ISurfTriMesh* pSTM = nullptr ;
pSTM = ( bOk ? GetSurfTriMeshRectSwept( dDimH, dDimV, dBevelH, dBevelV, CrvGuide, nCapType, dLinTol) : nullptr) ;
// inserisco la superficie trimesh nel DB
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, pSTM) : GDB_ID_NULL) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfTmRectSwept(" + IdToString( nParentId) + "," +
ToString( dDimH) + "," +
ToString( dDimV) + "," +
ToString( dBevelH) + "," +
ToString( dBevelV) + "," +
ToString( nGuideId) + "," +
ToString( nCapType) + "," +
ToString( dLinTol) + ")" +
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
return nNewId ;
}
//-------------------------------------------------------------------------------
int
ExeCreateSurfTmSwept( int nParentId, int nSectId, int nGuideId, const Vector3d& vtAx,
bool bCapEnds, double dLinTol, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
bool bOk = true ;
// recupero il riferimento locale
Frame3d frLoc ;
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
// recupero la guida in locale
CurveLocal CrvGuide( pGeomDB, nGuideId, frLoc) ;
bOk = bOk && ( CrvGuide.Get() != nullptr) ;
// porto in locale vettore asse
Vector3d vtAxL = GetVectorLocal( pGeomDB, vtAx, nRefType, frLoc) ;
// inizializzazione superficie e suo Id
ISurfTriMesh* pSTM = nullptr ;
int nNewId = GDB_ID_NULL ;
// recupero il tipo di entità della sezione
int nSecType = pGeomDB->GetGeoType( nSectId) ;
// controllo se la sezione è definita da una curva
if ( ( nSecType & GEO_CURVE) != 0) {
// recupero la sezione in locale
CurveLocal CrvSect( pGeomDB, nSectId, frLoc) ;
bOk = bOk && ( CrvSect.Get() != nullptr) ;
// calcolo la Swept
pSTM = ( bOk ? GetSurfTriMeshSwept( CrvSect, CrvGuide, vtAxL, bCapEnds, dLinTol) : nullptr) ;
// inserisco la superficie trimesh nel DB
nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, pSTM) : GDB_ID_NULL) ;
}
// controllo se la sezione è definita da una regione piana
else if ( nSecType == SRF_FLATRGN) {
// recupero la regione sezion in locale
SurfLocal SrfSect( pGeomDB, nSectId, frLoc) ;
const ISurfFlatRegion* pSFrSect = GetSurfFlatRegion( SrfSect.Get()) ;
bOk = bOk && ( pSFrSect != nullptr) ;
// calcolo la Swept
pSTM = ( bOk ? GetSurfTriMeshSwept( pSFrSect, CrvGuide, vtAxL, bCapEnds, dLinTol) : nullptr) ;
// inserisco la superficie trimesh nel DB
nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, pSTM) : GDB_ID_NULL) ;
}
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfTmSwept(" + IdToString( nParentId) + "," +
ToString( nSectId) + "," +
ToString( nGuideId) + ",{" +
ToString( vtAx) + "}," +
( bCapEnds ? "true" : "false") + "," +
ToString( dLinTol) + "," +
RefTypeToString( nRefType) + ")" +
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
return nNewId ;
}
//-------------------------------------------------------------------------------
int
ExeCreateSurfTmTransSwept( int nParentId, int nSectId, int nGuideId, bool bCapEnds, double dLinTol)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
@@ -1140,21 +1334,21 @@ ExeCreateSurfTmSwept( int nParentId, int nSectId, int nGuideId, bool bCapEnds, d
bOk = bOk && ( CrvGuide.Get() != nullptr) ;
// creo la superficie trimesh
ISurfTriMesh* pSTM = nullptr ;
pSTM = ( bOk ? GetSurfTriMeshSwept( CrvSect, CrvGuide, bCapEnds, dLinTol) : nullptr) ;
pSTM = ( bOk ? GetSurfTriMeshTransSwept( CrvSect, CrvGuide, bCapEnds, dLinTol) : nullptr) ;
// inserisco la superficie trimesh nel DB
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, pSTM) : GDB_ID_NULL) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfTmSwept(" + IdToString( nParentId) + "," +
ToString( nSectId) + "," +
ToString( nGuideId) + "," +
( bCapEnds ? "true" : "false") + "," +
ToString( dLinTol) + ")" +
string sLua = "EgtSurfTmTransSwept(" + IdToString( nParentId) + "," +
ToString( nSectId) + "," +
ToString( nGuideId) + "," +
( bCapEnds ? "true" : "false") + "," +
ToString( dLinTol) + ")" +
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
@@ -1171,7 +1365,7 @@ ExeCreateSurfTmRuled( int nParentId, int nPtOrCrvId1, int nPtOrCrvId2, int nType
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
// creo la superficie trimesh
ISurfTriMesh* pSTM = nullptr ;
// se la prima entità è un punto e la seconda una curva
// se la prima entità è un punto e la seconda una curva
if ( pGeomDB->GetGeoType( nPtOrCrvId1) == GEO_PNT3D &&
( pGeomDB->GetGeoType( nPtOrCrvId2) & GEO_CURVE) != 0) {
// recupero il punto in locale
@@ -1187,7 +1381,7 @@ ExeCreateSurfTmRuled( int nParentId, int nPtOrCrvId1, int nPtOrCrvId2, int nType
// calcolo la superficie
pSTM = ( bOk ? GetSurfTriMeshRuled( ptP, CrvLoc, dLinTol) : nullptr) ;
}
// se la prima entità è una curva e la seconda un punto
// se la prima entità è una curva e la seconda un punto
else if ( ( pGeomDB->GetGeoType( nPtOrCrvId1) & GEO_CURVE) != 0 &&
pGeomDB->GetGeoType( nPtOrCrvId2) == GEO_PNT3D) {
// recupero la curva in locale
@@ -1231,7 +1425,7 @@ ExeCreateSurfTmRuled( int nParentId, int nPtOrCrvId1, int nPtOrCrvId2, int nType
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
@@ -1342,7 +1536,7 @@ ExeCreateSurfTmBySewing( int nParentId, const INTVECTOR& vIds, bool bErase)
bOk = bOk && pGeomDB->GetGlobFrame( nId, frStmS) ;
// lo esprimo rispetto a quello della prima superficie
frStmS.ToLoc( frLoc) ;
// se è la prima, copio
// se è la prima, copio
if ( bFirst) {
bOk = bOk && pStm->CopyFrom( pStmS) ;
bOk = bOk && pStm->ToGlob( frStmS) ;
@@ -1387,42 +1581,6 @@ ExeCreateSurfTmBySewing( int nParentId, const INTVECTOR& vIds, bool bErase)
return nNewId ;
}
//----------------------------------------------------------------------------
int
ExeCreateSurfTmBySurfBezier( int nParentId, int nSbezId)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
// recupero la superficie di Bezier
const ISurfBezier* pSbez = GetSurfBezier( pGeomDB->GetGeoObj( nSbezId)) ;
bool bOk = ( pSbez != nullptr) ;
// recupero il riferimento della superficie sorgente
Frame3d frSou ;
bOk = bOk && pGeomDB->GetGlobFrame( nSbezId, frSou) ;
// recupero il riferimento locale
Frame3d frLoc ;
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
// copio la superficie ausiliaria della Bezier
const ISurfTriMesh* pAuxSurf = ( bOk ? pSbez->GetAuxSurf() : nullptr) ;
PtrOwner<ISurfTriMesh> pStm( pAuxSurf != nullptr ? pAuxSurf->Clone() : nullptr) ;
bOk = bOk && ! IsNull( pStm) ;
// la porto nel riferimento destinazione
pStm->LocToLoc( frSou, frLoc) ;
// inserisco la superficie trimesh nel DB
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pStm)) : GDB_ID_NULL) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfTmBySurfBezier(" + IdToString( nParentId) + "," +
IdToString( nSbezId) + ")" +
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco il risultato
return nNewId ;
}
//----------------------------------------------------------------------------
int
ExeCreateSurfTmByVolZmap( int nParentId, int nZmapId, int nPart)
@@ -1531,7 +1689,7 @@ ExeCreateSurfBezier( int nParentId, int nDegU, int nDegV, int nSpanU, int nSpanV
" -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nId ;
}
@@ -1583,6 +1741,171 @@ ExeCreateSurfBezierRational( int nParentId, int nDegU, int nDegV, int nSpanU, in
" -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nId ;
}
//-------------------------------------------------------------------------------
int
ExeCreateSurfBezierLeaves( int nParentId, int nSurfBzId, int nTextHeight, bool bShowTrim, int* pnCount)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
// recupero la superficie
const ISurfBezier* pSurfBez = GetSurfBezier( pGeomDB->GetGeoObj( nSurfBzId)) ;
if ( pSurfBez == nullptr)
return GDB_ID_NULL ;
// disegno le foglie
vector<tuple<int,Point3d,Point3d>> vLeaves ;
pSurfBez->GetLeaves( vLeaves) ;
double dFactor = 1 ;
int nFirstId = GDB_ID_NULL ;
int nCount = 0 ;
for ( int k = 0 ; k < (int)vLeaves.size() ; ++ k) {
Point3d ptBL = get<1>( vLeaves[k]) * dFactor ;
Point3d ptTR = get<2>( vLeaves[k]) * dFactor ;
Point3d ptBR( ptTR.x, ptBL.y) ;
Point3d ptTL( ptBL.x, ptTR.y) ;
PolyLine PL ;
PL.AddUPoint( 0, ptBL) ;
PL.AddUPoint( 1, ptBR) ;
PL.AddUPoint( 2, ptTR) ;
PL.AddUPoint( 3, ptTL) ;
PL.Close() ;
// creo la curva e la inserisco nel GDB
PtrOwner<ICurveComposite> pCrvCompo( CreateCurveComposite()) ;
if ( IsNull( pCrvCompo) || ! pCrvCompo->FromPolyLine( PL) || ! pCrvCompo->SetExtrusion( Z_AX))
return GDB_ID_NULL ;
// inserisco la curva composita nel DB
int nCrvId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pCrvCompo)) ;
if ( nCrvId == GDB_ID_NULL)
return GDB_ID_NULL ;
++ nCount ;
if ( nFirstId == GDB_ID_NULL)
nFirstId = nCrvId ;
// creo il testo e lo riempio
string sText = ToString( get<0>( vLeaves[k])) ;
Point3d ptCenter( ( ptBL + ptTR) / 2) ;
PtrOwner<IExtText> pTXT( CreateExtText()) ;
if ( IsNull( pTXT) || ! pTXT->Set( ptCenter, Z_AX, X_AX, sText, "", false, nTextHeight))
return GDB_ID_NULL ;
// inserisco il testo nel DB
int nTxtId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pTXT)) ;
if ( nTxtId == GDB_ID_NULL)
return GDB_ID_NULL ;
++ nCount ;
}
// se richiesto disegno la regione di trim
const ISurfFlatRegion* pSfr = pSurfBez->GetTrimRegion() ;
if ( bShowTrim && pSfr != nullptr) {
PtrOwner<ISurfFlatRegion> pTrimReg( pSfr->Clone()) ;
if ( ! IsNull( pTrimReg)) {
int nTrimId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pTrimReg)) ;
if ( nTrimId == GDB_ID_NULL)
return GDB_ID_NULL ;
++ nCount ;
}
}
// restituisco i risultati
if ( pnCount != nullptr)
*pnCount = nCount ;
return nFirstId ;
}
//-------------------------------------------------------------------------------
int
ExeCreateSurfBezierTria2D( int nParentId, int nSurfBzId, int nTextHeight, bool bShowTrim, int* pnCount)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
// recupero la superficie
const ISurfBezier* pSurfBez = GetSurfBezier( pGeomDB->GetGeoObj( nSurfBzId)) ;
if ( pSurfBez == nullptr)
return GDB_ID_NULL ;
// disegno i triangoli
vector<tuple<int,Point3d,Point3d,Point3d>> vTria2D ;
pSurfBez->GetTriangles2D( vTria2D) ;
int nFirstId = GDB_ID_NULL ;
int nCount = 0 ;
bool bOk = true ;
for ( int k = 0 ; k < (int)vTria2D.size() ; ++ k) {
PtrOwner<ISurfTriMesh> pStm( CreateSurfTriMesh()) ;
bOk = bOk && ! IsNull( pStm) ;
Point3d ptP1L = get<1>(vTria2D[k]) ;
Point3d ptP2L = get<2>(vTria2D[k]) ;
Point3d ptP3L = get<3>(vTria2D[k]) ;
// assegno il triangolo
if ( bOk) {
pStm->Init( 3, 1, 1) ;
int vV[3]{ pStm->AddVertex( ptP1L),
pStm->AddVertex( ptP2L),
pStm->AddVertex( ptP3L)} ;
bOk = ( pStm->AddTriangle( vV) != SVT_NULL) && pStm->AdjustTopology() ;
}
// inserisco la superficie nel DB
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pStm)) : GDB_ID_NULL) ;
if ( nNewId == GDB_ID_NULL)
return GDB_ID_NULL ;
if ( nFirstId == GDB_ID_NULL)
nFirstId = nNewId ;
++ nCount ;
// creo il testo e lo riempio
string sText = ToString( get<0>( vTria2D[k])) ;
Point3d ptCenter( ( ptP1L + ptP2L + ptP3L) / 3) ;
PtrOwner<IExtText> pTXT( CreateExtText()) ;
if ( IsNull( pTXT) || ! pTXT->Set( ptCenter, Z_AX, X_AX, sText, "", false, nTextHeight))
return GDB_ID_NULL ;
// inserisco il testo nel DB
int nTxtId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pTXT)) ;
if ( nTxtId == GDB_ID_NULL)
return GDB_ID_NULL ;
++ nCount ;
}
// se richiesto disegno la regione di trim
const ISurfFlatRegion* pSfr = pSurfBez->GetTrimRegion() ;
if ( bShowTrim && pSfr != nullptr) {
PtrOwner<ISurfFlatRegion> pTrimReg( pSfr->Clone()) ;
if ( ! IsNull( pTrimReg)) {
int nTrimId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pTrimReg)) ;
if ( nTrimId == GDB_ID_NULL)
return GDB_ID_NULL ;
++ nCount ;
}
}
// restituisco i risultati
if ( pnCount != nullptr)
*pnCount = nCount ;
return nFirstId ;
}
//-------------------------------------------------------------------------------
int
ExeCreateBezierSphere( int nParentId, const Point3d& ptCenter, double dR, int nRefType) {
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
bool bOk = true ;
// recupero il riferimento di immersione della superficie
Frame3d frLoc ;
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
// reucpero il punto in locale
Point3d ptCenterLoc = GetPointLocal( pGeomDB, ptCenter, nRefType, frLoc) ;
// Creo la superficie
PtrOwner<ISurfBezier> pSurfBez( CreateBezierSphere( ptCenterLoc, dR)) ;
int nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pSurfBez)) : GDB_ID_NULL) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtCreateBezierSphere(" + IdToString( nParentId) + "," +
ToString( ptCenter) + "," +
ToString( dR) + "," +
RefTypeToString( nRefType) + ")" +
" -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// resituisco l'identificativo dell'entit creata
return nId ;
}
+47 -4
View File
@@ -1,4 +1,4 @@
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
// EgalTech 2016-2016
//----------------------------------------------------------------------------
// 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) ;
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 ;
}
@@ -103,7 +146,7 @@ ExeCreateVolZmapByRegionExtrusion( int nParentId, int nSfrId, double dDimZ, doub
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
@@ -141,6 +184,6 @@ ExeCreateVolZmapFromSurfTm( int nParentId, int nStmId, double dPrec, bool bTriDe
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
// restituisco l'identificativo della nuova entità
return nNewId ;
}
+21
View File
@@ -23,6 +23,7 @@
#include "/EgtDev/Include/EGkCurveArc.h"
#include "/EgtDev/Include/EGkCurveBezier.h"
#include "/EgtDev/Include/EGkCurveComposite.h"
#include "/EgtDev/Include/EGkCurveAux.h"
#include "/EgtDev/Include/EGkDistPointCurve.h"
#include "/EgtDev/Include/EGkIntersCurves.h"
#include "/EgtDev/Include/EGkSurfFlatRegion.h"
@@ -188,6 +189,8 @@ ExeCurveIsACircle( int nId, Point3d& ptCen, Vector3d& vtN, double& dRad, bool& b
bCCW = ( pArc->GetAngCenter() > 0) ;
return true ;
}
else
return false ;
}
case CRV_COMPO :
{ ICurveComposite* pCompo = GetCurveComposite( pGObj) ;
@@ -548,6 +551,24 @@ ExeArcNormVersor( int nId, int nRefId, Vector3d& vtNorm)
return TransformVector( pGeomDB, nId, nRefId, vtNorm) ;
}
//----------------------------------------------------------------------------
bool
ExeCurveCompoLength( int nId, int nSimpCrv, double& dLen)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la curva composita
const ICurveComposite* pCompoCrv = GetCurveComposite( pGeomDB->GetGeoObj( nId)) ;
if ( pCompoCrv == nullptr)
return false ;
// recupero la curva semplice di indice richiesto
const ICurve* pSimpCrv = pCompoCrv->GetCurve( nSimpCrv) ;
if ( pSimpCrv == nullptr)
return false ;
// recupero la sua lunghezza
return pSimpCrv->GetLength( dLen) ;
}
//----------------------------------------------------------------------------
bool
ExeCurveCompoCenter( int nId, int nSimpCrv, int nRefId, Point3d& ptCen)
+161
View File
@@ -0,0 +1,161 @@
//----------------------------------------------------------------------------
// EgalTech 2023-2024
//----------------------------------------------------------------------------
// File : Exe_GdbGetPocketing.cpp Data : 02.02.24 Versione : 2.6b1
// Contenuto : Funzioni di interrogazione di regioni piane del DBG per EXE.
//
//
//
// Modifiche : 29.11.23 RE Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "EXE.h"
#include "EXE_Macro.h"
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EGkSfrCreate.h"
#include "/EgtDev/Include/EGkCalcPocketing.h"
using namespace std ;
//----------------------------------------------------------------------------
bool
ExePocketing( const int nId, double dRad, double dStep, double dAngle, int nType, bool bSmooth, int nDestGrpId,
int& nFirstId, int& nCrvCount)
{
// database geometrico
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false) ;
// recupero la FlatRegion da svuotare
PtrOwner<ISurfFlatRegion> pMySfr ;
const ISurfFlatRegion* pSfr = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId)) ;
if ( pSfr == nullptr) {
// verifico se è una curva chiusa e piana che permette di definire una regione
const ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nId)) ;
Plane3d plPlane ;
if ( pCrv == nullptr || ! pCrv->IsFlat( plPlane, true, 10 * EPS_SMALL))
return false ;
SurfFlatRegionByContours SfrCntr ;
SfrCntr.AddCurve( pCrv->Clone()) ;
pMySfr.Set( SfrCntr.GetSurf()) ;
if ( IsNull( pMySfr))
return false ;
pSfr = pMySfr ;
}
// recupero il suo frame
Frame3d frSfr ;
if ( ! pGeomDB->GetGlobFrame( nId, frSfr))
return false ;
// recupero il riferimento del gruppo di destinazione
Frame3d frDest ;
if ( ! pGeomDB->GetGroupGlobFrame( nDestGrpId, frDest))
return false ;
// eseguo Pocketing
ICRVCOMPOPOVECTOR vCrvCompoRes ;
bool bOk = CalcPocketing( pSfr, dRad, dStep, dAngle, nType, bSmooth, vCrvCompoRes) ;
nFirstId = GDB_ID_NULL ;
nCrvCount = int( vCrvCompoRes.size()) ;
if ( bOk && nCrvCount > 0) {
// scorro le curve di Pocketing ottenute
for ( int nI = 0 ; nI < nCrvCount ; ++ nI) {
vCrvCompoRes[nI]->LocToLoc( frSfr, frDest) ;
// inserisco la curva nel DB Geometrico
int nCurrId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( vCrvCompoRes[nI])) ;
if ( nCurrId == GDB_ID_NULL)
return false ;
if ( nI == 0)
nFirstId = nCurrId ;
}
ExeSetModified() ;
}
if ( IsCmdLog()) {
string sLua = "EgtPocketing(" + ToString( nId) + "," +
ToString( dRad) + "," +
ToString( dStep) + "," +
ToString( dAngle) + "," +
ToString( nType) + "," +
ToString( bSmooth) + "," +
ToString( nDestGrpId) + ")" +
" FirstId=" + ToString( nFirstId) + " CurveCount=" + ToString( nCrvCount) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
//----------------------------------------------------------------------------
int
ExeSurfFrGetZigZagInfill( int nId, int nDestGrpId, double dStep, double dAng, bool bSmooth, bool bRemoveOverlapLink,
int* pnCount)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// recupero la superficie FlatRegion
ISurfFlatRegion* pOrigSrf = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId)) ;
if ( pOrigSrf == nullptr)
return GDB_ID_NULL ;
PtrOwner<ISurfFlatRegion> pSfr( pOrigSrf->Clone()) ;
bool bOk = ( ! IsNull( pSfr)) ;
// recupero il riferimento della superficie
Frame3d frSurf ;
bOk = bOk && pGeomDB->GetGlobFrame( nId, frSurf) ;
// recupero il riferimento di destinazione
Frame3d frDest ;
bOk = bOk && pGeomDB->GetGroupGlobFrame( nDestGrpId, frDest) ;
// creo il riferimento per il calcolo del percorso a zigzag
Vector3d vtN ;
if ( bOk)
vtN = pSfr->GetNormVersor() ;
bOk = bOk && vtN.ToGlob( frSurf) ;
Frame3d frRef ;
bOk = bOk && frRef.Set( ORIG, vtN) ;
bOk = bOk && frRef.Rotate( ORIG, vtN, dAng) ;
// calcolo il percorso a zigzag
bOk = bOk && pSfr->LocToLoc( frSurf, frRef) ;
ICRVCOMPOPOVECTOR vpCrvs ;
bOk = bOk && CalcZigZagInfill( pSfr, dStep, bSmooth, bRemoveOverlapLink, vpCrvs) ;
// inserisco le curve risultanti nel DB
int nFirstId = GDB_ID_NULL ;
int nCount = 0 ;
for ( int i = 0 ; bOk && i < ( int) vpCrvs.size() ; i ++) {
// porto la curva nel riferimento di destinazione
bOk = bOk && vpCrvs[i]->LocToLoc( frRef, frDest) ;
// la inserisco nel DB geometrico
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( vpCrvs[i])) : GDB_ID_NULL) ;
bOk = bOk && ( nNewId != GDB_ID_NULL) ;
// aggiorno contatori
if ( bOk && nFirstId == GDB_ID_NULL)
nFirstId = nNewId ;
if ( bOk)
++ nCount ;
}
ExeSetModified() ;
// restituisco risultati
if ( pnCount != nullptr)
*pnCount = nCount ;
if ( IsCmdLog()) {
string sLua = "EgtGetSurfFrZigZagInfill(" + ToString( nId) + "," +
ToString( dStep) + "," +
ToString( dAng) + "," +
ToString( bSmooth) + "," +
ToString( bRemoveOverlapLink) + "," +
" -- Ok=" + ToString( bOk) + " FirstId=" + ToString( nFirstId) + " CurveCount=" + ToString( nCount) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return nFirstId ;
}
+248 -72
View File
@@ -21,6 +21,7 @@
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EXeConst.h"
#include "/EgtDev/Include/EGkGeoPoint3d.h"
#include "/EgtDev/Include/EGkCurveLine.h"
#include "/EgtDev/Include/EGkCurveBezier.h"
#include "/EgtDev/Include/EGkCurveComposite.h"
#include "/EgtDev/Include/EGkCurveLocal.h"
@@ -28,6 +29,12 @@
#include "/EgtDev/Include/EGkSurfFlatRegion.h"
#include "/EgtDev/Include/EGkSurfTriMesh.h"
#include "/EgtDev/Include/EGkSurfBezier.h"
#include "/EgtDev/Include/EGkDistPointSurfTm.h"
#include "/EgtDev/Include/EGkIntersCurves.h"
#include "/EgtDev/Include/EGkIntersLineBox.h"
#include "/EgtDev/Include/EGkIntersLineSurfTm.h"
#include "/EgtDev/Include/EGkCalcPocketing.h"
#include "/EgtDev/Include/EGkPolygonElevation.h"
#include "/EgtDev/Include/EGkSurfLocal.h"
#include "/EgtDev/Include/EGkStringUtils3d.h"
@@ -48,6 +55,18 @@ ExeSurfArea( int nId, double& dArea)
return ( pSurf != nullptr && pSurf->GetArea( dArea)) ;
}
//----------------------------------------------------------------------------
bool
ExeSurfIsClosed( int nId)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie
ISurf* pSurf = GetSurf( pGeomDB->GetGeoObj( nId)) ;
// verifico se è superficie chiusa
return ( pSurf != nullptr && pSurf->IsClosed()) ;
}
//----------------------------------------------------------------------------
bool
ExeSurfVolume( int nId, double& dVol)
@@ -294,63 +313,16 @@ ExeExtractSurfFrChunkLoops( int nId, int nChunk, int nDestGrpId, int* pnCount)
//----------------------------------------------------------------------------
int
ExeSurfFrGetZigZagInfill( int nId, int nDestGrpId, double dStep, double dAng, bool bStepCorrection, bool bInvert, int* pnCount)
ExeSurfTmVertexCount( int nId)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// recupero la superficie FlatRegion
ISurfFlatRegion * pOrigSrf = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId)) ;
if ( pOrigSrf == nullptr)
return GDB_ID_NULL ;
PtrOwner<ISurfFlatRegion> pSfr( pOrigSrf->Clone()) ;
bool bOk = ( ! IsNull( pSfr)) ;
// recupero il riferimento della superficie
Frame3d frSurf ;
bOk = bOk && pGeomDB->GetGlobFrame( nId, frSurf) ;
// recupero il riferimento di destinazione
Frame3d frDest ;
bOk = bOk && pGeomDB->GetGroupGlobFrame( nDestGrpId, frDest) ;
// creo il riferimento per il calcolo del percorso a zigzag
Vector3d vtN ;
if ( bOk)
vtN = pSfr->GetNormVersor() ;
bOk = bOk && vtN.ToGlob( frSurf) ;
Frame3d frRef ;
bOk = bOk && frRef.Set( ORIG, vtN) ;
bOk = bOk && frRef.Rotate( ORIG, vtN, dAng) ;
// calcolo il percorso a zigzag
bOk = bOk && pSfr->LocToLoc( frSurf, frRef) ;
ICRVCOMPOPOVECTOR vpCrvs ;
bOk = bOk && pSfr->GetZigZagInfill( dStep, bStepCorrection, bInvert, vpCrvs) ;
// inserisco le curve risultanti nel DB
int nFirstId = GDB_ID_NULL ;
int nCount = 0 ;
for ( int i = 0 ; bOk && i < ( int) vpCrvs.size() ; i ++) {
// porto la curva nel riferimento di destinazione
bOk = bOk && vpCrvs[i]->LocToLoc( frRef, frDest) ;
// la inserisco nel DB geometrico
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( vpCrvs[i])) : GDB_ID_NULL) ;
bOk = bOk && ( nNewId != GDB_ID_NULL) ;
// copio il materiale
if ( ! pGeomDB->CopyMaterial( nId, nNewId))
return GDB_ID_NULL ;
// aggiorno contatori
if ( bOk && nFirstId == GDB_ID_NULL)
nFirstId = nNewId ;
if ( bOk)
++ nCount ;
}
ExeSetModified() ;
// restituisco risultati
if ( pnCount != nullptr)
*pnCount = nCount ;
return nFirstId ;
VERIFY_GEOMDB( pGeomDB, 0)
// recupero la superficie trimesh
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
if ( pStm == nullptr)
return 0 ;
// recupero il numero di vertici
return pStm->GetVertexCount() ;
}
//----------------------------------------------------------------------------
@@ -367,6 +339,59 @@ ExeSurfTmFacetCount( int nId)
return pStm->GetFacetCount() ;
}
//----------------------------------------------------------------------------
int
ExeSurfTmPartCount( int nId)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, -1)
// recupero la superficie trimesh
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
if ( pStm == nullptr)
return -1 ;
// recupero il numero di parti
return pStm->GetPartCount() ;
}
//-----------------------------------------------------------------------------
bool
ExeSurfTmGetVertex( int nId, int nVert, int nRefId, Point3d& ptVert)
{
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 vertice di indice dato
if ( ! pStm->GetVertex( nVert, ptVert))
return false ;
// gestione trasformazioni ( eventuali)
return TransformPoint( pGeomDB, nId, nRefId, ptVert) ;
}
//-----------------------------------------------------------------------------
bool
ExeSurfTmGetNearestVertex( int nId, const Point3d& ptNear, int nRefId, int& nVert, Point3d& ptVert)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie trimesh
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
if ( pStm == nullptr)
return false ;
// porto il punto Near nel riferimento dell'entità
Point3d ptNearL = ptNear ;
if ( ! InvTransformPoint( pGeomDB, nId, nRefId, ptNearL))
return false ;
// recupero il vertice più vicino della superficie
nVert = GetSurfTmNearestVertex( ptNearL, *pStm) ;
if ( ! pStm->GetVertex( nVert, ptVert))
return false ;
// gestione trasformazioni ( eventuali)
return TransformPoint( pGeomDB, nId, nRefId, ptVert) ;
}
//----------------------------------------------------------------------------
int
ExeSurfTmFacetFromTria( int nId, int nT)
@@ -507,6 +532,83 @@ ExeSurfTmFacetMinAreaRectangle( int nId, int nFacet, int nRefId, Frame3d& frRect
return TransformFrame( pGeomDB, nId, nRefId, frRect) ;
}
//----------------------------------------------------------------------------
bool
ExeSurfTmFacetElevationInBBox( int nId, int nFacet, const BBox3d& b3Box, bool bAcceptOutFacet, int nRefId, double& dElev)
{
// La faccia deve essere tutta contenuta nel Box
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie trimesh e il suo riferimento
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
if ( pStm == nullptr)
return false ;
Frame3d frStm ;
if ( ! pGeomDB->GetGlobFrame( nId, frStm))
return false ;
// verifico il box e ne recupero il riferimento
if ( b3Box.IsEmpty())
return false ;
Frame3d frBox ;
if ( nRefId == GDB_ID_ROOT)
frBox = GLOB_FRM ;
else if ( nRefId == GDB_ID_GRID)
frBox = pGeomDB->GetGridFrame() ;
else {
// nRefId può essere un gruppo o una entità
if ( ! pGeomDB->GetGroupGlobFrame( nRefId, frBox) &&
! pGeomDB->GetGlobFrame( nRefId, frBox))
return false ;
}
// recupero il contorno esterno della faccia e lo porto nel riferimento del box
POLYLINEVECTOR vPL ;
pStm->GetFacetLoops( nFacet, vPL) ;
if ( vPL.empty())
return false ;
vPL[0].LocToLoc( frStm, frBox) ;
// ne derivo il poligono
Polygon3d pgFacet ;
if ( ! pgFacet.FromPolyLine( vPL[0]))
return false ;
// calcolo l'elevazione
return PolygonElevationInBBox( pgFacet, b3Box, bAcceptOutFacet, dElev) ;
}
//----------------------------------------------------------------------------
bool
ExeSurfTmFacetElevationInClosedSurfTm( int nFacetStmId, int nFacet, int nClosedStmId, bool bAcceptOutFacet, double& dElev)
{
// La faccia deve essere tutta contenuta nel Box
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie trimesh della faccia e il suo riferimento
const ISurfTriMesh* pFacStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nFacetStmId)) ;
if ( pFacStm == nullptr)
return false ;
Frame3d frFacStm ;
if ( ! pGeomDB->GetGlobFrame( nFacetStmId, frFacStm))
return false ;
// recupero la superficie trimesh chiusa (volume)
const ISurfTriMesh* pCldStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nClosedStmId)) ;
if ( pCldStm == nullptr)
return false ;
Frame3d frCldStm ;
if ( ! pGeomDB->GetGlobFrame( nClosedStmId, frCldStm))
return false ;
// recupero il contorno esterno della faccia e lo porto nel riferimento della superficie chiusa
POLYLINEVECTOR vPL ;
pFacStm->GetFacetLoops( nFacet, vPL) ;
if ( vPL.empty())
return false ;
vPL[0].LocToLoc( frFacStm, frCldStm) ;
// ne derivo il poligono
Polygon3d pgFacet ;
if ( ! pgFacet.FromPolyLine( vPL[0]))
return false ;
// calcolo l'elevazione
return PolygonElevationInClosedSurfTm( pgFacet, *pCldStm, bAcceptOutFacet, dElev) ;
}
//----------------------------------------------------------------------------
bool
ExeSurfTmFacetOppositeSide( int nId, int nFacet, const Vector3d& vtDir, int nRefId,
@@ -754,7 +856,8 @@ ExeExtractSurfTmLoops( int nId, int nDestGrpId, int* pnCount)
//----------------------------------------------------------------------------
int
ExeGetSurfTmSilhouette( int nId, const Vector3d& vtDir, double dToler, int nDestGrpId, int nRefType, int* pnCount)
ExeGetSurfTmSilhouette( int nId, const Vector3d& vtDir, double dToler, int nDestGrpId, int nRefType,
int* pnCount, bool bAllTria)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
@@ -771,7 +874,7 @@ ExeGetSurfTmSilhouette( int nId, const Vector3d& vtDir, double dToler, int nDest
Vector3d vtDirL = GetVectorLocal( pGeomDB, vtDir, nRefType, frSurf) ;
// recupero i loop come polilinee
POLYLINEVECTOR vPL ;
bOk = bOk && pStm->GetSilhouette( vtDirL, dToler, vPL) ;
bOk = bOk && pStm->GetSilhouette( vtDirL, dToler, vPL, bAllTria) ;
// dalle polilinee creo le curve e le inserisco nel DB
int nFirstId = GDB_ID_NULL ;
int nCount = 0 ;
@@ -799,7 +902,8 @@ ExeGetSurfTmSilhouette( int nId, const Vector3d& vtDir, double dToler, int nDest
string sLua = "EgtGetSurfTmSilhouette(" + ToString( nId) + ",{" +
ToString( vtDir) + "}," +
ToString( nDestGrpId) + "," +
RefTypeToString( nRefType) + ")" +
RefTypeToString( nRefType) + "," +
ToString( bAllTria) + ")" +
" -- Id1=" + ToString( nFirstId) + ",Nbr=" + ToString( nCount) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
@@ -910,6 +1014,20 @@ ExeCopySurfTmFacet( int nId, int nFacet, int nDestGrpId)
return nFacId ;
}
//-----------------------------------------------------------------------------
bool
ExeSurfTmGetAllVertInFacet( int nId, int nFacet, INTVECTOR& vVert)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie TriMesh
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
if ( pStm == nullptr)
return false ;
// recupero l'elenco dei vertici nella faccia
return pStm->GetAllVertInFacet( nFacet, vVert) ;
}
//-----------------------------------------------------------------------------
bool
ExeSurfTmGetFacetBBox( int nId, int nFacet, int nFlag, BBox3d& b3Box)
@@ -936,7 +1054,7 @@ ExeSurfTmGetFacetBBoxGlob( int nId, int nFacet, int nFlag, BBox3d& b3Box)
return false ;
// recupero il riferimento globale del gruppo cui appartiene
Frame3d frGlob ;
if ( nId != GDB_ID_ROOT && ! pGeomDB->GetGroupGlobFrame( pGeomDB->GetParentId( nId), frGlob))
if ( ! pGeomDB->GetGlobFrame( nId, frGlob))
return false ;
// recupero il bounding box della faccia dell'oggetto in globale
return pStm->GetFacetBBox( nFacet, frGlob, b3Box, nFlag) ;
@@ -954,7 +1072,7 @@ ExeSurfTmGetFacetBBoxRef( int nId, int nFacet, int nFlag, const Frame3d& frRef,
return false ;
// recupero il riferimento globale del gruppo cui appartiene
Frame3d frGlob ;
if ( nId != GDB_ID_ROOT && ! pGeomDB->GetGroupGlobFrame( pGeomDB->GetParentId( nId), frGlob))
if ( ! pGeomDB->GetGlobFrame( nId, frGlob))
return false ;
// porto il riferimento di espressione in quello della superficie
Frame3d frGlobL = frGlob ;
@@ -963,6 +1081,63 @@ ExeSurfTmGetFacetBBoxRef( int nId, int nFacet, int nFlag, const Frame3d& frRef,
return pStm->GetFacetBBox( nFacet, frGlobL, b3Box, nFlag) ;
}
//----------------------------------------------------------------------------
int
ExeSurfTmGetEdges( int nId, int nDestGrpId, bool bSmoothAng, int* pnCount)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// recupero la superficie TriMesh
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pStm != nullptr) ;
// recupero il riferimento globale del gruppo cui appartiene
Frame3d frSurf ;
bOk = bOk && pGeomDB->GetGlobFrame( nId, frSurf) ;
// recupero il riferimento di destinazione
Frame3d frDest ;
bOk = bOk && pGeomDB->GetGroupGlobFrame( nDestGrpId, frDest) ;
// ne determino gli spigoli
ICURVEPOVECTOR vpCurve ;
bOk = bOk && pStm->GetEdges( vpCurve) ;
// inserisco gli spigoli come curve nel DB
int nFirstId = GDB_ID_NULL ;
int nCount = 0 ;
for ( int i = 0 ; i < int( vpCurve.size()) ; ++ i) {
// se richiesto, verifico l'angolo tra le facce adiacenti (0=allineate)
if ( bSmoothAng) {
double dAngInt = vpCurve[i]->GetTempParam() ;
if ( abs( dAngInt) < pStm->GetSmoothAngle())
continue ;
}
// lo porto nel riferimento destinazione
bOk = bOk && vpCurve[i]->LocToLoc( frSurf, frDest) ;
// lo inserisco nel DB geometrico
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( vpCurve[i])) : GDB_ID_NULL) ;
bOk = bOk && ( nNewId != GDB_ID_NULL) ;
// copio il materiale
bOk = bOk && pGeomDB->CopyMaterial( nId, nNewId) ;
// aggiorno contatori
if ( bOk && nFirstId == GDB_ID_NULL)
nFirstId = nNewId ;
if ( bOk)
++ nCount ;
}
if ( ! bOk)
nCount = -1 ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfTmGetEdges(" + ToString( nId) + ",{" +
ToString( nDestGrpId) + ")" +
" -- Id1=" + ToString( nFirstId) + ",Nbr=" + ToString( nCount) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultati
if ( pnCount != nullptr)
*pnCount = nCount ;
return nFirstId ;
}
//----------------------------------------------------------------------------
bool
ExeSurfBezierGetPoint( int nSurfId, double dU, double dV, int nRefId, Point3d& ptP)
@@ -1287,25 +1462,26 @@ ExeExtractSurfBezierLoops( int nId, int nDestGrpId, int* pnCount)
// richiedo i contorni della superficie e li inserisco nel DB
int nFirstId = GDB_ID_NULL ;
int nCount = 0 ;
int nL = 0 ;
PtrOwner<ICurve> pCrv( bOk ? pSbz->GetLoop( nL) : nullptr) ;
while ( ! IsNull( pCrv)) {
// porto la curva nel riferimento destinazione
bOk = bOk && pCrv->LocToLoc( frSurf, frDest) ;
// la inserisco nel DB geometrico
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( pCrv)) : GDB_ID_NULL) ;
ICRVCOMPOPOVECTOR vCC ;
pSbz->GetLoops( vCC , true) ;
for ( int i = 0 ; i < int( vCC.size()) ; ++i) {
if ( IsNull( vCC[i]) || ! vCC[i]->IsValid())
continue ;
// porto la curva nel riferimento destinazione
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) ;
// copio il materiale
if ( ! pGeomDB->CopyMaterial( nId, nNewId))
// copio il materiale
if ( ! pGeomDB->CopyMaterial( nId, nNewId))
return GDB_ID_NULL ;
// aggiorno contatori
// aggiorno contatori
if ( bOk && nFirstId == GDB_ID_NULL)
nFirstId = nNewId ;
if ( bOk)
++ nCount ;
// passo alla prossima curva
pCrv.Set( bOk ? pSbz->GetLoop( ++nL) : nullptr) ;
}
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
+2 -2
View File
@@ -250,8 +250,8 @@ ExeVolZmapGetEdges( int nId, int nDestGrpId, int* pnCount)
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtGetSurfTmSilhouette(" + ToString( nId) + ",{" +
ToString( nDestGrpId) + ")" +
string sLua = "EgtVolZmapGetEdges(" + ToString( nId) + ",{" +
ToString( nDestGrpId) + ")" +
" -- Id1=" + ToString( nFirstId) + ",Nbr=" + ToString( nCount) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
+536 -17
View File
@@ -27,19 +27,26 @@
#include "/EgtDev/Include/EGkIntersCurves.h"
#include "/EgtDev/Include/EGkDistPointCurve.h"
#include "/EgtDev/Include/EGkCurveLocal.h"
#include "/EgtDev/Include/EGkSurfLocal.h"
#include "/EgtDev/Include/EGkCurveAux.h"
#include "/EgtDev/Include/EGkOffsetCurve.h"
#include "/EgtDev/Include/EGkMedialAxis.h"
#include "/EgtDev/Include/EGkChainCurves.h"
#include "/EgtDev/Include/EGkProjectCurveSurfTm.h"
#include "/EgtDev/Include/EGkSurfFlatRegion.h"
#include "/EgtDev/Include/EGkExtTExt.h"
#include "/EgtDev/Include/EGkGdbIterator.h"
#include "/EgtDev/Include/EGkStringUtils3d.h"
#include "/EgtDev/Include/EGkIntervals.h"
#include "/EgtDev/Include/EGkPolygon3d.h"
#include "/EgtDev/Include/EGkGeoPoint3d.h"
#include "/EgtDev/Include/EGkGeoVector3d.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
#include "/EgtDev/Include/EGkCalcPocketing.h"
#include <EgtDev/Include/EGkSfrCreate.h>
#include <functional>
using namespace std ;
//----------------------------------------------------------------------------
@@ -97,14 +104,14 @@ ExeOffsetCurve( int nId, double dDist, int nType)
//----------------------------------------------------------------------------
int
ExeOffsetCurveAdv( int nId, double dDist, int nType, int* pnCount)
ExeOffsetCurveAdv( int nId, double dDist, int nType, int* pnCount, double dLinTol)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// recupero la curva
const ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
// eseguo l'offset
OffsetCurve OffsCrv ;
OffsetCurve OffsCrv( dLinTol) ;
bool bOk = OffsCrv.Make( pCurve, dDist, nType) ;
// salvo le curve di offset
int nRefId = nId ;
@@ -181,12 +188,12 @@ ExeCurveMedialAxis( int nId)
//-------------------------------------------------------------------------------
bool
ExeApproxCurve( int nId, int nApprType, double dLinTol)
ExeApproxCurve( int nId, int nApprType, double dLinTol, double dMaxSegmLen)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// recupero la curva
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
const ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pCurve != nullptr) ;
// eseguo l'approssimazione
PtrOwner<ICurveComposite> pCC( CreateCurveComposite()) ;
@@ -195,7 +202,10 @@ ExeApproxCurve( int nId, int nApprType, double dLinTol)
nApprType == APP_LEFT_LINES || nApprType == APP_LEFT_CONVEX_LINES ||
nApprType == APP_RIGHT_LINES || nApprType == APP_RIGHT_CONVEX_LINES) {
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
bOk = bOk && pCC->RemoveSmallDefects( 0.5 * dLinTol, ANG_TOL_STD_DEG) ;
}
else { // con bi-archi
PolyArc PA ;
@@ -207,8 +217,10 @@ ExeApproxCurve( int nId, int nApprType, double dLinTol)
dAngTol = min( ANG_TOL_STD_DEG + 0.2 * dCoeff * ANG_TOL_STD_DEG, ANG_TOL_MAX_DEG) ;
}
bOk = bOk && pCurve->ApproxWithArcsEx( dLinTol, dAngTol, dLinFea, PA) && pCC->FromPolyArc( PA) ;
// eliminazione di small Z
bOk = bOk && pCC->RemoveSmallDefects( 0.5 * dLinTol, ANG_TOL_STD_DEG) ;
// merge di archi identici di biarchi
bOk = bOk && pCC->MergeCurves( 0.5 * dLinTol, dAngTol) ;
bOk = bOk && pCC->MergeCurves( 0.5 * dLinTol, ANG_TOL_STD_DEG) ;
}
// copio estrusione e spessore
Vector3d vtExtr ;
@@ -288,9 +300,9 @@ ExeChangeClosedCurveStart( int nId, double dU)
bOk = bOk && ( pCurve != nullptr) ;
// cambio il punto iniziale
if ( bOk && pCurve->GetType() == CRV_ARC)
bOk = bOk && dynamic_cast<ICurveArc*>(pCurve)->ChangeStartPoint(dU) ;
bOk = bOk && GetCurveArc( pCurve)->ChangeStartPoint(dU) ;
else if ( bOk && pCurve->GetType() == CRV_COMPO)
bOk = bOk && dynamic_cast<ICurveComposite*>(pCurve)->ChangeStartPoint(dU) ;
bOk = bOk && GetCurveComposite( pCurve)->ChangeStartPoint(dU) ;
else
bOk = false ;
ExeSetModified() ;
@@ -327,9 +339,9 @@ ExeChangeClosedCurveStartPoint( int nId, const Point3d& ptP, int nRefType)
bOk = bOk && distPC.GetParamAtMinDistPoint( 0, dPar, nFlag) ;
// cambio il punto iniziale
if ( bOk && pCurve->GetType() == CRV_ARC)
bOk = bOk && dynamic_cast<ICurveArc*>(pCurve)->ChangeStartPoint(dPar) ;
bOk = bOk && GetCurveArc(pCurve)->ChangeStartPoint(dPar) ;
else if ( bOk && pCurve->GetType() == CRV_COMPO)
bOk = bOk && dynamic_cast<ICurveComposite*>(pCurve)->ChangeStartPoint(dPar) ;
bOk = bOk && GetCurveComposite( pCurve)->ChangeStartPoint(dPar) ;
else
bOk = false ;
ExeSetModified() ;
@@ -405,6 +417,142 @@ ExeModifyCurveEndPoint( int nId, const Point3d& ptP, int nRefType)
return bOk ;
}
//----------------------------------------------------------------------------
bool
ExeSpiralizeCurveAlongExtrusion( int nId, double dDelta)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
bool bOk = true ;
// recupero la curva
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
bOk = bOk && ( pCurve != nullptr) ;
Vector3d vtExtr ;
bOk = bOk && pCurve->GetExtrusion( vtExtr) ;
Point3d ptEnd ;
bOk = bOk && pCurve->GetEndPoint( ptEnd) ;
// se linea o arco
if ( bOk && ( pCurve->GetType() == CRV_LINE || pCurve->GetType() == CRV_ARC))
bOk = bOk && pCurve->ModifyEnd( ptEnd + dDelta * vtExtr) ;
// se composita il delta va ripartito su tutte le sottocurve
else if ( bOk && pCurve->GetType() == CRV_COMPO) {
ICurveComposite* pCompo = GetCurveComposite( pCurve) ;
double dLen ;
bOk = bOk && pCompo->GetLength( dLen) ;
// calcolo il delta di ogni sottocurva
DBLVECTOR vdDelta( pCompo->GetCurveCount() - 1) ;
for ( int i = 1 ; bOk && i < pCompo->GetCurveCount() ; i ++) {
double dLenU ;
pCompo->GetLengthAtParam( i, dLenU) ;
vdDelta[i-1] = dDelta * dLenU / dLen ;
}
for ( int i = 1 ; bOk && i < pCompo->GetCurveCount() ; i ++) {
Point3d ptJoint ;
pCompo->GetPointD1D2( i, ICurve::FROM_MINUS, ptJoint) ;
ptJoint += vtExtr * vdDelta[i-1] ;
pCompo->ModifyJoint( i, ptJoint) ;
}
// ultimo punto
bOk = bOk && pCompo->ModifyEnd( ptEnd + dDelta * vtExtr) ;
}
ExeSetModified() ;
// restituisco il risultato
return bOk ;
}
//----------------------------------------------------------------------------
bool
ExeSpiralizeCurveAlongGuide( int nCrvId, int nGuideId, double dLinTol)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
bool bOk = true ;
// recupero la curva e il suo riferimento
ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nCrvId)) ;
bOk = bOk && ( pCrv != nullptr) ;
Frame3d frCrv ;
bOk = bOk && pGeomDB->GetGlobFrame( nCrvId, frCrv) ;
// recupero la curva guida e il suo riferimento
const ICurve * pCrvGuide = GetCurve( pGeomDB->GetGeoObj( nGuideId)) ;
bOk = bOk && ( pCrvGuide != nullptr) ;
Frame3d frGuide ;
bOk = bOk && pGeomDB->GetGlobFrame( nGuideId, frGuide) ;
// approssimo le curve con polylines
PolyLine PL1, PL2 ;
bOk = bOk && pCrv->ApproxWithLines( dLinTol, ANG_TOL_STD_DEG, APP_SPECIAL_LINES, PL1) ;
bOk = bOk && pCrvGuide->ApproxWithLines( dLinTol, ANG_TOL_STD_DEG, APP_SPECIAL_LINES, PL2) ;
// porto la polyline della curva guida nel riferimento locale
bOk = bOk && PL2.LocToLoc( frGuide, frCrv) ;
// modifico PL2 per gestire eventuali punti di intersezione
PtrOwner<ICurveComposite> pCompoGuide( CreateCurveComposite()) ;
bOk = bOk && ( ! IsNull( pCompoGuide)) ;
bOk = bOk && pCompoGuide->FromPolyLine( PL2) ;
Point3d ptP1 ;
bool bFound = bOk && PL1.GetFirstPoint( ptP1) ;
while ( bOk && bFound) {
double dAddPar ;
if ( bOk && pCompoGuide->GetParamAtPoint( ptP1, dAddPar, 100 * EPS_SMALL))
bOk = bOk && pCompoGuide->AddJoint( dAddPar) ;
bFound = PL1.GetNextPoint( ptP1) ;
}
bOk = bOk && pCompoGuide->ApproxWithLines( dLinTol, ANG_TOL_STD_DEG, APP_SPECIAL_LINES, PL2) ;
// associo i punti a minima distanza delle polylines
PNTIVECTOR vPnt1, vPnt2 ;
bool bTmp ;
bOk = bOk && AssociatePolyLinesMinDistPoints( PL1, PL2, vPnt1, vPnt2, bTmp) ;
PtrOwner<ICurveComposite> pCompo( CreateCurveComposite()) ;
bOk = bOk && ! IsNull( pCompo) ;
double dLenTot ;
Point3d ptOld ;
if ( bOk)
ptOld = vPnt2[0].first ;
bOk = bOk && pCrv->GetLength( dLenTot) ;
bOk = bOk && pCompo->AddPoint( vPnt2[0].first) ;
for ( int i = 1 ; bOk && i < ( int)vPnt1.size() - 1 ; i++) {
double dPar ;
bOk = bOk && pCrv->GetParamAtPoint( vPnt1[i].first, dPar) ;
double dLen = 0 ;
bOk = bOk && pCrv-> GetLengthAtParam( dPar, dLen) ;
// calcolo il nuovo punto per la curva
Point3d ptNew = Media( vPnt2[ vPnt1[i].second].first, vPnt1[i].first, dLen / dLenTot) ;
if ( ! AreSamePointApprox( ptOld, ptNew)) {
bOk = bOk && pCompo->AddLine( ptNew) ;
ptOld = ptNew ;
}
}
if ( bOk && ! AreSamePointApprox( ptOld, vPnt1.back().first))
bOk = bOk && pCompo->AddLine( vPnt1.back().first) ;
// copio estrusione e spessore
Vector3d vtExtr ;
if ( bOk && pCrv->GetExtrusion( vtExtr))
pCompo->SetExtrusion( vtExtr) ;
double dThick ;
if ( bOk && pCrv->GetThickness( dThick))
pCompo->SetThickness(dThick) ;
// sostituisco la vecchia curva con la nuova
bOk = bOk && pGeomDB->ReplaceGeoObj( nCrvId, Release( pCompo)) ;
ExeSetModified() ;
// restituisco il risultato
return bOk ;
}
//----------------------------------------------------------------------------
static bool
ModifyOneCurveExtrusion( IGeomDB* pGeomDB, int nId, const Vector3d& vtExtr, int nRefType)
@@ -1995,7 +2143,7 @@ bool
ExeMergeCurvesInCurveCompo( int nId, double dLinTol, bool bStartEnd)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
VERIFY_GEOMDB( pGeomDB, false)
// recupero la curva composita
ICurveComposite* pCompo = GetCurveComposite( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pCompo != nullptr) ;
@@ -2018,7 +2166,7 @@ bool
ExeRemoveCurveCompoUndercutOnY( int nId, double dLinTol)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
VERIFY_GEOMDB( pGeomDB, false)
// recupero la curva composita
ICurveComposite* pCompo = GetCurveComposite( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pCompo != nullptr) ;
@@ -2040,7 +2188,7 @@ static bool
MyChainCurvesInGroup( int nGroupId, const Point3d& ptNear, bool bAllowInvert, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
VERIFY_GEOMDB( pGeomDB, false)
nGroupId = AdjustId( nGroupId) ;
// recupero il riferimento del gruppo
Frame3d frGrp ;
@@ -2093,11 +2241,11 @@ MyChainCurvesInGroup( int nGroupId, const Point3d& ptNear, bool bAllowInvert, in
bool
ExeChainCurvesInGroup( int nGroupId, const Point3d& ptNear, int nRefType)
{
bool bOk = MyChainCurvesInGroup(nGroupId, ptNear, true, nRefType) ;
bool bOk = MyChainCurvesInGroup( nGroupId, ptNear, true, nRefType) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtChainCurvesInGroup(" + ToString( nGroupId) + "," +
string sLua = "EgtChainCurvesInGroup(" + ToString( nGroupId) + ",{" +
ToString( ptNear) + "}," +
RefTypeToString( nRefType) + ")" +
" -- Ok=" + ToString( bOk) ;
@@ -2110,11 +2258,11 @@ ExeChainCurvesInGroup( int nGroupId, const Point3d& ptNear, int nRefType)
bool
ExeReorderCurvesInGroup( int nGroupId, const Point3d& ptNear, int nRefType)
{
bool bOk = MyChainCurvesInGroup(nGroupId, ptNear, false, nRefType) ;
bool bOk = MyChainCurvesInGroup( nGroupId, ptNear, false, nRefType) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtReorderCurvesInGroup(" + ToString( nGroupId) + "," +
string sLua = "EgtReorderCurvesInGroup(" + ToString( nGroupId) + ",{" +
ToString( ptNear) + "}," +
RefTypeToString( nRefType) + ")" +
" -- Ok=" + ToString( bOk) ;
@@ -2122,3 +2270,374 @@ ExeReorderCurvesInGroup( int nGroupId, const Point3d& ptNear, int nRefType)
}
return bOk ;
}
//-------------------------------------------------------------------------------
static bool
MyProjectCurveOnSurfTm( int nCurveId, int nSurfTmId, const Vector3d& vtDir, int nDestGrpId,
double dLinTol, double dMaxSegmLen, int nRefType)
{
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 trimesh e il suo riferimento
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nSurfTmId)) ;
if ( pStm == nullptr)
return false ;
Frame3d frStm ;
if ( ! pGeomDB->GetGlobFrame( nSurfTmId, frStm))
return false ;
// recupero il riferimento del gruppo di destinazione
nDestGrpId = AdjustId( nDestGrpId) ;
Frame3d frDest ;
if ( ! pGeomDB->GetGroupGlobFrame( nDestGrpId, frDest))
return false ;
// porto la curva e il vettore nel riferimento della superficie
CurveLocal CrvLoc( pCrv, frCrv, frStm) ;
if ( CrvLoc.Get() == nullptr)
return false ;
Vector3d vtDirL = GetVectorLocal( pGeomDB, vtDir, nRefType, frCrv) ;
vtDirL.LocToLoc( frCrv, frStm) ;
// eseguo la proiezione
PNT5AXVECTOR vPt5ax ;
if ( ! ProjectCurveOnSurfTm( *CrvLoc.Get(), *pStm, vtDirL, dLinTol, dMaxSegmLen, 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 ;
pGeoVct->Set( 10 * GetLocToLoc( Pt5ax.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
ExeProjectCurveOnSurfTm( int nCurveId, int nSurfTmId, const Vector3d& vtDir, int nDestGrpId,
double dLinTol, double dMaxSegmLen, int nRefType)
{
bool bOk = MyProjectCurveOnSurfTm( nCurveId, nSurfTmId, vtDir, nDestGrpId, dLinTol, dMaxSegmLen, nRefType) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtProjectCurveOnSurfTm(" + ToString( nCurveId) + "," +
ToString( nSurfTmId) + ",{" +
ToString( vtDir) + "}," +
ToString( nDestGrpId) + "," +
ToString( dLinTol) + "," +
ToString( dMaxSegmLen) + "," +
RefTypeToString( nRefType) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
//-------------------------------------------------------------------------------
static bool
MyProjectCurveOnSurfTmExt( 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 trimesh e il suo riferimento
const ISurfTriMesh* pStm = GetSurfTriMesh( 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 ISurfTriMesh* pGdeStm = nullptr ;
pGdePnt = GetGeoPoint3d( pGeomDB->GetGeoObj( nGuideId)) ;
if ( pGdePnt == nullptr) {
pGdeCrv = GetCurve( pGeomDB->GetGeoObj( nGuideId)) ;
if ( pGdeCrv == nullptr) {
pGdeStm = GetSurfTriMesh( 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 ;
// 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 ( ! ProjectCurveOnSurfTm( *CrvLoc.Get(), *pStm, *pGdeLoc, dLinTol, dMaxSegmLen, vPt5ax))
return false ;
}
else if ( pGdeCrv != nullptr) {
CurveLocal GdeLoc( pGdeCrv, frGde, frStm) ;
if ( GdeLoc.Get() == nullptr)
return false ;
if ( ! ProjectCurveOnSurfTm( *CrvLoc.Get(), *pStm, *GdeLoc.Get(), dLinTol, dMaxSegmLen, vPt5ax))
return false ;
}
else { // pGdeStm != nullptr
SurfLocal GdeLoc( pGdeStm, frGde, frStm) ;
const ISurfTriMesh* pGdeLoc = GetSurfTriMesh( GdeLoc.Get()) ;
if ( pGdeLoc == nullptr)
return false ;
if ( ! ProjectCurveOnSurfTm( *CrvLoc.Get(), *pStm, *pGdeLoc, dLinTol, dMaxSegmLen, 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.vtDir) ;
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
ExeProjectCurveOnSurfTmExt( int nCurveId, int nSurfTmId, int nGuideId, int nDestGrpId,
double dLinTol, double dMaxSegmLen, bool bDirFromGuide)
{
bool bOk = MyProjectCurveOnSurfTmExt( nCurveId, nSurfTmId, nGuideId, nDestGrpId, dLinTol, dMaxSegmLen, bDirFromGuide) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtProjectCurveOnSurfTmExt(" + ToString( nCurveId) + "," +
ToString( nSurfTmId) + ",{" +
ToString( nGuideId) + "}," +
ToString( nDestGrpId) + "," +
ToString( dLinTol) + "," +
ToString( dMaxSegmLen) + "," +
( bDirFromGuide ? "true" : "false") + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
//----------------------------------------------------------------------------
int
ExeCurveGetVoronoi( int nId, int nDestGrpId, int nBound, int* pnCount)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// recupero la curva
const ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nId)) ;
if ( pCrv == nullptr)
return GDB_ID_NULL ;
// recupero il riferimento della curva
Frame3d frCrv ;
if ( ! pGeomDB->GetGlobFrame( nId, frCrv))
return GDB_ID_NULL ;
// recupero il riferimento di destinazione
Frame3d frDest ;
if ( ! pGeomDB->GetGroupGlobFrame( nDestGrpId, frDest))
return GDB_ID_NULL ;
// Calcolo diagramma di Voronoi
ICURVEPOVECTOR vCrv ;
CalcCurveVoronoiDiagram( *pCrv, vCrv, nBound) ;
// inserisco i risultati nel DB geometrico
int nFirstId = GDB_ID_NULL ;
int nCount = 0 ;
for ( int i = 0 ; i < int( vCrv.size()) ; i++) {
vCrv[i]->LocToLoc( frCrv, frDest) ;
int nId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( vCrv[i])) ;
if ( nId != GDB_ID_NULL) {
nCount ++ ;
if ( nFirstId == GDB_ID_NULL)
nFirstId = nId ;
}
}
ExeSetModified() ;
if ( IsCmdLog()) {
string sLua = "EgtCurveGetVoronoi(" + ToString( nId) + "," +
ToString( nDestGrpId) + ")" +
" FirstId=" + ToString( nFirstId) + " nCurveCount=" + ToString( nCount) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultati
if ( pnCount != nullptr)
*pnCount = nCount ;
return nFirstId ;
}
//----------------------------------------------------------------------------
int
ExeCurveGetMedialAxis( int nId, int nDestGrpId, int nSide, int* pnCount)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// recupero la curva
const ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nId)) ;
if ( pCrv == nullptr)
return GDB_ID_NULL ;
// recupero il riferimento della curva
Frame3d frCrv ;
if ( ! pGeomDB->GetGlobFrame( nId, frCrv))
return GDB_ID_NULL ;
// recupero il riferimento di destinazione
Frame3d frDest ;
if ( ! pGeomDB->GetGroupGlobFrame( nDestGrpId, frDest))
return GDB_ID_NULL ;
// Calcolo il Medial Axis
ICURVEPOVECTOR vCrv ;
CalcCurveMedialAxis( *pCrv, vCrv, nSide) ;
// inserisco i risultati nel DB geometrico
int nFirstId = GDB_ID_NULL ;
int nCount = 0 ;
for ( int i = 0 ; i < int( vCrv.size()) ; i++) {
vCrv[i]->LocToLoc( frCrv, frDest) ;
int nId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( vCrv[i])) ;
if ( nId != GDB_ID_NULL) {
nCount ++ ;
if ( nFirstId == GDB_ID_NULL)
nFirstId = nId ;
}
}
ExeSetModified() ;
if ( IsCmdLog()) {
string sLua = "EgtCurveMedialAxisAdv(" + ToString( nId) + "," +
ToString( nSide) + "," +
ToString( nDestGrpId) + ")" +
" FirstId=" + ToString( nFirstId) + " nCurveCount=" + ToString( nCount) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultati
if ( pnCount != nullptr)
*pnCount = nCount ;
return nFirstId ;
}
//----------------------------------------------------------------------------
int
ExeCurveGetFatCurve( int nId, int nDestGrpId, double dRad, bool bSquareEnds, bool bSquareMids, int* pnCount)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// recupero la curva
const ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nId)) ;
if ( pCrv == nullptr)
return GDB_ID_NULL ;
// recupero il riferimento della curva
Frame3d frCrv ;
if ( ! pGeomDB->GetGlobFrame( nId, frCrv))
return GDB_ID_NULL ;
// recupero il riferimento di destinazione
Frame3d frDest ;
if ( ! pGeomDB->GetGroupGlobFrame( nDestGrpId, frDest))
return GDB_ID_NULL ;
// Calcolo la curva ingrossata
ICURVEPOVECTOR vCrv ;
CalcCurveFatCurve( *pCrv, vCrv, dRad, bSquareEnds, bSquareMids) ;
// inserisco i risultati nel DB geometrico
int nFirstId = GDB_ID_NULL ;
int nCount = 0 ;
for ( int i = 0 ; i < int( vCrv.size()) ; i++) {
vCrv[i]->LocToLoc( frCrv, frDest) ;
int nId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( vCrv[i])) ;
if ( nId != GDB_ID_NULL) {
nCount ++ ;
if ( nFirstId == GDB_ID_NULL)
nFirstId = nId ;
}
}
ExeSetModified() ;
if ( IsCmdLog()) {
string sLua = "EgtCurveGetFatCurve(" + ToString( nId) + "," +
ToString( nDestGrpId) + ")" +
" FirstId=" + ToString( nFirstId) + " nCurveCount=" + ToString( nCount) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultati
if ( pnCount != nullptr)
*pnCount = nCount ;
return nFirstId ;
}
+430 -45
View File
@@ -24,12 +24,15 @@
#include "/EgtDev/Include/EGkCurveLocal.h"
#include "/EgtDev/Include/EGkSurfFlatRegion.h"
#include "/EgtDev/Include/EGkSurfTriMesh.h"
#include "/EgtDev/Include/EGkSurfBezier.h"
#include "/EgtDev/Include/EGkSurfLocal.h"
#include "/EgtDev/Include/EGkStmFromTriangleSoup.h"
#include "/EgtDev/Include/EGkCAvSimpleSurfFrMove.h"
#include "/EgtDev/Include/EGkStringUtils3d.h"
#include "/EgtDev/Include/EGkSubtractProjectedFacesOnStmFace.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
using namespace std ;
//----------------------------------------------------------------------------
@@ -74,7 +77,7 @@ MyExplodeSurfTriMesh( int nId, int& nCount)
return GDB_ID_NULL ;
// recupero il numero di componenti connesse
int nParts = pStm->GetPartCount() ;
// se ci sono più parti, separo queste
// se ci sono più parti, separo queste
if ( nParts > 1) {
int nFirstId = GDB_ID_NULL ;
nCount = 0 ;
@@ -101,7 +104,7 @@ MyExplodeSurfTriMesh( int nId, int& nCount)
}
// recupero il numero di facce
int nFacets = pStm->GetFacetCount() ;
// se ci sono più facce, separo queste
// se ci sono più facce, separo queste
if ( nFacets > 1) {
// copio tutte le facce
int nFirstId = GDB_ID_NULL ;
@@ -127,7 +130,7 @@ MyExplodeSurfTriMesh( int nId, int& nCount)
// restituisco risultati
return nFirstId ;
}
// non devo fare alcunché
// non devo fare alcunché
nCount = 1 ;
return nId ;
}
@@ -144,7 +147,7 @@ MyExplodeSurfFlatRegion( int nId, int& nCount)
return GDB_ID_NULL ;
// recupero il numero di componenti connessi (chunk)
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) {
nCount = 1 ;
return nId ;
@@ -204,12 +207,54 @@ ExeExplodeSurface( int nId, int* pnCount)
return nFirstId ;
}
//-------------------------------------------------------------------------------
bool
ExeApproxSurface( int nId, double dLinTol, double dTriaMinSide)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// opero secondo il tipo di superficie
PtrOwner<ISurfTriMesh> pStm ;
int nType = pGeomDB->GetGeoType( nId) ;
if ( nType == SRF_TRIMESH) {
// copio la superficie
const ISurfTriMesh* pStri = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
pStm.Set( pStri != nullptr ? pStri->Clone() : nullptr) ;
}
else if ( nType == SRF_FLATRGN) {
// recupero la superficie ausiliaria della regione
const ISurfFlatRegion* pSfr = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId)) ;
const ISurfTriMesh* pAuxSurf = ( pSfr != nullptr ? pSfr->GetAuxSurf() : nullptr) ;
pStm.Set( pAuxSurf != nullptr ? pAuxSurf->Clone() : nullptr) ;
}
else if ( nType == SRF_BEZIER) {
// recupero la superficie ausiliaria della Bezier
const ISurfBezier* pSbez = GetSurfBezier( pGeomDB->GetGeoObj( nId)) ;
pStm.Set( ( pSbez != nullptr ? pSbez->GetApproxSurf( dLinTol, dTriaMinSide) : nullptr)) ;
}
bool bOk = ( ! IsNull( pStm)) ;
// semplificazione della trimesh
bOk = bOk && pStm->DoCompacting( dLinTol) ;
// sostituisco la vecchia superficie con la nuova
bOk = bOk && pGeomDB->ReplaceGeoObj( nId, Release( pStm)) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtApproxSurf(" + ToString( nId) + "," +
ToString( dLinTol) + "," +
ToString( dTriaMinSide) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
//----------------------------------------------------------------------------
bool
ExeSurfFrAdd( int nId1, int nId2)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
VERIFY_GEOMDB( pGeomDB, false)
// recupero la prima superficie FlatRegion
ISurfFlatRegion* pSfr1 = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId1)) ;
bool bOk = ( pSfr1 != nullptr) ;
@@ -238,7 +283,7 @@ bool
ExeSurfFrSubtract( int nId1, int nId2)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
VERIFY_GEOMDB( pGeomDB, false)
// recupero la prima superficie FlatRegion
ISurfFlatRegion* pSfr1 = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId1)) ;
bool bOk = ( pSfr1 != nullptr) ;
@@ -251,7 +296,7 @@ ExeSurfFrSubtract( int nId1, int nId2)
bOk = bOk && ( pSfr2L != nullptr) ;
// eseguo la sottrazione della seconda superficie dalla prima
bOk = bOk && pSfr1->Subtract( *pSfr2L) ;
// se il risultato è vuoto, cancello la FlatRegion
// se il risultato è vuoto, cancello la FlatRegion
if ( bOk && ! pSfr1->IsValid())
pGeomDB->Erase( nId1) ;
ExeSetModified() ;
@@ -270,7 +315,7 @@ bool
ExeSurfFrIntersect( int nId1, int nId2)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
VERIFY_GEOMDB( pGeomDB, false)
// recupero la prima superficie FlatRegion
ISurfFlatRegion* pSfr1 = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId1)) ;
bool bOk = ( pSfr1 != nullptr) ;
@@ -283,7 +328,7 @@ ExeSurfFrIntersect( int nId1, int nId2)
bOk = bOk && ( pSfr2L != nullptr) ;
// eseguo l'intersezione tra le due superfici
bOk = bOk && pSfr1->Intersect( *pSfr2L) ;
// se il risultato è vuoto, cancello la FlatRegion
// se il risultato è vuoto, cancello la FlatRegion
if ( bOk && ! pSfr1->IsValid())
pGeomDB->Erase( nId1) ;
ExeSetModified() ;
@@ -302,13 +347,13 @@ bool
ExeSurfFrOffset( int nId, double dDist, int nType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie FlatRegion
ISurfFlatRegion* pSfr = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pSfr != nullptr) ;
// eseguo l'offset
bOk = bOk && pSfr->Offset( dDist, nType) ;
// se il risultato è vuoto, cancello la FlatRegion
// se il risultato è vuoto, cancello la FlatRegion
if ( bOk && ! pSfr->IsValid())
pGeomDB->Erase( nId) ;
ExeSetModified() ;
@@ -325,10 +370,36 @@ ExeSurfFrOffset( int nId, double dDist, int nType)
//----------------------------------------------------------------------------
bool
ExeSurfFrMoveSimpleNoCollision( int nId1, int nId2, const Vector3d& vtDir, double& dLen, int nRefType)
ExeSurfFrOffsetAdv( int nId, double dDist, int nType, int& nNewId)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// 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
ExeSurfFrMoveSimpleNoCollision( int nId1, int nId2, const Vector3d& vtDir, double& dLen, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la prima superficie FlatRegion
ISurfFlatRegion* pSfr1 = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId1)) ;
bool bOk = ( pSfr1 != nullptr) ;
@@ -350,7 +421,7 @@ bool
ExeSurfFrRotateSimpleNoCollision( int nId1, int nId2, const Point3d& ptCen, double& dAngDeg, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
VERIFY_GEOMDB( pGeomDB, false)
// recupero la prima superficie FlatRegion
ISurfFlatRegion* pSfr1 = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId1)) ;
bool bOk = ( pSfr1 != nullptr) ;
@@ -367,6 +438,155 @@ ExeSurfFrRotateSimpleNoCollision( int nId1, int nId2, const Point3d& ptCen, doub
return ( bOk && CAvSimpleSurfFrMove( *pSfr1, *pSfr2L).Rotate(ptCenL, dAngDeg)) ;
}
//-------------------------------------------------------------------------------
bool
ExeSurfTmMoveVertex( int nId, int nVert, const Point3d& ptNewVert, int nRefType, bool bUpdate)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie
ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pStm != nullptr) ;
// recupero il riferimento in cui è immersa la superficie
Frame3d frStm ;
bOk = bOk && pGeomDB->GetGlobFrame( nId, frStm) ;
// eseguo la modifica
if ( bOk) {
// porto il nuovo vertice nel riferimento della superficie
Point3d ptNewVertL = GetPointLocal( pGeomDB, ptNewVert, nRefType, frStm) ;
// eseguo la modifica
bOk = pStm->MoveVertex( nVert, ptNewVertL) ;
// se richiesto, semplificazione della trimesh
if ( bUpdate)
bOk = bOk && pStm->DoCompacting() ;
}
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfTmMoveVertex(" + IdToString( nId) + "," +
ToString( nVert) + ",{" +
ToString( ptNewVert) + "}," +
RefTypeToString( nRefType) + "," +
( bUpdate ? "true" : "false") + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultato
return bOk ;
}
//-------------------------------------------------------------------------------
bool
ExeSurfTmMoveFacet( int nId, int nFacet, const Vector3d& vtMove, int nRefType, bool bUpdate)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie
ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pStm != nullptr) ;
// recupero il riferimento in cui è immersa la superficie
Frame3d frStm ;
bOk = bOk && pGeomDB->GetGlobFrame( nId, frStm) ;
// porto in locale il movimento
Vector3d vtMoveL = GetVectorLocal( pGeomDB, vtMove, nRefType, frStm) ;
// recupero tutti i vertici della faccia
INTVECTOR vVert ;
bOk = bOk && pStm->GetAllVertInFacet( nFacet, vVert) ;
// sposto tutti i vertici della faccia della quantità desiderata
if ( bOk) {
for ( const auto nVert : vVert) {
// recupero la posizione originale del vertice
Point3d ptV ;
if ( pStm->GetVertex( nVert, ptV))
pStm->MoveVertex( nVert, ptV + vtMoveL) ;
}
}
// se richiesto, semplificazione della trimesh
if ( bUpdate)
bOk = bOk && pStm->DoCompacting() ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfTmMoveFacet(" + IdToString( nId) + "," +
ToString( nFacet) + ",{" +
ToString( vtMove) + "}," +
RefTypeToString( nRefType) + "," +
( bUpdate ? "true" : "false") + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultato
return bOk ;
}
//-------------------------------------------------------------------------------
static int
MySurfTmToTriangles( int nId, int& nCount)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// recupero la superficie TriMesh
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
if ( pStm == nullptr)
return GDB_ID_NULL ;
// recupero il numero di triangoli
int nTria = pStm->GetTriangleCount() ;
// se ci sono più triangoli, li separo
if ( nTria > 1) {
// copio tutti triangoli
int nFirstId = GDB_ID_NULL ;
nCount = 0 ;
for ( int i = 0 ; i < pStm->GetTriangleSize() ; ++ i) {
ISurfTriMesh* pFac = pStm->CloneTriangle( i) ;
if ( pFac == nullptr)
continue ;
// inserisco la superficie nello stesso gruppo e nello stesso posto del GeomDB
int nNewId = pGeomDB->InsertGeoObj( GDB_ID_NULL, nId, GDB_BEFORE, pFac) ;
if ( nNewId == GDB_ID_NULL)
return GDB_ID_NULL ;
// copio gli attributi
if ( ! pGeomDB->CopyAttributes( nId, nNewId))
return GDB_ID_NULL ;
// aggiorno contatori
if ( nFirstId == GDB_ID_NULL)
nFirstId = nNewId ;
++ nCount ;
}
// elimino la superficie originale
pGeomDB->Erase( nId) ;
// restituisco risultati
return nFirstId ;
}
// non devo fare alcunché
nCount = 1 ;
return nId ;
}
//-------------------------------------------------------------------------------
int
ExeSurfTmToTriangles( int nId, int* pnCount)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// verifico sia una superficie trimesh
int nFirstId = GDB_ID_NULL ;
int nCount = 0 ;
if ( pGeomDB->GetGeoType( nId) == SRF_TRIMESH) {
nFirstId = MySurfTmToTriangles( nId, nCount) ;
}
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfTmToTriangles(" + IdToString( nId) + ")" +
" -- Id1=" + ToString( nFirstId) + ",Nbr=" + ToString( nCount) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultati
if ( pnCount != nullptr)
*pnCount = nCount ;
return nFirstId ;
}
//-------------------------------------------------------------------------------
bool
ExeSurfTmRemoveFacet( int nId, int nFacet)
@@ -381,7 +601,7 @@ ExeSurfTmRemoveFacet( int nId, int nFacet)
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfTmRemoveFacet(" + ToString( nId) + "," +
string sLua = "EgtSurfTmRemoveFacet(" + IdToString( nId) + "," +
ToString( nFacet) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
@@ -404,7 +624,7 @@ ExeSurfTmSwapFacets( int nId, int nFacet1, int nFacet2)
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfTmSwapFacets(" + ToString( nId) + "," +
string sLua = "EgtSurfTmSwapFacets(" + IdToString( nId) + "," +
ToString( nFacet1) + "," +
ToString( nFacet2) + ")" +
" -- Ok=" + ToString( bOk) ;
@@ -428,7 +648,7 @@ ExeSurfTmRemovePart( int nId, int nPart)
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfTmRemovePart(" + ToString( nId) + "," +
string sLua = "EgtSurfTmRemovePart(" + IdToString( nId) + "," +
ToString( nPart) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
@@ -442,7 +662,7 @@ bool
ExeCutSurfTmPlane( int nId, const Point3d& ptOn, const Vector3d& vtN, bool bSaveOnEq, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie TriMesh
ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pStm != nullptr) ;
@@ -460,7 +680,42 @@ ExeCutSurfTmPlane( int nId, const Point3d& ptOn, const Vector3d& vtN, bool bSave
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtCutSurfTmPlane(" + ToString( nId) + ",{" +
string sLua = "EgtCutSurfTmPlane(" + 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
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") + "," +
@@ -477,7 +732,7 @@ bool
ExeCutSurfTmClosedCurve( int nSurfId, int nCurveId, bool bSaveOnEq)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie TriMesh
ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nSurfId)) ;
bool bOk = ( pStm != nullptr) ;
@@ -507,7 +762,7 @@ bool
ExeSurfTmAdd( int nId1, int nId2, bool bTwoColors)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
VERIFY_GEOMDB( pGeomDB, false)
// recupero la prima superficie TriMesh
ISurfTriMesh* pStm1 = GetSurfTriMesh( pGeomDB->GetGeoObj( nId1)) ;
bool bOk = ( pStm1 != nullptr) ;
@@ -539,7 +794,7 @@ bool
ExeSurfTmSubtract( int nId1, int nId2, bool bTwoColors)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
VERIFY_GEOMDB( pGeomDB, false)
// recupero la prima superficie TriMesh
ISurfTriMesh* pStm1 = GetSurfTriMesh( pGeomDB->GetGeoObj( nId1)) ;
bool bOk = ( pStm1 != nullptr) ;
@@ -552,7 +807,7 @@ ExeSurfTmSubtract( int nId1, int nId2, bool bTwoColors)
bOk = bOk && ( pStm2L != nullptr) ;
// eseguo la sottrazione tra le due superfici
bOk = bOk && pStm1->Subtract( *pStm2L) ;
// se il risultato è vuoto, cancello la superficie
// se il risultato vuoto, cancello la superficie
if ( bOk && ! pStm1->IsValid()) {
pGeomDB->Erase( nId1) ;
pStm1 = nullptr ;
@@ -576,7 +831,7 @@ bool
ExeSurfTmIntersect( int nId1, int nId2, bool bTwoColors)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
VERIFY_GEOMDB( pGeomDB, false)
// recupero la prima superficie TriMesh
ISurfTriMesh* pStm1 = GetSurfTriMesh( pGeomDB->GetGeoObj( nId1)) ;
bool bOk = ( pStm1 != nullptr) ;
@@ -589,7 +844,7 @@ ExeSurfTmIntersect( int nId1, int nId2, bool bTwoColors)
bOk = bOk && ( pStm2L != nullptr) ;
// eseguo l'intersezione tra le due superfici
bOk = bOk && pStm1->Intersect( *pStm2L) ;
// se il risultato è vuoto, cancello la superficie
// se il risultato vuoto, cancello la superficie
if ( bOk && ! pStm1->IsValid()) {
pGeomDB->Erase( nId1) ;
pStm1 = nullptr ;
@@ -608,27 +863,6 @@ ExeSurfTmIntersect( int nId1, int nId2, bool bTwoColors)
return bOk ;
}
//----------------------------------------------------------------------------
bool
ExeSurfTmResetTwoColors( int nId)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// recupero la superficie TriMesh
ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pStm != nullptr) ;
// reset dei flag sui triangoli per i due colori
bOk = bOk && pStm->ResetTFlags() ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfTmResetTwoColors(" + ToString( nId) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
//----------------------------------------------------------------------------
static ISurfTriMesh*
MyCreateSubSurfTm( const ISurfTriMesh* pStm, const INTVECTOR& vTria, const INTVECTOR& vTria2)
@@ -776,3 +1010,154 @@ ExeSurfTmCut( int nId, int nCutterId, bool bInVsOut, bool bSaveOnEq)
}
return bOk ;
}
//----------------------------------------------------------------------------
bool
ExeSurfTmSubtractProjectedFacesOnFace( int nSurfId, int nFaceInd, int nDestGrpId,
INTVECTOR vSurfsId, bool bOCFlag,
bool& bExistProjection, int& nNewId, int& nNewFaceNbr)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie TriMesh su cui proiettare
ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nSurfId)) ;
if ( pStm == nullptr)
return false ;
// recupero il riferimento della superficie
Frame3d frSurf ;
if ( ! pGeomDB->GetGlobFrame( nSurfId, frSurf))
return false ;
// recupero il riferimento del gruppo di destinazione
Frame3d frDest ;
if ( ! pGeomDB->GetGroupGlobFrame( nDestGrpId, frDest))
return false ;
// costruzione vettori di superfici e indici delle facce per proiezione
ISURFTMPOVECTOR vpStmOthers ;
vector<SurfLocal> vSurfCLoc ;
// recupero le altre superfici e le porto nel sistema di riferimento della prima
for ( int i = 0 ; i < int( vSurfsId.size()) ; ++ i) {
if ( pGeomDB->GetGeoType( vSurfsId[i]) != SRF_TRIMESH)
return false ;
vSurfCLoc.emplace_back( pGeomDB, vSurfsId[i], frSurf) ;
const ISurfTriMesh* pStmCurr = GetSurfTriMesh( vSurfCLoc.back().Get()) ;
vpStmOthers.emplace_back( pStmCurr->Clone()) ;
}
// eseguo la proiezione
ISurfTriMesh* pStmRes = nullptr ;
bool bOk = SubtractProjectedFacesOnStmFace( *pStm, nFaceInd, vpStmOthers, bOCFlag,
bExistProjection, pStmRes, nNewFaceNbr) ;
if ( ! bOk) {
delete( pStmRes) ;
pStmRes = nullptr ;
}
nNewId = GDB_ID_NULL ;
if ( bOk && pStmRes != nullptr) {
// porto nel sistema di riferimento destinazione
pStmRes->LocToLoc( frSurf, frDest) ;
// la inserisco nel DB geometrico
nNewId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, pStmRes) ;
if ( nNewId == GDB_ID_NULL)
return false ;
ExeSetModified() ;
}
if ( IsCmdLog()) {
string sLua = "EgtSubtractProjectedFacesOnStmFace(" + ToString( nSurfId) + "," +
ToString( nFaceInd) + "," +
ToString( nDestGrpId) + "," +
ToString( vSurfsId) + "," +
ToString( bOCFlag) + ")" +
" -- Ok=" + ToString( bOk) + " Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
//----------------------------------------------------------------------------
bool
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 ;
}
//----------------------------------------------------------------------------
static bool
MySurfBzTrim( int nId, int nTrimmerId)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie Bezier da trimmare
ISurfBezier* pSrfBz = GetSurfBezier( pGeomDB->GetGeoObj( nId)) ;
if ( pSrfBz == nullptr)
return false ;
// recupero il riferimento della superficie
Frame3d frSurf ;
if ( ! pGeomDB->GetGlobFrame( nId, frSurf))
return false ;
// recupero la superficie TriMesh divisore in locale alla prima
SurfLocal SurfCLoc( pGeomDB, nTrimmerId, frSurf) ;
//const ISurfTriMesh* pStmCLoc = GetSurfTriMesh( SurfCLoc) ;
const ISurfFlatRegion* pSrfFr = GetSurfFlatRegion( SurfCLoc) ;
if ( pSrfFr == nullptr)
return false ;
PtrOwner<ISurfFlatRegion> pSrfFrCopy( pSrfFr->Clone()) ;
if ( ! pSrfFr->GetNormVersor().IsZplus())
pSrfFrCopy->Invert() ;
// eseguo il taglio
return pSrfBz->SetTrimRegion( *pSrfFrCopy) ;
}
//----------------------------------------------------------------------------
bool
ExeSurfBzTrim( int nId, int nCutterId)
{
bool bOk = MySurfBzTrim( nId, nCutterId) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfTmCut(" + ToString( nId) + "," +
ToString( nCutterId) + "," +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
+69 -19
View File
@@ -104,10 +104,9 @@ ExeVolZmapChangeResolution( int nId, int nNewRes)
VERIFY_GEOMDB( pGeomDB, false)
// recupero lo Zmap
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nId)) ;
if ( pVZM == nullptr)
return false ;
bool bOk = ( pVZM != nullptr) ;
// cambio la risoluzione (rapporto Voxel/Dexel, valori ammessi 1 e 2)
bool bOk = pVZM->ChangeResolution( nNewRes) ;
bOk = bOk && pVZM->ChangeResolution( nNewRes) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
@@ -120,6 +119,29 @@ ExeVolZmapChangeResolution( int nId, int nNewRes)
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
ExeRemoveVolZmapPart( int nId, int nPart)
@@ -144,7 +166,7 @@ ExeRemoveVolZmapPart( int nId, int nPart)
//----------------------------------------------------------------------------
bool
ExeVolZmapSetStdTool( const INTVECTOR& vIds, const string& sToolName,
double dLen, double dDiam, double dCornR, double dCutterH, int nFlag)
double dLen, double dDiam, double dCornR, double dCutterH, int nFlag, bool bFirst)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
@@ -152,7 +174,7 @@ ExeVolZmapSetStdTool( const INTVECTOR& vIds, const string& sToolName,
bool bOk = true ;
for ( int i = 0 ; i < int( vIds.size()) ; ++ i) {
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( vIds[i])) ;
bOk = ( pVZM != nullptr && pVZM->SetStdTool( sToolName, dLen, 0.5 * dDiam, dCornR, dCutterH, nFlag)) && bOk ;
bOk = ( pVZM != nullptr && pVZM->SetStdTool( sToolName, dLen, 0.5 * dDiam, dCornR, dCutterH, nFlag, bFirst)) && bOk ;
}
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
@@ -173,7 +195,7 @@ ExeVolZmapSetStdTool( const INTVECTOR& vIds, const string& sToolName,
//----------------------------------------------------------------------------
bool
ExeVolZmapSetAdvTool( const INTVECTOR& vIds, const string& sToolName,
double dLen, double dDiam, double dTipLen, double dTipDiam, double dCornR, double dCutterH, int nFlag)
double dLen, double dDiam, double dTipLen, double dTipDiam, double dCornR, double dCutterH, int nFlag, bool bFirst)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
@@ -181,7 +203,7 @@ ExeVolZmapSetAdvTool( const INTVECTOR& vIds, const string& sToolName,
bool bOk = true ;
for ( int i = 0 ; i < int( vIds.size()) ; ++ i) {
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( vIds[i])) ;
bOk = ( pVZM != nullptr && pVZM->SetAdvTool( sToolName, dLen, dDiam / 2, dTipLen, dTipDiam / 2, dCornR, dCutterH, nFlag)) && bOk ;
bOk = ( pVZM != nullptr && pVZM->SetAdvTool( sToolName, dLen, dDiam / 2, dTipLen, dTipDiam / 2, dCornR, dCutterH, nFlag, bFirst)) && bOk ;
}
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
@@ -204,7 +226,7 @@ ExeVolZmapSetAdvTool( const INTVECTOR& vIds, const string& sToolName,
//----------------------------------------------------------------------------
bool
ExeVolZmapSetSawTool( const INTVECTOR& vIds, const string& sToolName,
double dLen, double dDiam, double dThick, double dStemDiam, double dCornR, int nFlag)
double dLen, double dDiam, double dThick, double dStemDiam, double dCornR, int nFlag, bool bFirst)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
@@ -212,7 +234,7 @@ ExeVolZmapSetSawTool( const INTVECTOR& vIds, const string& sToolName,
bool bOk = true ;
for ( int i = 0 ; i < int( vIds.size()) ; ++ i) {
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( vIds[i])) ;
bOk = ( pVZM != nullptr && pVZM->SetSawTool( sToolName, dLen, dDiam / 2, dThick, dStemDiam / 2, dCornR, nFlag)) && bOk ;
bOk = ( pVZM != nullptr && pVZM->SetSawTool( sToolName, dLen, dDiam / 2, dThick, dStemDiam / 2, dCornR, nFlag, bFirst)) && bOk ;
}
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
@@ -233,7 +255,7 @@ ExeVolZmapSetSawTool( const INTVECTOR& vIds, const string& sToolName,
//----------------------------------------------------------------------------
bool
ExeVolZmapSetGenTool( const INTVECTOR& vIds, const string& sToolName, int nToolSectId, int nFlag)
ExeVolZmapSetGenTool( const INTVECTOR& vIds, const string& sToolName, int nToolSectId, int nFlag, bool bFirst)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
@@ -243,7 +265,7 @@ ExeVolZmapSetGenTool( const INTVECTOR& vIds, const string& sToolName, int nToolS
// recupero gli Zmap e assegno i dati dell'utensile
for ( int i = 0 ; i < int( vIds.size()) ; ++ i) {
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( vIds[i])) ;
bOk = ( pVZM != nullptr && pVZM->SetGenTool( sToolName, pCC, nFlag) && bOk) ;
bOk = ( pVZM != nullptr && pVZM->SetGenTool( sToolName, pCC, nFlag, bFirst) && bOk) ;
}
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
@@ -261,7 +283,7 @@ ExeVolZmapSetGenTool( const INTVECTOR& vIds, const string& sToolName, int nToolS
//----------------------------------------------------------------------------
bool
ExeVolZmapSetMortiserTool( const INTVECTOR& vIds, const string& sToolName,
double dLen, double dWidth, double dThick, double dCornR, int nFlag)
double dLen, double dWidth, double dThick, double dCornR, int nFlag, bool bFirst)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
@@ -269,7 +291,7 @@ ExeVolZmapSetMortiserTool( const INTVECTOR& vIds, const string& sToolName,
bool bOk = true ;
for ( int i = 0 ; i < int( vIds.size()) ; ++ i) {
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( vIds[i])) ;
bOk = ( pVZM != nullptr && pVZM->SetMortiserTool( sToolName, dLen, dWidth, dThick, dCornR, nFlag) && bOk) ;
bOk = ( pVZM != nullptr && pVZM->SetMortiserTool( sToolName, dLen, dWidth, dThick, dCornR, nFlag, bFirst) && bOk) ;
}
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
@@ -290,7 +312,7 @@ ExeVolZmapSetMortiserTool( const INTVECTOR& vIds, const string& sToolName,
//----------------------------------------------------------------------------
bool
ExeVolZmapSetChiselTool( const INTVECTOR& vIds, const string& sToolName,
double dLen, double dWidth, double dThick, int nFlag)
double dLen, double dWidth, double dThick, int nFlag, bool bFirst)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
@@ -298,7 +320,7 @@ ExeVolZmapSetChiselTool( const INTVECTOR& vIds, const string& sToolName,
bool bOk = true ;
for ( int i = 0 ; i < int( vIds.size()) ; ++ i) {
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( vIds[i])) ;
bOk = ( pVZM != nullptr && pVZM->SetChiselTool( sToolName, dLen, dWidth, dThick, nFlag) && bOk) ;
bOk = ( pVZM != nullptr && pVZM->SetChiselTool( sToolName, dLen, dWidth, dThick, nFlag, bFirst) && bOk) ;
}
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
@@ -317,7 +339,8 @@ ExeVolZmapSetChiselTool( const INTVECTOR& vIds, const string& sToolName,
//----------------------------------------------------------------------------
bool
ExeVolZmapResetTool( const INTVECTOR& vIds)
ExeVolZmapSetAdditiveTool( const INTVECTOR& vIds, const string& sToolName,
double dLen, double dDiam, double dCornR, int nFlag, bool bFirst)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
@@ -325,7 +348,34 @@ ExeVolZmapResetTool( const INTVECTOR& vIds)
bool bOk = true ;
for ( int i = 0 ; i < int( vIds.size()) ; ++ i) {
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( vIds[i])) ;
bOk = ( pVZM != nullptr && pVZM->ResetTool() && bOk) ;
bOk = ( bOk && pVZM != nullptr && pVZM->SetAdditiveTool( sToolName, dLen, dDiam / 2, dCornR, nFlag, bFirst)) ;
}
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtVolZmapSetAdditiveTool({" + IdListToString( vIds) + "}," +
sToolName + "," +
ToString( dLen) + "," +
ToString( dDiam) + "," +
ToString( dCornR) + "," +
ToString( nFlag) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultato
return bOk ;
}
//----------------------------------------------------------------------------
bool
ExeVolZmapResetTools( const INTVECTOR& vIds)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero gli Zmap e assegno i dati dell'utensile
bool bOk = true ;
for ( int i = 0 ; i < int( vIds.size()) ; ++ i) {
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( vIds[i])) ;
bOk = ( pVZM != nullptr && pVZM->ResetTools() && bOk) ;
}
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
@@ -397,7 +447,7 @@ ExeVolZmapMillingStep( int nId, const Point3d& ptPs, const Vector3d& vtDs,
Vector3d vtDeL = GetVectorLocal( pGeomDB, vtDe, nRefType, frLoc) ;
// recupero lo Zmap e eseguo movimento di fresatura con l'utensile già associato
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nId)) ;
bOk = bOk && ( pVZM != nullptr && pVZM->MillingStep( ptPsL, vtDsL, ptPeL, vtDeL)) ;
bOk = bOk && ( pVZM != nullptr && pVZM->MillingStep( 0, ptPsL, vtDsL, ptPeL, vtDeL)) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
@@ -433,7 +483,7 @@ ExeVolZmapMillingStep( int nId, const Point3d& ptPs, const Vector3d& vtDs, const
Vector3d vtAeL = GetVectorLocal( pGeomDB, vtAe, nRefType, frLoc) ;
// recupero lo Zmap e eseguo movimento di fresatura con l'utensile già associato
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nId)) ;
bOk = bOk && ( pVZM != nullptr && pVZM->MillingStep( ptPsL, vtDsL, vtAsL, ptPeL, vtDeL, vtAeL)) ;
bOk = bOk && ( pVZM != nullptr && pVZM->MillingStep( 0, ptPsL, vtDsL, vtAsL, ptPeL, vtDeL, vtAeL)) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
+10
View File
@@ -746,6 +746,16 @@ ExeRemoveInfo( int nId, const string& sKey)
return bOk ;
}
//-----------------------------------------------------------------------------
bool
ExeGetAllInfo( int nId, STRVECTOR& vsInfo)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero tutte le info
return pGeomDB->GetAllInfo( nId, vsInfo) ;
}
//-----------------------------------------------------------------------------
bool
ExeSetTextureName( int nId, const string& sTxrName)
+15 -8
View File
@@ -15,6 +15,7 @@
#include "stdafx.h"
#include "EXE.h"
#include "EXE_Macro.h"
#include "GeoTools.h"
#include "AuxTools.h"
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EGkStringUtils3d.h"
@@ -254,6 +255,7 @@ ExeCopy( int nSouId, int nRefId, int nSonBeforeAfter)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nRefId = AdjustId( nRefId) ;
// eseguo la copia
int nNewId = pGeomDB->Copy( nSouId, GDB_ID_NULL, nRefId, nSonBeforeAfter) ;
pGeomDB->RemoveInfo( nNewId, GDB_SI_LIST) ;
@@ -264,11 +266,11 @@ ExeCopy( int nSouId, int nRefId, int nSonBeforeAfter)
string sLua ;
if ( nSonBeforeAfter == GDB_LAST_SON)
sLua = "EgtCopy(" + ToString( nSouId) + "," +
ToString( nRefId) + ")" +
IdToString( nRefId) + ")" +
" -- Id=" + ToString( nNewId) ;
else
sLua = "EgtCopy(" + ToString( nSouId) + "," +
ToString( nRefId) + "," +
IdToString( nRefId) + "," +
InsToString( nSonBeforeAfter) + ")" +
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
@@ -283,6 +285,7 @@ ExeCopyGlob( int nSouId, int nRefId, int nSonBeforeAfter)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nRefId = AdjustId( nRefId) ;
// eseguo la copia mantenendo la posizione in globale
int nNewId = pGeomDB->CopyGlob( nSouId, GDB_ID_NULL, nRefId, nSonBeforeAfter) ;
pGeomDB->RemoveInfo( nNewId, GDB_SI_LIST) ;
@@ -293,11 +296,11 @@ ExeCopyGlob( int nSouId, int nRefId, int nSonBeforeAfter)
string sLua ;
if ( nSonBeforeAfter == GDB_LAST_SON)
sLua = "EgtCopyGlob(" + ToString( nSouId) + "," +
ToString( nRefId) + ")" +
IdToString( nRefId) + ")" +
" -- Id=" + ToString( nNewId) ;
else
sLua = "EgtCopyGlob(" + ToString( nSouId) + "," +
ToString( nRefId) + "," +
IdToString( nRefId) + "," +
InsToString( nSonBeforeAfter) + ")" +
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
@@ -312,6 +315,7 @@ ExeRelocate( int nSouId, int nRefId, int nSonBeforeAfter)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
nRefId = AdjustId( nRefId) ;
// eseguo la rilocazione
bool bOk = pGeomDB->Relocate( nSouId, nRefId, nSonBeforeAfter) ;
ExeSetModified() ;
@@ -320,11 +324,11 @@ ExeRelocate( int nSouId, int nRefId, int nSonBeforeAfter)
string sLua ;
if ( nSonBeforeAfter == GDB_LAST_SON)
sLua = "EgtRelocate(" + ToString( nSouId) + "," +
ToString( nRefId) + ")" +
IdToString( nRefId) + ")" +
" -- Ok=" + ToString( bOk) ;
else
sLua = "EgtRelocate(" + ToString( nSouId) + "," +
ToString( nRefId) + "," +
IdToString( nRefId) + "," +
InsToString( nSonBeforeAfter) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
@@ -339,6 +343,7 @@ ExeRelocateGlob( int nSouId, int nRefId, int nSonBeforeAfter)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
nRefId = AdjustId( nRefId) ;
// eseguo la rilocazione mantenendo la posizione in globale
bool bOk = pGeomDB->RelocateGlob( nSouId, nRefId, nSonBeforeAfter) ;
ExeSetModified() ;
@@ -347,11 +352,11 @@ ExeRelocateGlob( int nSouId, int nRefId, int nSonBeforeAfter)
string sLua ;
if ( nSonBeforeAfter == GDB_LAST_SON)
sLua = "EgtRelocateGlob(" + ToString( nSouId) + "," +
ToString( nRefId) + ")" +
IdToString( nRefId) + ")" +
" -- Ok=" + ToString( bOk) ;
else
sLua = "EgtRelocateGlob(" + ToString( nSouId) + "," +
ToString( nRefId) + "," +
IdToString( nRefId) + "," +
InsToString( nSonBeforeAfter) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
@@ -594,6 +599,8 @@ ExeGeoObjDump( int nId, string& sDump)
sDump = pGeoObj->GetTitle() + " " + ToString( nId) + "\r\n" ;
// preparo gli attributi
pGeomDB->DumpAttributes( nId, sDump, bMM, "\r\n") ;
// preparo stipple
pGeomDB->DumpStipple( nId, sDump, bMM, "\r\n") ;
// preparo TextureData
pGeomDB->DumpTextureData( nId, sDump, bMM, "\r\n") ;
// preparo UserObj
+150 -14
View File
@@ -344,6 +344,26 @@ ExeGetPrevLayer( int nId, bool bOnlyVisible)
return ExeVerifyOrPrev( pGeomDB, nLayerId, bOnlyVisible) ;
}
//-------------------------------------------------------------------------------
bool
ExeIsGhostPart( int nGhostId)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// verifico sia il segnaposto di un pezzo (Ghost)
if ( pGeomDB->GetGdbType( nGhostId) == GDB_TY_GROUP &&
pGeomDB->GetParentId( nGhostId) == GDB_ID_ROOT &&
ExeIsSystemObj( pGeomDB, nGhostId) &&
pGeomDB->ExistsInfo( nGhostId, GDB_SI_SOURCE)) {
int nPartId = GDB_ID_NULL ;
pGeomDB->GetInfo( nGhostId, GDB_SI_SOURCE, nPartId) ;
int nRawId = pGeomDB->GetParentId( nPartId) ;
if ( ExeIsRawPart( nRawId))
return true ;
}
return false ;
}
//-------------------------------------------------------------------------------
int
ExeGetFirstGhostPart( void)
@@ -677,6 +697,32 @@ IsPartForDuplo( IGeomDB* pGeomDB, int nPartId)
return false ;
}
//-----------------------------------------------------------------------------
static bool
IsDuplo( IGeomDB* pGeomDB, int nDupId, bool& bInDuploGroup)
{
// verifica collegamento a DB geometrico
if ( pGeomDB == nullptr)
return false ;
// Recupero il gruppo base dei duplicati
int nDuploBaseId = GetDuploBase( pGeomDB) ;
if ( nDuploBaseId == GDB_ID_NULL)
return false ;
// Verifico sia un duplicato (gruppo sotto quello dei duplicati con riferimento a originale)
int nBaseId ;
if ( pGeomDB->GetGdbType( nDupId) == GDB_TY_GROUP && pGeomDB->ExistsInfo( nDupId, GDB_SI_DUPSOU)) {
if ( pGeomDB->GetParentId( nDupId) == nDuploBaseId) {
bInDuploGroup = true ;
return true ;
}
else if ( pGeomDB->GetInfo( nDupId, GDB_SI_BASE, nBaseId) && pGeomDB->GetParentId( nBaseId) == nDuploBaseId) {
bInDuploGroup = false ;
return true ;
}
}
return false ;
}
//-----------------------------------------------------------------------------
int
ExeDuploNew( int nSouId)
@@ -729,7 +775,8 @@ ExeDuploCount( int nSouId, int& nCount)
// Conto i reali duplo
nCount = 0 ;
for ( int i = 0 ; i < int( vnRef.size()) ; ++ i) {
if ( ExeIsDuplo( vnRef[i]))
bool bInDuploGroup ;
if ( IsDuplo( pGeomDB, vnRef[i], bInDuploGroup))
++ nCount ;
}
return true ;
@@ -754,6 +801,105 @@ ExeDuploList( int nSouId, INTVECTOR& vnRef)
return true ;
}
//-----------------------------------------------------------------------------
bool
ExeDuploInRawCount( int nSouId, int& nCount)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// Verifico sia un pezzo
if ( ! IsPartForDuplo( pGeomDB, nSouId))
return false ;
// Recupero info del sorgente
INTVECTOR vnRef ;
pGeomDB->GetInfo( nSouId, GDB_SI_DUPLIST, vnRef) ;
// Conto i reali duplo che sono riferiti o che stanno in un grezzo
nCount = 0 ;
for ( int i = 0 ; i < int( vnRef.size()) ; ++ i) {
// verifico sia un duplo
int nDupId = vnRef[i] ;
bool bInDuploGroup ;
if ( ! IsDuplo( pGeomDB, nDupId, bInDuploGroup))
continue ;
// se nel gruppo dei duplo
if ( bInDuploGroup) {
// verifico sia incluso in un grezzo di un gruppo di lavoro
INTVECTOR vnRef ;
if ( ! pGeomDB->GetInfo( nDupId, GDB_SI_LIST, vnRef))
continue ;
for ( auto& nId : vnRef) {
// verifico esista
if ( ! pGeomDB->ExistsObj( nId))
continue ;
// verifico sia in un grezzo (previsto solo in uno come massimo)
int nMachGrpId = pGeomDB->GetParentId( pGeomDB->GetParentId( pGeomDB->GetParentId( nId))) ;
string sMachGrpName ;
if ( ExeGetMachGroupName( nMachGrpId, sMachGrpName)) {
++ nCount ;
break ;
}
}
}
// se in altro gruppo
else {
// verifico se incluso nel grezzo del gruppo di lavoro corrente (previsto solo in un gruppo)
if ( ExeIsRawPart( pGeomDB->GetParentId( nDupId)))
++ nCount ;
}
}
return true ;
}
//-----------------------------------------------------------------------------
bool
ExeDuploWithoutRawList( INTVECTOR& vnDup)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// Reset del risultato
vnDup.clear() ;
// Recupero gruppo dei duplo
int nDuploBaseId = GetDuploBase( pGeomDB) ;
if ( nDuploBaseId == GDB_ID_NULL)
return true ;
// Ciclo sui duplo
for ( int nDuploId = pGeomDB->GetFirstGroupInGroup( nDuploBaseId) ;
nDuploId != GDB_ID_NULL ;
nDuploId = pGeomDB->GetNextGroup( nDuploId)) {
// se marcatore
if ( pGeomDB->ExistsInfo( nDuploId, GDB_SI_SOURCE)) {
int nPartId = GDB_ID_NULL ;
pGeomDB->GetInfo( nDuploId, GDB_SI_SOURCE, nPartId) ;
int nMachGrpId = pGeomDB->GetParentId( pGeomDB->GetParentId( pGeomDB->GetParentId( nPartId))) ;
string sMachGrpName ;
if ( pGeomDB->ExistsInfo( nPartId, GDB_SI_DUPSOU) && ExeGetMachGroupName( nMachGrpId, sMachGrpName))
continue ;
}
// se vero duplo
else if ( pGeomDB->ExistsInfo( nDuploId, GDB_SI_DUPSOU) && pGeomDB->ExistsInfo( nDuploId, GDB_SI_LIST)) {
// verifico sia incluso in un grezzo di un gruppo di lavoro
bool bFound = false ;
INTVECTOR vnRef ;
pGeomDB->GetInfo( nDuploId, GDB_SI_LIST, vnRef) ;
for ( auto& nId : vnRef) {
// verifico sia in un grezzo (previsto solo in uno come massimo)
int nMachGrpId = pGeomDB->GetParentId( pGeomDB->GetParentId( pGeomDB->GetParentId( nId))) ;
string sMachGrpName ;
if ( ExeGetMachGroupName( nMachGrpId, sMachGrpName)) {
bFound = true ;
break ;
}
}
if ( bFound)
continue ;
}
// inserisco nella lista dei duplo senza grezzo
vnDup.emplace_back( nDuploId) ;
}
return true ;
}
//-----------------------------------------------------------------------------
bool
ExeDuploSetModified( int nSouId)
@@ -955,19 +1101,9 @@ ExeIsDuplo( int nDupId)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// Recupero il gruppo base dei duplicati
int nDuploBaseId = GetDuploBase( pGeomDB) ;
if ( nDuploBaseId == GDB_ID_NULL)
return false ;
// Verifico sia un duplicato (gruppo sotto quello dei duplicati con riferimento a originale)
int nBaseId ;
if ( pGeomDB->GetGdbType( nDupId) == GDB_TY_GROUP &&
( pGeomDB->GetParentId( nDupId) == nDuploBaseId ||
( pGeomDB->GetInfo( nDupId, GDB_SI_BASE, nBaseId) && pGeomDB->GetParentId( nBaseId) == nDuploBaseId)) &&
pGeomDB->ExistsInfo( nDupId, GDB_SI_DUPSOU))
return true ;
else
return false ;
// Verifico sia un duplicato
bool bPartVsGhost ;
return IsDuplo( pGeomDB, nDupId, bPartVsGhost) ;
}
//-----------------------------------------------------------------------------
+129 -10
View File
@@ -1,13 +1,14 @@
//----------------------------------------------------------------------------
// EgalTech 2014-2015
// EgalTech 2014-2023
//----------------------------------------------------------------------------
// File : EXE_General.cpp Data : 01.09.14 Versione : 1.5i1
// File : EXE_General.cpp Data : 14.11.23 Versione : 2.5k2
// Contenuto : Funzioni generali per EXE.
//
//
//
// Modifiche : 01.09.14 DS Creazione modulo.
// 28.11.19 DS Aggiunto caricamento opzionale del Nesting.
// 28.11.19 DS Aggiunto caricamento opzionale di Nesting.
// 14.11.23 DS Aggiunto caricamento opzionale di Exchange 3dm.
//
//----------------------------------------------------------------------------
@@ -17,6 +18,7 @@
#include "LUA_Base.h"
#include "DllGraphics.h"
#include "DllExchange.h"
#include "DllExch3dm.h"
#include "DllMachKernel.h"
#include "DllNesting.h"
#include "/EgtDev/Include/EXeExecutor.h"
@@ -29,6 +31,7 @@
#include "/EgtDev/Include/EGnFileUtils.h"
#include "/EgtDev/Include/EGnGetModuleVer.h"
#include "/EgtDev/Include/EGnPcInfo.h"
#include "/EgtDev/Include/EGnGetKeyData.h"
#include "/EgtDev/Include/EgtIniFile.h"
#include "/EgtDev/Include/EgtLogger.h"
#include "/EgtDev/Include/EgtStringConverter.h"
@@ -49,10 +52,13 @@ static string s_sKey ;
static int s_nKeyType = KEY_LOCK_TYPE_ANY ;
static bool s_bNetHwKey = false ;
static int s_nKeyExpDays = 0 ;
static int s_nKeyAssExpDays = 0 ;
static int s_nKeyOptExpDays = 0 ;
static string s_sNestKey ;
static string s_sLockId ;
static string s_sIniFile ;
static bool s_bEnableUI = true ;
static pfOnTerminateProcess s_pFunOnTerminateProcess = nullptr ;
static pfProcEvents s_pFunProcEvents = nullptr ;
static pfOutText s_pFunOutText = nullptr ;
static HWND s_hMainWnd = nullptr ;
@@ -68,6 +74,7 @@ ExeInit( int nDebug, const string& sLogFile, const string& sLogMsg)
if ( s_pGenLog != nullptr)
delete s_pGenLog ;
// cancello riferimenti a funzioni installate
s_pFunOnTerminateProcess = nullptr ;
s_pFunProcEvents = nullptr ;
s_pFunOutText = nullptr ;
s_bEnableUI = true ;
@@ -110,12 +117,16 @@ ExeInit( int nDebug, const string& sLogFile, const string& sLogMsg)
if ( LoadExchangeDll( s_pGenLog, s_sKey, s_bNetHwKey))
LOG_INFO( s_pGenLog, MyGetEExVersion())
// carico libreria exchange 3dm opzionale
if ( LoadExch3dmDll( s_pGenLog, s_sKey, s_bNetHwKey))
LOG_INFO( s_pGenLog, MyGetEE3Version())
// carico libreria di lavorazione opzionale
if ( LoadMachKernelDll( s_pGenLog, s_sKey, s_bNetHwKey))
LOG_INFO( s_pGenLog, MyGetEMkVersion())
// carico libreria nesting opzionale (non può usare la chiave di rete)
if ( LoadNestingDll( s_pGenLog, s_sKey, s_sNestKey))
if ( LoadNestingDll( s_pGenLog, s_sKey, s_sNestKey, s_bNetHwKey))
LOG_INFO( s_pGenLog, MyGetENsVersion())
// Info sulla protezione e sul sistema
@@ -166,9 +177,11 @@ ExeExit( void)
// libero le librerie opzionali
FreeMachKernelDll() ;
FreeExchangeDll() ;
FreeExch3dmDll() ;
FreeGraphicsDll() ;
// cancello riferimenti a funzioni installate
s_pFunOnTerminateProcess = nullptr ;
s_pFunProcEvents = nullptr ;
s_pFunOutText = nullptr ;
s_bEnableUI = true ;
@@ -188,9 +201,37 @@ ExeExit( void)
s_pGenLog = nullptr ;
}
// libero eventuale chiave di rete
if ( s_bNetHwKey)
CloseNetHwKey() ;
return true ;
}
//-----------------------------------------------------------------------------
bool
ExeSetOnTerminateProcess( pfOnTerminateProcess pFun)
{
s_pFunOnTerminateProcess = pFun ;
return ( pFun != nullptr) ;
}
//-----------------------------------------------------------------------------
bool
ExeOnTerminateProcess( int nExitCode)
{
// lancio eventuale callback
bool bTerminate = true ;
if ( s_pFunOnTerminateProcess != nullptr)
bTerminate = s_pFunOnTerminateProcess( nExitCode) ;
// se confermata chiusura, libero eventuale chiave di rete
if ( bTerminate && s_bNetHwKey)
CloseNetHwKey() ;
return bTerminate ;
}
//-----------------------------------------------------------------------------
int
ExeGetDebugLevel( void)
@@ -218,6 +259,7 @@ bool
ExeSetKey( const string& sKey)
{
s_sKey = sKey ;
SetEGnKey( s_sKey) ;
return true ;
}
@@ -248,15 +290,66 @@ bool
ExeSetLockType( int nType)
{
s_nKeyType = nType ;
SetEGnKeyType( s_nKeyType) ;
return SetLockType( nType) ;
}
//-----------------------------------------------------------------------------
bool
ExeSetNetHwKey( bool bNetHwKey)
ExeSetLockId( const string& sLockId)
{
int nKeyType ;
bool bNetKey ;
int nUserId ;
GetLockIdStringInfo( sLockId, nKeyType, bNetKey, nUserId) ;
bool bOk ;
switch ( nKeyType) {
default :
ExeSetNetHwKey( false) ;
bOk = false ;
break ;
case KEY_LOCK_TYPE_SW :
ExeSetNetHwKey( false) ;
bOk = ( s_nKeyType != KEY_LOCK_TYPE_HW) ;
break ;
case KEY_LOCK_TYPE_HW :
{ string sAddrPort ;
GetLockIdStringNetData( sLockId, sAddrPort) ;
ExeSetNetHwKey( bNetKey, nUserId, sAddrPort) ;
bOk = true ;
break ;
}
}
if ( bOk)
s_sLockId = sLockId ;
else
s_sLockId = "" ;
return bOk ;
}
//-----------------------------------------------------------------------------
const string&
ExeGetLockId( void)
{
if ( s_sLockId.empty())
GetLockId( s_sLockId) ;
return s_sLockId ;
}
//-----------------------------------------------------------------------------
bool
ExeSetNetHwKey( bool bNetHwKey, int nUserId, const string& sAddrPort)
{
s_bNetHwKey = bNetHwKey ;
return SetNetHwKey( bNetHwKey) ;
SetEGnNetHwKey( s_bNetHwKey) ;
return SetNetHwKey( s_bNetHwKey, nUserId, sAddrPort) ;
}
//-----------------------------------------------------------------------------
bool
ExeGetNetHwKey( void)
{
return s_bNetHwKey ;
}
//-----------------------------------------------------------------------------
@@ -387,6 +480,10 @@ ExeGetVersionInfo( string& sVer, const char* szNewLine)
sVer += szNewLine ;
sVer += MyGetEExVersion() ;
}
if ( IsLoadedExch3dmDll()) {
sVer += szNewLine ;
sVer += MyGetEE3Version() ;
}
if ( IsLoadedMachKernelDll()) {
sVer += szNewLine ;
sVer += MyGetEMkVersion() ;
@@ -411,7 +508,7 @@ ExeGetKeyInfo( string& sKey)
sLockId = sLockId.substr( 7, 6) ;
if ( sLockId.empty())
return false ;
int nLockSN ;
int nLockSN = 0 ;
if ( GetLockSN( nLockSN))
sLockId += " (" + ToString( nLockSN) + ")" ;
}
@@ -430,14 +527,14 @@ bool
ExeGetKeyLevel( int nProd, int nVer, int nLev, int& nKLev)
{
// verifico la chiave e il livello
int nRet = GetKeyLevel( s_sKey, nProd, nVer, nLev, nKLev, s_nKeyExpDays) ;
int nRet = GetKeyLevelEx( s_sKey, nProd, nVer, nLev, nKLev, s_nKeyExpDays, s_nKeyAssExpDays) ;
SetEGnKeyLevel( nRet, nKLev, s_nKeyExpDays) ;
if ( nRet != KEY_OK) {
string sErr = "Error on Key (EGKL/" + ToString( nRet) + ")" ;
LOG_ERROR( s_pGenLog, sErr.c_str()) ;
nKLev = - nRet ;
return false ;
}
return true ;
}
@@ -448,6 +545,7 @@ ExeGetKeyOptions( int nProd, int nVer, int nLev, unsigned int& nOpt2)
// verifico la chiave e le opzioni
unsigned int nOpt1 ;
int nRet = GetKeyOptions( s_sKey, nProd, nVer, nLev, nOpt1, nOpt2, s_nKeyOptExpDays) ;
SetEGnKeyOptions( nRet, nOpt1, nOpt2, s_nKeyOptExpDays) ;
if ( nRet != KEY_OK) {
nOpt2 = 0 ;
string sErr = "Error on Key (EGKO/" + ToString( nRet) + ")" ;
@@ -460,7 +558,6 @@ ExeGetKeyOptions( int nProd, int nVer, int nLev, unsigned int& nOpt2)
LOG_ERROR( s_pGenLog, sErr.c_str()) ;
return true ;
}
return true ;
}
@@ -474,6 +571,16 @@ ExeGetKeyLeftDays( int& nLeftDays)
return true ;
}
//-----------------------------------------------------------------------------
bool
ExeGetKeyAssLeftDays( int& nAssLeftDays)
{
if ( s_nKeyAssExpDays == 0)
return false ;
nAssLeftDays = s_nKeyAssExpDays - GetCurrDay() ;
return true ;
}
//-----------------------------------------------------------------------------
bool
ExeGetKeyOptLeftDays( int& nOptLeftDays)
@@ -536,6 +643,18 @@ ExeGetEnableUI( void)
return s_bEnableUI ;
}
//-----------------------------------------------------------------------------
int
ExeMessageBox( const string& sText, const string& sTitle, int nType)
{
int nRes = 0 ;
if ( ExeGetEnableUI()) {
HWND hTopWnd = ExeGetMainWindowHandle() ;
nRes = MessageBox( hTopWnd, stringtoW( sText), stringtoW( sTitle), nType | MB_TASKMODAL) ;
}
return nRes ;
}
//-----------------------------------------------------------------------------
bool
ExeSetProcessEvents( pfProcEvents pFun)
+825 -549
View File
File diff suppressed because it is too large Load Diff
+12
View File
@@ -277,6 +277,8 @@ ExeNewFile( void)
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// scrivo il log
LOG_INFO( GetLogger(), "New File") ;
// restituisco il risultato
return bOk ;
}
@@ -316,6 +318,11 @@ ExeOpenFile( const string& sFilePath)
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// scrivo il log
{
string sLog = "Open File " + sFilePath ;
LOG_INFO( GetLogger(), sLog.c_str()) ;
}
// restituisco il risultato
return bOk ;
}
@@ -447,6 +454,11 @@ ExeSaveFile( const string& sFilePath, int nFlag)
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// scrivo il log
{
string sLog = "Saved File " + sFilePath ;
LOG_INFO( GetLogger(), sLog.c_str()) ;
}
// restituisco il risultato
return bOk ;
}
+5 -3
View File
@@ -262,11 +262,13 @@ ExeLuaExecLine( const string& sLine)
//-----------------------------------------------------------------------------
bool
ExeLuaExecFile( const string& sFilePath)
ExeLuaExecFile( const string& sFilePath, bool LogInfo)
{
// emetto info
string sInfo = "Exec File = " + sFilePath ;
LOG_INFO( GetLogger(), sInfo.c_str())
if ( LogInfo) {
string sInfo = "Exec File = " + sFilePath ;
LOG_INFO( GetLogger(), sInfo.c_str())
}
// disabilito il log dei comandi
CmdLogOff cmdLogOff ;
// esecuzione script
+120 -10
View File
@@ -245,6 +245,26 @@ ExeAddMachGroup( const string& sName, const string& sMachineName)
return nId ;
}
//-----------------------------------------------------------------------------
int
ExeCopyMachGroup( const string& sSouName, const string& sName)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL)
// copio la macchinata (gruppo di lavorazione)
int nId = pMachMgr->CopyMachGroup( sSouName, sName) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtCopyMachGroup('" + sSouName + "','" +
sName + "')" +
" -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco il risultato
return nId ;
}
//-----------------------------------------------------------------------------
bool
ExeRemoveMachGroup( int nMGroupId)
@@ -264,6 +284,26 @@ ExeRemoveMachGroup( int nMGroupId)
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
ExeGetMachGroupName( int nId, string& sName)
@@ -291,8 +331,8 @@ int
ExeGetMachGroupId( const string& sName)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// recupero l'indice della macchinata
VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL)
// recupero l'identificativo della macchinata
return pMachMgr->GetMachGroupId( sName) ;
}
@@ -353,16 +393,16 @@ ExeAddPhase( void)
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, 0)
// aggiungo una nuova fase di lavorazione alla macchinata corrente
int nId = pMachMgr->AddPhase() ;
int nInd = pMachMgr->AddPhase() ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtAddPhase()"
" -- Id=" + ToString( nId) ;
" -- Ind=" + ToString( nInd) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco il risultato
return nId ;
return nInd ;
}
//-----------------------------------------------------------------------------
@@ -451,7 +491,7 @@ bool
ExeIsRawPart( int nRawId)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL)
VERIFY_MACHMGR( pMachMgr, false)
// verifico se è un grezzo della macchinata corrente
return pMachMgr->IsRawPart( nRawId) ;
}
@@ -1565,6 +1605,16 @@ ExeFindToolInCurrSetup( const string& sTool)
return pMachMgr->FindToolInCurrSetup( sTool) ;
}
//-----------------------------------------------------------------------------
bool
ExeGetToolSetupPosInCurrSetup( const string& sTool, string& sTcPos)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// eseguo la verifica
return pMachMgr->GetToolSetupPosInCurrSetup( sTool, sTcPos) ;
}
//-----------------------------------------------------------------------------
bool
ExeGetToolsInCurrSetupPos( const string& sTcPos, STRVECTOR& vsTools)
@@ -2700,7 +2750,7 @@ ExeApplyAllMachiningsEx( bool bRecalc, bool bStopOnFirstErr, string& sErrList, s
while ( nOperId != GDB_ID_NULL) {
if ( pMachMgr->GetOperationType( nOperId) == OPER_DISP) {
pMachMgr->SetCurrPhase( pMachMgr->GetOperationPhase( nOperId)) ;
if ( ! pMachMgr->DispositionSpecialApply( nOperId, bRecalc)) {
if ( ! pMachMgr->DispositionSpecialApply( nOperId, true)) {
bOk = false ;
if ( pMachMgr->GetLastErrorId() != 0)
sErrList += pMachMgr->GetOperationName( nOperId) + " -> " + pMachMgr->GetLastErrorString() + "\r\n" ;
@@ -2846,12 +2896,12 @@ ExeGetClEntMove( int nEntId, int& nMove)
//-----------------------------------------------------------------------------
bool
ExeGetClEntFlag( int nEntId, int& nFlag)
ExeGetClEntFlag( int nEntId, int& nFlag, int& nFlag2)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// recupero il flag
return pMachMgr->GetClEntFlag( nEntId, nFlag) ;
// recupero i flag
return pMachMgr->GetClEntFlag( nEntId, nFlag, nFlag2) ;
}
//-----------------------------------------------------------------------------
@@ -2864,6 +2914,26 @@ ExeGetClEntIndex( int nEntId, int& nIndex)
return pMachMgr->GetClEntIndex( nEntId, nIndex) ;
}
//-----------------------------------------------------------------------------
bool
ExeGetClEntAxesMask( int nEntId, int& nMask)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// recupero la mascheratura del movimento assi
return pMachMgr->GetClEntAxesMask( nEntId, nMask) ;
}
//-----------------------------------------------------------------------------
bool
ExeGetClEntAxesVal( int nEntId, DBLVECTOR& vAxes)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// recupero il valore degli assi
return pMachMgr->GetClEntAxesVal( nEntId, vAxes) ;
}
//-----------------------------------------------------------------------------
// Simulazione
//-----------------------------------------------------------------------------
@@ -3152,6 +3222,16 @@ ExeSetRotAxisBlock( const string& sAxis, double 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
ExeGetCalcTool( string& sTool, string& sHead, int& nExit)
@@ -3162,6 +3242,16 @@ ExeGetCalcTool( string& sTool, string& sHead, int& 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
ExeGetRotAxisBlocked( int nInd, string& sAxis, double& dVal)
@@ -3331,6 +3421,16 @@ ExeGetHeadExitCount( const string& 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
ExeGetTcPosId( const string& sTcPos)
@@ -3391,6 +3491,16 @@ ExeGetAllTablesNames( STRVECTOR& 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
ExeGetAllHeadsNames( STRVECTOR& vNames)
+57
View File
@@ -0,0 +1,57 @@
//----------------------------------------------------------------------------
// EgalTech 2023-2023
//----------------------------------------------------------------------------
// File : EXE_Mutex.cpp Data : 05.02.23 Versione : 2.5a6
// Contenuto : Funzioni per gestione mutex.
//
//
//
// Modifiche : 05.02.23 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "EXE.h"
#include "/EgtDev/Include/EgtStringConverter.h"
using namespace std ;
//----------------------------------------------------------------------------
static HANDLE s_hMutex = NULL ;
//----------------------------------------------------------------------------
bool
ExeCreateMutex( const string& sMutexName)
{
if ( s_hMutex != NULL)
return false ;
HANDLE hMutex = CreateMutex( NULL, TRUE, stringtoW( sMutexName)) ;
if ( hMutex == NULL)
return false ;
else if ( GetLastError() == ERROR_ALREADY_EXISTS) {
ReleaseMutex( hMutex) ;
CloseHandle( hMutex) ;
return false ;
}
else {
s_hMutex = hMutex ;
return true ;
}
}
//----------------------------------------------------------------------------
bool
ExeReleaseMutex( void)
{
if ( s_hMutex == NULL)
return true ;
bool bOk = ( ReleaseMutex( s_hMutex) != FALSE) ;
CloseHandle( s_hMutex) ;
s_hMutex = NULL ;
return bOk ;
}
+77 -9
View File
@@ -1613,6 +1613,50 @@ ExeCalcFlatPartUpRegion( int nPartId, bool bCalc)
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
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)) ;
if ( pCrv == nullptr)
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 ;
@@ -1696,8 +1741,12 @@ AdjustLayerForSideAngle( IGeomDB* pGeomDB, int nLayOrigId, const string& sLayOri
ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nNewId)) ;
if ( pCrv == nullptr)
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)
if ( ! AdjustLayerCurves( pGeomDB, nTmpLayId))
@@ -1720,7 +1769,7 @@ AdjustLayerForSideAngle( IGeomDB* pGeomDB, int nLayOrigId, const string& sLayOri
if ( nNewId == GDB_ID_NULL)
return false ;
// determino ed eseguo offset
double dSideAng ;
double dSideAng, dSideAng2 ;
if ( pGeomDB->GetInfo( nCrvId, NST_KEY_SIDEANG, dSideAng) && abs( dSideAng) > EPS_ANG_SMALL) {
double dOffset = 0 ;
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)) ;
if ( pCrv == nullptr)
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)
if ( ! AdjustLayerCurves( pGeomDB, nTmpLay2Id))
@@ -1769,10 +1832,13 @@ AdjustLayerForSideAngle( IGeomDB* pGeomDB, int nLayOrigId, const string& sLayOri
//if ( dStartProD > EPS_SMALL)
// pCrv->ExtendStartByLen( dStartProD) ;
double dStartProMin = min( dStartProD, dStartProU) ;
if ( dStartProMin < - EPS_SMALL)
if ( dStartProMin < - EPS_SMALL) {
pCrv->TrimStartAtLen( - dStartProMin) ;
if ( abs( dStartProD - dStartProU) > EPS_SMALL)
pGeomDB->SetInfo( nCrvId, MCH_KEY_START_WHISKEXT, abs( dStartProD - dStartProU)) ;
if ( abs( dStartProD - dStartProU) > EPS_SMALL)
pGeomDB->SetInfo( nCrvId, MCH_KEY_START_WHISKEXT, abs( dStartProD - dStartProU)) ;
}
else
pGeomDB->SetInfo( nCrvId, MCH_KEY_START_WHISKEXT, max( dStartProD, dStartProU)) ;
}
else {
if ( dStartProD < - EPS_SMALL)
@@ -1799,9 +1865,11 @@ AdjustLayerForSideAngle( IGeomDB* pGeomDB, int nLayOrigId, const string& sLayOri
double dLen ;
pCrv->GetLength( dLen) ;
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)
pGeomDB->SetInfo( nCrvId, MCH_KEY_END_WHISKEXT, abs( dEndProD - dEndProU)) ;
else
pGeomDB->SetInfo( nCrvId, MCH_KEY_END_WHISKEXT, max( dEndProD, dEndProU)) ;
}
else {
if ( dEndProD < - EPS_SMALL) {
+40 -3
View File
@@ -183,10 +183,23 @@ ExeSetGridGeo( double dSnapStep, int nMinLineSstep, int nMajLineSstep, int nExtS
{
IEGrScene* pScene = GetCurrScene() ;
VERIFY_SCENE( pScene, false)
// imposto i parametri geometrici di griglia
return pScene->SetGridGeo( dSnapStep, nMinLineSstep, nMajLineSstep, nExtSstep) ;
}
//-----------------------------------------------------------------------------
bool
ExeSetGridGeoAdv( double dSnapStep, int nMinLineSstep, int nMajLineSstep,
double dXmin, double dXmax, double dYmin, double dYmax)
{
IEGrScene* pScene = GetCurrScene() ;
VERIFY_SCENE( pScene, false)
// imposto i parametri geometrici di griglia
return pScene->SetGridGeoAdv( dSnapStep, nMinLineSstep, nMajLineSstep, dXmin, dXmax, dYmin, dYmax) ;
}
//-----------------------------------------------------------------------------
bool
ExeSetGridColor( Color colMin, Color colMaj)
@@ -212,11 +225,13 @@ ExeResize( int nW, int nH)
bool
ExeDraw( void)
{
// se interfaccia disabilitata, esco subito
if ( ! ExeGetEnableUI())
return true ;
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, false)
// se abilitato, eseguo disegno
if ( ExeGetEnableUI())
pGseCtx->m_pScene->Draw() ;
// eseguo disegno
pGseCtx->m_pScene->Draw() ;
// valido la finestra disegnata
ValidateRgn( pGseCtx->m_hWnd, NULL) ;
return true ;
@@ -625,6 +640,15 @@ ExeZoomWin( int nPrevX, int nPrevY, int nCurrX, int nCurrY, bool bRedraw)
return true ;
}
//-----------------------------------------------------------------------------
bool
ExeSetViewOrizzOffsStep( int nDirOffsStep)
{
IEGrScene* pScene = GetCurrScene() ;
VERIFY_SCENE( pScene, false)
return pScene->SetCameraDirOrizzOffset( nDirOffsStep) ;
}
//-----------------------------------------------------------------------------
bool
ExeSetView( int nDir, bool bRedraw)
@@ -694,6 +718,19 @@ ExeRotateView( int nPrevX, int nPrevY, int nCurrX, int nCurrY, bool bRedraw)
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
ExeGetView( int* pnDir)
+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.
+12 -2
View File
@@ -22,7 +22,7 @@
<ProjectGuid>{DF654897-F85B-4108-A621-F2C4AB099A48}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>EgtExecutor</RootNamespace>
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0.20348.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
@@ -104,6 +104,8 @@
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<MinimalRebuild>false</MinimalRebuild>
<OpenMPSupport>false</OpenMPSupport>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -164,6 +166,7 @@ copy $(TargetPath) \EgtProg\DllD64</Command>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -197,7 +200,7 @@ copy $(TargetPath) \EgtProg\Dll32</Command>
<OpenMPSupport>false</OpenMPSupport>
<EnableFiberSafeOptimizations>false</EnableFiberSafeOptimizations>
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
<EnableEnhancedInstructionSet>AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
<EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
<LanguageStandard>stdcpp17</LanguageStandard>
<AdditionalOptions>-Wno-tautological-undefined-compare</AdditionalOptions>
</ClCompile>
@@ -225,6 +228,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClInclude Include="..\Include\EXeConst.h" />
<ClInclude Include="..\Include\EXeDllMain.h" />
<ClInclude Include="..\Include\EXeExecutor.h" />
<ClInclude Include="DllExch3dm.h" />
<ClInclude Include="DllMain.h" />
<ClInclude Include="DllNesting.h" />
<ClInclude Include="EXE.h" />
@@ -245,6 +249,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClInclude Include="stdafx.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="DllExch3dm.cpp" />
<ClCompile Include="DllNesting.cpp" />
<ClCompile Include="EXE_BeamMgr.cpp" />
<ClCompile Include="EXE_CAvTool.cpp" />
@@ -252,6 +257,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClCompile Include="EXE_GdbCreateVol.cpp" />
<ClCompile Include="EXE_GdbGet.cpp" />
<ClCompile Include="EXE_GdbGetCurve.cpp" />
<ClCompile Include="EXE_GdbGetPocketing.cpp" />
<ClCompile Include="EXE_GdbGetSurf.cpp" />
<ClCompile Include="EXE_GdbGetVol.cpp" />
<ClCompile Include="EXE_GdbModifyVol.cpp" />
@@ -259,6 +265,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClCompile Include="EXE_GeoInters.cpp" />
<ClCompile Include="EXE_Image.cpp" />
<ClCompile Include="EXE_MaxFiller.cpp" />
<ClCompile Include="EXE_Mutex.cpp" />
<ClCompile Include="EXE_NstAutoNesting.cpp" />
<ClCompile Include="EXE_NstMachining.cpp" />
<ClCompile Include="EXE_NstPartNesting.cpp" />
@@ -286,6 +293,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClCompile Include="EXE_Picture.cpp" />
<ClCompile Include="EXE_Scene.cpp" />
<ClCompile Include="EXE_ShortestPath.cpp" />
<ClCompile Include="EXE_TestObjSurface.cpp" />
<ClCompile Include="EXE_TscExec.cpp" />
<ClCompile Include="AuxTools.cpp" />
<ClCompile Include="DllExchange.cpp" />
@@ -301,6 +309,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClCompile Include="LUA_CDeObjSolid.cpp" />
<ClCompile Include="LUA_GdbGet.cpp" />
<ClCompile Include="LUA_GdbGetCurve.cpp" />
<ClCompile Include="LUA_GdbGetPocketing.cpp" />
<ClCompile Include="LUA_GdbGetSurf.cpp" />
<ClCompile Include="LUA_GdbGetVol.cpp" />
<ClCompile Include="LUA_GeoDist.cpp" />
@@ -308,6 +317,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClCompile Include="LUA_MaxFiller.cpp" />
<ClCompile Include="LUA_Picture.cpp" />
<ClCompile Include="LUA_PolynomialRoots.cpp" />
<ClCompile Include="LUA_TestObjSurface.cpp" />
<ClCompile Include="PictureObj.cpp" />
<ClCompile Include="LUA_Base.cpp" />
<ClCompile Include="LUA_GdbCreateCurve.cpp" />
+21
View File
@@ -108,6 +108,9 @@
<ClInclude Include="DllNesting.h">
<Filter>File di intestazione</Filter>
</ClInclude>
<ClInclude Include="DllExch3dm.h">
<Filter>File di intestazione</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="LUA_Exchange.cpp">
@@ -386,6 +389,24 @@
<ClCompile Include="LUA_BeamMgr.cpp">
<Filter>File di origine\LUA</Filter>
</ClCompile>
<ClCompile Include="EXE_Mutex.cpp">
<Filter>File di origine\EXE</Filter>
</ClCompile>
<ClCompile Include="DllExch3dm.cpp">
<Filter>File di origine\Optional Dll</Filter>
</ClCompile>
<ClCompile Include="EXE_GdbGetPocketing.cpp">
<Filter>File di origine\EXE</Filter>
</ClCompile>
<ClCompile Include="LUA_GdbGetPocketing.cpp">
<Filter>File di origine\LUA</Filter>
</ClCompile>
<ClCompile Include="EXE_TestObjSurface.cpp">
<Filter>File di origine\EXE</Filter>
</ClCompile>
<ClCompile Include="LUA_TestObjSurface.cpp">
<Filter>File di origine\LUA</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="EgtExecutor.rc">
+9 -3
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.
//
//
@@ -54,6 +54,9 @@ bool LuaInstallGdbModifyVol( LuaMgr& luaMgr) ;
//-------------------------- GdbGet ------------------------------------------
bool LuaInstallGdbGet( LuaMgr& luaMgr) ;
//-------------------------- GdbGetPocketing ---------------------------------
bool LuaInstallGdbGetPocketing( LuaMgr& luaMgr) ;
//-------------------------- GdbGetCurve -------------------------------------
bool LuaInstallGdbGetCurve( LuaMgr& luaMgr) ;
@@ -62,7 +65,7 @@ bool LuaInstallGdbGetSurf( LuaMgr& luaMgr) ;
//-------------------------- GdbGetVol ---------------------------------------
bool LuaInstallGdbGetVol( LuaMgr& luaMgr) ;
//-------------------------- GdbPartLayer ------------------------------------
bool LuaInstallGdbPartLayer( LuaMgr& luaMgr) ;
@@ -90,6 +93,9 @@ bool LuaInstallGeoInters( LuaMgr& luaMgr) ;
//-------------------------- Collision Detection -----------------------------
bool LuaInstallCDeObjSolid( LuaMgr& luaMgr) ;
//-------------------------- Test Interference -------------------------------
bool LuaInstallTestObjSurface( LuaMgr& luaMgr) ;
//-------------------------- MachMgr -----------------------------------------
bool LuaInstallMachMgr( LuaMgr& luaMgr) ;
+8
View File
@@ -78,6 +78,10 @@ LuaInstallEgtFunctions( LuaMgr& LuaMgr)
LOG_ERROR( GetLogger(), "Error in LuaInstallGdbGet (LuaInstallEgtFunctions)")
return false ;
}
if ( ! LuaInstallGdbGetPocketing( LuaMgr)) {
LOG_ERROR( GetLogger(), "Error in LuaInstallGdbGetPocketing (LuaInstallEgtFunctions)")
return false ;
}
if ( ! LuaInstallGdbGetCurve( LuaMgr)) {
LOG_ERROR( GetLogger(), "Error in LuaInstallGdbGetCurve (LuaInstallEgtFunctions)")
return false ;
@@ -126,6 +130,10 @@ LuaInstallEgtFunctions( LuaMgr& LuaMgr)
LOG_ERROR( GetLogger(), "Error in LuaInstallCDeObjSolid (LuaInstallEgtFunctions)")
return false ;
}
if ( ! LuaInstallTestObjSurface( LuaMgr)) {
LOG_ERROR( GetLogger(), "Error in LuaInstallTestObjSurface (LuaInstallEgtFunctions)")
return false ;
}
if ( ! LuaInstallMachMgr( LuaMgr)) {
LOG_ERROR( GetLogger(), "Error in LuaInstallMachMgr (LuaInstallEgtFunctions)")
return false ;
+22
View File
@@ -118,6 +118,27 @@ LuaCAvGetToolOutline( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCAvToolPosBox( lua_State* L)
{
// 4 parametri : ptP, vtAx, b3Box, vtMove
Point3d ptP ;
LuaCheckParam( L, 1, ptP)
Vector3d vtAx ;
LuaCheckParam( L, 2, vtAx)
BBox3d b3Box ;
LuaCheckParam( L, 3, b3Box)
Vector3d vtMove ;
LuaCheckParam( L, 4, vtMove)
LuaClearStack( L) ;
// determino il movimento da dare all'utensile per evitare la collisione con il parallelepipedo
double dMove = ExeCAvToolPosBox( ptP, vtAx, b3Box, vtMove) ;
// restituisco il risultato
LuaSetParam( L, dMove) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCAvToolPosStm( lua_State* L)
@@ -176,6 +197,7 @@ LuaInstallCAvTool( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtCAvSetSawTool", LuaCAvSetSawTool) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCAvSetGenTool", LuaCAvSetGenTool) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCAvGetToolOutline", LuaCAvGetToolOutline) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCAvToolPosBox", LuaCAvToolPosBox) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCAvToolPosStm", LuaCAvToolPosStm) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCAvToolPathStm", LuaCAvToolPathStm) ;
return bOk ;
+23
View File
@@ -165,6 +165,28 @@ LuaCDeSpheSolid( lua_State* L)
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaCDeSolidSolid( lua_State* L)
{
// 3 parametri : nSolid1Id, nSolid2Id, dSafeDist
int nSolid1Id ;
LuaCheckParam( L, 1, nSolid1Id)
int nSolid2Id ;
LuaCheckParam( L, 2, nSolid2Id)
double dSafeDist ;
LuaCheckParam( L, 3, dSafeDist)
LuaClearStack( L) ;
// eseguo verifica di collisione
int nRes = ExeCDeSolidSolid( nSolid1Id, nSolid2Id, dSafeDist) ;
// restituisco il risultato
if ( nRes >= 0)
LuaSetParam( L, ( nRes != 0)) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
bool
LuaInstallCDeObjSolid( LuaMgr& luaMgr)
@@ -175,5 +197,6 @@ LuaInstallCDeObjSolid( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtCDeCylSolid", LuaCDeCylSolid) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCDeConeSolid", LuaCDeConeSolid) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCDeSpheSolid", LuaCDeSpheSolid) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCDeSolidSolid", LuaCDeSolidSolid) ;
return bOk ;
}
+60 -16
View File
@@ -169,18 +169,35 @@ LuaImport3MF( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaImport3dm( lua_State* L)
{
// 1 parametro : path del file da importare
string sFilePath ;
LuaCheckParam( L, 1, sFilePath)
LuaClearStack( L) ;
// apro il file
bool bOk = ExeImport3dm( sFilePath) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
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 ;
LuaCheckParam( L, 1, sFilePath)
double dLinToler = 0.1 ;
LuaGetParam( L, 2, dLinToler) ;
int nFlag = 0 ;
LuaGetParam( L, 3, nFlag) ;
LuaClearStack( L) ;
// apro il file
bool bOk = ExeAdvancedImport( sFilePath, dLinToler) ;
bool bOk = ExeAdvancedImport( sFilePath, dLinToler, nFlag) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
@@ -190,16 +207,18 @@ LuaAdvancedImport( lua_State* L)
static int
LuaExportDxf( lua_State* L)
{
// 2 o 3 parametri, GroupId e path del file da esportare [, Flag]
// 2, 3 o 4 parametri : GroupId e path del file da esportare [, Flag] [, Filter]
int nGroupId ;
LuaCheckParam( L, 1, nGroupId)
string sFilePath ;
LuaCheckParam( L, 2, sFilePath)
int nFlag = EEXFLAG_DEFAULT ;
LuaGetParam( L, 3, nFlag) ;
int nFilter = EEXFLT_DEFAULT ;
LuaGetParam( L, 4, nFilter) ;
LuaClearStack( L) ;
// creo il file
bool bOk = ExeExportDxf( nGroupId, sFilePath, nFlag) ;
bool bOk = ExeExportDxf( nGroupId, sFilePath, nFlag, nFilter) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
@@ -209,11 +228,13 @@ LuaExportDxf( lua_State* L)
static int
LuaExportStl( lua_State* L)
{
// 2 parametri, GroupId e path del file da esportare
// 2 parametri : GroupId e path del file da esportare [, Filter]
int nGroupId ;
LuaCheckParam( L, 1, nGroupId)
string sFilePath ;
LuaCheckParam( L, 2, sFilePath)
int nFilter = EEXFLT_DEFAULT ;
LuaGetParam( L, 3, nFilter) ;
LuaClearStack( L) ;
// creo il file
bool bOk = ExeExportStl( nGroupId, sFilePath) ;
@@ -226,14 +247,16 @@ LuaExportStl( lua_State* L)
static int
LuaExport3MF( lua_State* L)
{
// 2 parametri, GroupId e path del file da esportare
// 2 o 3 parametri : GroupId e path del file da esportare [, Filter]
int nGroupId ;
LuaCheckParam( L, 1, nGroupId)
string sFilePath ;
LuaCheckParam( L, 2, sFilePath)
int nFilter = EEXFLT_DEFAULT ;
LuaGetParam( L, 3, nFilter) ;
LuaClearStack( L) ;
// creo il file
bool bOk = ExeExport3MF( nGroupId, sFilePath) ;
bool bOk = ExeExport3MF( nGroupId, sFilePath, nFilter) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
@@ -241,19 +264,19 @@ LuaExport3MF( lua_State* L)
//-------------------------------------------------------------------------------
static int
LuaExportThreeJS( lua_State* L)
LuaExport3dm( lua_State* L)
{
// 2 o 3 parametri, GroupId e path del file da esportare [, Filter]
// 2 o 3 parametri : GroupId e path del file da esportare [, Filter]
int nGroupId ;
LuaCheckParam( L, 1, nGroupId)
string sFilePath ;
LuaCheckParam( L, 2, sFilePath)
int nFilter = EEXFLT_DEFAULT;
LuaGetParam( L, 3, nFilter);
int nFilter = EEXFLT_DEFAULT ;
LuaGetParam( L, 3, nFilter) ;
LuaClearStack( L) ;
// creo il file
bool bOk = ExeExportThreeJS( nGroupId, sFilePath, nFilter) ;
// restituisco il risultato
// creo il file
bool bOk = ExeExport3dm( nGroupId, sFilePath, nFilter) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
@@ -262,7 +285,7 @@ LuaExportThreeJS( lua_State* L)
static int
LuaExportSvg( lua_State* L)
{
// 2 o 3 parametri, GroupId, Path del file da esportare [, Filter]
// 2 o 3 parametri : GroupId, Path del file da esportare [, Filter]
int nGroupId ;
LuaCheckParam( L, 1, nGroupId)
string sFilePath ;
@@ -277,6 +300,25 @@ LuaExportSvg( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaExportThreeJS( lua_State* L)
{
// 2 o 3 parametri : GroupId, Path del file da esportare [, Filter]
int nGroupId ;
LuaCheckParam( L, 1, nGroupId)
string sFilePath ;
LuaCheckParam( L, 2, sFilePath)
int nFilter = EEXFLT_DEFAULT ;
LuaGetParam( L, 3, nFilter) ;
LuaClearStack( L) ;
// creo il file
bool bOk = ExeExportThreeJS( nGroupId, sFilePath, nFilter) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
bool
LuaInstallExchange( LuaMgr& luaMgr)
@@ -291,11 +333,13 @@ LuaInstallExchange( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtImportPnt", LuaImportPnt) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtImportStl", LuaImportStl) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtImport3MF", LuaImport3MF) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtImport3dm", LuaImport3dm) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAdvancedImport", LuaAdvancedImport) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtExportDxf", LuaExportDxf) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtExportStl", LuaExportStl) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtExport3MF", LuaExport3MF) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtExportThreeJS", LuaExportThreeJS) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtExport3dm", LuaExport3dm) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtExportSvg", LuaExportSvg) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtExportThreeJS", LuaExportThreeJS) ;
return bOk ;
}
+172
View File
@@ -344,6 +344,172 @@ LuaCreateAlignedDimension( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateRadialDimension( lua_State* L)
{
// 4 o 5 parametri : nParentId, nCrvId, ptDim, Text [, nRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
int nCrvId ;
LuaCheckParam( L, 2, nCrvId) ;
Point3d ptDim ;
LuaCheckParam( L, 3, ptDim) ;
string sText ;
LuaCheckParam( L, 4, sText) ;
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 5, nRefType) ;
LuaClearStack( L ) ;
// creo la quota allineata
int nId = ExeCreateRadialDimension( nParentId, nCrvId, ptDim, sText, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateDiametralDimension( lua_State* L )
{
// 4 o 5 parametri : nParentId, nCrvId, ptDim, Text [, nRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
int nCrvId ;
LuaCheckParam( L, 2, nCrvId) ;
Point3d ptDim ;
LuaCheckParam( L, 3, ptDim) ;
string sText ;
LuaCheckParam( L, 4, sText) ;
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 5, nRefType) ;
LuaClearStack( L) ;
// creo la quota allineata
int nId = ExeCreateDiametralDimension( nParentId, nCrvId, ptDim, sText, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateAngularDimension(lua_State* L)
{
// 6 o 7 parametri : ParentId, ptV, ptP1, ptP2, ptDim, Text [, nRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
Point3d ptV ;
LuaCheckParam( L, 2, ptV) ;
Point3d ptP1 ;
LuaCheckParam( L, 3, ptP1) ;
Point3d ptP2 ;
LuaCheckParam( L, 4, ptP2) ;
Point3d ptDim ;
LuaCheckParam( L, 5, ptDim) ;
string sText ;
LuaCheckParam( L, 6, sText) ;
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 7, nRefType) ;
LuaClearStack( L) ;
// creo la quota angolare
int nId = ExeCreateAngularDimension( nParentId, ptV, ptP1, ptP2, ptDim, sText, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateAngularDimensionEx(lua_State* L)
{
// 7 o 8 parametri : ParentId, ptV1, ptP1, ptV2, ptP2, ptDim, Text [, nRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
Point3d ptV1 ;
LuaCheckParam( L, 2, ptV1) ;
Point3d ptP1 ;
LuaCheckParam( L, 3, ptP1) ;
Point3d ptV2 ;
LuaCheckParam( L, 4, ptV2) ;
Point3d ptP2 ;
LuaCheckParam( L, 5, ptP2) ;
Point3d ptDim ;
LuaCheckParam( L, 6, ptDim) ;
string sText ;
LuaCheckParam( L, 7, sText) ;
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 8, nRefType) ;
LuaClearStack( L) ;
// creo la quota angolare
int nId = ExeCreateAngularDimensionEx( nParentId, ptV1, ptP1, ptV2, ptP2, ptDim, sText, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateAngularDimensionFromLines( lua_State* L)
{
// 4 o 5 parametri : nParentId, vLineIds, ptDim, Text [, nRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
INTVECTOR vLineIds ;
LuaCheckParam( L, 2, vLineIds) ;
Point3d ptDim ;
LuaCheckParam( L, 3, ptDim) ;
string sText ;
LuaCheckParam( L, 4, sText) ;
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 5, nRefType) ;
LuaClearStack( L ) ;
// creo la quota allineata
int nId = ExeCreateAngularDimensionFromLines( nParentId, vLineIds, ptDim, sText, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L ) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateAngularDimensionFromArc( lua_State* L)
{
// 4 o 5 parametri : nParentId, nCrvId, ptDim, Text [, nRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
int nCrvId ;
LuaCheckParam( L, 2, nCrvId) ;
Point3d ptDim ;
LuaCheckParam( L, 3, ptDim) ;
string sText ;
LuaCheckParam( L, 4, sText) ;
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 5, nRefType) ;
LuaClearStack( L) ;
// creo la quota allineata
int nId = ExeCreateAngularDimensionFromArc( nParentId, nCrvId, ptDim, sText, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
bool
LuaInstallGdbCreate( LuaMgr& luaMgr)
@@ -361,5 +527,11 @@ LuaInstallGdbCreate( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtHorizontalDimension", LuaCreateHorizontalDimension) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVerticalDimension", LuaCreateVerticalDimension) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAlignedDimension", LuaCreateAlignedDimension) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRadialDimension", LuaCreateRadialDimension) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtDiametralDimension", LuaCreateDiametralDimension) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAngularDimension", LuaCreateAngularDimension) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAngularDimensionEx", LuaCreateAngularDimensionEx) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAngularDimensionFromLines", LuaCreateAngularDimensionFromLines) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAngularDimensionFromArc", LuaCreateAngularDimensionFromArc) ;
return bOk ;
}
+56
View File
@@ -425,6 +425,60 @@ LuaCreateArc3P( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateArc2PR( lua_State* L)
{
// 5 o 6 parametri : ParentId, PtStart, PtEnd, dRad, bCCW [, nRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
Point3d ptStart ;
LuaCheckParam( L, 2, ptStart)
Point3d ptEnd ;
LuaCheckParam( L, 3, ptEnd)
double dRad ;
LuaCheckParam( L, 4, dRad)
bool bCCW ;
LuaCheckParam( L, 5, bCCW) ;
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 6, nRefType) ;
LuaClearStack( L) ;
// creo l'arco
int nId = ExeCreateArc2PR( nParentId, ptStart, ptEnd, dRad, bCCW, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateArc2PB( lua_State* L)
{
// 4 o 5 parametri : ParentId, PtStart, PtEnd, dBulge [, nRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
Point3d ptStart ;
LuaCheckParam( L, 2, ptStart)
Point3d ptEnd ;
LuaCheckParam( L, 3, ptEnd)
double dBulge ;
LuaCheckParam( L, 4, dBulge)
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 5, nRefType) ;
LuaClearStack( L) ;
// creo l'arco
int nId = ExeCreateArc2PB( nParentId, ptStart, ptEnd, dBulge, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateArc2PD( lua_State* L)
@@ -1057,6 +1111,8 @@ LuaInstallGdbCreateCurve( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtArcC2P", LuaCreateArcC2P) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtArcC2PEx", LuaCreateArcC2PEx) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtArc3P", LuaCreateArc3P) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtArc2PR", LuaCreateArc2PR) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtArc2PB", LuaCreateArc2PB) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtArc2PD", LuaCreateArc2PD) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtArc2PDEx", LuaCreateArc2PDEx) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtArc2PV", LuaCreateArc2PV) ;
+238 -42
View File
@@ -14,6 +14,7 @@
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "LUA.h"
#include "EXE_Const.h"
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EXeConst.h"
#include "/EgtDev/Include/EGkLuaAux.h"
@@ -22,9 +23,6 @@
using namespace std ;
//-------------------------------------------------------------------------------
static const double LIN_TOL_DEF = 0.05 ;
//-------------------------------------------------------------------------------
static int
LuaCreateSurfFrRectangle( lua_State* L)
@@ -149,7 +147,7 @@ LuaCreateSurfFlatRegion( lua_State* L)
static int
LuaCreateSurfFrFatCurve( lua_State* L)
{
// 4 parametri : ParentId, nCrvId, dRad, bSquared
// 4 o 5 o 6 parametri : ParentId, nCrvId, dRad, bSquared [, bSquaredMids] [, dLinTol]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
int nCrvId ;
@@ -158,9 +156,13 @@ LuaCreateSurfFrFatCurve( lua_State* L)
LuaCheckParam( L, 3, dRad)
bool bSquared ;
LuaCheckParam( L, 4, bSquared)
bool bSquaredMids = bSquared ;
LuaGetParam( L, 5, bSquaredMids) ;
double dLinTol = 10 * EPS_SMALL ;
LuaGetParam( L, 6, dLinTol) ;
LuaClearStack( L) ;
// creo una regione piana
int nId = ExeCreateSurfFrFatCurve( nParentId, nCrvId, dRad, bSquared) ;
int nId = ExeCreateSurfFrFatCurve( nParentId, nCrvId, dRad, bSquared, bSquaredMids, dLinTol) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
@@ -320,7 +322,7 @@ LuaCreateSurfTmCylinder( lua_State* L)
LuaCheckParam( L, 4, dRad)
double dHeight ;
LuaCheckParam( L, 5, dHeight)
double dLinTol = LIN_TOL_DEF ;
double dLinTol = LIN_TOL_SRF ;
int nRefType = RTY_DEFAULT ;
if ( LuaGetParam( L, 6, dLinTol))
LuaGetParam( L, 7, nRefType) ;
@@ -352,7 +354,7 @@ LuaCreateSurfTmCone( lua_State* L)
LuaCheckParam( L, 4, dRad)
double dHeight ;
LuaCheckParam( L, 5, dHeight)
double dLinTol = LIN_TOL_DEF ;
double dLinTol = LIN_TOL_SRF ;
int nRefType = RTY_DEFAULT ;
if ( LuaGetParam( L, 6, dLinTol))
LuaGetParam( L, 7, nRefType) ;
@@ -380,14 +382,14 @@ LuaCreateSurfTmSphere( lua_State* L)
LuaCheckParam( L, 2, ptOrig)
double dRad ;
LuaCheckParam( L, 3, dRad)
double dLinTol = LIN_TOL_DEF ;
double dLinTol = LIN_TOL_SRF ;
int nRefType = RTY_DEFAULT ;
if ( LuaGetParam( L, 4, dLinTol))
LuaGetParam( L, 5, nRefType) ;
else
LuaGetParam( L, 4, nRefType) ;
LuaClearStack( L) ;
// creo STM cilindro
// creo STM sfera
int nId = ExeCreateSurfTmSphere( nParentId, ptOrig, dRad, dLinTol, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
@@ -397,6 +399,58 @@ LuaCreateSurfTmSphere( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateSurfTmTriangle( lua_State* L)
{
// 4 o 5 parametri : ParentId, PtP1, PtP2, PtP3 [, nRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
Point3d PtP1 ;
LuaCheckParam( L, 2, PtP1)
Point3d PtP2 ;
LuaCheckParam( L, 3, PtP2)
Point3d PtP3 ;
LuaCheckParam( L, 4, PtP3)
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 5, nRefType) ;
LuaClearStack( L) ;
// creo STM triangolo
int nId = ExeCreateSurfTmTriangle( nParentId, PtP1, PtP2, PtP3, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateSurfTmRectangle( lua_State* L)
{
// 4 o 5 parametri : ParentId, PtO, PtL, PtT [, nRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
Point3d ptO ;
LuaCheckParam( L, 2, ptO)
Point3d ptL ;
LuaCheckParam( L, 3, ptL)
Point3d ptT ;
LuaCheckParam( L, 4, ptT)
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 5, nRefType) ;
LuaClearStack( L) ;
// creo STM rettangolo
int nId = ExeCreateSurfTmRectangle( nParentId, ptO, ptL, ptT, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateSurfTmByFlatContour( lua_State* L)
@@ -406,7 +460,7 @@ LuaCreateSurfTmByFlatContour( lua_State* L)
LuaCheckParam( L, 1, nParentId)
int nCrvId ;
LuaCheckParam( L, 2, nCrvId)
double dLinTol = LIN_TOL_DEF ;
double dLinTol = LIN_TOL_SRF ;
if ( lua_gettop( L) >= 3)
LuaCheckParam( L, 3, dLinTol) ;
LuaClearStack( L) ;
@@ -429,7 +483,7 @@ LuaCreateSurfTmByRegion( lua_State* L)
LuaCheckParam( L, 1, nParentId)
INTVECTOR vCrvIds ;
LuaCheckParam( L, 2, vCrvIds)
double dLinTol = LIN_TOL_DEF ;
double dLinTol = LIN_TOL_SRF ;
if ( lua_gettop( L) >= 3)
LuaCheckParam( L, 3, dLinTol) ;
LuaClearStack( L) ;
@@ -454,7 +508,7 @@ LuaCreateSurfTmByExtrusion( lua_State* L)
LuaCheckParam( L, 2, vCrvIds)
Vector3d vtExtr ;
LuaCheckParam( L, 3, vtExtr)
double dLinTol = LIN_TOL_DEF ;
double dLinTol = LIN_TOL_SRF ;
int nRefType = RTY_DEFAULT ;
if ( LuaGetParam( L, 4, dLinTol))
LuaGetParam( L, 5, nRefType) ;
@@ -483,7 +537,7 @@ LuaCreateSurfTmByRegionExtrusion( lua_State* L)
LuaCheckParam( L, 2, vCrvIds)
Vector3d vtExtr ;
LuaCheckParam( L, 3, vtExtr)
double dLinTol = LIN_TOL_DEF ;
double dLinTol = LIN_TOL_SRF ;
int nRefType = RTY_DEFAULT ;
if ( LuaGetParam( L, 4, dLinTol))
LuaGetParam( L, 5, nRefType) ;
@@ -515,7 +569,7 @@ LuaCreateSurfTmByRevolve( lua_State* L)
LuaCheckParam( L, 4, vtAx)
bool bCapEnds ;
LuaCheckParam( L, 5, bCapEnds)
double dLinTol = LIN_TOL_DEF ;
double dLinTol = LIN_TOL_SRF ;
int nRefType = RTY_DEFAULT ;
if ( LuaGetParam( L, 6, dLinTol))
LuaGetParam( L, 7, nRefType) ;
@@ -553,7 +607,7 @@ LuaCreateSurfTmByScrewing( lua_State* L)
bool bCapEnds = false ;
if ( LuaGetParam( L, nPar, bCapEnds))
++ nPar ;
double dLinTol = LIN_TOL_DEF ;
double dLinTol = LIN_TOL_SRF ;
if ( LuaGetParam( L, nPar, dLinTol))
++ nPar ;
int nRefType = RTY_DEFAULT ;
@@ -570,9 +624,76 @@ LuaCreateSurfTmByScrewing( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateSurfTmRectSwept( lua_State* L)
{
// 7 o 8 parametri : ParentId, dDimH, dDimV, dBevelH, dBevelV, GuideId, nCapType [, dTol]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
double dDimH ;
LuaCheckParam( L, 2, dDimH)
double dDimV ;
LuaCheckParam( L, 3, dDimV)
double dBevelH ;
LuaCheckParam( L, 4, dBevelH)
double dBevelV ;
LuaCheckParam( L, 5, dBevelV)
int nGuideId ;
LuaCheckParam( L, 6, nGuideId)
int nCapType ;
LuaCheckParam( L, 7, nCapType)
double dLinTol = LIN_TOL_SRF ;
LuaGetParam( L, 8, dLinTol) ;
LuaClearStack( L) ;
// creo STM rectangular swept
int nId = ExeCreateSurfTmRectSwept( nParentId, dDimH, dDimV, dBevelH, dBevelV, nGuideId, nCapType, dLinTol) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
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]
int nParentId ;
@@ -583,12 +704,11 @@ LuaCreateSurfTmSwept( lua_State* L)
LuaCheckParam( L, 3, nGuideId)
bool bCapEnds ;
LuaCheckParam( L, 4, bCapEnds)
double dLinTol = LIN_TOL_DEF ;
if ( lua_gettop( L) >= 5)
LuaCheckParam( L, 5, dLinTol) ;
double dLinTol = LIN_TOL_SRF ;
LuaGetParam( L, 5, dLinTol) ;
LuaClearStack( L) ;
// creo STM swept
int nId = ExeCreateSurfTmSwept( nParentId, nSectId, nGuideId, bCapEnds, dLinTol) ;
// creo STM swept di traslazione
int nId = ExeCreateSurfTmTransSwept( nParentId, nSectId, nGuideId, bCapEnds, dLinTol) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
@@ -609,7 +729,7 @@ LuaCreateSurfTmRuled( lua_State* L)
int nPtOrCrvId2 ;
LuaCheckParam( L, 3, nPtOrCrvId2)
string sType = "IP" ;
double dLinTol = LIN_TOL_DEF ;
double dLinTol = LIN_TOL_SRF ;
if ( LuaGetParam( L, 4, sType))
LuaGetParam( L, 5, dLinTol) ;
else
@@ -676,26 +796,6 @@ LuaCreateSurfTmBySewing( lua_State* L)
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
LuaCreateSurfTmByVolZmap( lua_State* L)
@@ -787,6 +887,96 @@ LuaCreateSurfBezierRational( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateSurfBezierLeaves( 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 = ExeCreateSurfBezierLeaves( 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
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 ;
}
//-------------------------------------------------------------------------------
bool
LuaInstallGdbCreateSurf( LuaMgr& luaMgr)
@@ -806,19 +996,25 @@ LuaInstallGdbCreateSurf( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmCylinder", LuaCreateSurfTmCylinder) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmCone", LuaCreateSurfTmCone) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSphere", LuaCreateSurfTmSphere) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmTriangle", LuaCreateSurfTmTriangle) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmRectangle", LuaCreateSurfTmRectangle) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByFlatContour", LuaCreateSurfTmByFlatContour) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByRegion", LuaCreateSurfTmByRegion) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByExtrusion", LuaCreateSurfTmByExtrusion) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByRegionExtrusion", LuaCreateSurfTmByRegionExtrusion) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByRevolve", LuaCreateSurfTmByRevolve) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByScrewing", LuaCreateSurfTmByScrewing) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmRectSwept", LuaCreateSurfTmRectSwept) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSwept", LuaCreateSurfTmSwept) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmTransSwept", LuaCreateSurfTmTransSwept) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmRuled", LuaCreateSurfTmRuled) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByTriangles", LuaCreateSurfTmByTriangles) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmBySewing", LuaCreateSurfTmBySewing) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmBySurfBezier", LuaCreateSurfTmBySurfBezier) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByVolZmap", LuaCreateSurfTmByVolZmap) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezier", LuaCreateSurfBezier) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierRat", LuaCreateSurfBezierRational) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierLeaves", LuaCreateSurfBezierLeaves) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierTria2D", LuaCreateSurfBezierTria2D) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCreateBezierSphere", LuaCreateBezierSphere) ;
return bOk ;
}
+37
View File
@@ -54,6 +54,42 @@ LuaCreateVolZmapBox( lua_State* L)
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
LuaCreateVolZmapByRegionExtrusion( lua_State* L)
@@ -110,6 +146,7 @@ LuaInstallGdbCreateVol( LuaMgr& luaMgr)
{
bool bOk = ( &luaMgr != nullptr) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapBox", LuaCreateVolZmapBox) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapEmpty", LuaCreateVolZmapEmpty) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapByRegionExtrusion", LuaCreateVolZmapByRegionExtrusion) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapFromSurfTm", LuaCreateVolZmapFromSurfTm) ;
return bOk ;
+20
View File
@@ -432,6 +432,25 @@ LuaArcNormVersor( lua_State* L)
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaCurveCompoLength( lua_State* L)
{
// 2 parametri : Id, nCrv
int nId ;
LuaCheckParam( L, 1, nId)
int nCrv ;
LuaCheckParam( L, 2, nCrv)
LuaClearStack( L) ;
// recupero il centro della curva semplice indicizzata
double dLen ;
if ( ExeCurveCompoLength( nId, nCrv, dLen))
LuaSetParam( L, dLen) ;
else
LuaSetParam( L) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaCurveCompoCenter( lua_State* L)
@@ -538,6 +557,7 @@ LuaInstallGdbGetCurve( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtArcAngCenter", LuaArcAngCenter) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtArcDeltaN", LuaArcDeltaN) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtArcNormVersor", LuaArcNormVersor) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCompoLength", LuaCurveCompoLength) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCompoCenter", LuaCurveCompoCenter) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCompoRadius", LuaCurveCompoRadius) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCompoAngCenter", LuaCurveCompoAngCenter) ;
+90
View File
@@ -0,0 +1,90 @@
//----------------------------------------------------------------------------
// EgalTech 2023-2023
//----------------------------------------------------------------------------
// File : LUA_GdbGetPocketing.cpp Data : 28.11.23 Versione : 2.5k6
// Contenuto : Funzioni di creazione percorsi di svuotatura o infill per LUA.
//
//
//
// Modifiche : 29.11.23 RE Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "LUA.h"
#include "/EgtDev/Include/EXeExecutor.h"
using namespace std ;
//----------------------------------------------------------------------------
static int
LuaPocketing( lua_State* L) {
// 7 parametri : nId, dRad, dStep, dAngle, nType, bSmooth, nDestGrpId
int nId ;
LuaCheckParam( L, 1, nId) ;
double dRad ;
LuaCheckParam( L, 2, dRad) ;
double dStep ;
LuaCheckParam( L, 3, dStep) ;
double dAngle ;
LuaCheckParam( L, 4, dAngle) ;
int nType ;
LuaCheckParam( L, 5, nType) ;
bool bSmooth ;
LuaCheckParam( L, 6, bSmooth) ;
int nDestGrpId ;
LuaCheckParam( L, 7, nDestGrpId) ;
LuaClearStack( L) ;
// calcolo delle curve elementari di svuotatura
int nFirstId = GDB_ID_NULL ;
int nCrvCount = 0 ;
bool bOk = ExePocketing( nId, dRad, dStep, dAngle, nType, bSmooth, nDestGrpId, nFirstId, nCrvCount) ;
if ( ! bOk)
LuaSetParam( L) ;
else
LuaSetParam( L, nFirstId) ;
LuaSetParam( L, nCrvCount) ;
return 2 ;
}
//----------------------------------------------------------------------------
static int
LuaSurfFrGetZigZagInfill( lua_State* L)
{
// 6 parametri : nId, nDestGrpId, dSideStep, dAng, bSmooth, bRemoveOverlapLink
int nId ;
LuaCheckParam( L, 1, nId)
int nDestGrpId ;
LuaCheckParam( L, 2, nDestGrpId)
double dStep ;
LuaCheckParam( L, 3, dStep)
double dAng ;
LuaCheckParam( L, 4, dAng) ;
bool bSmooth ;
LuaCheckParam( L, 5, bSmooth) ;
bool bRemoveOverlapLink ;
LuaCheckParam( L, 6, bRemoveOverlapLink) ;
LuaClearStack( L) ;
// recupero i contorni della superficie
int nCount = 0 ;
int nNewId = ExeSurfFrGetZigZagInfill( nId, nDestGrpId, dStep, dAng, bSmooth, bRemoveOverlapLink, &nCount) ;
// restituisco il risultato
if ( nNewId != GDB_ID_NULL)
LuaSetParam( L, nNewId) ;
else
LuaSetParam( L) ;
LuaSetParam( L, nCount) ;
return 2 ;
}
//-------------------------------------------------------------------------------
bool
LuaInstallGdbGetPocketing( LuaMgr& luaMgr)
{
bool bOk = ( &luaMgr != nullptr) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtPocketing", LuaPocketing) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetSurfFrZigZagInfill", LuaSurfFrGetZigZagInfill) ;
return bOk ;
}
+202 -27
View File
@@ -40,6 +40,20 @@ LuaSurfArea( lua_State* L)
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaSurfIsClosed( lua_State* L)
{
// 1 parametro : Id
int nId ;
LuaCheckParam( L, 1, nId)
LuaClearStack( L) ;
// verifico se è superficie chiusa
bool bOk = ExeSurfIsClosed( nId) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaSurfVolume( lua_State* L)
@@ -223,35 +237,18 @@ LuaSurfFrRotateSimpleNoCollision( lua_State* L)
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaSurfFrGetZigZagInfill( lua_State* L)
LuaSurfTmVertexCount( lua_State* L)
{
// 6 parametri : nId, nDestGrpId, dSideStep, dAng, bAllowStepCorrection, bInvert
// 1 parametro : Id
int nId ;
LuaCheckParam( L, 1, nId)
int nDestGrpId ;
LuaCheckParam( L, 2, nDestGrpId)
double dStep ;
LuaCheckParam( L, 3, dStep)
double dAng ;
LuaCheckParam( L, 4, dAng) ;
bool bStepCorrection ;
LuaCheckParam( L, 5, bStepCorrection)
bool bInvert ;
LuaCheckParam( L, 6, bInvert)
LuaClearStack( L) ;
// recupero i contorni della superficie
int nCount = 0 ;
int nNewId = ExeSurfFrGetZigZagInfill( nId, nDestGrpId, dStep, dAng, bStepCorrection, bInvert, &nCount) ;
// restituisco il risultato
if ( nNewId != GDB_ID_NULL)
LuaSetParam( L, nNewId) ;
else
LuaSetParam( L) ;
LuaSetParam( L, nCount) ;
return 2 ;
// recupero il numero di vertici della superficie trimesh
int nNbr = ExeSurfTmVertexCount( nId) ;
LuaSetParam( L, nNbr) ;
return 1 ;
}
//----------------------------------------------------------------------------
@@ -268,6 +265,72 @@ LuaSurfTmFacetCount( lua_State* L)
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaSurfTmPartCount( lua_State* L)
{
// 1 parametro : Id
int nId ;
LuaCheckParam( L, 1, nId)
LuaClearStack( L) ;
// recupero il numero di parti della superficie trimesh
int nParts = ExeSurfTmPartCount( nId) ;
if ( nParts >= 0)
LuaSetParam( L, nParts) ;
else
LuaSetParam( L) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaSurfTmGetVertex( lua_State* L)
{
// 2 o 3 parametri : Id, nVert, [, nRefId]
int nId ;
LuaCheckParam( L, 1, nId)
int nVert ;
LuaCheckParam( L, 2, nVert)
int nRefId = nId ;
LuaGetParam( L, 3, nRefId) ;
LuaClearStack( L) ;
// recupero il vertice di indice dato (0-based)
Point3d ptVert ;
bool bOk = ExeSurfTmGetVertex( nId, nVert, nRefId, ptVert) ;
if ( bOk)
LuaSetParam( L, ptVert) ;
else
LuaSetParam( L) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaSurfTmGetNearestVertex( lua_State* L)
{
// 2 o 3 parametri : Id, ptNear [, nRefId]
int nId ;
LuaCheckParam( L, 1, nId)
Point3d ptNear ;
LuaCheckParam( L, 2, ptNear)
int nRefId = nId ;
LuaGetParam( L, 3, nRefId) ;
LuaClearStack( L) ;
// recupero il vertice più vicino della superficie
int nVert ;
Point3d ptVert ;
bool bOk = ExeSurfTmGetNearestVertex( nId, ptNear, nRefId, nVert, ptVert) ;
if ( bOk) {
LuaSetParam( L, nVert) ;
LuaSetParam( L, ptVert) ;
}
else {
LuaSetParam( L) ;
LuaSetParam( L) ;
}
return 2 ;
}
//----------------------------------------------------------------------------
static int
LuaSurfTmFacetFromTria( lua_State* L)
@@ -288,6 +351,27 @@ LuaSurfTmFacetFromTria( lua_State* L)
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaSurfTmGetAllVertInFacet( lua_State* L)
{
// 2 parametri : nId, nFacet
int nId ;
LuaCheckParam( L, 1, nId)
int nFacet ;
LuaCheckParam( L, 2, nFacet)
LuaClearStack( L) ;
// recupero l'elenco dei vertici nella faccia
INTVECTOR vVert ;
bool bOk = ExeSurfTmGetAllVertInFacet( nId, nFacet, vVert) ;
// restituisco il risultato
if ( bOk)
LuaSetParam( L, vVert) ;
else
LuaSetParam( L) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaSurfTmGetFacetBBox( lua_State* L)
@@ -510,6 +594,58 @@ LuaSurfTmFacetMinAreaRectangle( lua_State* L)
}
}
//----------------------------------------------------------------------------
static int
LuaSurfTmFacetElevationInBBox( lua_State* L)
{
// 3 o 4 o 5 parametri : Id, nFacet, b3Box [, bAcceptOutFacet] [, nRefId]
int nId ;
LuaCheckParam( L, 1, nId)
int nFacet ;
LuaCheckParam( L, 2, nFacet)
BBox3d b3Box ;
LuaCheckParam( L, 3, b3Box)
bool bAcceptOutFacet = false ;
int nRefId = nId ;
if ( ! LuaGetParam( L, 4, nRefId)) {
LuaGetParam( L, 4, bAcceptOutFacet) ;
LuaGetParam( L, 5, nRefId) ;
}
LuaClearStack( L) ;
// calcolo elevazione
double dElev ;
bool bOk = ExeSurfTmFacetElevationInBBox( nId, nFacet, b3Box, bAcceptOutFacet, nRefId, dElev) ;
if ( bOk)
LuaSetParam( L, dElev) ;
else
LuaSetParam( L) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaSurfTmFacetElevationInClosedSurfTm( lua_State* L)
{
// 3 o 4 parametri : nFacetStmId, nFacet, nClosedStmId [, bAcceptOutFacet]
int nFacetStmId ;
LuaCheckParam( L, 1, nFacetStmId)
int nFacet ;
LuaCheckParam( L, 2, nFacet)
int nClosedStmId ;
LuaCheckParam( L, 3, nClosedStmId)
bool bAcceptOutFacet = false ;
LuaGetParam( L, 4, bAcceptOutFacet) ;
LuaClearStack( L) ;
// calcolo elevazione
double dElev ;
bool bOk = ExeSurfTmFacetElevationInClosedSurfTm( nFacetStmId, nFacet, nClosedStmId, bAcceptOutFacet, dElev) ;
if ( bOk)
LuaSetParam( L, dElev) ;
else
LuaSetParam( L) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaSurfTmFacetOppositeSide( lua_State* L)
@@ -608,7 +744,7 @@ LuaExtractSurfTmLoops( lua_State* L)
static int
LuaGetSurfTmSilhouette( lua_State* L)
{
// 4 o 5 parametri : nId, vtDir, dToler, nDestGrpId [, nRefType]
// 4 o 5 o 6 parametri : nId, vtDir, dToler, nDestGrpId [, nRefType [, bAllTria]]
int nId ;
LuaCheckParam( L, 1, nId)
Vector3d vtDir ;
@@ -618,11 +754,15 @@ LuaGetSurfTmSilhouette( lua_State* L)
int nDestGrpId ;
LuaCheckParam( L, 4, nDestGrpId)
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 5, nRefType) ;
bool bAllTria = false ;
if ( LuaGetParam( L, 5, nRefType))
LuaGetParam( L, 6, bAllTria) ;
else
LuaGetParam( L, 5, bAllTria) ;
LuaClearStack( L) ;
// recupero i contorni della superficie
int nCount = 0 ;
int nNewId = ExeGetSurfTmSilhouette( nId, vtDir, dToler, nDestGrpId, nRefType, &nCount) ;
int nNewId = ExeGetSurfTmSilhouette( nId, vtDir, dToler, nDestGrpId, nRefType, &nCount, bAllTria) ;
// restituisco il risultato
if ( nNewId != GDB_ID_NULL)
LuaSetParam( L, nNewId) ;
@@ -678,6 +818,33 @@ LuaCopySurfTmFacet( lua_State* L)
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaSurfTmGetEdges( lua_State* L)
{
// 2 o 3 parametri : nId, nDestGrpId [, bSmoothAng]
int nId ;
LuaCheckParam( L, 1, nId)
int nDestGrpId ;
LuaCheckParam( L, 2, nDestGrpId)
bool bSmoothAng = true ;
LuaGetParam( L, 3, bSmoothAng) ;
LuaClearStack( L) ;
// calcolo gli spigoli della superficie
int nCount ;
int nFirstId = ExeSurfTmGetEdges( nId, nDestGrpId, bSmoothAng, &nCount) ;
// restituisco il risultato
if ( nFirstId != GDB_ID_NULL || nCount != -1) {
LuaSetParam( L, nFirstId) ;
LuaSetParam( L, nCount) ;
}
else {
LuaSetParam( L) ;
LuaSetParam( L) ;
}
return 2 ;
}
//----------------------------------------------------------------------------
static int
LuaSurfBezierGetPoint( lua_State* L)
@@ -919,6 +1086,7 @@ LuaInstallGdbGetSurf( LuaMgr& luaMgr)
{
bool bOk = ( &luaMgr != nullptr) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfArea", LuaSurfArea) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfIsClosed", LuaSurfIsClosed) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfVolume", LuaSurfVolume) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrNormVersor", LuaSurfFrNormVersor) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrGrossArea", LuaSurfFrGrossArea) ;
@@ -928,9 +1096,13 @@ LuaInstallGdbGetSurf( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtExtractSurfFrChunkLoops", LuaExtractSurfFrChunkLoops) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrMoveSimpleNoCollision", LuaSurfFrMoveSimpleNoCollision) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrRotateSimpleNoCollision", LuaSurfFrRotateSimpleNoCollision) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetSurfFrZigZagInfill", LuaSurfFrGetZigZagInfill) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmVertexCount", LuaSurfTmVertexCount) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetCount", LuaSurfTmFacetCount) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmPartCount", LuaSurfTmPartCount) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetVertex", LuaSurfTmGetVertex) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetNearestVertex", LuaSurfTmGetNearestVertex) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetFromTria", LuaSurfTmFacetFromTria) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetAllVertInFacet", LuaSurfTmGetAllVertInFacet) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetFacetBBox", LuaSurfTmGetFacetBBox) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetFacetBBoxGlob", LuaSurfTmGetFacetBBoxGlob) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetFacetBBoxRef", LuaSurfTmGetFacetBBoxRef) ;
@@ -940,12 +1112,15 @@ LuaInstallGdbGetSurf( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetCenter", LuaSurfTmFacetCenter) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetNormVersor", LuaSurfTmFacetNormVersor) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetMinAreaRectangle", LuaSurfTmFacetMinAreaRectangle) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetElevationInBBox", LuaSurfTmFacetElevationInBBox) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetElevationInClosedSurfTm", LuaSurfTmFacetElevationInClosedSurfTm) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetOppositeSide", LuaSurfTmFacetOppositeSide) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetsContact", LuaSurfTmFacetsContact) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtExtractSurfTmLoops", LuaExtractSurfTmLoops) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetSurfTmSilhouette", LuaGetSurfTmSilhouette) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtExtractSurfTmFacetLoops", LuaExtractSurfTmFacetLoops) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCopySurfTmFacet", LuaCopySurfTmFacet) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetEdges", LuaSurfTmGetEdges) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierGetPoint", LuaSurfBezierGetPoint) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierGetPointD1", LuaSurfBezierGetPointD1) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierGetPointNrmD1", LuaSurfBezierGetPointNrmD1) ;
+2 -1
View File
@@ -211,6 +211,7 @@ LuaVolZmapGetDepth( lua_State* L)
}
return 2 ;
}
//----------------------------------------------------------------------------
static int
LuaVolZmapGetEdges( lua_State* L)
@@ -221,7 +222,7 @@ LuaVolZmapGetEdges( lua_State* L)
int nDestGrpId ;
LuaCheckParam( L, 2, nDestGrpId)
LuaClearStack( L) ;
// eseguo calcolo profondità dal punto lungo la direzione
// calcolo gli spigoli del solido
int nCount ;
int nFirstId = ExeVolZmapGetEdges( nId, nDestGrpId, &nCount) ;
// restituisco il risultato
+179 -5
View File
@@ -19,6 +19,7 @@
#include "/EgtDev/Include/EXeConst.h"
#include "/EgtDev/Include/EGkCurve.h"
#include "/EgtDev/Include/EGkLuaAux.h"
#include "/EgtDev/Include/EGkCalcPocketing.h"
using namespace std ;
@@ -59,17 +60,19 @@ LuaOffsetCurve( lua_State* L)
static int
LuaOffsetCurveAdv( lua_State* L)
{
// 2 o 3 parametri : Id, dDist [, nType]
// 2 o 3 o 4 parametri : Id, dDist [, nType] [, dLinTol]
int nId ;
LuaCheckParam( L, 1, nId)
double dDist ;
LuaCheckParam( L, 2, dDist)
int nType = ICurve::OFF_FILLET ;
LuaGetParam( L, 3, nType) ;
double dLinTol = 10 * EPS_SMALL ;
LuaGetParam( L, 4, dLinTol) ;
LuaClearStack( L) ;
// offset della curva
int nCount ;
int nNewId = ExeOffsetCurveAdv( nId, dDist, nType, &nCount) ;
int nNewId = ExeOffsetCurveAdv( nId, dDist, nType, &nCount, dLinTol) ;
if ( nCount >= 0) {
LuaSetParam( L, nNewId) ;
LuaSetParam( L, nCount) ;
@@ -102,16 +105,18 @@ LuaCurveMedialAxis( lua_State* L)
static int
LuaApproxCurve( lua_State* L)
{
// 2 o 3 parametri : Id, nApprType [, dLinTol]
// 2 o 3 o 4 parametri : Id, nApprType [, dLinTol [, dMaxSegmLen]]
int nId ;
LuaCheckParam( L, 1, nId)
int nApprType ;
LuaCheckParam( L, 2, nApprType)
double dLinTol = 0.01 ;
LuaGetParam( L, 3, dLinTol) ;
double dMaxSegmLen = INFINITO ;
if ( LuaGetParam( L, 3, dLinTol))
LuaGetParam( L, 4, dMaxSegmLen) ;
LuaClearStack( L) ;
// approssimazione della curva con rette
bool bOk = ExeApproxCurve( nId, nApprType, dLinTol) ;
bool bOk = ExeApproxCurve( nId, nApprType, dLinTol, dMaxSegmLen) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
@@ -206,6 +211,40 @@ LuaModifyCurveEndPoint( lua_State* L)
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaSpiralizeCurveAlongExtrusion( lua_State* L)
{
// 2 parametri : Id, Delta
int nId ;
LuaCheckParam( L, 1, nId)
double dDelta ;
LuaCheckParam( L, 2, dDelta)
LuaClearStack( L) ;
// modifico la curva
bool bOk = ExeSpiralizeCurveAlongExtrusion( nId, dDelta) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaSpiralizeCurveAlongGuide( lua_State* L)
{
// 2 o 3 parametri : Id, IdGuide, dTol
int nId ;
LuaCheckParam( L, 1, nId)
int nGuideId ;
LuaCheckParam( L, 2, nGuideId)
double dTol = 10 * EPS_SMALL ;
LuaGetParam( L, 3, dTol) ;
LuaClearStack( L) ;
// modifico la curva
bool bOk = ExeSpiralizeCurveAlongGuide( nId, nGuideId, dTol) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaModifyCurveExtrusion( lua_State* L)
@@ -910,6 +949,134 @@ LuaReorderCurvesInGroup( lua_State* L)
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaProjectCurveOnSurfTm( lua_State* L)
{
// 4, 5, 6 o 7 parametri : nCurveId, nSurfTmId, vtDir, nDestGrpId [, dLinTol [, dMaxSegmLen] [, nRefType]]
int nCurveId ;
LuaCheckParam( L, 1, nCurveId)
int nSurfTmId ;
LuaCheckParam( L, 2, nSurfTmId)
Vector3d vtDir ;
LuaCheckParam( L, 3, vtDir)
int nDestGrpId ;
LuaCheckParam( L, 4, nDestGrpId)
double dLinTol = 0.01 ;
double dMaxSegmLen = INFINITO ;
int nRefType = RTY_DEFAULT ;
if ( LuaGetParam( L, 5, dLinTol) &&
LuaGetParam( L, 6, dMaxSegmLen))
LuaGetParam( L, 7, nRefType) ;
LuaClearStack( L) ;
// proietto la curva su una trimesh secondo la direzione data
bool bOk = ExeProjectCurveOnSurfTm( nCurveId, nSurfTmId, vtDir, nDestGrpId, dLinTol, dMaxSegmLen, nRefType) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaProjectCurveOnSurfTmExt( 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 trimesh secondo la direzione data
bool bOk = ExeProjectCurveOnSurfTmExt( nCurveId, nSurfTmId, nGuideId, nDestGrpId, dLinTol, dMaxSegmLen, bDirFromGuide) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaCurveGetVoronoi( lua_State* L)
{
// 2 o 3 parametri : Id, nDestGrpId [, nBound]
int nId ;
LuaCheckParam( L, 1, nId)
int nDestGrpId ;
LuaCheckParam( L, 2, nDestGrpId)
int nBound = 3 ; // VORONOI_STD_BOUND
LuaGetParam( L, 3, nBound) ;
LuaClearStack( L) ;
// eseguo
int nCount = 0 ;
int nNewId = ExeCurveGetVoronoi( nId, nDestGrpId, nBound, &nCount) ;
if ( nNewId != GDB_ID_NULL)
LuaSetParam( L, nNewId) ;
else
LuaSetParam( L) ;
LuaSetParam( L, nCount) ;
return 2 ;
}
//----------------------------------------------------------------------------
static int
LuaCurveMedialAxisAdv( lua_State* L)
{
// 2 o 3 parametri : Id, nDestGrpId [, nSide]
int nId ;
LuaCheckParam( L, 1, nId)
int nDestGrpId ;
LuaCheckParam( L, 2, nDestGrpId)
int nSide = 1 ; // WMAT_LEFT
LuaGetParam( L, 3, nSide) ;
LuaClearStack( L) ;
// eseguo
int nCount = 0 ;
int nNewId = ExeCurveGetMedialAxis( nId, nDestGrpId, nSide, &nCount) ;
if ( nNewId != GDB_ID_NULL)
LuaSetParam( L, nNewId) ;
else
LuaSetParam( L) ;
LuaSetParam( L, nCount) ;
return 2 ;
}
//----------------------------------------------------------------------------
static int
LuaCurveGetFatCurve( lua_State* L)
{
// 4 o 5 parametri : Id, nDestGrpId, dRad, bSquare [, bSquareMids]
int nId ;
LuaCheckParam( L, 1, nId)
int nDestGrpId ;
LuaCheckParam( L, 2, nDestGrpId)
double dRad ;
LuaCheckParam( L, 3, dRad)
bool bSquareEnds ;
LuaCheckParam( L, 4, bSquareEnds)
bool bSquareMids = bSquareEnds ;
LuaGetParam( L, 5, bSquareMids) ;
LuaClearStack( L) ;
// eseguo
int nCount = 0 ;
int nNewId = ExeCurveGetFatCurve( nId, nDestGrpId, dRad, bSquareEnds, bSquareMids, &nCount) ;
if ( nNewId != GDB_ID_NULL)
LuaSetParam( L, nNewId) ;
else
LuaSetParam( L) ;
LuaSetParam( L, nCount) ;
return 2 ;
}
//-------------------------------------------------------------------------------
bool
LuaInstallGdbModifyCurve( LuaMgr& luaMgr)
@@ -925,6 +1092,8 @@ LuaInstallGdbModifyCurve( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtChangeClosedCurveStartPoint", LuaChangeClosedCurveStartPoint) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtModifyCurveStartPoint", LuaModifyCurveStartPoint) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtModifyCurveEndPoint", LuaModifyCurveEndPoint) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSpiralizeCurveAlongExtrusion", LuaSpiralizeCurveAlongExtrusion) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSpiralizeCurveAlongGuide", LuaSpiralizeCurveAlongGuide) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtModifyCurveExtrusion", LuaModifyCurveExtrusion) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtModifyCurveThickness", LuaModifyCurveThickness) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtTrimCurveStartAtLen", LuaTrimCurveStartAtLen) ;
@@ -963,5 +1132,10 @@ LuaInstallGdbModifyCurve( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtRemoveCurveCompoUndercutOnY", LuaRemoveCurveCompoUndercutOnY) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtChainCurvesInGroup", LuaChainCurvesInGroup) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtReorderCurvesInGroup", LuaReorderCurvesInGroup) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtProjectCurveOnSurfTm", LuaProjectCurveOnSurfTm) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtProjectCurveOnSurfTmExt", LuaProjectCurveOnSurfTmExt) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveGetVoronoi", LuaCurveGetVoronoi) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveMedialAxisAdv", LuaCurveMedialAxisAdv) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveGetFatCurve", LuaCurveGetFatCurve) ;
return bOk ;
}
+224 -16
View File
@@ -14,6 +14,7 @@
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "LUA.h"
#include "EXE_Const.h"
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EXeConst.h"
#include "/EgtDev/Include/EGkCurve.h"
@@ -22,7 +23,6 @@
using namespace std ;
//----------------------------------------------------------------------------
static int
LuaInvertSurf( lua_State* L)
@@ -57,6 +57,25 @@ LuaExplodeSurf( lua_State* L)
return 2 ;
}
//-------------------------------------------------------------------------------
static int
LuaApproxSurf( lua_State* L)
{
// 1 o 2 parametri : Id [, dLinTol [, dTriaMinSide]]
int nId ;
LuaCheckParam( L, 1, nId)
double dLinTol = LIN_TOL_SRF ;
double dTriaMinSide = 100 * EPS_SMALL ;
if ( LuaGetParam( L, 2, dLinTol))
LuaGetParam( L, 3, dTriaMinSide) ;
LuaClearStack( L) ;
// approssimazione della superficie
bool bOk = ExeApproxSurface( nId, dLinTol, dTriaMinSide) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaSurfFrAdd( lua_State* L)
@@ -123,6 +142,96 @@ LuaSurfFrOffset( lua_State* L)
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
LuaSurfTmMoveVertex( lua_State* L)
{
// 3 o 4 o 5 parametri : nId, nVert, ptNewVert [, nRefId] [, bUpdate]
int nId ;
LuaCheckParam( L, 1, nId)
int nVert ;
LuaCheckParam( L, 2, nVert)
Point3d ptNewVert ;
LuaCheckParam( L, 3, ptNewVert)
int nRefType = RTY_DEFAULT ;
bool bUpdate = true ;
if ( LuaGetParam( L, 4, nRefType))
LuaGetParam( L, 5, bUpdate) ;
else
LuaGetParam( L, 4, bUpdate) ;
LuaClearStack( L) ;
// sposto il vertice di indice dato della trimesh
bool bOk = ExeSurfTmMoveVertex( nId, nVert, ptNewVert, nRefType, bUpdate) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaSurfTmMoveFacet( lua_State* L)
{
// 3 o 4 o 5 parametri : nId, nFacet, vtMove [, nRefId] [, bUpdate]
int nId ;
LuaCheckParam( L, 1, nId)
int nFacet ;
LuaCheckParam( L, 2, nFacet)
Vector3d vtMove ;
LuaCheckParam( L, 3, vtMove)
int nRefType = RTY_DEFAULT ;
bool bUpdate = true ;
if ( LuaGetParam( L, 4, nRefType))
LuaGetParam( L, 5, bUpdate) ;
else
LuaGetParam( L, 4, bUpdate) ;
LuaClearStack( L) ;
// sposto la faccia di indice dato della trimesh
bool bOk = ExeSurfTmMoveFacet( nId, nFacet, vtMove, nRefType, bUpdate) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaSurfTmToTriangles( lua_State* L)
{
// 1 parametro : nId
int nId ;
LuaCheckParam( L, 1, nId)
LuaClearStack( L) ;
// esplosione della trimesh in triangoli
int nCount ;
int nFirstId = ExeSurfTmToTriangles( nId, &nCount) ;
if ( nFirstId != GDB_ID_NULL)
LuaSetParam( L, nFirstId) ;
else
LuaSetParam( L) ;
LuaSetParam( L, nCount) ;
return 2 ;
}
//----------------------------------------------------------------------------
static int
LuaSurfTmRemoveFacet( lua_State* L)
@@ -199,6 +308,29 @@ LuaCutSurfTmPlane( lua_State* L)
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
LuaCutSurfTmClosedCurve( lua_State* L)
@@ -272,20 +404,6 @@ LuaSurfTmIntersect( lua_State* 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
LuaSurfTmSplit( lua_State* L)
@@ -327,6 +445,87 @@ LuaSurfTmCut( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaSurfTmSubtractProjectedFacesOnFace( lua_State* L)
{
// 3 o 4 o 5 parametri : nSurfId, nFaceInd, nDestGrpId [, vSurfsId] [, bOCFlag]
int nSurfId ;
LuaCheckParam( L, 1, nSurfId) ;
int nFaceInd ;
LuaCheckParam( L, 2, nFaceInd) ;
int nDestGrpId ;
LuaCheckParam( L, 3, nDestGrpId) ;
INTVECTOR vSurfsId ;
bool bOCFlag = true ;
if ( LuaGetParam( L, 4, vSurfsId))
LuaGetParam( L, 5, bOCFlag) ;
else
LuaGetParam( L, 4, bOCFlag) ;
LuaClearStack( L) ;
// sottraggo alla faccia scelta la proiezione delle altre TriMesh
int nNewId = GDB_ID_NULL;
bool bExistProjection = false ;
int nNewFaceNbr = 0 ;
bool bOk = ExeSurfTmSubtractProjectedFacesOnFace( nSurfId, nFaceInd, nDestGrpId, vSurfsId,
bOCFlag, bExistProjection, nNewId, nNewFaceNbr) ;
LuaSetParam( L, bOk) ;
LuaSetParam( L, bExistProjection) ;
if ( nNewId != GDB_ID_NULL)
LuaSetParam( L, nNewId) ;
else
LuaSetParam( L) ;
LuaSetParam( L, nNewFaceNbr) ;
return 4 ;
}
//-------------------------------------------------------------------------------
static int
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
LuaSurfBzTrim( lua_State* L)
{
// 2 parametri : nId, nCutterId
int nId ;
LuaCheckParam( L, 1, nId)
int nCutterId ;
LuaCheckParam( L, 2, nCutterId)
LuaClearStack( L) ;
// taglio la prima superficie in base alla seconda
bool bOk = ExeSurfBzTrim( nId, nCutterId) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
bool
LuaInstallGdbModifySurf( LuaMgr& luaMgr)
@@ -334,20 +533,29 @@ LuaInstallGdbModifySurf( LuaMgr& luaMgr)
bool bOk = ( &luaMgr != nullptr) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtInvertSurf", LuaInvertSurf) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtExplodeSurf", LuaExplodeSurf) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtApproxSurf", LuaApproxSurf) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrAdd", LuaSurfFrAdd) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrSubtract", LuaSurfFrSubtract) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrIntersect", LuaSurfFrIntersect) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrOffset", LuaSurfFrOffset) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrOffsetAdv", LuaSurfFrOffsetAdv) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmMoveVertex", LuaSurfTmMoveVertex) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmMoveFacet", LuaSurfTmMoveFacet) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmToTriangles", LuaSurfTmToTriangles) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmRemoveFacet", LuaSurfTmRemoveFacet) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSwapFacets", LuaSurfTmSwapFacets) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmRemovePart", LuaSurfTmRemovePart) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCutSurfTmPlane", LuaCutSurfTmPlane) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCutSurfBzPlane", LuaCutSurfBzPlane) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCutSurfTmClosedCurve", LuaCutSurfTmClosedCurve) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmAdd", LuaSurfTmAdd) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSubtract", LuaSurfTmSubtract) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmIntersect", LuaSurfTmIntersect) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmResetTwoColors", LuaSurfTmResetTwoColors) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSplit", LuaSurfTmSplit) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmCut", LuaSurfTmCut) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSubtractProjectedFacesOnFace", LuaSurfTmSubtractProjectedFacesOnFace) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmResetTwoColors", LuaSurfTmResetTwoColors) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSetShowEdges", LuaSurfTmSetShowEdges) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBzTrim", LuaSurfBzTrim) ;
return bOk ;
}
+55 -11
View File
@@ -56,6 +56,23 @@ LuaVolZmapChangeResolution( lua_State* L)
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
LuaRemoveVolZmapPart( lua_State* L)
@@ -94,7 +111,7 @@ LuaVolZmapSetStdTool( lua_State* L)
LuaGetParam( L, 7, nFlag) ;
LuaClearStack( L) ;
// imposto utensile standard a Zmap indicati
bool bOk = ExeVolZmapSetStdTool( vIds, sToolName, dLen, dDiam, dCornR, dCutterH, nFlag) ;
bool bOk = ExeVolZmapSetStdTool( vIds, sToolName, dLen, dDiam, dCornR, dCutterH, nFlag, true) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
@@ -125,7 +142,7 @@ LuaVolZmapSetAdvTool( lua_State* L)
LuaGetParam( L, 9, nFlag) ;
LuaClearStack( L) ;
// imposto utensile avanzato a Zmap indicati
bool bOk = ExeVolZmapSetAdvTool( vIds, sToolName, dLen, dDiam, dTipLen, dTipDiam, dCornR, dCutterH, nFlag) ;
bool bOk = ExeVolZmapSetAdvTool( vIds, sToolName, dLen, dDiam, dTipLen, dTipDiam, dCornR, dCutterH, nFlag, true) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
@@ -135,7 +152,7 @@ LuaVolZmapSetAdvTool( lua_State* L)
static int
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 ;
LuaCheckParam( L, 1, vIds)
string sToolName ;
@@ -154,7 +171,7 @@ LuaVolZmapSetSawTool( lua_State* L)
LuaGetParam( L, 8, nFlag) ;
LuaClearStack( L) ;
// imposto utensile avanzato a Zmap indicati
bool bOk = ExeVolZmapSetSawTool( vIds, sToolName, dLen, dDiam, dThick, dStemDiam, dCornR, nFlag) ;
bool bOk = ExeVolZmapSetSawTool( vIds, sToolName, dLen, dDiam, dThick, dStemDiam, dCornR, nFlag, true) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
@@ -164,7 +181,7 @@ LuaVolZmapSetSawTool( lua_State* L)
static int
LuaVolZmapSetGenTool( lua_State* L)
{
// 3 o 4 parametri : vIds, sToolName, ToolSectId, nFlag
// 3 o 4 parametri : vIds, sToolName, ToolSectId [, nFlag]
INTVECTOR vIds ;
LuaCheckParam( L, 1, vIds)
string sToolName ;
@@ -175,7 +192,7 @@ LuaVolZmapSetGenTool( lua_State* L)
LuaGetParam( L, 4, nFlag) ;
LuaClearStack( L) ;
// imposto utensile generico a Zmap indicati
bool bOk = ExeVolZmapSetGenTool( vIds, sToolName, nToolSectId, nFlag) ;
bool bOk = ExeVolZmapSetGenTool( vIds, sToolName, nToolSectId, nFlag, true) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
@@ -185,7 +202,7 @@ LuaVolZmapSetGenTool( lua_State* L)
static int
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 ;
LuaCheckParam( L, 1, vIds)
string sToolName ;
@@ -202,7 +219,7 @@ LuaVolZmapSetMortiserTool( lua_State* L)
LuaGetParam( L, 7, nFlag) ;
LuaClearStack( L) ;
// imposto mortasatrice a Zmap indicati
bool bOk = ExeVolZmapSetMortiserTool( vIds, sToolName, dLen, dWidth, dThick, dCornR, nFlag) ;
bool bOk = ExeVolZmapSetMortiserTool( vIds, sToolName, dLen, dWidth, dThick, dCornR, nFlag, true) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
@@ -212,7 +229,7 @@ LuaVolZmapSetMortiserTool( lua_State* L)
static int
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 ;
LuaCheckParam( L, 1, vIds)
string sToolName ;
@@ -227,7 +244,32 @@ LuaVolZmapSetChiselTool( lua_State* L)
LuaGetParam( L, 6, nFlag) ;
LuaClearStack( L) ;
// imposto scalpello a Zmap indicati
bool bOk = ExeVolZmapSetChiselTool( vIds, sToolName, dLen, dWidth, dThick, nFlag) ;
bool bOk = ExeVolZmapSetChiselTool( vIds, sToolName, dLen, dWidth, dThick, nFlag, true) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaVolZmapSetAdditiveTool( lua_State* L)
{
// 5 o 6 parametri : vIds, sToolName, dLen, dDiam, dCornR [, nFlag]
INTVECTOR vIds ;
LuaCheckParam( L, 1, vIds)
string sToolName ;
LuaCheckParam( L, 2, sToolName)
double dLen ;
LuaCheckParam( L, 3, dLen)
double dDiam ;
LuaCheckParam( L, 4, dDiam)
double dCornR ;
LuaCheckParam( L, 5, dCornR)
int nFlag = 1 ;
LuaGetParam( L, 6, nFlag) ;
LuaClearStack( L) ;
// imposto utensile additivo a Zmap indicati
bool bOk = ExeVolZmapSetAdditiveTool( vIds, sToolName, dLen, dDiam, dCornR, nFlag, true) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
@@ -242,7 +284,7 @@ LuaVolZmapResetTool( lua_State* L)
LuaCheckParam( L, 1, vIds)
LuaClearStack( L) ;
// reset utensile a Zmap indicati
bool bOk = ExeVolZmapResetTool( vIds) ;
bool bOk = ExeVolZmapResetTools( vIds) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
@@ -350,6 +392,7 @@ LuaInstallGdbModifyVol( LuaMgr& luaMgr)
bool bOk = ( &luaMgr != nullptr) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtExplodeVolume", LuaExplodeVolume) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapChangeResolution", LuaVolZmapChangeResolution) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetShowEdges", LuaVolZmapSetShowEdges) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRemoveVolZmapPart", LuaRemoveVolZmapPart) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetStdTool", LuaVolZmapSetStdTool) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetAdvTool", LuaVolZmapSetAdvTool) ;
@@ -357,6 +400,7 @@ LuaInstallGdbModifyVol( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetGenTool", LuaVolZmapSetGenTool) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetMortiserTool", LuaVolZmapSetMortiserTool) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetChiselTool", LuaVolZmapSetChiselTool) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetAdditiveTool", LuaVolZmapSetAdditiveTool) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapResetTool", LuaVolZmapResetTool) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapGetToolOutline", LuaVolZmapGetToolOutline) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapMillingStep", LuaVolZmapMillingStep) ;
+23 -13
View File
@@ -519,10 +519,8 @@ LuaSetInfo( lua_State* L)
} break ;
case LUA_TTABLE :
{ Frame3d frVal ;
BBox3d b3Val ;
Vector3d vtVal ; // va bene anche per Point3d
INTVECTOR vnVal ;
DBLVECTOR vdVal ;
BBox3d b3Val ;
DBLVECTOR vdVal ; // va bene anche per Vector3d, Point3d, vnVal
STRVECTOR vsVal ;
if ( LuaGetParam( L, 3, frVal)) {
LuaClearStack( L) ;
@@ -531,15 +529,7 @@ LuaSetInfo( lua_State* L)
else if ( LuaGetParam( L, 3, b3Val)) {
LuaClearStack( L) ;
bOk = ExeSetInfo( nId, sKey, b3Val) ;
}
else if ( LuaGetParam( L, 3, vtVal)) {
LuaClearStack( L) ;
bOk = ExeSetInfo( nId, sKey, vtVal) ;
}
else if ( LuaGetParam( L, 3, vnVal)) {
LuaClearStack( L) ;
bOk = ExeSetInfo( nId, sKey, vnVal) ;
}
}
else if ( LuaGetParam( L, 3, vdVal)) {
LuaClearStack( L) ;
bOk = ExeSetInfo( nId, sKey, vdVal) ;
@@ -682,6 +672,25 @@ LuaRemoveInfo( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaGetAllInfo( lua_State* L)
{
// 1 parametro : Id
int nId ;
LuaCheckParam( L, 1, nId)
LuaClearStack( L) ;
// recupero tutte le info
STRVECTOR vsInfo ;
bool bOk = ExeGetAllInfo( nId, vsInfo) ;
// restituisco il risultato
if ( bOk)
LuaSetParam( L, vsInfo) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaSetTextureName( lua_State* L)
@@ -809,6 +818,7 @@ LuaInstallGdbObjAttribs( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtGetInfo", LuaGetInfo) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtExistsInfo", LuaExistsInfo) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRemoveInfo", LuaRemoveInfo) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAllInfo", LuaGetAllInfo) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSetTextureName", LuaSetTextureName) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSetTextureFrame", LuaSetTextureFrame) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRemoveTextureData", LuaRemoveTextureData) ;
+54
View File
@@ -277,6 +277,21 @@ LuaGetPrevLayer( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaIsGhostPart( lua_State* L)
{
// 1 parametro : nGhostId
int nGhostId ;
LuaCheckParam( L, 1, nGhostId)
LuaClearStack( L) ;
// verifico sia un segnaposto di pezzo messo in grezzo
bool bOk = ExeIsGhostPart( nGhostId) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaGetFirstGhostPart( lua_State* L)
@@ -454,6 +469,42 @@ LuaDuploList( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaDuploInRawCount( lua_State* L)
{
// 1 parametro : nSouId
int nSouId ;
LuaCheckParam( L, 1, nSouId)
LuaClearStack( L) ;
// recupero il numero di duplicati che sono riferiti da grezzi nei vari gruppi di lavoro del progetto
int nCount ;
bool bOk = ExeDuploInRawCount( nSouId, nCount) ;
// restituisco il risultato
if ( bOk)
LuaSetParam( L, nCount) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaDuploWithoutRawList( lua_State* L)
{
// nessun parametro
LuaClearStack( L) ;
// recupero l'elenco dei duplicati
INTVECTOR vnDup ;
bool bOk = ExeDuploWithoutRawList( vnDup) ;
// restituisco il risultato
if ( bOk)
LuaSetParam( L, vnDup) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaDuploSetModified( lua_State* L)
@@ -605,6 +656,7 @@ LuaInstallGdbPartLayer( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtGetNextLayer", LuaGetNextLayer) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetLastLayer", LuaGetLastLayer) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetPrevLayer", LuaGetPrevLayer) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtIsGhostPart", LuaIsGhostPart) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetFirstGhostPart", LuaGetFirstGhostPart) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetNextGhostPart", LuaGetNextGhostPart) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtEraseEmptyParts", LuaEraseEmptyParts) ;
@@ -616,6 +668,8 @@ LuaInstallGdbPartLayer( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtDuploNew", LuaDuploNew) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtDuploCount", LuaDuploCount) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtDuploList", LuaDuploList) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtDuploInRawCount", LuaDuploInRawCount) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtDuploWithoutRawList", LuaDuploWithoutRawList) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtDuploSetModified", LuaDuploSetModified) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtDuploGetModified", LuaDuploGetModified) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtDuploSetLocked", LuaDuploSetLocked) ;
+177 -26
View File
@@ -31,6 +31,7 @@
#include "/EgtDev/Include/EgtNumUtils.h"
#include "/EgtDev/Include/EgtStringConverter.h"
#include "Windowsx.h"
#include "shlobj.h"
using namespace std ;
@@ -52,7 +53,7 @@ MyPrint( lua_State* L)
s = lua_tostring( L, -1) ; /* get result */
if ( s == nullptr)
return luaL_error( L,
LUA_QL("tostring") " must return a string to " LUA_QL("print")) ;
"'tostring' must return a string to 'print'") ;
if ( i > 1)
sOut += "\t" ;
sOut += s ;
@@ -178,11 +179,11 @@ LuaSplitStringPlus( lua_State* L)
// 2 parametri : sVal, sHea
string sVal ;
string sHea ;
bool bFound = LuaGetParam( L, 1, sVal) ;
LuaCheckParam( L, 2, sHea)
bool bOk = LuaGetParam( L, 1, sVal) &&
LuaGetParam( L, 2, sHea) ;
LuaClearStack( L) ;
// se ricevuta stringa, la divido in parti conservandone le intestazioni
if ( bFound) {
// se ricevute stringhe, divido la prima in parti con intestazioni della seconda (che conservo)
if ( bOk) {
STRVECTOR vsVal ;
TokenizePlus( sVal, sHea, vsVal) ;
// ritorno il risultato
@@ -194,6 +195,25 @@ LuaSplitStringPlus( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaReplaceString( lua_State* L)
{
// 3 parametri : sVal, sOld, sNew
string sVal ;
LuaCheckParam( L, 1, sVal)
string sOld ;
LuaCheckParam( L, 2, sOld)
string sNew ;
LuaCheckParam( L, 3, sNew)
LuaClearStack( L) ;
// eseguo sostituzione nella stringa della sequenza indicata dal secondo parametro con quella del terzo
int nRes = ReplaceString( sVal, sOld, sNew) ;
// restituisco il risultato
LuaSetParam( L, sVal) ;
LuaSetParam( L, nRes) ;
return 2 ;
}
//-------------------------------------------------------------------------------
static int
LuaSetVal( lua_State* L)
@@ -208,19 +228,19 @@ LuaSetVal( lua_State* L)
{ bool bVal ;
LuaGetParam( L, 2, bVal) ;
LuaClearStack( L) ;
bOk = SetValInNotes( sKey, bVal, sNotes) ;
bOk = SetVal( sKey, bVal, sNotes) ;
} break ;
case LUA_TNUMBER :
{ double dVal ;
LuaGetParam( L, 2, dVal) ;
LuaClearStack( L) ;
bOk = SetValInNotes( sKey, dVal, sNotes) ;
bOk = SetVal( sKey, dVal, sNotes) ;
} break ;
case LUA_TSTRING :
{ string sVal ;
LuaGetParam( L, 2, sVal) ;
LuaClearStack( L) ;
bOk = SetValInNotes( sKey, (const string&) sVal, sNotes) ;
bOk = SetVal( sKey, (const string&) sVal, sNotes) ;
} break ;
case LUA_TTABLE :
{ Frame3d frVal ;
@@ -231,32 +251,35 @@ LuaSetVal( lua_State* L)
STRVECTOR vsVal ;
if ( LuaGetParam( L, 2, frVal)) {
LuaClearStack( L) ;
bOk = SetValInNotes( sKey, frVal, sNotes) ;
bOk = SetVal( sKey, frVal, sNotes) ;
}
else if ( LuaGetParam( L, 2, b3Val)) {
LuaClearStack( L) ;
bOk = SetValInNotes( sKey, b3Val, sNotes) ;
bOk = SetVal( sKey, b3Val, sNotes) ;
}
else if ( LuaGetParam( L, 2, vtVal)) {
LuaClearStack( L) ;
bOk = SetValInNotes( sKey, vtVal, sNotes) ;
bOk = SetVal( sKey, vtVal, sNotes) ;
}
else if ( LuaGetParam( L, 2, vnVal)) {
LuaClearStack( L) ;
bOk = SetValInNotes( sKey, vnVal, sNotes) ;
bOk = SetVal( sKey, vnVal, sNotes) ;
}
else if ( LuaGetParam( L, 2, vdVal)) {
LuaClearStack( L) ;
bOk = SetValInNotes( sKey, vdVal, sNotes) ;
bOk = SetVal( sKey, vdVal, sNotes) ;
}
else if ( LuaGetParam( L, 2, vsVal)) {
LuaClearStack( L) ;
bOk = SetValInNotes( sKey, vsVal, sNotes) ;
bOk = SetVal( sKey, vsVal, sNotes) ;
}
} break ;
}
// restituisco il risultato
LuaSetParam( L, sNotes) ;
if ( bOk)
LuaSetParam( L, sNotes) ;
else
LuaSetParam(L, "") ;
return 1 ;
}
@@ -493,7 +516,7 @@ LuaGetEnableUI( lua_State* L)
static int
LuaOutBox( lua_State* L)
{
// 2 o 3 parametri : stringa, titolo [, icona]
// 2, 3 o 4 parametri : sOut, sTitle [, sIcon] [, sButtons]
string sOut ;
LuaCheckParam( L, 1, sOut)
string sTitle ;
@@ -510,16 +533,34 @@ LuaOutBox( lua_State* L)
nIcon = MB_ICONINFORMATION ;
else if ( sIcon == "QUESTION")
nIcon = MB_ICONQUESTION ;
string sButtons ;
LuaGetParam( L, 4, sButtons) ;
int nButtons = MB_OKCANCEL ;
ToUpper( sButtons) ;
if ( sButtons == "OK")
nButtons = MB_OK ;
else if ( sButtons == "OKCANCEL")
nButtons = MB_OKCANCEL ;
else if ( sButtons == "ABORTRETRYIGNORE")
nButtons = MB_ABORTRETRYIGNORE ;
else if ( sButtons == "YESNOCANCEL")
nButtons = MB_YESNOCANCEL ;
else if ( sButtons == "YESNO")
nButtons = MB_YESNO ;
else if ( sButtons == "RETRYCANCEL")
nButtons = MB_RETRYCANCEL ;
else if ( sButtons == "CANCELTRYCONTINUE")
nButtons = MB_CANCELTRYCONTINUE ;
LuaClearStack( L) ;
// se abilitata UI, emetto la finestra di dialogo
int nRes = IDCANCEL ;
if ( ExeGetEnableUI()) {
HWND hTopWnd = ExeGetMainWindowHandle() ; // FindTopWindow() ;
nRes = MessageBox( hTopWnd, stringtoW( sOut), stringtoW( sTitle),
MB_OKCANCEL | nIcon | MB_TASKMODAL) ;
}
// risultato (Ok->true, Cancel->false)
LuaSetParam( L, ( nRes == IDOK)) ;
// emetto finestra di dialogo (solo se ablitata UI)
int nRes = ExeMessageBox( sOut, sTitle, nButtons | nIcon) ;
// risultato
if ( nRes == IDOK || nRes == IDRETRY || nRes == IDYES || nRes == IDTRYAGAIN)
LuaSetParam( L, true) ;
else if ( nRes == IDNO || nRes == IDCONTINUE || nRes == IDIGNORE)
LuaSetParam( L, false) ;
else
LuaSetParam( L) ;
return 1 ;
}
@@ -716,6 +757,67 @@ LuaCompareFilesLastWriteTime( lua_State* L)
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
LuaExistsDirectory( lua_State* L)
@@ -985,6 +1087,50 @@ LuaWinExec( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCloseExe( lua_State* L)
{
// 1 parametro opzionale : [nExitCode]
int nExitCode = 0 ;
LuaGetParam( L, 1, nExitCode) ;
LuaClearStack( L) ;
// eseguo chiusura forzata
if ( ExeOnTerminateProcess( nExitCode))
TerminateProcess( GetCurrentProcess(), abs( nExitCode)) ;
// restituisco il risultato (se arrivo qui vuol dire che non è consnetito terminare l'esecuzione)
LuaSetParam( L, false) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateMutex( lua_State* L)
{
// un solo parametro : sMutexName
string sMutexName ;
LuaCheckParam( L, 1, sMutexName)
LuaClearStack( L) ;
// verifico esistenza Mutex con Nome (altrimenti lo creo per bloccare gli altri)
bool bOk = ExeCreateMutex( sMutexName) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaReleaseMutex( lua_State* L)
{
// nessun parametro
LuaClearStack( L) ;
// rilascio l'eventuale Mutex con Nome attivo
bool bOk = ExeReleaseMutex() ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
const int MAX_CTRLS = IDC_TEXT8 -IDC_TEXT1 + 1 ;
const int OFFS_CTRLS = 40 ;
@@ -1150,7 +1296,7 @@ LuaDialogBox( lua_State* L)
// se abilitata UI, lancio dialogo
if ( ExeGetEnableUI()) {
// lancio dialogo
HWND hTopWnd = ExeGetMainWindowHandle() ; // FindTopWindow() ;
HWND hTopWnd = ExeGetMainWindowHandle() ;
bool bOk = ( DialogBox( GetModuleIstance(), MAKEINTRESOURCE( IDD_LUADLG), hTopWnd, (DLGPROC)DialogBoxProc) == IDOK) ;
// restituzione parametri
if ( bOk) {
@@ -1181,6 +1327,7 @@ LuaInstallGeneral( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtNumToString", LuaNumToString) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSplitString", LuaSplitString) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSplitStringPlus", LuaSplitStringPlus) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtReplaceString", LuaReplaceString) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSetVal", LuaSetVal) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetVal", LuaGetVal) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetUUID", LuaGetUUID) ;
@@ -1202,6 +1349,7 @@ LuaInstallGeneral( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtEraseFile", LuaEraseFile) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtFindAllFiles", LuaFindAllFiles) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCompareFilesLastWriteTime", LuaCompareFilesLastWriteTime) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtDirectoryDialog", LuaDirectoryDialog) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtExistsDirectory", LuaExistsDirectory) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCreateDirectory", LuaCreateDirectory) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtEmptyDirectory", LuaEmptyDirectory) ;
@@ -1219,6 +1367,9 @@ LuaInstallGeneral( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtMsg", LuaGetMsg) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtDialogBox", LuaDialogBox) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtWinExec", LuaWinExec) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCloseExe", LuaCloseExe) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCreateMutex", LuaCreateMutex) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtReleaseMutex", LuaReleaseMutex) ;
return bOk ;
}
+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
LuaInstallGeoBase( LuaMgr& luaMgr)
@@ -557,5 +634,9 @@ LuaInstallGeoBase( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtBBoxToGlob", LuaBBoxToGlob) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtBBoxToLoc", LuaBBoxToLoc) ;
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 ;
}
+33
View File
@@ -49,6 +49,38 @@ LuaPointCurveDist( lua_State* L)
return 3 ;
}
//----------------------------------------------------------------------------
static int
LuaPointCurveDistSide( lua_State* L)
{
// 3 o 4 parametri : ptP, nCrvId, vtN [, nRefId]
Point3d ptP ;
LuaCheckParam( L, 1, ptP)
int nId ;
LuaCheckParam( L, 2, nId)
Vector3d vtN ;
LuaCheckParam( L, 3, vtN)
int nRefType = nId ;
LuaGetParam( L, 4, nRefType) ;
LuaClearStack( L) ;
// calcolo la distanza
int nSide ;
double dDist ;
Point3d ptMin ;
bool bOk = ExePointCurveDistSide( ptP, nId, vtN, nRefType, &dDist, ptMin, &nSide) ;
if ( bOk) {
LuaSetParam( L, dDist) ;
LuaSetParam( L, ptMin) ;
LuaSetParam( L, nSide) ;
}
else {
LuaSetParam( L) ;
LuaSetParam( L) ;
LuaSetParam( L) ;
}
return 3 ;
}
//----------------------------------------------------------------------------
static int
LuaPointSurfTmDist( lua_State* L)
@@ -85,6 +117,7 @@ LuaInstallGeoDist( LuaMgr& luaMgr)
{
bool bOk = ( &luaMgr != nullptr) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtPointCurveDist", LuaPointCurveDist) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtPointCurveDistSide", LuaPointCurveDistSide) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtPointSurfTmDist", LuaPointSurfTmDist) ;
return bOk ;
}
+256 -130
View File
@@ -20,6 +20,41 @@
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
LuaLineBoxInters( lua_State* L)
@@ -53,38 +88,6 @@ LuaLineBoxInters( lua_State* L)
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
LuaLineSurfTmInters( lua_State* L)
@@ -120,6 +123,136 @@ LuaLineSurfTmInters( lua_State* L)
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
LuaPlaneSurfTmInters( lua_State* L)
@@ -186,99 +319,6 @@ LuaParPlanesSurfTmInters( lua_State* L)
return 2 ;
}
//----------------------------------------------------------------------------
static int
LuaSurfTmSurfTmInters( lua_State* L)
{
// 3 o 4 parametri : Id1, nId2, nDestGrpId [, dToler]
int nId1 ;
LuaCheckParam( L, 1, nId1)
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 ;
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
LuaLineVolZmapInters( lua_State* L)
{
// 3 o 4 parametri : ptP, vtDir, Id, [, nRefId]
Point3d ptP ;
LuaCheckParam( L, 1, ptP)
Vector3d vtDir ;
LuaCheckParam( L, 2, vtDir)
int nId ;
LuaCheckParam( L, 3, nId)
int nRefType = nId ;
LuaGetParam( L, 4, nRefType) ;
LuaClearStack( L) ;
// eseguo calcolo intersezione
INTDBLVECTOR vInters ;
if ( ExeLineVolZmapInters( ptP, vtDir, nId, nRefType, vInters)) {
LuaSetParam( L, true) ;
INTVECTOR vType( vInters.size()) ;
DBLVECTOR vPar( vInters.size()) ;
for ( size_t i = 0 ; i < vInters.size() ; ++ i) {
vType[i] = vInters[i].first ;
vPar[i] = vInters[i].second ;
}
LuaSetParam( L, vType) ;
LuaSetParam( L, vPar) ;
}
else {
LuaSetParam( L) ;
LuaSetParam( L) ;
LuaSetParam( L) ;
}
return 3 ;
}
//----------------------------------------------------------------------------
static int
LuaPlaneVolZmapInters( lua_State* L)
@@ -310,19 +350,105 @@ LuaPlaneVolZmapInters( lua_State* L)
return 2 ;
}
//----------------------------------------------------------------------------
static int
LuaCurveCurveInters( lua_State* L)
{
// 3 parametri : nId1, nId2, nDestGrpId
int nId1 ;
LuaCheckParam( L, 1, nId1)
int nId2 ;
LuaCheckParam( L, 2, nId2)
int nDestGrpId ;
LuaCheckParam( L, 3, nDestGrpId) ;
LuaClearStack( L) ;
// eseguo l'intersezione
int nPntCount = 0 ;
int nCrvCount = 0 ;
int nNewId = ExeCurveCurveInters( nId1, nId2, nDestGrpId, &nPntCount, &nCrvCount) ;
// restituisco il risultato
if ( nNewId != GDB_ID_NULL)
LuaSetParam( L, nNewId) ;
else
LuaSetParam( L) ;
LuaSetParam( L, nPntCount) ;
LuaSetParam( L, nCrvCount) ;
return 3 ;
}
//----------------------------------------------------------------------------
static int
LuaCurveSurfTmInters( lua_State* L)
{
// 3 parametri : nCrvId, nStmId, nDestGrpId
int nCrvId ;
LuaCheckParam( L, 1, nCrvId)
int nStmId ;
LuaCheckParam( L, 2, nStmId)
int nDestGrpId ;
LuaCheckParam( L, 3, nDestGrpId) ;
LuaClearStack( L) ;
// eseguo l'intersezione
int nPntCount = 0 ;
int nCrvCount = 0 ;
int nNewId = ExeCurveSurfTmInters( nCrvId, nStmId, nDestGrpId, &nPntCount, &nCrvCount) ;
// restituisco il risultato
if ( nNewId != GDB_ID_NULL)
LuaSetParam( L, nNewId) ;
else
LuaSetParam( L) ;
LuaSetParam( L, nPntCount) ;
LuaSetParam( L, nCrvCount) ;
return 3 ;
}
//----------------------------------------------------------------------------
static int
LuaSurfTmSurfTmInters( lua_State* L)
{
// 3 o 4 parametri : Id1, nId2, nDestGrpId [, dToler]
int nId1 ;
LuaCheckParam( L, 1, nId1)
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 ;
}
//-------------------------------------------------------------------------------
bool
LuaInstallGeoInters( LuaMgr& luaMgr)
{
bool bOk = ( &luaMgr != nullptr) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtLineCurveInters", LuaLineCurveInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtLineBoxInters", LuaLineBoxInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtPlaneBoxInters", LuaPlaneBoxInters) ;
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( "EgtParPlanesSurfTmInters", LuaParPlanesSurfTmInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSurfTmInters", LuaSurfTmSurfTmInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtPlaneCurveInters", LuaPlaneCurveInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtLineVolZmapInters", LuaLineVolZmapInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtPlaneVolZmapInters", LuaPlaneVolZmapInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCurveInters", LuaCurveCurveInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveSurfTmInters", LuaCurveSurfTmInters) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSurfTmInters", LuaSurfTmSurfTmInters) ;
return bOk ;
}
}
+192 -31
View File
@@ -227,6 +227,26 @@ LuaAddMachGroup( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCopyMachGroup( lua_State* L)
{
// 2 parametri : nome del gruppo sorgente, nome del nuovo gruppo
string sSouName ;
LuaCheckParam( L, 1, sSouName)
string sName ;
LuaCheckParam( L, 2, sName) ;
LuaClearStack( L) ;
// copio la macchinata
int nId = ExeCopyMachGroup( sSouName, sName) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaRemoveMachGroup( lua_State* L)
@@ -242,6 +262,24 @@ LuaRemoveMachGroup( lua_State* L)
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
LuaGetMachGroupName( lua_State* L)
@@ -1714,10 +1752,12 @@ LuaFindToolInCurrSetup( lua_State* L)
string sTool ;
LuaGetParam( L, 1, sTool) ;
LuaClearStack( L) ;
// verifico l'attrezzaggio della macchinata corrente
bool bOk = ExeFindToolInCurrSetup( sTool) ;
// verifico attrezzaggio utensile e ne recupero l'eventuale posizione
string sTcPos ;
bool bOk = ExeGetToolSetupPosInCurrSetup( sTool, sTcPos) ;
LuaSetParam( L, bOk) ;
return 1 ;
LuaSetParam( L, sTcPos) ;
return 2 ;
}
//-----------------------------------------------------------------------------
@@ -2957,14 +2997,18 @@ LuaGetClEntFlag( lua_State* L)
LuaGetParam( L, 1, nEntId) ;
LuaClearStack( L) ;
// recupero il flag
int nFlag ;
bool bOk = ExeGetClEntFlag( nEntId, nFlag) ;
int nFlag, nFlag2 ;
bool bOk = ExeGetClEntFlag( nEntId, nFlag, nFlag2) ;
// restituisco il risultato
if ( bOk)
if ( bOk) {
LuaSetParam( L, nFlag) ;
else
LuaSetParam( L, nFlag2) ;
}
else {
LuaSetParam( L) ;
return 1 ;
LuaSetParam( L) ;
}
return 2 ;
}
//-----------------------------------------------------------------------------
@@ -2986,6 +3030,44 @@ LuaGetClEntIndex( lua_State* 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
int nMask ;
bool bOk = ExeGetClEntAxesMask( nEntId, nMask) ;
// restituisco il risultato
if ( bOk)
LuaSetParam( L, nMask) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-----------------------------------------------------------------------------
static int
LuaGetClEntAxesVal( lua_State* L)
{
// 1 parametro : nEntId
int nEntId ;
LuaGetParam( L, 1, nEntId) ;
LuaClearStack( L) ;
// recupero il valore degli assi
DBLVECTOR vAxes ;
bool bOk = ExeGetClEntAxesVal( nEntId, vAxes) ;
// restituisco il risultato
if ( bOk)
LuaSetParam( L, vAxes) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
// Simulation
//-------------------------------------------------------------------------------
@@ -3291,26 +3373,19 @@ LuaSetRotAxisBlock( lua_State* L)
//-------------------------------------------------------------------------------
static int
LuaGetRotAxisBlocked( lua_State* L)
LuaGetCalcTable( lua_State* L)
{
// 1 parametro : nInd ( 0-based)
int nInd ;
LuaCheckParam( L, 1, nInd)
// nessun parametro
LuaClearStack( L) ;
// recupero dati bloccaggio asse in posizione nInd
string sAxis ;
double dVal ;
bool bOk = ExeGetRotAxisBlocked( nInd, sAxis, dVal) ;
// recupero la tavola correnti
string sTable ;
bool bOk = ExeGetCalcTable( sTable) ;
// restituisco il risultato
if ( bOk) {
LuaSetParam( L, sAxis) ;
LuaSetParam( L, dVal) ;
}
else {
if ( bOk)
LuaSetParam( L, sTable) ;
else
LuaSetParam( L) ;
LuaSetParam( L) ;
}
return 2 ;
return 1 ;
}
//-------------------------------------------------------------------------------
@@ -3338,6 +3413,47 @@ LuaGetCalcTool( lua_State* L)
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
LuaGetCalcAngles( lua_State* L)
@@ -3405,7 +3521,7 @@ LuaGetCalcPositions( lua_State* L)
static int
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 ;
LuaCheckParam( L, 1, dX)
double dY ;
@@ -3414,7 +3530,7 @@ LuaGetCalcTipFromPositions( lua_State* L)
LuaCheckParam( L, 3, dZ)
DBLVECTOR vAng ;
int i ;
for ( i = 4 ; i <= 7 ; ++ i) {
for ( i = 4 ; i <= 9 ; ++ i) {
double dAng ;
if ( LuaGetParam( L, i, dAng))
vAng.emplace_back( dAng) ;
@@ -3439,9 +3555,9 @@ LuaGetCalcTipFromPositions( lua_State* L)
static int
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 ;
for ( int i = 1 ; i <= 4 ; ++ i) {
for ( int i = 1 ; i <= 6 ; ++ i) {
double dAng ;
if ( LuaGetParam( L, i, dAng))
vAng.emplace_back( dAng) ;
@@ -3464,9 +3580,9 @@ LuaGetCalcToolDirFromAngles( lua_State* L)
static int
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 ;
for ( int i = 1 ; i <= 4 ; ++ i) {
for ( int i = 1 ; i <= 6 ; ++ i) {
double dAng ;
if ( LuaGetParam( L, i, dAng))
vAng.emplace_back( dAng) ;
@@ -3621,6 +3737,26 @@ LuaGetHeadExitCount( lua_State* L)
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
LuaGetTcPosId( lua_State* L)
@@ -3732,6 +3868,23 @@ LuaGetAllTablesNames( lua_State* L)
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
LuaGetAllHeadsNames( lua_State* L)
@@ -3983,7 +4136,9 @@ LuaInstallMachMgr( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtGetPrevMachGroup", LuaGetPrevMachGroup) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetMachGroupNewName", LuaGetMachGroupNewName) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAddMachGroup", LuaAddMachGroup) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCopyMachGroup", LuaCopyMachGroup) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRemoveMachGroup", LuaRemoveMachGroup) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtChangeMachGroupName", LuaChangeMachGroupName) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetMachGroupName", LuaGetMachGroupName) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetMachGroupMachineName", LuaGetMachGroupMachineName) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetMachGroupId", LuaGetMachGroupId) ;
@@ -4140,6 +4295,8 @@ LuaInstallMachMgr( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtGetClEntMove", LuaGetClEntMove) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetClEntFlag", LuaGetClEntFlag) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetClEntIndex", LuaGetClEntIndex) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetClEntAxesMask", LuaGetClEntAxesMask) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetClEntAxesVal", LuaGetClEntAxesVal) ;
// Simulation
bOk = bOk && luaMgr.RegisterFunction( "EgtSimInit", LuaSimInit) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSimStart", LuaSimStart) ;
@@ -4162,20 +4319,24 @@ LuaInstallMachMgr( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAxisId", LuaGetAxisId) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetHeadId", LuaGetHeadId) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetHeadExitCount", LuaGetHeadExitCount) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetExitId", LuaGetExitId) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetTcPosId", LuaGetTcPosId) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAxisToken", LuaGetAxisToken) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAxisType", LuaGetAxisType) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAxisInvert", LuaGetAxisInvert) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAxisOffset", LuaGetAxisOffset) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAllTablesNames", LuaGetAllTablesNames) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAllAxesNames", LuaGetAllAxesNames) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAllHeadsNames", LuaGetAllHeadsNames) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAllTcPosNames", LuaGetAllTcPosNames) ;
// Machine Calc
bOk = bOk && luaMgr.RegisterFunction( "EgtSetCalcTable", LuaSetCalcTable) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSetCalcTool", LuaSetCalcTool) ;
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( "EgtGetAllCurrAxesNames", LuaGetAllCurrAxesNames) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetRotAxisBlocked", LuaGetRotAxisBlocked) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcAngles", LuaGetCalcAngles) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcPositions", LuaGetCalcPositions) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcTipFromPositions", LuaGetCalcTipFromPositions) ;
+73
View File
@@ -175,6 +175,21 @@ LuaZoomObject( lua_State* L)
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
LuaSetView( lua_State* L)
@@ -228,6 +243,60 @@ LuaSetViewCenter( lua_State* L)
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
LuaGetImage( lua_State* L)
@@ -267,9 +336,13 @@ LuaInstallScene( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtZoomRadius", LuaZoomRadius) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtZoom", LuaZoom) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtZoomObject", LuaZoomObject) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSetViewOrizzOffsStep", LuaSetViewOrizzOffsStep) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSetView", LuaSetView) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSetGenericView", LuaSetGenericView) ;
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) ;
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 ;
}
+1 -1
View File
@@ -31,5 +31,5 @@
#pragma comment(lib, EGTLIBDIR "EgtGeneral" EGTLIBVER ".lib")
#pragma comment(lib, EGTLIBDIR "EgtNumKernel" EGTLIBVER ".lib")
#pragma comment(lib, EGTLIBDIR "EgtGeomKernel" EGTLIBVER ".lib")
#pragma comment(lib, EGTEXTDIR "Lua/Lib/Lua53" EGTLIBVER ".lib")
#pragma comment(lib, EGTEXTDIR "Lua/Lib/Lua54" EGTLIBVER ".lib")
#pragma comment(lib, EGTLIBDIR "SEgtLock" EGTLIBVER ".lib")