EgtExecutor :
- aggiunta funzione Exe e Lua CurveCompoRadius.
This commit is contained in:
@@ -926,6 +926,35 @@ ExeCurveCompoCenter( int nId, int nSimpCrv, int nRefId, Point3d& ptCen)
|
||||
return TransformPoint( pGeomDB, nId, nRefId, ptCen) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeCurveCompoRadius( int nId, int nSimpCrv, double& dRad)
|
||||
{
|
||||
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 ;
|
||||
// a seconda del tipo di curva
|
||||
switch ( pSimpCrv->GetType()) {
|
||||
case CRV_LINE :
|
||||
dRad = -1 ;
|
||||
break ;
|
||||
case CRV_ARC :
|
||||
dRad = GetCurveArc( pSimpCrv)->GetRadius() ;
|
||||
break ;
|
||||
case CRV_BEZ :
|
||||
dRad = -2 ;
|
||||
break ;
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSurfArea( int nId, double& dArea)
|
||||
|
||||
@@ -603,6 +603,25 @@ LuaCurveCompoCenter( lua_State* L)
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCurveCompoRadius( lua_State* L)
|
||||
{
|
||||
// 2 parametri : Id, nCrv
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
int nCrv ;
|
||||
LuaCheckParam( L, 2, nCrv)
|
||||
LuaClearStack( L) ;
|
||||
// recupero il raggio della curva semplice indicizzata
|
||||
double dRadius ;
|
||||
if ( ExeCurveCompoRadius( nId, nCrv, dRadius))
|
||||
LuaSetParam( L, dRadius) ;
|
||||
else
|
||||
LuaSetParam( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSurfArea( lua_State* L)
|
||||
@@ -1123,6 +1142,7 @@ LuaInstallGeoSnap( LuaMgr& luaMgr)
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtArcDeltaN", LuaArcDeltaN) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtArcNormVersor", LuaArcNormVersor) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCompoCenter", LuaCurveCompoCenter) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCompoRadius", LuaCurveCompoRadius) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfArea", LuaSurfArea) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfVolume", LuaSurfVolume) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrNormVersor", LuaSurfFrNormVersor) ;
|
||||
|
||||
Reference in New Issue
Block a user