EgtExecutor :
- aggiunte funzioni Exe e Lua SurfTmFacetAdjacencies e SurfTmFacetsContact.
This commit is contained in:
@@ -993,6 +993,20 @@ ExeSurfTmFacetFromTria( int nId, int nT)
|
||||
return pStm->GetFacetFromTria( nT) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSurfTmFacetAdjacencies( int nId, int nFacet, INTMATRIX& vAdj)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// recupero la superficie TriMesh
|
||||
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
|
||||
bool bOk = ( pStm != nullptr) ;
|
||||
// recupero le adiacenze
|
||||
bOk = bOk && pStm->GetFacetAdjacencies( nFacet, vAdj) ;
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSurfTmFacetNearestEndPoint( int nId, int nFacet, const Point3d& ptNear, int nRefId,
|
||||
@@ -1071,6 +1085,26 @@ ExeSurfTmFacetNormVersor( int nId, int nFacet, int nRefId, Vector3d& vtNorm)
|
||||
return TrasformVector( pGeomDB, nId, nRefId, vtNorm) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSurfTmFacetsContact( int nId, int nF1, int nF2, int nRefId, bool& bAdjac, Point3d& ptP1, Point3d& ptP2, double& dAng)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero la superficie trimesh
|
||||
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pStm == nullptr)
|
||||
return false ;
|
||||
// recupero i dati di contatto tra le due facce
|
||||
if ( ! pStm->GetFacetsContact( nF1, nF2, bAdjac, ptP1, ptP2, dAng))
|
||||
return false ;
|
||||
// gestione trasformazione ( eventuale)
|
||||
if ( bAdjac)
|
||||
return TrasformPoint( pGeomDB, nId, nRefId, ptP1) && TrasformPoint( pGeomDB, nId, nRefId, ptP2) ;
|
||||
else
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeTextNormVersor( int nId, int nRefId, Vector3d& vtNorm)
|
||||
|
||||
@@ -648,6 +648,27 @@ LuaSurfTmFacetCount( lua_State* L)
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSurfTmFacetAdjacencies( lua_State* L)
|
||||
{
|
||||
// 2 parametri : nId, nFacet
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
int nFacet ;
|
||||
LuaCheckParam( L, 2, nFacet)
|
||||
LuaClearStack( L) ;
|
||||
// recupero le adiacenze della faccetta della superficie
|
||||
INTMATRIX vAdj ;
|
||||
bool bOk = ExeSurfTmFacetAdjacencies( nId, nFacet, vAdj) ;
|
||||
// restituisco il risultato
|
||||
if ( bOk)
|
||||
LuaSetParam( L, vAdj) ;
|
||||
else
|
||||
LuaSetParam( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSurfTmFacetNearestEndPoint( lua_State* L)
|
||||
@@ -751,6 +772,39 @@ LuaSurfTmFacetNormVersor( lua_State* L)
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSurfTmFacetsContact( lua_State* L)
|
||||
{
|
||||
// 3 o 4 parametri : Id, nF1, nF2 [, nRefId]
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
int nF1 ;
|
||||
LuaCheckParam( L, 2, nF1)
|
||||
int nF2 ;
|
||||
LuaCheckParam( L, 3, nF2)
|
||||
int nRefId = nId ;
|
||||
LuaGetParam( L, 4, nRefId) ;
|
||||
LuaClearStack( L) ;
|
||||
// recupero i dati di contatto tra le due facce
|
||||
bool bAdjac ;
|
||||
Point3d ptP1, ptP2 ;
|
||||
double dAng = 0 ;
|
||||
if ( ExeSurfTmFacetsContact( nId, nF1, nF2, nRefId, bAdjac, ptP1, ptP2, dAng)) {
|
||||
LuaSetParam( L, bAdjac) ;
|
||||
LuaSetParam( L, ptP1) ;
|
||||
LuaSetParam( L, ptP2) ;
|
||||
LuaSetParam( L, dAng) ;
|
||||
}
|
||||
else {
|
||||
LuaSetParam( L) ;
|
||||
LuaSetParam( L) ;
|
||||
LuaSetParam( L) ;
|
||||
LuaSetParam( L) ;
|
||||
}
|
||||
return 4 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaTextNormVersor( lua_State* L)
|
||||
@@ -808,10 +862,12 @@ LuaInstallGeoSnap( LuaMgr& luaMgr)
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrChunkCount", LuaSurfFrChunkCount) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrChunkSimpleClassify", LuaSurfFrChunkSimpleClassify) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetCount", LuaSurfTmFacetCount) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetAdjacencies", LuaSurfTmFacetAdjacencies) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetNearestEndPoint", LuaSurfTmFacetNearestEndPoint) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetNearestMidPoint", LuaSurfTmFacetNearestMidPoint) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetCenter", LuaSurfTmFacetCenter) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetNormVersor", LuaSurfTmFacetNormVersor) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetsContact", LuaSurfTmFacetsContact) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtTextNormVersor", LuaTextNormVersor) ;
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user