EgtExecutor 1.6v4 :
- aggiunta Exe e Lua InvertVector - aggiunte Lua EgtCreateContext e EgtDeleteContext - aggiunta Lua EgtSplitStringPlus.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user