EgtInterface 1.6a6 :

- sistemate funzioni su Project (New, Open, Insert, Save, SaveAs, Import, Export) e Exec.
This commit is contained in:
Dario Sassi
2015-01-28 11:58:50 +00:00
parent 1bea531b4f
commit f039e22297
8 changed files with 169 additions and 31 deletions
+67 -10
View File
@@ -82,14 +82,25 @@ EgtImportDxf( const string& sFilePath)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
bool bOk = true ;
// importo il file DXF
// aggiungo un gruppo pezzo
int nPartId = pGeomDB->AddGroup( GDB_ID_NULL, GDB_ID_ROOT, Frame3d()) ;
// preparo l'importatore
PtrOwner<IImportDxf> pImpDxf( CreateImportDxf()) ;
VERIFY_NULL( Get( pImpDxf), "Error in CreateImportDxf", false)
bOk = bOk && ! IsNull( pImpDxf) ;
// eseguo l'importazione
return pImpDxf->Import( sFilePath, pGeomDB, nPartId) ;
bOk = bOk && pImpDxf->Import( sFilePath, pGeomDB, nPartId) ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLuaPath = sFilePath ;
ReplaceString( sLuaPath, "\\", "\\\\") ;
string sLua = "EgtImportDxf('" + sLuaPath + "')" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco il risultato
return bOk ;
}
//-----------------------------------------------------------------------------
@@ -105,15 +116,26 @@ EgtImportStl( const string& sFilePath)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
bool bOk = true ;
// importo il file STL
// aggiungo un gruppo pezzo e un gruppo layer
int nPartId = pGeomDB->AddGroup( GDB_ID_NULL, GDB_ID_ROOT, Frame3d()) ;
int nLayerId = pGeomDB->AddGroup( GDB_ID_NULL, nPartId, Frame3d()) ;
// preparo l'importatore
PtrOwner<IImportStl> pImpStl( CreateImportStl()) ;
VERIFY_NULL( Get( pImpStl), "Error in CreateImportStl", false)
bOk = bOk && ! IsNull( pImpStl) ;
// eseguo l'importazione
return pImpStl->Import( sFilePath, pGeomDB, nLayerId) ;
bOk = bOk && pImpStl->Import( sFilePath, pGeomDB, nLayerId) ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLuaPath = sFilePath ;
ReplaceString( sLuaPath, "\\", "\\\\") ;
string sLua = "EgtImportStl('" + sLuaPath + "')" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco il risultato
return bOk ;
}
//-----------------------------------------------------------------------------
@@ -129,14 +151,25 @@ EgtImportCnc( const string& sFilePath)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
bool bOk = true ;
// importo il file CNC
// aggiungo un gruppo pezzo
int nPartId = pGeomDB->AddGroup( GDB_ID_NULL, GDB_ID_ROOT, Frame3d()) ;
// preparo l'importatore
PtrOwner<IImportCnc> pImpCnc( CreateImportCnc()) ;
VERIFY_NULL( Get( pImpCnc), "Error in CreateImportCnc", false)
bOk = bOk && ! IsNull( pImpCnc) ;
// eseguo l'importazione
return pImpCnc->Import( sFilePath, pGeomDB, nPartId) ;
bOk = bOk && pImpCnc->Import( sFilePath, pGeomDB, nPartId) ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLuaPath = sFilePath ;
ReplaceString( sLuaPath, "\\", "\\\\") ;
string sLua = "EgtImportCnc('" + sLuaPath + "')" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco il risultato
return bOk ;
}
//-----------------------------------------------------------------------------
@@ -152,12 +185,24 @@ EgtExportDxf( int nId, const string& sFilePath)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
bool bOk = true ;
// esporto il file DXF
// preparo l'esportatore
PtrOwner<IExportDxf> pExpDxf( CreateExportDxf()) ;
VERIFY_NULL( Get( pExpDxf), "Error in CreateExportDxf", false)
bOk = bOk && ! IsNull( pExpDxf) ;
// eseguo l'esportazione
return pExpDxf->Export( pGeomDB, nId, sFilePath) ;
bOk = bOk && pExpDxf->Export( pGeomDB, nId, sFilePath) ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLuaPath = sFilePath ;
ReplaceString( sLuaPath, "\\", "\\\\") ;
string sLua = "EgtExportDxf(" + ToString( nId) + ",'" +
sLuaPath + "')" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco il risultato
return bOk ;
}
//-----------------------------------------------------------------------------
@@ -173,10 +218,22 @@ EgtExportStl( int nId, const string& sFilePath)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
bool bOk = true ;
// esporto il file STL
// preparo l'esportatore
PtrOwner<IExportStl> pExpStl( CreateExportStl()) ;
VERIFY_NULL( Get( pExpStl), "Error in CreateExportStl", false)
bOk = bOk && ! IsNull( pExpStl) ;
// eseguo l'esportazione
return pExpStl->Export( pGeomDB, nId, sFilePath) ;
bOk = bOk && pExpStl->Export( pGeomDB, nId, sFilePath) ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLuaPath = sFilePath ;
ReplaceString( sLuaPath, "\\", "\\\\") ;
string sLua = "EgtExportStl(" + ToString( nId) + ",'" +
sLuaPath + "')" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco il risultato
return bOk ;
}