EgtExecutor 1.6v4 :

- aggiunta Exe e Lua InvertVector
- aggiunte Lua EgtCreateContext e EgtDeleteContext
- aggiunta Lua EgtSplitStringPlus.
This commit is contained in:
Dario Sassi
2016-10-18 18:37:08 +00:00
parent cd1e810cf1
commit 0d6a829de7
7 changed files with 142 additions and 33 deletions
+29
View File
@@ -98,6 +98,35 @@ ExeChangeVectorBase( int nId, const Point3d& ptB, int nRefType)
return bOk ;
}
//----------------------------------------------------------------------------
bool
ExeInvertVector( const INTVECTOR& vIds)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// eseguo inversione
bool bOk = true ;
for ( size_t i = 0 ; i < vIds.size() && bOk ; ++ i) {
int nId = (( vIds[i] != GDB_ID_SEL) ? vIds[i] : pGeomDB->GetFirstSelectedObj()) ;
while ( nId != GDB_ID_NULL && bOk) {
// recupero il vettore e lo inverto
IGeoVector3d* pGVect = GetGeoVector3d( pGeomDB->GetGeoObj( nId)) ;
bOk = ( pGVect != nullptr && pGVect->ChangeVector( - pGVect->GetVector())) ;
// passo alla successiva
nId = (( vIds[i] != GDB_ID_SEL) ? GDB_ID_NULL : pGeomDB->GetNextSelectedObj()) ;
}
}
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtInvertVector({" + IdListToString( vIds) + "})" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultato
return bOk ;
}
//-------------------------------------------------------------------------------
bool
ExeModifyText( int nId, const string& sNewText)