EgtExecutor 2.1i3 :

- aggiunte funzioni Exe e Lua SurfTmSwapFacets, SurfTmGetFacetBBox e SurfTmGetFacetBBoxGlob.
This commit is contained in:
Dario Sassi
2019-09-30 09:22:40 +00:00
parent f90534e36e
commit 9f8be941b5
3 changed files with 125 additions and 1 deletions
+56
View File
@@ -632,6 +632,62 @@ ExeCopySurfTmFacet( int nId, int nFacet, int nDestGrpId)
return nFacId ;
}
//-------------------------------------------------------------------------------
int
ExeSurfTmSwapFacets( int nId, int nFacet1, int nFacet2)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie TriMesh
ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pStm != nullptr) ;
// eseguo lo scambio
bOk = bOk && pStm->SwapFacets( nFacet1, nFacet2) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfTmSwapFacets(" + ToString( nId) + "," +
ToString( nFacet1) + "," +
ToString( nFacet2) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultato
return bOk ;
}
//-----------------------------------------------------------------------------
bool
ExeSurfTmGetFacetBBox( int nId, int nFacet, int nFlag, BBox3d& b3Box)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie TriMesh
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
if ( pStm == nullptr)
return false ;
// recupero il bounding box della faccia dell'oggetto in locale
return pStm->GetFacetLocalBBox( nFacet, b3Box, nFlag) ;
}
//-----------------------------------------------------------------------------
bool
ExeSurfTmGetFacetBBoxGlob( int nId, int nFacet, int nFlag, BBox3d& b3Box)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie TriMesh
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
if ( pStm == nullptr)
return false ;
// recupero il riferimento globale del gruppo cui appartiene
Frame3d frGlob ;
if ( nId != GDB_ID_ROOT && ! pGeomDB->GetGroupGlobFrame( pGeomDB->GetParentId( nId), frGlob))
return false ;
// recupero il bounding box della faccia dell'oggetto in globale
return pStm->GetFacetBBox( nFacet, frGlob, b3Box, nFlag) ;
}
//-------------------------------------------------------------------------------
bool
ExeCutSurfTmPlane( int nId, const Point3d& ptOn, const Vector3d& vtN, bool bSaveOnEq, int nRefType)