Compare commits

...

4 Commits

Author SHA1 Message Date
Daniele Bariletti a5a0646ddc EgtExecutor :
- correzione minore a export 3dm.
2023-10-17 11:12:09 +02:00
Daniele Bariletti b954be810c EgtExecutor :
- aggiunte funzioni per l'Export 3dm.
2023-10-12 11:01:31 +02:00
Daniele Bariletti 8500a0467e EgtExecutor :
- aggiunta del 3dm Export.
2023-10-12 11:01:27 +02:00
Daniele Bariletti 8145b4586c EgtExecutor :
- introdotto l'uso della grafica di default per gli ExtDim
importati da 3dm.
2023-10-12 11:01:20 +02:00
4 changed files with 77 additions and 2 deletions
+18
View File
@@ -10,6 +10,8 @@
// 03.07.18 DS Aggiunto ImportPnt. // 03.07.18 DS Aggiunto ImportPnt.
// 15.09.19 DS Aggiunto ExportSvg. // 15.09.19 DS Aggiunto ExportSvg.
// 14.12.20 DS Aggiunto ImportBtlx. // 14.12.20 DS Aggiunto ImportBtlx.
// 23.06.23 DB Aggiunto Import3dm.
// 21.09.23 DB Aggiunto Export3dm.
// //
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -53,6 +55,7 @@ static const char* EEX_CREATEIMPORT3DM = "CreateImport3dm" ;
static const char* EEX_CREATEEXPORTDXF = "CreateExportDxf" ; static const char* EEX_CREATEEXPORTDXF = "CreateExportDxf" ;
static const char* EEX_CREATEEXPORTSTL = "CreateExportStl" ; static const char* EEX_CREATEEXPORTSTL = "CreateExportStl" ;
static const char* EEX_CREATEEXPORT3MF = "CreateExport3MF" ; static const char* EEX_CREATEEXPORT3MF = "CreateExport3MF" ;
static const char* EEX_CREATEEXPORT3DM = "CreateExport3dm" ;
static const char* EEX_CREATEEXPORTSVG = "CreateExportSvg" ; static const char* EEX_CREATEEXPORTSVG = "CreateExportSvg" ;
static const char* EEX_SETTHREEJSLIBDIR = "SetThreeJSLibDir" ; static const char* EEX_SETTHREEJSLIBDIR = "SetThreeJSLibDir" ;
static const char* EEX_CREATEEXPORTTHREEJS = "CreateExportThreeJS" ; static const char* EEX_CREATEEXPORTTHREEJS = "CreateExportThreeJS" ;
@@ -377,6 +380,21 @@ MyCreateExport3MF( void)
return pFun() ; return pFun() ;
} }
//-----------------------------------------------------------------------------
IExport3dm*
MyCreateExport3dm( void)
{
// verifico caricamento libreria EgtExchange
if ( s_hEEx == nullptr)
return nullptr ;
// recupero funzione creazione oggetto
typedef IExport3dm* (* PF_CreateExport3dm) ( void) ;
PF_CreateExport3dm pFun = (PF_CreateExport3dm)GetProcAddress( s_hEEx, EEX_CREATEEXPORT3DM) ;
if ( pFun == nullptr)
return nullptr ;
return pFun() ;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
IExportSvg* IExportSvg*
MyCreateExportSvg( void) MyCreateExportSvg( void)
+2
View File
@@ -29,6 +29,7 @@ class IImport3dm ;
class IExportDxf ; class IExportDxf ;
class IExportStl ; class IExportStl ;
class IExport3MF ; class IExport3MF ;
class IExport3dm ;
class IExportThreeJS ; class IExportThreeJS ;
class IExportSvg ; class IExportSvg ;
class IExcExecutor ; class IExcExecutor ;
@@ -55,6 +56,7 @@ IImport3dm* MyCreateImport3dm( void) ;
IExportDxf* MyCreateExportDxf( void) ; IExportDxf* MyCreateExportDxf( void) ;
IExportStl* MyCreateExportStl( void) ; IExportStl* MyCreateExportStl( void) ;
IExport3MF* MyCreateExport3MF( void) ; IExport3MF* MyCreateExport3MF( void) ;
IExport3dm* MyCreateExport3dm( void) ;
bool MySetThreeJSLibDir( const std::string& sThreeJSLibDir) ; bool MySetThreeJSLibDir( const std::string& sThreeJSLibDir) ;
IExportThreeJS* MyCreateExportThreeJS( void) ; IExportThreeJS* MyCreateExportThreeJS( void) ;
IExportSvg* MyCreateExportSvg( void) ; IExportSvg* MyCreateExportSvg( void) ;
+37 -2
View File
@@ -32,6 +32,7 @@
#include "/EgtDev/Include/EExExportDxf.h" #include "/EgtDev/Include/EExExportDxf.h"
#include "/EgtDev/Include/EExExportStl.h" #include "/EgtDev/Include/EExExportStl.h"
#include "/EgtDev/Include/EExExport3MF.h" #include "/EgtDev/Include/EExExport3MF.h"
#include "/EgtDev/Include/EExExport3dm.h"
#include "/EgtDev/Include/EExExportSvg.h" #include "/EgtDev/Include/EExExportSvg.h"
#include "/EgtDev/Include/EExExportThreeJS.h" #include "/EgtDev/Include/EExExportThreeJS.h"
#include "/EgtDev/Include/EGnStringUtils.h" #include "/EgtDev/Include/EGnStringUtils.h"
@@ -373,7 +374,16 @@ ExeImport3dm( const string& sFilePath, double dScaleFactor)
PtrOwner<IImport3dm> pImp3dm( MyCreateImport3dm()) ; PtrOwner<IImport3dm> pImp3dm( MyCreateImport3dm()) ;
bOk = bOk && ! IsNull( pImp3dm) ; bOk = bOk && ! IsNull( pImp3dm) ;
// eseguo l'importazione // eseguo l'importazione
bOk = bOk && pImp3dm->Import( sFilePath, pGseCtx->m_pGeomDB, nLayerId, dScaleFactor) ; 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, nLayerId, dScaleFactor,
dTextHeight, dExtLine, dArrLen, dTextDist, bLenIsMM, nDecDig, sFont) ;
// aggiorno stato file corrente // aggiorno stato file corrente
if ( pGseCtx->m_sFilePath.empty()) if ( pGseCtx->m_sFilePath.empty())
pGseCtx->m_sFilePath = sFilePath ; pGseCtx->m_sFilePath = sFilePath ;
@@ -554,7 +564,7 @@ ExeExport3MF( int nId, const string& sFilePath, int nFilter)
IGeomDB* pGeomDB = GetCurrGeomDB() ; IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false) VERIFY_GEOMDB( pGeomDB, false)
bool bOk = true ; bool bOk = true ;
// esporto il file STL // esporto il file 3MF
// preparo l'esportatore // preparo l'esportatore
PtrOwner<IExport3MF> pExp3MF( MyCreateExport3MF()) ; PtrOwner<IExport3MF> pExp3MF( MyCreateExport3MF()) ;
bOk = bOk && ! IsNull( pExp3MF) ; bOk = bOk && ! IsNull( pExp3MF) ;
@@ -572,6 +582,31 @@ ExeExport3MF( int nId, const string& sFilePath, int nFilter)
return bOk ; 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 bool
ExeExportSvg( int nId, const string& sFilePath, int nFilter) ExeExportSvg( int nId, const string& sFilePath, int nFilter)
+20
View File
@@ -262,6 +262,25 @@ LuaExport3MF( lua_State* L)
return 1 ; 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) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
static int static int
LuaExportSvg( lua_State* L) LuaExportSvg( lua_State* L)
@@ -319,6 +338,7 @@ LuaInstallExchange( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtExportDxf", LuaExportDxf) ; bOk = bOk && luaMgr.RegisterFunction( "EgtExportDxf", LuaExportDxf) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtExportStl", LuaExportStl) ; bOk = bOk && luaMgr.RegisterFunction( "EgtExportStl", LuaExportStl) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtExport3MF", LuaExport3MF) ; bOk = bOk && luaMgr.RegisterFunction( "EgtExport3MF", LuaExport3MF) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtExport3dm", LuaExport3dm) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtExportSvg", LuaExportSvg) ; bOk = bOk && luaMgr.RegisterFunction( "EgtExportSvg", LuaExportSvg) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtExportThreeJS", LuaExportThreeJS) ; bOk = bOk && luaMgr.RegisterFunction( "EgtExportThreeJS", LuaExportThreeJS) ;
return bOk ; return bOk ;