diff --git a/EXE_GdbGetCurve.cpp b/EXE_GdbGetCurve.cpp index a1b7022..04bbe0b 100644 --- a/EXE_GdbGetCurve.cpp +++ b/EXE_GdbGetCurve.cpp @@ -548,6 +548,24 @@ ExeArcNormVersor( int nId, int nRefId, Vector3d& vtNorm) return TransformVector( pGeomDB, nId, nRefId, vtNorm) ; } +//---------------------------------------------------------------------------- +bool +ExeCurveCompoLength( int nId, int nSimpCrv, double& dLen) +{ + IGeomDB* pGeomDB = GetCurrGeomDB() ; + VERIFY_GEOMDB( pGeomDB, false) + // recupero la curva composita + const ICurveComposite* pCompoCrv = GetCurveComposite( pGeomDB->GetGeoObj( nId)) ; + if ( pCompoCrv == nullptr) + return false ; + // recupero la curva semplice di indice richiesto + const ICurve* pSimpCrv = pCompoCrv->GetCurve( nSimpCrv) ; + if ( pSimpCrv == nullptr) + return false ; + // recupero la sua lunghezza + return pSimpCrv->GetLength( dLen) ; +} + //---------------------------------------------------------------------------- bool ExeCurveCompoCenter( int nId, int nSimpCrv, int nRefId, Point3d& ptCen) diff --git a/EgtExecutor.rc b/EgtExecutor.rc index 8992e6d..c6a95ab 100644 Binary files a/EgtExecutor.rc and b/EgtExecutor.rc differ diff --git a/LUA_GdbGetCurve.cpp b/LUA_GdbGetCurve.cpp index 8f32e0b..112d39d 100644 --- a/LUA_GdbGetCurve.cpp +++ b/LUA_GdbGetCurve.cpp @@ -432,6 +432,25 @@ LuaArcNormVersor( lua_State* L) return 1 ; } +//---------------------------------------------------------------------------- +static int +LuaCurveCompoLength( lua_State* L) +{ + // 2 parametri : Id, nCrv + int nId ; + LuaCheckParam( L, 1, nId) + int nCrv ; + LuaCheckParam( L, 2, nCrv) + LuaClearStack( L) ; + // recupero il centro della curva semplice indicizzata + double dLen ; + if ( ExeCurveCompoLength( nId, nCrv, dLen)) + LuaSetParam( L, dLen) ; + else + LuaSetParam( L) ; + return 1 ; +} + //---------------------------------------------------------------------------- static int LuaCurveCompoCenter( lua_State* L) @@ -538,6 +557,7 @@ LuaInstallGdbGetCurve( LuaMgr& luaMgr) bOk = bOk && luaMgr.RegisterFunction( "EgtArcAngCenter", LuaArcAngCenter) ; bOk = bOk && luaMgr.RegisterFunction( "EgtArcDeltaN", LuaArcDeltaN) ; bOk = bOk && luaMgr.RegisterFunction( "EgtArcNormVersor", LuaArcNormVersor) ; + bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCompoLength", LuaCurveCompoLength) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCompoCenter", LuaCurveCompoCenter) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCompoRadius", LuaCurveCompoRadius) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCompoAngCenter", LuaCurveCompoAngCenter) ;