diff --git a/EXE_Exchange.cpp b/EXE_Exchange.cpp index c3eb232..00743ec 100644 --- a/EXE_Exchange.cpp +++ b/EXE_Exchange.cpp @@ -32,6 +32,7 @@ #include "/EgtDev/Include/EExExportDxf.h" #include "/EgtDev/Include/EExExportStl.h" #include "/EgtDev/Include/EExExport3MF.h" +#include "/EgtDev/Include/EExExport3dm.h" #include "/EgtDev/Include/EExExportSvg.h" #include "/EgtDev/Include/EExExportThreeJS.h" #include "/EgtDev/Include/EGnStringUtils.h" @@ -563,7 +564,7 @@ ExeExport3MF( int nId, const string& sFilePath, int nFilter) IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, false) bool bOk = true ; - // esporto il file STL + // esporto il file 3MF // preparo l'esportatore PtrOwner pExp3MF( MyCreateExport3MF()) ; bOk = bOk && ! IsNull( pExp3MF) ; @@ -581,6 +582,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 pExp3dm( MyCreateExport3dm()) ; + bOk = bOk && ! IsNull( pExp3dm) ; + // eseguo l'esportazione + 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) diff --git a/LUA_Exchange.cpp b/LUA_Exchange.cpp index 4981ee2..df72bea 100644 --- a/LUA_Exchange.cpp +++ b/LUA_Exchange.cpp @@ -262,6 +262,25 @@ LuaExport3MF( lua_State* L) 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 LuaExportSvg( lua_State* L) @@ -319,6 +338,7 @@ LuaInstallExchange( LuaMgr& luaMgr) 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 ;