EgtInterface 1.6b6 :

- aggiornamenti vari
- introdotto comando per merge (cucitura) di superfici
- migliorata gestione oggetti selezionati in comandi.
This commit is contained in:
Dario Sassi
2015-03-11 09:06:35 +00:00
parent 5e3c729190
commit b0389f3fda
28 changed files with 1168 additions and 614 deletions
+1 -104
View File
@@ -22,7 +22,6 @@
#include "/EgtDev/Include/EInConst.h"
#include "/EgtDev/Include/EgkGeoPoint3d.h"
#include "/EgtDev/Include/EgkGeoVector3d.h"
#include "/EgtDev/Include/EgkSurfTriMesh.h"
#include "/EgtDev/Include/EgkExtText.h"
#include "/EgtDev/Include/EGkStringUtils3d.h"
#include "/EgtDev/Include/EGnStringConverter.h"
@@ -112,108 +111,6 @@ __stdcall EgtChangeVectorBase( int nId, const double ptB[3], int nRefType)
return ( bOk ? TRUE : FALSE) ;
}
//----------------------------------------------------------------------------
BOOL
__stdcall EgtInvertSurface( int nId)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, FALSE)
bool bOk = true ;
// eseguo inversione singola
if ( nId != GDB_ID_SEL) {
// recupero la superficie e la inverto
ISurf* pSurf = GetSurf( pGeomDB->GetGeoObj( nId)) ;
if ( pSurf != nullptr && ! pSurf->Invert())
bOk = false ;
}
// eseguo inversione dei selezionati
else {
int nI = pGeomDB->GetFirstSelectedObj() ;
while ( nI != GDB_ID_NULL && bOk) {
// recupero la superficie e la inverto
ISurf* pSurf = GetSurf( pGeomDB->GetGeoObj( nI)) ;
if ( pSurf != nullptr && ! pSurf->Invert())
bOk = false ;
// passo alla successiva
nI = pGeomDB->GetNextSelectedObj() ;
}
}
EgtSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtInvertSurf(" + ( nId != GDB_ID_SEL ? ToString( nId) : "GDB_ID_SEL") + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultato
return ( bOk ? TRUE : FALSE) ;
}
//----------------------------------------------------------------------------
BOOL
__stdcall EgtSurfTmDoSewing( int nNumId, const int nIds[], BOOL bErase)
{
INTVECTOR vIds ;
vIds.reserve( nNumId) ;
for ( int i = 0 ; i < nNumId ; ++i) {
vIds.push_back( nIds[i]) ;
}
return ( EgtSurfTmDoSewing( vIds, ( bErase != FALSE)) ? TRUE : FALSE) ;
}
//----------------------------------------------------------------------------
bool
EgtSurfTmDoSewing( const INTVECTOR& vIds, bool bErase)
{
// --- tutte le superfici vengono cucite alla prima ---
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// almeno un oggetto nell'elenco
bool bOk = ( vIds.size() > 0) ;
// recupero la prima superficie
ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( vIds[0])) ;
bOk = bOk && ( pStm != nullptr) ;
// ne recupero il riferimento
Frame3d frStm ;
bOk = bOk && pGeomDB->GetGlobFrame( vIds[0], frStm) ;
// esecuzione
for ( size_t i = 1 ; bOk && i < vIds.size() ; ++ i) {
// recupero la superficie da cucire
const ISurfTriMesh* pStmS = GetSurfTriMesh( pGeomDB->GetGeoObj( vIds[i])) ;
bOk = bOk && ( pStmS != nullptr) ;
// recupero il riferimento
Frame3d frStmS ;
bOk = bOk && pGeomDB->GetGlobFrame( vIds[i], frStmS) ;
// lo esprimo rispetto a quello della prima superficie
frStmS.ToLoc( frStm) ;
// eseguo la cucitura
bOk = bOk && pStm->DoSewing( *pStmS, frStm) ;
}
// compatto
bOk = bOk && pStm->DoCompacting() ;
// se richiesto, cancello le superfici cucite alla prima
if ( bOk && bErase) {
for ( size_t i = 1 ; i < vIds.size() ; ++ i)
pGeomDB->Erase( vIds[i]) ;
}
EgtSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sIds ;
for ( size_t i = 0 ; i < vIds.size() ; ++ i) {
if ( i > 0)
sIds += "," ;
sIds += vIds[i] ;
}
string sLua = "EgtSurfTmDoSewing({" + sIds + "}," +
( bErase ? "true" : "false") + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco il risultato
return bOk ;
}
//-------------------------------------------------------------------------------
BOOL
__stdcall EgtModifyText( int nId, const wchar_t* wsNewText)
@@ -300,7 +197,7 @@ __stdcall EgtExplodeText( int nId)
bOk = bOk && pTXT->GetOutline( lstPCRV) ;
// inserisco le curve nella stessa posizione del testo
ICURVEPLIST::iterator iIter ;
for ( iIter = lstPCRV.begin() ; bOk && iIter != lstPCRV.end() ; ++ iIter) {
for ( iIter = lstPCRV.begin() ; iIter != lstPCRV.end() ; ++ iIter) {
// inserisco la curva nello stesso gruppo e nello stesso posto del GeomDB
int nCrvId = pGeomDB->InsertGeoObj( GDB_ID_NULL, nId, GDB_BEFORE, (*iIter)) ;
if ( nCrvId == GDB_ID_NULL)