EgtExecutor :
- spostate le funzioni di offset. - aggiunta la funzione di offset 3d delle curve.
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
#include "/EgtDev/Include/EXeConst.h"
|
||||
#include "/EgtDev/Include/EGkGdbConst.h"
|
||||
#include "/EgtDev/Include/EGkLuaAux.h"
|
||||
#include "/EgtDev/Include/EGkCurve.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
@@ -1112,6 +1113,92 @@ LuaCreateCirclesAlongCurve( lua_State* L)
|
||||
return 2 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaOffsetCurveAdv( lua_State* L)
|
||||
{
|
||||
// 2 o 3 o 4 parametri : Id, dDist [, nType] [, dLinTol]
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
double dDist ;
|
||||
LuaCheckParam( L, 2, dDist)
|
||||
int nType = ICurve::OFF_FILLET ;
|
||||
LuaGetParam( L, 3, nType) ;
|
||||
double dLinTol = 10 * EPS_SMALL ;
|
||||
LuaGetParam( L, 4, dLinTol) ;
|
||||
LuaClearStack( L) ;
|
||||
// offset della curva
|
||||
int nCount ;
|
||||
int nNewId = ExeOffsetCurveAdv( nId, dDist, nType, &nCount, dLinTol) ;
|
||||
if ( nCount >= 0) {
|
||||
LuaSetParam( L, nNewId) ;
|
||||
LuaSetParam( L, nCount) ;
|
||||
}
|
||||
else {
|
||||
LuaSetParam( L) ;
|
||||
LuaSetParam( L, nCount) ;
|
||||
}
|
||||
return 2 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCurveGetFatCurve( lua_State* L)
|
||||
{
|
||||
// 4 o 5 parametri : Id, nDestGrpId, dRad, bSquare [, bSquareMids]
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
int nDestGrpId ;
|
||||
LuaCheckParam( L, 2, nDestGrpId)
|
||||
double dRad ;
|
||||
LuaCheckParam( L, 3, dRad)
|
||||
bool bSquareEnds ;
|
||||
LuaCheckParam( L, 4, bSquareEnds)
|
||||
bool bSquareMids = bSquareEnds ;
|
||||
LuaGetParam( L, 5, bSquareMids) ;
|
||||
LuaClearStack( L) ;
|
||||
// eseguo
|
||||
int nCount = 0 ;
|
||||
int nNewId = ExeCurveGetFatCurve( nId, nDestGrpId, dRad, bSquareEnds, bSquareMids, &nCount) ;
|
||||
if ( nNewId != GDB_ID_NULL)
|
||||
LuaSetParam( L, nNewId) ;
|
||||
else
|
||||
LuaSetParam( L) ;
|
||||
LuaSetParam( L, nCount) ;
|
||||
|
||||
return 2 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaOffsetCurve3d( lua_State* L)
|
||||
{
|
||||
// 3 o 4 o 5 parametri : Id, SurfId, dDist [, nType] [, dLinTol]
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
int nSurfId ;
|
||||
LuaCheckParam( L, 2, nSurfId)
|
||||
double dDist ;
|
||||
LuaCheckParam( L, 3, dDist)
|
||||
int nType = ICurve::OFF_FILLET ;
|
||||
LuaGetParam( L, 4, nType) ;
|
||||
double dLinTol = 10 * EPS_SMALL ;
|
||||
LuaGetParam( L, 5, dLinTol) ;
|
||||
LuaClearStack( L) ;
|
||||
// offset della curva
|
||||
int nCount ;
|
||||
int nNewId = ExeOffsetCurve3d( nId, nSurfId, dDist, nType, &nCount, dLinTol) ;
|
||||
if ( nCount >= 0) {
|
||||
LuaSetParam( L, nNewId) ;
|
||||
LuaSetParam( L, nCount) ;
|
||||
}
|
||||
else {
|
||||
LuaSetParam( L) ;
|
||||
LuaSetParam( L, nCount) ;
|
||||
}
|
||||
return 2 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
LuaInstallGdbCreateCurve( LuaMgr& luaMgr)
|
||||
@@ -1157,5 +1244,8 @@ LuaInstallGdbCreateCurve( LuaMgr& luaMgr)
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtPolygonFromApothem", LuaCreatePolygonFromApothem) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtPolygonFromSide", LuaCreatePolygonFromSide) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCirclesAlongCurve", LuaCreateCirclesAlongCurve) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtOffsetCurveAdv", LuaOffsetCurveAdv) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveGetFatCurve", LuaCurveGetFatCurve) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtOffsetCurve3d", LuaOffsetCurve3d) ;
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user