EgtExecutor :
- aggiunte funzioni Exe ExeSetUserLevel e ExeGetUserLevel - aggiunta funzione Lua EgtGetUserLevel - piccola modifica (Exe e Lua) a calcolo intersezioni piani paralleli con superficie.
This commit is contained in:
@@ -44,6 +44,7 @@ static int s_nDebugLev = 0 ;
|
||||
static Logger* s_pGenLog = nullptr ;
|
||||
static bool s_bCmdLog = false ;
|
||||
static Logger* s_pCmdLog = nullptr ;
|
||||
static int s_nUserLev = 1 ;
|
||||
static string s_sKey ;
|
||||
static int s_nKeyType = KEY_LOCK_TYPE_ANY ;
|
||||
static int s_nKeyExpDays = 0 ;
|
||||
@@ -195,6 +196,21 @@ ExeGetDebugLevel( void)
|
||||
return s_nDebugLev ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSetUserLevel( int nUserLev)
|
||||
{
|
||||
s_nUserLev = max( nUserLev, 1) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
ExeGetUserLevel( void)
|
||||
{
|
||||
return s_nUserLev ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSetKey( const string& sKey)
|
||||
|
||||
+9
-8
@@ -371,7 +371,7 @@ ExeLineSurfTmInters( const Point3d& ptP, const Vector3d& vtDir, int nId, int nRe
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
MyAddPlaneStmIntersResultToGeomDB( IGeomDB * pGeomDB, const PNTVECTOR& vPnt, const BIPNTVECTOR& vBpt, const TRIA3DVECTOR& vTria,
|
||||
MyAddPlaneStmIntersResultToGeomDB( IGeomDB* pGeomDB, const PNTVECTOR& vPnt, const BIPNTVECTOR& vBpt, const TRIA3DVECTOR& vTria,
|
||||
const Frame3d& frOrig, const Frame3d& frDest, int nId, int nDestGrpId, const Vector3d& vtExtr,
|
||||
double dToler, int& nPntCount, int& nCrvCount, int& nSrfCount)
|
||||
{
|
||||
@@ -494,6 +494,7 @@ MyAddPlaneStmIntersResultToGeomDB( IGeomDB * pGeomDB, const PNTVECTOR& vPnt, con
|
||||
|
||||
return nFirstId ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
MyPlaneSurfTmInters( const Point3d& ptOn, const Vector3d& vtN, int nId, int nDestGrpId, int nRefType, double dToler,
|
||||
@@ -569,7 +570,7 @@ ExePlaneSurfTmInters( const Point3d& ptOn, const Vector3d& vtN, int nId, int nDe
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
MyParPlanesSurfTmInters( const Vector3d& vtN, const Point3d& pt, const DBLVECTOR& vdDist, int nId, int nDestGrpId, int nRefType, double dToler, int& nGrpCount)
|
||||
MyParPlanesSurfTmInters( const Point3d& ptOn, const Vector3d& vtN, const DBLVECTOR& vdDist, int nId, int nDestGrpId, int nRefType, double dToler, int& nGrpCount)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
@@ -587,11 +588,11 @@ MyParPlanesSurfTmInters( const Vector3d& vtN, const Point3d& pt, const DBLVECTOR
|
||||
return GDB_ID_NULL ;
|
||||
|
||||
// porto in locale la normale del piano
|
||||
Point3d ptOnL = GetPointLocal( pGeomDB, ptOn, nRefType, frSurf) ;
|
||||
Vector3d vtNL = GetVectorLocal( pGeomDB, vtN, nRefType, frSurf) ;
|
||||
Point3d ptL = GetPointLocal( pGeomDB, pt, nRefType, frSurf) ;
|
||||
// costruisco il frame dei piani
|
||||
Frame3d frPlanes ;
|
||||
frPlanes.Set( ptL, vtNL) ;
|
||||
frPlanes.Set( ptOnL, vtNL) ;
|
||||
|
||||
// intersezione fra superficie e piani paralleli
|
||||
IntersParPlanesSurfTm intPlStm( frPlanes, *pStm) ;
|
||||
@@ -626,12 +627,12 @@ MyParPlanesSurfTmInters( const Vector3d& vtN, const Point3d& pt, const DBLVECTOR
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
ExeParPlanesSurfTmInters( const Vector3d& vtN, const Point3d& pt, const DBLVECTOR& vdDist, int nId, int nDestGrpId, int nRefType, double dToler,
|
||||
ExeParPlanesSurfTmInters( const Point3d& ptOn, const Vector3d& vtN, const DBLVECTOR& vdDist, int nId, int nDestGrpId, int nRefType, double dToler,
|
||||
int* pnGrpCount)
|
||||
{
|
||||
// eseguo
|
||||
int nGrpCount{ 0} ;
|
||||
int nFirstId = MyParPlanesSurfTmInters( vtN, pt, vdDist, nId, nDestGrpId, nRefType, dToler, nGrpCount) ;
|
||||
int nFirstId = MyParPlanesSurfTmInters( ptOn, vtN, vdDist, nId, nDestGrpId, nRefType, dToler, nGrpCount) ;
|
||||
// aggiorno contatori
|
||||
if ( nFirstId != GDB_ID_NULL) {
|
||||
if ( pnGrpCount != nullptr)
|
||||
@@ -641,8 +642,8 @@ ExeParPlanesSurfTmInters( const Vector3d& vtN, const Point3d& pt, const DBLVECTO
|
||||
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtParPlanesSurfTmInters({" + ToString( vtN) + "},{" +
|
||||
ToString( pt) + "},{" +
|
||||
string sLua = "EgtParPlanesSurfTmInters({" + ToString( ptOn) + "},{" +
|
||||
ToString( vtN) + "},{" +
|
||||
ToString( vdDist) + "}," +
|
||||
ToString( nId) + "," +
|
||||
ToString( nDestGrpId) + "," +
|
||||
|
||||
@@ -448,6 +448,18 @@ LuaGetDebugLevel( lua_State* L)
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetUserLevel( lua_State* L)
|
||||
{
|
||||
// nessun parametro
|
||||
LuaClearStack( L) ;
|
||||
// restituisco il livello utente
|
||||
int nUserLev = ExeGetUserLevel() ;
|
||||
LuaSetParam( L, nUserLev) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaOutLog( lua_State* L)
|
||||
@@ -1163,6 +1175,7 @@ LuaInstallGeneral( LuaMgr& luaMgr)
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSetTscVar", LuaSetTscVar) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetTscVar", LuaGetTscVar) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetDebugLevel", LuaGetDebugLevel) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetUserLevel", LuaGetUserLevel) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtOutLog", LuaOutLog) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetEnableUI", LuaGetEnableUI) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtOutBox", LuaOutBox) ;
|
||||
|
||||
+5
-5
@@ -158,11 +158,11 @@ LuaPlaneSurfTmInters( lua_State* L)
|
||||
static int
|
||||
LuaParPlanesSurfTmInters( lua_State* L)
|
||||
{
|
||||
// 4 o 5 o 6 parametri : vtN, vPnt, nId, nDestGrpId [, nRefType] [, dToler]
|
||||
// 5 o 6 o 7 parametri : ptOn, vtN, vdDist, nId, nDestGrpId [, nRefType] [, dToler]
|
||||
Point3d ptOn ;
|
||||
LuaCheckParam( L, 1, ptOn)
|
||||
Vector3d vtN ;
|
||||
LuaCheckParam( L, 1, vtN)
|
||||
Point3d pt ;
|
||||
LuaCheckParam( L, 2, pt)
|
||||
LuaCheckParam( L, 2, vtN)
|
||||
DBLVECTOR vdDist ;
|
||||
LuaCheckParam( L, 3, vdDist)
|
||||
int nId ;
|
||||
@@ -176,7 +176,7 @@ LuaParPlanesSurfTmInters( lua_State* L)
|
||||
LuaClearStack( L) ;
|
||||
// eseguo l'intersezione
|
||||
int nGrpCount = 0 ;
|
||||
int nNewId = ExeParPlanesSurfTmInters( vtN, pt, vdDist, nId, nDestGrpId, nRefType, dToler, &nGrpCount) ;
|
||||
int nNewId = ExeParPlanesSurfTmInters( ptOn, vtN, vdDist, nId, nDestGrpId, nRefType, dToler, &nGrpCount) ;
|
||||
// restituisco il risultato
|
||||
if ( nNewId != GDB_ID_NULL)
|
||||
LuaSetParam( L, nNewId) ;
|
||||
|
||||
Reference in New Issue
Block a user