EgtExecutor 1.8k2 :
- aggiunta funzione Exe e Lua Transform che porta gli oggetti nel globale de riferimento indicato.
This commit is contained in:
@@ -23,6 +23,65 @@
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
ExeTransform( INTVECTOR& vIds, const Frame3d& frRef, int nRefType)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
bool bOk = true ;
|
||||
// se trasformazione espressa in locale
|
||||
if ( nRefType == RTY_LOC) {
|
||||
// verifico che tutti gli oggetti siano nello stesso riferimento
|
||||
bOk = bOk && VerifySameFrame( pGeomDB, vIds) ;
|
||||
// ciclo sul vettore degli identificativi
|
||||
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) {
|
||||
// eseguo trasformazione
|
||||
IGeoObj* pGObj = pGeomDB->GetGeoObj( nId) ;
|
||||
if ( pGObj == nullptr || ! pGObj->ToGlob( frRef))
|
||||
bOk = false ;
|
||||
// passo alla successiva
|
||||
nId = (( vIds[i] != GDB_ID_SEL) ? GDB_ID_NULL : pGeomDB->GetNextSelectedObj()) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
// altrimenti in globale o in griglia
|
||||
else {
|
||||
Frame3d frRefG = frRef ;
|
||||
// se griglia, porto il vettore in globale
|
||||
if ( nRefType == RTY_GRID)
|
||||
frRefG.ToGlob( pGeomDB->GetGridFrame()) ;
|
||||
// ciclo sul vettore degli identificativi
|
||||
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) {
|
||||
// eseguo trasformazione
|
||||
IGeoObj* pGObj = pGeomDB->GetGeoObj( nId) ;
|
||||
if ( pGObj == nullptr || ! pGObj->ToGlob( frRefG))
|
||||
bOk = false ;
|
||||
// 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 = "EgtTransform({" + IdListToString( vIds) + "},{{" +
|
||||
ToString( frRef.Orig()) + "},{" +
|
||||
ToString( frRef.VersX()) + "},{" +
|
||||
ToString( frRef.VersY()) + "},{" +
|
||||
ToString( frRef.VersZ()) + "}}," +
|
||||
RefTypeToString( nRefType) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
ExeMove( INTVECTOR& vIds, const Vector3d& vtMove, int nRefType)
|
||||
|
||||
Reference in New Issue
Block a user