EgtExecutor 1.6k1 :

- aggiunto offset di regione
- se operazioni su regioni producono regione vuota, si cancella.
This commit is contained in:
Dario Sassi
2015-11-03 21:27:09 +00:00
parent 9b181e4b87
commit 187b45cec0
4 changed files with 53 additions and 1 deletions
+1 -1
View File
@@ -239,7 +239,7 @@ ExeCreateSurfFlatRegion( int nParentId, INTVECTOR& vCrvIds, int* pnCount)
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfFlatRegion(" + IdToString( nParentId) + ",{" +
IdListToString( vCrvIds) + "}," +
IdListToString( vCrvIds) + "})" +
" -- Id=" + ToString( nFirstId) + ",Nbr=" + ToString( nCount) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
+32
View File
@@ -232,6 +232,9 @@ ExeSurfFrSubtract( int nId1, int nId2)
}
// eseguo la sottrazione della seconda superficie dalla prima
bOk = bOk && pSfr1->Subtract( *pSfr2L) ;
// se il risultato è vuoto, cancello la FlatRegion
if ( bOk && ! pSfr1->IsValid())
pGeomDB->Erase( nId1) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
@@ -272,6 +275,9 @@ ExeSurfFrIntersect( int nId1, int nId2)
}
// eseguo l'intersezione tra le due superfici
bOk = bOk && pSfr1->Intersect( *pSfr2L) ;
// se il risultato è vuoto, cancello la FlatRegion
if ( bOk && ! pSfr1->IsValid())
pGeomDB->Erase( nId1) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
@@ -283,6 +289,32 @@ ExeSurfFrIntersect( int nId1, int nId2)
return bOk ;
}
//----------------------------------------------------------------------------
bool
ExeSurfFrOffset( int nId, double dDist, int nType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// recupero la superficie FlatRegion
ISurfFlatRegion* pSfr = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pSfr != nullptr) ;
// eseguo l'offset
bOk = bOk && pSfr->Offset( dDist, nType) ;
// se il risultato è vuoto, cancello la FlatRegion
if ( bOk && ! pSfr->IsValid())
pGeomDB->Erase( nId) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfFrOffset(" + ToString( nId) + "," +
ToString( dDist) + "," +
ToString( nType) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
//----------------------------------------------------------------------------
int
ExeExtractSurfFrChunkLoops( int nId, int nChunk, int nDestGrpId, int* pnCount)
BIN
View File
Binary file not shown.
+20
View File
@@ -16,6 +16,7 @@
#include "LUA.h"
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EXeConst.h"
#include "/EgtDev/Include/EGkCurve.h"
#include "/EgtDev/Include/EGkGdbConst.h"
#include "/EgtDev/Include/EGkLuaAux.h"
@@ -104,6 +105,24 @@ LuaSurfFrIntersect( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaSurfFrOffset( lua_State* L)
{
// 3 parametri : Id, dDist, nType
int nId ;
LuaCheckParam( L, 1, nId)
double dDist ;
LuaCheckParam( L, 2, dDist)
int nType = ICurve::OFF_FILLET ;
LuaGetParam( L, 3, nType) ;
LuaClearStack( L) ;
// eseguo l'offset della regione
bool bOk = ExeSurfFrOffset( nId, dDist, nType) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaExtractSurfFrChunkLoops( lua_State* L)
@@ -162,6 +181,7 @@ LuaInstallGdbModifySurf( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrAdd", LuaSurfFrAdd) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrSubtract", LuaSurfFrSubtract) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrIntersect", LuaSurfFrIntersect) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrOffset", LuaSurfFrOffset) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtExtractSurfFrChunkLoops", LuaExtractSurfFrChunkLoops) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtExtractSurfTmFacetLoops", LuaExtractSurfTmFacetLoops) ;
return bOk ;