EgtExecutor 1.6e6 :
- aggiunta gestione import CSF - aggiunta ExeAddSubPiece.
This commit is contained in:
@@ -34,6 +34,7 @@ using namespace std ;
|
||||
static const char* EEX_SETEEXLOGGER = "SetEExLogger" ;
|
||||
static const char* EEX_GETEEXVERSION = "GetEExVersion" ;
|
||||
static const char* EEX_SETEEXKEY = "SetEExKey" ;
|
||||
static const char* EEX_CREATEIMPORTCSF = "CreateImportCsf" ;
|
||||
static const char* EEX_CREATEIMPORTCNC = "CreateImportCnc" ;
|
||||
static const char* EEX_CREATEIMPORTDXF = "CreateImportDxf" ;
|
||||
static const char* EEX_CREATEIMPORTSTL = "CreateImportStl" ;
|
||||
@@ -122,6 +123,21 @@ MySetEExKey( const string& sKey)
|
||||
pFun( sKey) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
IImportCsf*
|
||||
MyCreateImportCsf( void)
|
||||
{
|
||||
// verifico caricamento libreria EgtExchange
|
||||
if ( s_hEEx == nullptr)
|
||||
return nullptr ;
|
||||
// recupero funzione creazione oggetto
|
||||
typedef IImportCsf* (* PF_CreateImportCsf) ( void) ;
|
||||
PF_CreateImportCsf pFun = (PF_CreateImportCsf)GetProcAddress( s_hEEx, EEX_CREATEIMPORTCSF) ;
|
||||
if ( pFun == nullptr)
|
||||
return nullptr ;
|
||||
return pFun() ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
IImportCnc*
|
||||
MyCreateImportCnc( void)
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include <string>
|
||||
|
||||
class ILogger ;
|
||||
class IImportCsf ;
|
||||
class IImportCnc ;
|
||||
class IImportDxf ;
|
||||
class IImportStl ;
|
||||
@@ -31,6 +32,7 @@ void MySetEExLogger( ILogger* pLogger) ;
|
||||
void MySetEExKey( const std::string& sKey) ;
|
||||
const char* MyGetEExVersion( void) ;
|
||||
IImportCnc* MyCreateImportCnc( void) ;
|
||||
IImportCsf* MyCreateImportCsf( void) ;
|
||||
IImportDxf* MyCreateImportDxf( void) ;
|
||||
IImportStl* MyCreateImportStl( void) ;
|
||||
IExportDxf* MyCreateExportDxf( void) ;
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "/EgtDev/Include/EExImportStl.h"
|
||||
#include "/EgtDev/Include/EExImportDxf.h"
|
||||
#include "/EgtDev/Include/EExImportCnc.h"
|
||||
#include "/EgtDev/Include/EExImportCsf.h"
|
||||
#include "/EgtDev/Include/EExExportStl.h"
|
||||
#include "/EgtDev/Include/EExExportDxf.h"
|
||||
#include "/EgtDev/Include/EGnStringUtils.h"
|
||||
@@ -51,6 +52,8 @@ ExeGetFileType( const string& sFilePath)
|
||||
return 12 ;
|
||||
else if ( sFileExt == "CNC")
|
||||
return 13 ;
|
||||
else if ( sFileExt == "HED" || sFileExt == "ENT" || sFileExt == "ENS")
|
||||
return 14 ;
|
||||
else if ( sFileExt == "TSC")
|
||||
return 101 ;
|
||||
else if ( sFileExt == "LUA")
|
||||
@@ -156,6 +159,34 @@ ExeImportCnc( const string& sFilePath)
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeImportCsf( const string& sFilePath)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_GEOMDB( pGseCtx, false)
|
||||
bool bOk = true ;
|
||||
// importo il file CSF
|
||||
// preparo l'importatore
|
||||
PtrOwner<IImportCsf> pImpCsf( MyCreateImportCsf()) ;
|
||||
bOk = bOk && ! IsNull( pImpCsf) ;
|
||||
// eseguo l'importazione (direttamente nella radice)
|
||||
bOk = bOk && pImpCsf->Import( sFilePath, pGseCtx->m_pGeomDB) ;
|
||||
// aggiorno stato file corrente
|
||||
pGseCtx->m_sFilePath = sFilePath ;
|
||||
pGseCtx->m_bModified = true ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLuaPath = sFilePath ;
|
||||
ReplaceString( sLuaPath, "\\", "\\\\") ;
|
||||
string sLua = "EgtImportCsf('" + sLuaPath + "')" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco il risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeExportDxf( int nId, const string& sFilePath)
|
||||
|
||||
@@ -512,6 +512,16 @@ ExeRotatePartInRawPart( int nPartId, const Vector3d& vtAx, double dAngRotDeg)
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
ExeAddSubPiece( const string& sName, const Point3d& ptPos)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_MACHMGR( pGseCtx, false)
|
||||
// inserisco il sottopezzo nella posizione indicata
|
||||
return pGseCtx->m_pMachMgr->AddSubPiece( sName, ptPos) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSetAxisPos( const string& sAxis, double dVal)
|
||||
|
||||
Binary file not shown.
@@ -70,6 +70,21 @@ LuaImportCnc( lua_State* L)
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaImportCsf( lua_State* L)
|
||||
{
|
||||
// 1 parametro : path del file da importare
|
||||
string sFilePath ;
|
||||
LuaCheckParam( L, 1, sFilePath)
|
||||
LuaClearStack( L) ;
|
||||
// apro il file
|
||||
bool bOk = ExeImportCsf( sFilePath) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaExportDxf( lua_State* L)
|
||||
@@ -112,6 +127,7 @@ LuaInstallExchange( LuaMgr& luaMgr)
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtImportDxf", LuaImportDxf) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtImportStl", LuaImportStl) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtImportCnc", LuaImportCnc) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtImportCsf", LuaImportCsf) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtExportDxf", LuaExportDxf) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtExportStl", LuaExportStl) ;
|
||||
return bOk ;
|
||||
|
||||
@@ -506,6 +506,26 @@ LuaRotatePartInRawPart( lua_State* L)
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaAddSubPiece( lua_State* L)
|
||||
{
|
||||
// 2 parametri : sName, ptPos
|
||||
string sName ;
|
||||
LuaCheckParam( L, 1, sName)
|
||||
Point3d ptPos ;
|
||||
LuaCheckParam( L, 2, ptPos)
|
||||
LuaClearStack( L) ;
|
||||
// metto l'asse nella nuova posizione
|
||||
int nId = ExeAddSubPiece( sName, ptPos) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSetAxisPos( lua_State* L)
|
||||
@@ -765,6 +785,7 @@ LuaInstallMachMgr( LuaMgr& luaMgr)
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtRemovePartFromRawPart", LuaRemovePartFromRawPart) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtMovePartInRawPart", LuaTranslatePartInRawPart) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtRotatePartInRawPart", LuaRotatePartInRawPart) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtAddSubPiece", LuaAddSubPiece) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSetAxisPos", LuaSetAxisPos) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAxisPos", LuaGetAxisPos) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAxisHomePos", LuaGetAxisHomePos) ;
|
||||
|
||||
Reference in New Issue
Block a user