Compare commits

..

70 Commits

Author SHA1 Message Date
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
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
41 changed files with 2449 additions and 293 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) ;
+4 -2
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.
//
//----------------------------------------------------------------------------
@@ -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
+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)
+137 -17
View File
@@ -17,6 +17,7 @@
#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"
@@ -33,6 +34,8 @@
#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"
@@ -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")
@@ -145,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 ;
}
@@ -173,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 ;
}
@@ -203,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 ;
}
@@ -230,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 ;
}
@@ -260,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 ;
}
@@ -290,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 ;
}
@@ -305,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())
@@ -321,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 ;
}
@@ -333,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())
@@ -351,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, nPartId,
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 ;
}
@@ -458,6 +548,11 @@ 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 ;
}
@@ -470,11 +565,11 @@ ExeExportDxf( int nId, const string& sFilePath, int nFlag, int nFilter)
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( nFilter, nFlag) ;
bOk = bOk && pExpDxf->SetOptions( nFilter, nFlag) ;
bOk = bOk && pExpDxf->Export( pGeomDB, nId, sFilePath) ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
@@ -496,11 +591,11 @@ ExeExportStl( int nId, const string& sFilePath, int nFilter)
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
pExpStl->SetOptions( nFilter) ;
bOk = bOk && pExpStl->SetOptions( nFilter) ;
bOk = bOk && pExpStl->Export( pGeomDB, nId, sFilePath) ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
@@ -520,12 +615,12 @@ 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
pExp3MF->SetOptions( nFilter) ;
// eseguo l'esportazione
bOk = bOk && pExp3MF->SetOptions( nFilter) ;
bOk = bOk && pExp3MF->Export( pGeomDB, nId, sFilePath) ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
@@ -538,6 +633,31 @@ ExeExport3MF( int nId, const string& sFilePath, int nFilter)
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)
@@ -545,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()) {
+7 -7
View File
@@ -131,7 +131,7 @@ ExeCreateGeoVector( int nParentId, const Vector3d& vtV, const Point3d& ptB, int
Point3d ptBL = GetPointLocal( pGeomDB, ptB, nRefType, frLoc) ;
// creo il vettore
PtrOwner<IGeoVector3d> pGeoVct( CreateGeoVector3d()) ;
bOk = bOk && !IsNull( pGeoVct) ;
bOk = bOk && ! IsNull( pGeoVct) ;
// setto il vettore (con il punto base)
bOk = bOk && pGeoVct->Set( vtVL, ptBL) ;
// inserisco il vettore nel DB
@@ -766,17 +766,17 @@ MyCreateAngularDimensionFromLines( int nParentId, INTVECTOR vLineIds, const Poin
return false ;
if ( abs(( ptDim1 - ptP1L).Len() + ( ptP0L - ptDim1).Len() - ( ptP0L - ptP1L).Len()) < EPS_SMALL ||
abs(( ptDim1 - ptP1L).Len() + ( ptP0L - ptP1L ).Len() - ( ptDim1 - ptP0L).Len()) < EPS_SMALL)
// ptDim è dal lato di ptP1L
ptP1L = ptP1L ;
// ptDim è dal lato di ptP1L, quindi tengo ptP1L
;
else
// ptDim è dal lato di ptP2L
// ptDim è dal lato di ptP2L
ptP1L = ptP2L ;
if ( abs(( ptDim2 - ptP3L).Len() + ( ptP0L - ptDim2).Len() - ( ptP0L - ptP3L).Len()) < EPS_SMALL ||
abs(( ptDim2 - ptP3L).Len() + ( ptP0L - ptP3L).Len() - ( ptDim2 - ptP0L).Len()) < EPS_SMALL)
// ptDim è dal lato di ptP1L
ptP3L = ptP3L ;
// ptDim è dal lato di ptP1L, quindi tengo ptP3L
;
else
// ptDim è dal lato di ptP2L
// ptDim è dal lato di ptP2L
ptP3L = ptP4L ;
}
+42 -7
View File
@@ -1091,6 +1091,44 @@ ExeCreateArc3P( int nParentId, const Point3d& ptP1,
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 +1137,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 +1983,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) ;
+147 -41
View File
@@ -56,8 +56,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
@@ -223,7 +222,7 @@ ExeCreateSurfFrDisk( int nParentId, const Point3d& ptOrig, double dRad, int nRef
//-------------------------------------------------------------------------------
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 +245,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,7 +255,8 @@ 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()) ;
}
@@ -863,6 +863,97 @@ ExeCreateSurfTmSphere( int nParentId, const Point3d& ptOrig,
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 ;
}
//-------------------------------------------------------------------------------
int
ExeCreateSurfTmByFlatContour( int nParentId, int nCrvId, double dLinTol)
@@ -1626,53 +1717,68 @@ ExeCreateSurfBezierRational( int nParentId, int nDegU, int nDegV, int nSpanU, in
//-------------------------------------------------------------------------------
int
ExeCreateSurfBezierLeaves( int nParentId, int nSurfBzId, int nTextHeight)
ExeCreateSurfBezierLeaves( int nParentId, int nSurfBzId, int nTextHeight, bool bShowTrim, int* pnCount)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
ISurfBezier* pSurfBez = GetSurfBezier( pGeomDB->GetGeoObj( nSurfBzId)) ;
nParentId = AdjustId( nParentId) ;
// recupero la superficie
const ISurfBezier* pSurfBez = GetSurfBezier( pGeomDB->GetGeoObj( nSurfBzId)) ;
if ( pSurfBez == nullptr)
return false ;
// recupero il riferimento della superficie
Frame3d frSurf ;
if ( ! pGeomDB->GetGlobFrame( nSurfBzId, frSurf))
return false ;
bool bOk = true ;
//disegno le foglie
return GDB_ID_NULL ;
// disegno le foglie
vector<tuple<int,Point3d,Point3d>> vLeaves ;
pSurfBez->GetLeaves( vLeaves) ;
double dFactor = 1 ;
int nId ;
for ( int k = 0 ; k < (int)vLeaves.size() ; ++k ) {
Point3d ptBL = std::get<1>(vLeaves[k]) * dFactor ;
Point3d ptTR = std::get<2>(vLeaves[k]) * dFactor ;
Point3d ptBr( ptTR.x, ptBL.y) ;
Point3d ptTl( ptBL.x, ptTR.y) ;
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( 1, ptBR) ;
PL.AddUPoint( 2, ptTR) ;
PL.AddUPoint( 3, ptTl) ;
PL.AddUPoint( 4, ptBL) ;
// creo la curva e la inserisco nel GDB
PL.AddUPoint( 3, ptTL) ;
PL.Close() ;
// creo la curva e la inserisco nel GDB
PtrOwner<ICurveComposite> pCrvCompo( CreateCurveComposite()) ;
bOk = bOk && ! IsNull( pCrvCompo) ;
// inserisco i segmenti che uniscono i punti
bOk = bOk && pCrvCompo->FromPolyLine( PL) ;
// assegno il versore estrusione
bOk = bOk && pCrvCompo->SetExtrusion( Z_AX) ;
// inserisco la curva composita nel DB
pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pCrvCompo)) ;
string sText = ToString( std::get<0>(vLeaves[k])) ;
// creo il testo e lo riempio
Point3d ptCenter( (ptBL + ptTR) / 2) ;
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()) ;
bOk = bOk && ! IsNull( pTXT) ;
bOk = bOk && pTXT->Set( ptCenter, Z_AX, X_AX, sText, "", false, nTextHeight) ;
// inserisco il testo nel DB
nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pTXT)): GDB_ID_NULL) ;
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 ;
}
return nId ;
// 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 ;
}
+4
View File
@@ -23,9 +23,11 @@
#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"
#include "EgtDev/Include/EGkVoronoi.h"
//----------------------------------------------------------------------------
bool
@@ -188,6 +190,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) ;
+150
View File
@@ -0,0 +1,150 @@
//----------------------------------------------------------------------------
// EgalTech 2023-2023
//----------------------------------------------------------------------------
// File : Exe_GdbGetPocketing.cpp Data : 28.11.23 Versione : 2.5k6
// 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/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)
{
// databse geometrico
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false) ;
// recupero la FlatRegion per i percorsi
const ISurfFlatRegion* pSfr = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId)) ;
if ( pSfr == nullptr)
return false ;
// 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 ;
// costruzione vettori di curve per Pocketing
ICRVCOMPOPOVECTOR vCrvCompoRes ;
// eseguo Pocketing
bool bOk = CalcPocketing( pSfr, dRad, dStep, dAngle, nType, bSmooth, vCrvCompoRes) ;
nFirstId = GDB_ID_NULL ; // primo Id da restituire
nCrvCount = int( vCrvCompoRes.size()) ;
if ( bOk && int( vCrvCompoRes.size()) > 0) {
// scorro le curve di Pocketing ottenute
for ( int u = 0 ; u < int( vCrvCompoRes.size()) ; ++ u) {
vCrvCompoRes[u]->LocToLoc( frSfr, frDest) ;
// inserisco la curva nel DB Geometrico
int nCurrId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( vCrvCompoRes[u])) ;
if ( nCurrId == GDB_ID_NULL)
return false ;
if ( u == 0)
nFirstId = nCurrId ; // memorizzo il primo Id da restituire
}
ExeSetModified() ;
}
if ( IsCmdLog()) {
string sLua = "EgtPocketing(" + ToString( nId) + "," +
ToString( dRad) + "," +
ToString( dStep) + "," +
ToString( dAngle) + "," +
ToString( nType) + "," +
ToString( bSmooth) + "," +
ToString( nDestGrpId) + ")" +
" -- Ok=" + ToString( bOk) + " 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 ;
}
+216 -67
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"
@@ -306,63 +313,30 @@ 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)
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() ;
}
// 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 ;
//----------------------------------------------------------------------------
int
ExeSurfTmFacetCount( int nId)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, 0)
// recupero la superficie trimesh
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
if ( pStm == nullptr)
return 0 ;
// recupero il numero delle facce
return pStm->GetFacetCount() ;
}
//----------------------------------------------------------------------------
@@ -379,18 +353,43 @@ ExeSurfTmPartCount( int nId)
return pStm->GetPartCount() ;
}
//----------------------------------------------------------------------------
int
ExeSurfTmFacetCount( int nId)
//-----------------------------------------------------------------------------
bool
ExeSurfTmGetVertex( int nId, int nVert, int nRefId, Point3d& ptVert)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, 0)
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie trimesh
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
if ( pStm == nullptr)
return 0 ;
// recupero il numero delle facce
return pStm->GetFacetCount() ;
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) ;
}
//----------------------------------------------------------------------------
@@ -533,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,
@@ -780,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)
@@ -797,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 ;
@@ -825,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()) ;
}
@@ -936,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)
@@ -962,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) ;
@@ -980,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 ;
@@ -989,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)
@@ -1344,4 +1493,4 @@ ExeExtractSurfBezierLoops( int nId, int nDestGrpId, int* pnCount)
if ( pnCount != nullptr)
*pnCount = nCount ;
return nFirstId ;
}
}
+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()) ;
}
+259 -14
View File
@@ -31,15 +31,20 @@
#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/EGkGeoVector3d.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
#include "/EgtDev/Include/EGkCalcPocketing.h"
#include <EgtDev/Include/EGkSfrCreate.h>
#include <functional>
using namespace std ;
//----------------------------------------------------------------------------
@@ -97,14 +102,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 ;
@@ -186,7 +191,7 @@ ExeApproxCurve( int nId, int nApprType, double dLinTol)
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()) ;
@@ -292,9 +297,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() ;
@@ -331,9 +336,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() ;
@@ -2135,7 +2140,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) ;
@@ -2158,7 +2163,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) ;
@@ -2180,7 +2185,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 ;
@@ -2233,11 +2238,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) ;
@@ -2250,11 +2255,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) ;
@@ -2262,3 +2267,243 @@ ExeReorderCurvesInGroup( int nGroupId, const Point3d& ptNear, int nRefType)
}
return bOk ;
}
//-------------------------------------------------------------------------------
static bool
MyProjectCurveOnSurfTm( int nCurveId, int nSurfTmId, const Vector3d& vtDir, int nDestGrpId, double dLinTol, 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, 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, int nRefType)
{
bool bOk = MyProjectCurveOnSurfTm( nCurveId, nSurfTmId, vtDir, nDestGrpId, dLinTol, nRefType) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtProjectCurveOnSurfTm(" + ToString( nCurveId) + "," +
ToString( nSurfTmId) + ",{" +
ToString( vtDir) + "}," +
ToString( nDestGrpId) + "," +
ToString( dLinTol) + "," +
RefTypeToString( nRefType) + ")" +
" -- 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 ;
}
+119 -16
View File
@@ -29,8 +29,10 @@
#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 ;
//----------------------------------------------------------------------------
@@ -75,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 ;
@@ -102,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 ;
@@ -128,7 +130,7 @@ MyExplodeSurfTriMesh( int nId, int& nCount)
// restituisco risultati
return nFirstId ;
}
// non devo fare alcunché
// non devo fare alcunch
nCount = 1 ;
return nId ;
}
@@ -145,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 ;
@@ -294,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() ;
@@ -326,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() ;
@@ -351,7 +353,7 @@ ExeSurfFrOffset( int nId, double dDist, int nType)
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() ;
@@ -410,6 +412,43 @@ 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, GDB_ID_NULL)
// 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 ;
}
//-------------------------------------------------------------------------------
static int
MySurfTmToTriangles( int nId, int& nCount)
@@ -422,7 +461,7 @@ MySurfTmToTriangles( int nId, int& nCount)
return GDB_ID_NULL ;
// recupero il numero di triangoli
int nTria = pStm->GetTriangleCount() ;
// se ci sono più triangoli, li separo
// se ci sono pi triangoli, li separo
if ( nTria > 1) {
// copio tutti triangoli
int nFirstId = GDB_ID_NULL ;
@@ -448,7 +487,7 @@ MySurfTmToTriangles( int nId, int& nCount)
// restituisco risultati
return nFirstId ;
}
// non devo fare alcunché
// non devo fare alcunch
nCount = 1 ;
return nId ;
}
@@ -468,7 +507,7 @@ ExeSurfTmToTriangles( int nId, int* pnCount)
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfTmToTriangles(" + ToString( nId) + ")" +
string sLua = "EgtSurfTmToTriangles(" + IdToString( nId) + ")" +
" -- Id1=" + ToString( nFirstId) + ",Nbr=" + ToString( nCount) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
@@ -492,7 +531,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()) ;
@@ -515,7 +554,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) ;
@@ -539,7 +578,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()) ;
@@ -571,7 +610,7 @@ 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") + "," +
@@ -663,7 +702,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 ;
@@ -700,7 +739,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 ;
@@ -888,6 +927,70 @@ 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 ;
}
//----------------------------------------------------------------------------
static bool
MySurfBzTrim( int nId, int nTrimmerId)
+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) ;
}
//-----------------------------------------------------------------------------
+49 -8
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"
@@ -55,6 +57,7 @@ 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 ;
@@ -70,6 +73,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 ;
@@ -112,6 +116,10 @@ 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())
@@ -168,9 +176,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 ;
@@ -197,6 +207,30 @@ ExeExit( void)
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)
@@ -278,9 +312,12 @@ ExeSetLockId( const string& sLockId)
bOk = ( s_nKeyType != KEY_LOCK_TYPE_HW) ;
break ;
case KEY_LOCK_TYPE_HW :
ExeSetNetHwKey( bNetKey, nUserId) ;
bOk = true ;
break ;
{ string sAddrPort ;
GetLockIdStringNetData( sLockId, sAddrPort) ;
ExeSetNetHwKey( bNetKey, nUserId, sAddrPort) ;
bOk = true ;
break ;
}
}
if ( bOk)
s_sLockId = sLockId ;
@@ -300,11 +337,11 @@ ExeGetLockId( void)
//-----------------------------------------------------------------------------
bool
ExeSetNetHwKey( bool bNetHwKey, int nUserId)
ExeSetNetHwKey( bool bNetHwKey, int nUserId, const string& sAddrPort)
{
s_bNetHwKey = bNetHwKey ;
SetEGnNetHwKey( s_bNetHwKey) ;
return SetNetHwKey( s_bNetHwKey, nUserId) ;
return SetNetHwKey( s_bNetHwKey, nUserId, sAddrPort) ;
}
//-----------------------------------------------------------------------------
@@ -435,6 +472,10 @@ ExeGetVersionInfo( string& sVer, const char* szNewLine)
sVer += szNewLine ;
sVer += MyGetEExVersion() ;
}
if ( IsLoadedExch3dmDll()) {
sVer += szNewLine ;
sVer += MyGetEE3Version() ;
}
if ( IsLoadedMachKernelDll()) {
sVer += szNewLine ;
sVer += MyGetEMkVersion() ;
+10 -4
View File
@@ -1020,16 +1020,22 @@ MyCurveCurveInters( const int nId1, const int nId2, const int nDestGrpId, int& n
return GDB_ID_NULL ;
// recupero le curve e le porto nel riferimento del gruppo di destinazione
PtrOwner<ICurve> pCrv1( GetCurve( pGeomDB->GetGeoObj( nId1))->Clone()) ;
if ( IsNull( pCrv1))
ICurve* pOrigCrv1 = GetCurve( pGeomDB->GetGeoObj( nId1)) ;
if ( pOrigCrv1 == nullptr)
return GDB_ID_NULL ;
PtrOwner<ICurve> pCrv1( pOrigCrv1->Clone()) ;
if( IsNull( pCrv1))
return GDB_ID_NULL ;
Frame3d frCrv1 ;
if ( ! pGeomDB->GetGlobFrame( nId1, frCrv1))
return GDB_ID_NULL ;
pCrv1->LocToLoc( frCrv1, frDest) ;
PtrOwner<ICurve> pCrv2( GetCurve( pGeomDB->GetGeoObj( nId2))->Clone()) ;
if ( IsNull( pCrv2))
ICurve* pOrigCrv2 = GetCurve( pGeomDB->GetGeoObj( nId2)) ;
if ( pOrigCrv2 == nullptr)
return GDB_ID_NULL ;
PtrOwner<ICurve> pCrv2( pOrigCrv2->Clone()) ;
if( IsNull( pCrv2))
return GDB_ID_NULL ;
Frame3d frCrv2 ;
if ( ! pGeomDB->GetGlobFrame( nId2, frCrv2))
+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 ;
}
+59 -9
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)
@@ -291,8 +311,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 +373,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 +471,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 +1585,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)
@@ -2846,12 +2876,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 +2894,16 @@ ExeGetClEntIndex( int nEntId, int& nIndex)
return pMachMgr->GetClEntIndex( nEntId, nIndex) ;
}
//-----------------------------------------------------------------------------
bool
ExeGetClEntAxesVal( int nEntId, DBLVECTOR& vAxes)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// recupero il valore degli assi
return pMachMgr->GetClEntAxesVal( nEntId, vAxes) ;
}
//-----------------------------------------------------------------------------
// Simulazione
//-----------------------------------------------------------------------------
@@ -3142,6 +3182,16 @@ ExeSetCalcTool( const string& sTool, const string& sHead, int nExit)
return pMachMgr->SetCalcTool( sTool, sHead, nExit) ;
}
//-----------------------------------------------------------------------------
bool
ExeGetAllCurrAxesName( STRVECTOR& vAxName)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// recupero gli assi correnti derivanti dalla scelta di tavola e utensile
return pMachMgr->GetAllCurrAxesName( vAxName) ;
}
//----------------------------------------------------------------------------
bool
ExeSetRotAxisBlock( const string& sAxis, double dVal)
+13
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)
BIN
View File
Binary file not shown.
+5 -1
View File
@@ -200,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>
@@ -228,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" />
@@ -248,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" />
@@ -255,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" />
@@ -305,6 +308,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" />
+12
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">
@@ -389,6 +392,15 @@
<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>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="EgtExecutor.rc">
+4 -1
View File
@@ -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) ;
+4
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 ;
+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 ;
+37 -1
View File
@@ -169,6 +169,21 @@ 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)
@@ -239,7 +254,26 @@ LuaExport3MF( lua_State* L)
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 ;
}
//-------------------------------------------------------------------------------
static int
LuaExport3dm( lua_State* L)
{
// 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 = ExeExport3dm( nGroupId, sFilePath, nFilter) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
@@ -297,10 +331,12 @@ 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( "EgtExport3dm", LuaExport3dm) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtExportSvg", LuaExportSvg) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtExportThreeJS", LuaExportThreeJS) ;
return bOk ;
+27
View File
@@ -425,6 +425,32 @@ LuaCreateArc3P( lua_State* 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 +1083,7 @@ 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( "EgtArc2PB", LuaCreateArc2PB) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtArc2PD", LuaCreateArc2PD) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtArc2PDEx", LuaCreateArc2PDEx) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtArc2PV", LuaCreateArc2PV) ;
+77 -10
View File
@@ -147,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 ;
@@ -156,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) ;
@@ -385,7 +389,7 @@ LuaCreateSurfTmSphere( lua_State* L)
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)
@@ -395,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)
@@ -820,22 +876,31 @@ LuaCreateSurfBezierRational( lua_State* L)
static int
LuaCreateSurfBezierLeaves( lua_State* L)
{
// 3 parametri : ParentId, nId, nTextHeight
// 2, 3 o 4 parametri : ParentId, nId [, nTextHeight] [, bShowTrim]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
int nSurfBzId ;
LuaCheckParam( L, 2, nSurfBzId)
int nTextHeight ;
LuaCheckParam( L, 3, nTextHeight)
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 nId = ExeCreateSurfBezierLeaves( nParentId, nSurfBzId, nTextHeight) ;
int nCount = 0 ;
int nId = ExeCreateSurfBezierLeaves( nParentId, nSurfBzId, nTextHeight, bShowTrim, &nCount) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
if ( nId != GDB_ID_NULL) {
LuaSetParam( L, nId) ;
else
LuaSetParam( L, nCount) ;
}
else {
LuaSetParam( L) ;
return 1 ;
LuaSetParam( L) ;
}
return 2 ;
}
//-------------------------------------------------------------------------------
@@ -857,6 +922,8 @@ 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) ;
+1
View File
@@ -18,6 +18,7 @@
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EXeConst.h"
#include "/EgtDev/Include/EGkLuaAux.h"
#include "/EgtDev/Include/EGkVoronoi.h"
//----------------------------------------------------------------------------
static int
+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 : vId, 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 ;
}
+174 -32
View File
@@ -237,35 +237,32 @@ LuaSurfFrRotateSimpleNoCollision( lua_State* L)
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaSurfTmVertexCount( lua_State* L)
{
// 1 parametro : Id
int nId ;
LuaCheckParam( L, 1, nId)
LuaClearStack( L) ;
// recupero il numero di vertici della superficie trimesh
int nNbr = ExeSurfTmVertexCount( nId) ;
LuaSetParam( L, nNbr) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaSurfFrGetZigZagInfill( lua_State* L)
LuaSurfTmFacetCount( 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 facce della superficie trimesh
int nNbr = ExeSurfTmFacetCount( nId) ;
LuaSetParam( L, nNbr) ;
return 1 ;
}
//----------------------------------------------------------------------------
@@ -287,18 +284,53 @@ LuaSurfTmPartCount( lua_State* L)
//----------------------------------------------------------------------------
static int
LuaSurfTmFacetCount( lua_State* L)
LuaSurfTmGetVertex( lua_State* L)
{
// 1 parametro : Id
// 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 numero di facce della superficie trimesh
int nNbr = ExeSurfTmFacetCount( nId) ;
LuaSetParam( L, nNbr) ;
// 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)
@@ -319,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)
@@ -541,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)
@@ -639,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 ;
@@ -649,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) ;
@@ -709,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)
@@ -960,10 +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( "EgtSurfTmPartCount", LuaSurfTmPartCount) ;
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) ;
@@ -973,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
+109 -2
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) ;
@@ -944,6 +947,106 @@ LuaReorderCurvesInGroup( lua_State* L)
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaProjectCurveOnSurfTm( lua_State* L)
{
// 4, 5 o 6 parametri : nCurveId, nSurfTmId, vtDir, nDestGrpId [, dLinTol [, 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 ;
int nRefType = RTY_DEFAULT ;
if ( LuaGetParam( L, 5, dLinTol))
LuaGetParam( L, 6, nRefType) ;
LuaClearStack( L) ;
// proietto la curva su una trimesh secondo la direzione data
bool bOk = ExeProjectCurveOnSurfTm( nCurveId, nSurfTmId, vtDir, nDestGrpId, dLinTol, nRefType) ;
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 = 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 = Voronoi::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)
@@ -999,5 +1102,9 @@ 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( "EgtCurveGetVoronoi", LuaCurveGetVoronoi) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveMedialAxisAdv", LuaCurveMedialAxisAdv) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveGetFatCurve", LuaCurveGetFatCurve) ;
return bOk ;
}
+60
View File
@@ -141,6 +141,30 @@ LuaSurfFrOffset( lua_State* 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
LuaSurfTmToTriangles( lua_State* L)
@@ -364,6 +388,40 @@ 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
LuaSurfBzTrim( lua_State* L)
@@ -393,6 +451,7 @@ LuaInstallGdbModifySurf( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrSubtract", LuaSurfFrSubtract) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrIntersect", LuaSurfFrIntersect) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrOffset", LuaSurfFrOffset) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmMoveVertex", LuaSurfTmMoveVertex) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmToTriangles", LuaSurfTmToTriangles) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmRemoveFacet", LuaSurfTmRemoveFacet) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSwapFacets", LuaSurfTmSwapFacets) ;
@@ -405,6 +464,7 @@ LuaInstallGdbModifySurf( LuaMgr& luaMgr)
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( "EgtSurfBzTrim", LuaSurfBzTrim) ;
return bOk ;
}
+3 -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) ;
+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) ;
+32 -8
View File
@@ -178,11 +178,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 +194,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)
@@ -256,7 +275,10 @@ LuaSetVal( lua_State* L)
} break ;
}
// restituisco il risultato
LuaSetParam( L, sNotes) ;
if ( bOk)
LuaSetParam( L, sNotes) ;
else
LuaSetParam(L, "") ;
return 1 ;
}
@@ -1012,9 +1034,10 @@ LuaCloseExe( lua_State* L)
LuaGetParam( L, 1, nExitCode) ;
LuaClearStack( L) ;
// eseguo chiusura forzata
bool bOk = ( TerminateProcess( GetCurrentProcess(), abs( nExitCode)) != FALSE) ;
// restituisco il risultato (in realtà il programma si è già concluso)
LuaSetParam( L, bOk) ;
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 ;
}
@@ -1242,6 +1265,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) ;
+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 ;
}
+73 -8
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)
@@ -1714,10 +1734,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 +2979,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 +3012,25 @@ LuaGetClEntIndex( lua_State* 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
//-------------------------------------------------------------------------------
@@ -3272,6 +3317,23 @@ LuaSetCalcTool( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaGetAllCurrAxesName( lua_State* L)
{
// nessun parametro
LuaClearStack( L) ;
// imposto l'utensile corrente per il calcolo
STRVECTOR vAxName ;
bool bOk = ExeGetAllCurrAxesName( vAxName) ;
// restituisco il risultato
if ( bOk)
LuaSetParam( L, vAxName) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaSetRotAxisBlock( lua_State* L)
@@ -3983,6 +4045,7 @@ 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( "EgtGetMachGroupName", LuaGetMachGroupName) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetMachGroupMachineName", LuaGetMachGroupMachineName) ;
@@ -4140,6 +4203,7 @@ 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( "EgtGetClEntAxesVal", LuaGetClEntAxesVal) ;
// Simulation
bOk = bOk && luaMgr.RegisterFunction( "EgtSimInit", LuaSimInit) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSimStart", LuaSimStart) ;
@@ -4173,6 +4237,7 @@ LuaInstallMachMgr( LuaMgr& luaMgr)
// Machine Calc
bOk = bOk && luaMgr.RegisterFunction( "EgtSetCalcTable", LuaSetCalcTable) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSetCalcTool", LuaSetCalcTool) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAllCurrAxesName", LuaGetAllCurrAxesName) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSetRotAxisBlock", LuaSetRotAxisBlock) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetRotAxisBlocked", LuaGetRotAxisBlocked) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcTool", LuaGetCalcTool) ;