EgtExecutor 2.4f1 :
- aggiunte funzioni Exe e Lua CurveParamAtPoint.
This commit is contained in:
@@ -72,6 +72,27 @@ ExeCurveParamAtLength( int nId, double dLen, double* pdPar)
|
||||
return ( pCurve != nullptr && pCurve->GetParamAtLength( dLen, *pdPar)) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeCurveParamAtPoint( int nId, const Point3d& ptP, double dTol, int nRefType, double* pdPar)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// verifico il parametro
|
||||
if ( pdPar == nullptr)
|
||||
return false ;
|
||||
// recupero la curva
|
||||
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
|
||||
bool bOk = ( pCurve != nullptr) ;
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
bOk = bOk && pGeomDB->GetGlobFrame( nId, frLoc) ;
|
||||
// porto il punto in locale
|
||||
Point3d ptL = GetPointLocal( pGeomDB, ptP, nRefType, frLoc) ;
|
||||
// recupero il parametro in corrispondenza ptL
|
||||
return ( bOk && pCurve->GetParamAtPoint( ptL, *pdPar, dTol)) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeCurveLengthAtPoint( int nId, const Point3d& ptOn, double dExtend, double* pdLen)
|
||||
|
||||
Binary file not shown.
@@ -76,6 +76,29 @@ LuaCurveParamAtLength( lua_State* L)
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCurveParamAtPoint( lua_State* L)
|
||||
{
|
||||
// 2 o 3 o 4 parametri : nId, pt [, dTol, nRefType]
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
Point3d ptP ;
|
||||
LuaCheckParam( L, 2, ptP)
|
||||
double dTol = EPS_SMALL ;
|
||||
LuaGetParam( L, 3, dTol) ;
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
LuaGetParam( L, 4, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// recupero il parametro in corrispondenza di pt
|
||||
double dPar ;
|
||||
if ( ExeCurveParamAtPoint( nId, ptP, dTol, nRefType, &dPar))
|
||||
LuaSetParam( L, dPar) ;
|
||||
else
|
||||
LuaSetParam( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCurveIsClosed( lua_State* L)
|
||||
@@ -497,6 +520,7 @@ LuaInstallGdbGetCurve( LuaMgr& luaMgr)
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveDomain", LuaCurveDomain) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveLength", LuaCurveLength) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveParamAtLength", LuaCurveParamAtLength) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveParamAtPoint", LuaCurveParamAtPoint) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveIsClosed", LuaCurveIsClosed) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveIsFlat", LuaCurveIsFlat) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveIsACircle", LuaCurveIsACircle) ;
|
||||
|
||||
Reference in New Issue
Block a user