EgtExecutor 1.8c3 :
- aggiunte funzioni Exe e Lua GetFirstGhostPart e GetNextGhostPart.
This commit is contained in:
@@ -30,6 +30,14 @@ ExeIsUserObj( IGeomDB* pGeomDB, int nId)
|
||||
return ( pGeomDB->GetCalcLevel( nId, nLev) && nLev == GDB_LV_USER) ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static bool
|
||||
ExeIsSystemObj( IGeomDB* pGeomDB, int nId)
|
||||
{
|
||||
int nLev ;
|
||||
return ( pGeomDB->GetCalcLevel( nId, nLev) && nLev == GDB_LV_SYSTEM) ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static bool
|
||||
ExeIsVisibleObj( IGeomDB* pGeomDB, int nId)
|
||||
@@ -65,6 +73,24 @@ ExeVerifyOrPrev( IGeomDB* pGeomDB, int nId, bool bOnlyVisible)
|
||||
return GDB_ID_NULL ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
ExeGhostVerifyOrNext( IGeomDB* pGeomDB, int nId)
|
||||
{
|
||||
while ( nId != GDB_ID_NULL) {
|
||||
if ( ExeIsSystemObj( pGeomDB, nId) &&
|
||||
pGeomDB->ExistsInfo( nId, GDB_SI_SOURCE)) {
|
||||
int nPartId = GDB_ID_NULL ;
|
||||
pGeomDB->GetInfo( nId, GDB_SI_SOURCE, nPartId) ;
|
||||
int nRawId = pGeomDB->GetParentId( nPartId) ;
|
||||
if ( ExeIsRawPart( nRawId))
|
||||
return nId ;
|
||||
}
|
||||
nId = pGeomDB->GetNextGroup( nId) ;
|
||||
}
|
||||
return GDB_ID_NULL ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
ExeIsPart( int nPartId)
|
||||
@@ -318,6 +344,30 @@ ExeGetPrevLayer( int nId, bool bOnlyVisible)
|
||||
return ExeVerifyOrPrev( pGeomDB, nLayerId, bOnlyVisible) ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
ExeGetFirstGhostPart( void)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// recupero il primo gruppo sotto la radice
|
||||
int nPartId = pGeomDB->GetFirstGroupInGroup( GDB_ID_ROOT) ;
|
||||
// verifico oppure passo al primo successivo valido
|
||||
return ExeGhostVerifyOrNext( pGeomDB, nPartId) ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
ExeGetNextGhostPart( int nId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// recupero il successivo gruppo
|
||||
int nPartId = pGeomDB->GetNextGroup( nId) ;
|
||||
// verifico oppure passo al primo successivo valido
|
||||
return ExeGhostVerifyOrNext( pGeomDB, nPartId) ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
ExeEraseEmptyParts( void)
|
||||
|
||||
@@ -383,6 +383,16 @@ ExeGetNextRawPart( int nRawId)
|
||||
return pMachMgr->GetNextRawPart( nRawId) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeIsRawPart( int nRawId)
|
||||
{
|
||||
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
||||
VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL)
|
||||
// verifico se è un grezzo della macchinata corrente
|
||||
return pMachMgr->IsRawPart( nRawId) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
ExeAddRawPart( Point3d ptOrig, double dLength, double dWidth, double dHeight, Color cCol)
|
||||
|
||||
Binary file not shown.
@@ -277,6 +277,40 @@ LuaGetPrevLayer( lua_State* L)
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetFirstGhostPart( lua_State* L)
|
||||
{
|
||||
// nessuno parametro
|
||||
LuaClearStack( L) ;
|
||||
// cerco primo pezzo messo in grezzo
|
||||
int nId = ExeGetFirstGhostPart() ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetParam( L, nId) ;
|
||||
else
|
||||
LuaSetParam( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetNextGhostPart( lua_State* L)
|
||||
{
|
||||
// 1 parametro : nGhostPartId
|
||||
int nGhostPartId ;
|
||||
LuaCheckParam( L, 1, nGhostPartId)
|
||||
LuaClearStack( L) ;
|
||||
// cerco pezzo successivo messo in grezzo
|
||||
int nId = ExeGetNextGhostPart( nGhostPartId) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetParam( L, nId) ;
|
||||
else
|
||||
LuaSetParam( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaEraseEmptyParts( lua_State* L)
|
||||
@@ -387,6 +421,8 @@ LuaInstallGdbPartLayer( LuaMgr& luaMgr)
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetNextLayer", LuaGetNextLayer) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetLastLayer", LuaGetLastLayer) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetPrevLayer", LuaGetPrevLayer) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetFirstGhostPart", LuaGetFirstGhostPart) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetNextGhostPart", LuaGetNextGhostPart) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtEraseEmptyParts", LuaEraseEmptyParts) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSelectPartObjs", LuaSelectPartObjs) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtDeselectPartObjs", LuaDeselectPartObjs) ;
|
||||
|
||||
Reference in New Issue
Block a user