EgtInterface 1.6d5 :

- aggiunta EgtApproxCurveArc
- trasformata EgtExplodeCurveBezier in EgtApproxCurvebezier
- aggiunta EgtExplodeSurfTm.
This commit is contained in:
Dario Sassi
2015-04-27 08:27:14 +00:00
parent d63fa552c6
commit 55898a7ac9
5 changed files with 137 additions and 29 deletions
+45
View File
@@ -114,3 +114,48 @@ __stdcall EgtExtractSurfTmFacetLoops( int nId, int nFacet, int nDestGrpId, int*
*pnCount = nCount ;
return nFirstId ;
}
//-------------------------------------------------------------------------------
int
__stdcall EgtExplodeSurfTm( int nId, int* pnCount)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// recupero la superficie TriMesh
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pStm != nullptr) ;
// copio tutte le facce
int nFirstId = GDB_ID_NULL ;
int nCount = 0 ;
int nFacet = pStm->GetFacetNum() ;
for ( int i = 0 ; i < nFacet ; ++ i) {
ISurfTriMesh* pFac = pStm->CloneFacet( i) ;
if ( pFac == nullptr)
continue ;
// inserisco la superficie nello stesso gruppo e nello stesso posto del GeomDB
int nFacId = pGeomDB->InsertGeoObj( GDB_ID_NULL, nId, GDB_BEFORE, pFac) ;
bOk = bOk && ( nFacId != GDB_ID_NULL) ;
// copio gli attributi
bOk = bOk && pGeomDB->CopyAttributes( nId, nFacId) ;
// aggiorno contatori
if ( bOk) {
if ( nFirstId == GDB_ID_NULL)
nFirstId = nFacId ;
++ nCount ;
}
}
nFirstId = ( bOk ? nFirstId : GDB_ID_NULL) ;
// elimino la superficie
bOk = bOk && pGeomDB->Erase( nId) ;
EgtSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtExplodeSurfTm(" + ToString( nId) + ")" +
" -- Id1=" + ToString( nFirstId) + ",Nbr=" + ToString( nCount) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultati
if ( pnCount != nullptr)
*pnCount = nCount ;
return nFirstId ;
}