EgtExecutor :

- aggiunte funzioni exe e lua CreateSurfTmPyramidFrustum e CreateSurfTmConeFrustum
- adattata funzione ExeCreateSurfTmPyramid a modifiche di GeomKernel per avere funzionamento da esterno inalterato
- piccole sistemazioni.
This commit is contained in:
Dario Sassi
2025-03-27 15:30:27 +01:00
parent 5f8961860a
commit 034635ae1d
3 changed files with 157 additions and 20 deletions
+66 -4
View File
@@ -747,9 +747,9 @@ ExeCreateSurfTmPyramid( int nParentId, const Point3d& ptIni, const Point3d& ptCr
// creo la piramide nel suo riferimento intrinseco
PtrOwner<ISurfTriMesh> pSTM( GetSurfTriMeshPyramid( abs( dWidth), dLen, dHeight)) ;
bOk = bOk && ! IsNull( pSTM) ;
// eventuale traslazione per larghezza negativa
if ( bOk && dWidth < 0)
pSTM->Translate( Vector3d( dWidth, 0, 0)) ;
// traslazione per riferimento BL e anche per eventuale larghezza negativa
if ( bOk)
pSTM->Translate( Vector3d( dWidth / 2 + min( dWidth, 0.), dLen / 2, 0)) ;
// porto la piramide nel riferimento locale
bOk = bOk && pSTM->ToGlob( frBox) ;
// inserisco la superficie nel DB
@@ -890,6 +890,63 @@ ExeCreateSurfTmSphere( int nParentId, const Point3d& ptOrig,
return nNewId ;
}
//-------------------------------------------------------------------------------
int
ExeCreateSurfTmPyramidFrustum( int nParentId, double dBaseDimX, double dBaseDimY, double dTopDimX, double dTopDimY, double dHeight)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
bool bOk = true ;
// creo il tronco di cono
PtrOwner<ISurfTriMesh> pSTM( GetSurfTriMeshPyramidFrustum( dBaseDimX, dBaseDimY, dTopDimX, dTopDimY, dHeight)) ;
bOk = bOk && ! IsNull( pSTM) ;
// inserisco la superficie nel DB
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pSTM)) : GDB_ID_NULL) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfTmPyramidFrustum(" + IdToString( nParentId) + "," +
ToString( dBaseDimX) + "," +
ToString( dBaseDimY) + "," +
ToString( dTopDimX) + "," +
ToString( dTopDimY) + "," +
ToString( dHeight) + ")" +
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
return nNewId ;
}
//-------------------------------------------------------------------------------
int
ExeCreateSurfTmConeFrustum( int nParentId, double dBaseRad, double dTopRad, double dHeight, double dLinTol)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
bool bOk = true ;
// creo il tronco di cono
PtrOwner<ISurfTriMesh> pSTM( GetSurfTriMeshConeFrustum( dBaseRad, dTopRad, dHeight, dLinTol)) ;
bOk = bOk && ! IsNull( pSTM) ;
// inserisco la superficie nel DB
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pSTM)) : GDB_ID_NULL) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfTmConeFrustum(" + IdToString( nParentId) + "," +
ToString( dBaseRad) + "," +
ToString( dTopRad) + "," +
ToString( dHeight) + "," +
ToString( dLinTol) + ")" +
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
return nNewId ;
}
//-------------------------------------------------------------------------------
int
ExeCreateSurfTmTriangle( int nParentId, const Point3d& ptP1, const Point3d& ptP2, const Point3d& ptP3, int nRefType)
@@ -1478,10 +1535,15 @@ ExeCreateSurfTmRuled( int nParentId, int nPtOrCrvId1, int nPtOrCrvId2, int nType
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sType = "'IP'" ;
if ( nType == ISurfTriMesh::RLT_MINDIST)
sType = "'MD'" ;
else if ( nType == ISurfTriMesh::RLT_ISOPAR_SMOOTH)
sType = "'IP_SM'" ;
string sLua = "EgtSurfTmRuled(" + IdToString( nParentId) + "," +
ToString( nPtOrCrvId1) + "," +
ToString( nPtOrCrvId2) + "," +
( nType == ISurfTriMesh::RLT_MINDIST ? "'MD'" : "'IP'") + "," +
sType + "," +
ToString( dLinTol) + ")" +
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;