EgtExecutor 2.4k2 :
- aggiunta funzione Exe e Lua ApproxSurface.
This commit is contained in:
+55
-12
@@ -24,6 +24,7 @@
|
||||
#include "/EgtDev/Include/EGkCurveLocal.h"
|
||||
#include "/EgtDev/Include/EGkSurfFlatRegion.h"
|
||||
#include "/EgtDev/Include/EGkSurfTriMesh.h"
|
||||
#include "/EgtDev/Include/EGkSurfBezier.h"
|
||||
#include "/EgtDev/Include/EGkSurfLocal.h"
|
||||
#include "/EgtDev/Include/EGkStmFromTriangleSoup.h"
|
||||
#include "/EgtDev/Include/EGkCAvSimpleSurfFrMove.h"
|
||||
@@ -204,12 +205,54 @@ ExeExplodeSurface( int nId, int* pnCount)
|
||||
return nFirstId ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
ExeApproxSurface( int nId, double dLinTol)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// opero secondo il tipo di superficie
|
||||
PtrOwner<ISurfTriMesh> pStm ;
|
||||
int nType = pGeomDB->GetGeoType( nId) ;
|
||||
if ( nType == SRF_TRIMESH) {
|
||||
// copio la superficie
|
||||
const ISurfTriMesh* pStri = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
|
||||
pStm.Set( pStri != nullptr ? pStri->Clone() : nullptr) ;
|
||||
}
|
||||
else if ( nType == SRF_FLATRGN) {
|
||||
// recupero la superficie ausiliaria della regione
|
||||
const ISurfFlatRegion* pSfr = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId)) ;
|
||||
const ISurfTriMesh* pAuxSurf = ( pSfr != nullptr ? pSfr->GetAuxSurf() : nullptr) ;
|
||||
pStm.Set( pAuxSurf != nullptr ? pAuxSurf->Clone() : nullptr) ;
|
||||
}
|
||||
else if ( nType == SRF_BEZIER) {
|
||||
// recupero la superficie ausiliaria della Bezier
|
||||
const ISurfBezier* pSbez = GetSurfBezier( pGeomDB->GetGeoObj( nId)) ;
|
||||
const ISurfTriMesh* pAuxSurf = ( pSbez != nullptr ? pSbez->GetAuxSurf() : nullptr) ;
|
||||
pStm.Set( pAuxSurf != nullptr ? pAuxSurf->Clone() : nullptr) ;
|
||||
}
|
||||
bool bOk = ( ! IsNull( pStm)) ;
|
||||
// va inserita la semplificazione di una trimesh
|
||||
|
||||
// sostituisco la vecchia superficie con la nuova
|
||||
bOk = bOk && pGeomDB->ReplaceGeoObj( nId, Release( pStm)) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtApproxSurf(" + ToString( nId) + "," +
|
||||
ToString( dLinTol) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSurfFrAdd( int nId1, int nId2)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero la prima superficie FlatRegion
|
||||
ISurfFlatRegion* pSfr1 = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId1)) ;
|
||||
bool bOk = ( pSfr1 != nullptr) ;
|
||||
@@ -238,7 +281,7 @@ bool
|
||||
ExeSurfFrSubtract( int nId1, int nId2)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero la prima superficie FlatRegion
|
||||
ISurfFlatRegion* pSfr1 = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId1)) ;
|
||||
bool bOk = ( pSfr1 != nullptr) ;
|
||||
@@ -270,7 +313,7 @@ bool
|
||||
ExeSurfFrIntersect( int nId1, int nId2)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero la prima superficie FlatRegion
|
||||
ISurfFlatRegion* pSfr1 = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId1)) ;
|
||||
bool bOk = ( pSfr1 != nullptr) ;
|
||||
@@ -302,7 +345,7 @@ bool
|
||||
ExeSurfFrOffset( int nId, double dDist, int nType)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero la superficie FlatRegion
|
||||
ISurfFlatRegion* pSfr = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId)) ;
|
||||
bool bOk = ( pSfr != nullptr) ;
|
||||
@@ -328,7 +371,7 @@ bool
|
||||
ExeSurfFrMoveSimpleNoCollision( int nId1, int nId2, const Vector3d& vtDir, double& dLen, int nRefType)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero la prima superficie FlatRegion
|
||||
ISurfFlatRegion* pSfr1 = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId1)) ;
|
||||
bool bOk = ( pSfr1 != nullptr) ;
|
||||
@@ -350,7 +393,7 @@ bool
|
||||
ExeSurfFrRotateSimpleNoCollision( int nId1, int nId2, const Point3d& ptCen, double& dAngDeg, int nRefType)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero la prima superficie FlatRegion
|
||||
ISurfFlatRegion* pSfr1 = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId1)) ;
|
||||
bool bOk = ( pSfr1 != nullptr) ;
|
||||
@@ -510,7 +553,7 @@ bool
|
||||
ExeCutSurfTmPlane( int nId, const Point3d& ptOn, const Vector3d& vtN, bool bSaveOnEq, int nRefType)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero la superficie TriMesh
|
||||
ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
|
||||
bool bOk = ( pStm != nullptr) ;
|
||||
@@ -545,7 +588,7 @@ bool
|
||||
ExeCutSurfTmClosedCurve( int nSurfId, int nCurveId, bool bSaveOnEq)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero la superficie TriMesh
|
||||
ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nSurfId)) ;
|
||||
bool bOk = ( pStm != nullptr) ;
|
||||
@@ -575,7 +618,7 @@ bool
|
||||
ExeSurfTmAdd( int nId1, int nId2, bool bTwoColors)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero la prima superficie TriMesh
|
||||
ISurfTriMesh* pStm1 = GetSurfTriMesh( pGeomDB->GetGeoObj( nId1)) ;
|
||||
bool bOk = ( pStm1 != nullptr) ;
|
||||
@@ -607,7 +650,7 @@ bool
|
||||
ExeSurfTmSubtract( int nId1, int nId2, bool bTwoColors)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero la prima superficie TriMesh
|
||||
ISurfTriMesh* pStm1 = GetSurfTriMesh( pGeomDB->GetGeoObj( nId1)) ;
|
||||
bool bOk = ( pStm1 != nullptr) ;
|
||||
@@ -644,7 +687,7 @@ bool
|
||||
ExeSurfTmIntersect( int nId1, int nId2, bool bTwoColors)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero la prima superficie TriMesh
|
||||
ISurfTriMesh* pStm1 = GetSurfTriMesh( pGeomDB->GetGeoObj( nId1)) ;
|
||||
bool bOk = ( pStm1 != nullptr) ;
|
||||
@@ -681,7 +724,7 @@ bool
|
||||
ExeSurfTmResetTwoColors( int nId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero la superficie TriMesh
|
||||
ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
|
||||
bool bOk = ( pStm != nullptr) ;
|
||||
|
||||
Reference in New Issue
Block a user