EgtExecutor 1.9g1 :

- aggiunta gestione import punti in Exe e LUA
- corretta gestione regione sotto con lati inclinati interni di pezzi piatti (flatParts)
- aggiunta funzione Exe e Lua CAvGetToolOutline per avere profilo di utensile in uso nella CollisionAvoidance.
This commit is contained in:
Dario Sassi
2018-07-05 10:28:52 +00:00
parent aaeeab4d83
commit be54bcf382
9 changed files with 326 additions and 147 deletions
+81 -48
View File
@@ -26,6 +26,7 @@
#include "/EgtDev/Include/EExImportBtl.h"
#include "/EgtDev/Include/EExExportStl.h"
#include "/EgtDev/Include/EExExportDxf.h"
#include "/EgtDev/Include/EExImportPnt.h"
#include "/EgtDev/Include/EGnStringUtils.h"
#include "/EgtDev/Include/EgtStringConverter.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
@@ -61,6 +62,8 @@ ExeGetFileType( const string& sFilePath)
return FT_BTL ;
else if ( sFileExt == "PNG" || sFileExt == "JPG" || sFileExt == "JPEG" || sFileExt == "BMP")
return FT_IMG ;
else if ( sFileExt == "PNT" || sFileExt == "XYZ")
return FT_PNT ;
else if ( sFileExt == "TSC")
return FT_TSC ;
else if ( sFileExt == "LUA")
@@ -75,58 +78,25 @@ ExeGetFileType( const string& sFilePath)
//-----------------------------------------------------------------------------
bool
ExeImportDxf( const string& sFilePath, double dScaleFactor)
ExeImportBtl( const string& sFilePath, int nFlag)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_GEOMDB( pGseCtx, false)
bool bOk = true ;
// importo il file DXF
// aggiungo un gruppo pezzo
int nPartId = pGseCtx->m_pGeomDB->AddGroup( GDB_ID_NULL, GDB_ID_ROOT, Frame3d()) ;
// importo il file BTL
// preparo l'importatore
PtrOwner<IImportDxf> pImpDxf( MyCreateImportDxf()) ;
bOk = bOk && ! IsNull( pImpDxf) ;
// eseguo l'importazione
bOk = bOk && pImpDxf->Import( sFilePath, pGseCtx->m_pGeomDB, nPartId, dScaleFactor) ;
PtrOwner<IImportBtl> pImpBtl( MyCreateImportBtl()) ;
bOk = bOk && ! IsNull( pImpBtl) ;
// eseguo l'importazione (direttamente nella radice)
bOk = bOk && pImpBtl->Import( sFilePath, pGseCtx->m_pGeomDB, nFlag) ;
// 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 = "EgtImportDxf('" + StringToLuaString( sFilePath) + "'," +
ToString( dScaleFactor) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco il risultato
return bOk ;
}
//-----------------------------------------------------------------------------
bool
ExeImportStl( const string& sFilePath, double dScaleFactor)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_GEOMDB( pGseCtx, false)
bool bOk = true ;
// importo il file STL
// 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
PtrOwner<IImportStl> pImpStl( MyCreateImportStl()) ;
bOk = bOk && ! IsNull( pImpStl) ;
// eseguo l'importazione
bOk = bOk && pImpStl->Import( sFilePath, pGseCtx->m_pGeomDB, nLayerId, dScaleFactor) ;
// 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 = "EgtImportStl('" + StringToLuaString( sFilePath) + "'," +
ToString( dScaleFactor) + ")" +
string sLua = "EgtImportBtl('" + StringToLuaString( sFilePath) + "'," +
ToString( nFlag) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
@@ -193,24 +163,56 @@ ExeImportCsf( const string& sFilePath)
//-----------------------------------------------------------------------------
bool
ExeImportBtl( const string& sFilePath, int nFlag)
ExeImportDxf( const string& sFilePath, double dScaleFactor)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_GEOMDB( pGseCtx, false)
bool bOk = true ;
// importo il file BTL
// importo il file DXF
// aggiungo un gruppo pezzo
int nPartId = pGseCtx->m_pGeomDB->AddGroup( GDB_ID_NULL, GDB_ID_ROOT, Frame3d()) ;
// preparo l'importatore
PtrOwner<IImportBtl> pImpBtl( MyCreateImportBtl()) ;
bOk = bOk && ! IsNull( pImpBtl) ;
// eseguo l'importazione (direttamente nella radice)
bOk = bOk && pImpBtl->Import( sFilePath, pGseCtx->m_pGeomDB, nFlag) ;
PtrOwner<IImportDxf> pImpDxf( MyCreateImportDxf()) ;
bOk = bOk && ! IsNull( pImpDxf) ;
// eseguo l'importazione
bOk = bOk && pImpDxf->Import( sFilePath, pGseCtx->m_pGeomDB, nPartId, dScaleFactor) ;
// 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 = "EgtImportBtl('" + StringToLuaString( sFilePath) + "'," +
string sLua = "EgtImportDxf('" + StringToLuaString( sFilePath) + "'," +
ToString( dScaleFactor) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco il risultato
return bOk ;
}
//-----------------------------------------------------------------------------
bool
ExeImportPnt( const string& sFilePath, int nFlag)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_GEOMDB( pGseCtx, false)
bool bOk = true ;
// importo il file PNT
// aggiungo un gruppo pezzo
int nPartId = pGseCtx->m_pGeomDB->AddGroup( GDB_ID_NULL, GDB_ID_ROOT, Frame3d()) ;
// preparo l'importatore
PtrOwner<IImportPnt> pImpPnt( MyCreateImportPnt()) ;
bOk = bOk && ! IsNull( pImpPnt) ;
// eseguo l'importazione
bOk = bOk && pImpPnt->Import( sFilePath, pGseCtx->m_pGeomDB, nPartId, nFlag) ;
// 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 = "EgtImportPnt('" + StringToLuaString( sFilePath) + "'," +
ToString( nFlag) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
@@ -219,6 +221,37 @@ ExeImportBtl( const string& sFilePath, int nFlag)
return bOk ;
}
//-----------------------------------------------------------------------------
bool
ExeImportStl( const string& sFilePath, double dScaleFactor)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_GEOMDB( pGseCtx, false)
bool bOk = true ;
// importo il file STL
// 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
PtrOwner<IImportStl> pImpStl( MyCreateImportStl()) ;
bOk = bOk && ! IsNull( pImpStl) ;
// eseguo l'importazione
bOk = bOk && pImpStl->Import( sFilePath, pGseCtx->m_pGeomDB, nLayerId, dScaleFactor) ;
// 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 = "EgtImportStl('" + StringToLuaString( sFilePath) + "'," +
ToString( dScaleFactor) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco il risultato
return bOk ;
}
//-----------------------------------------------------------------------------
bool
ExeExportDxf( int nId, const string& sFilePath)