EgtInterface 1.6a4 :
- completamento modifiche per registrazione comandi in lua e per gestione RefType e RefId.
This commit is contained in:
+30
-22
@@ -332,19 +332,18 @@ LuaCreateCurveArc2PVN( lua_State* L)
|
||||
static int
|
||||
LuaCreateCurveBezier( lua_State* L)
|
||||
{
|
||||
// 3 parametri : ParentId, Degree, CtrlPnts
|
||||
// 3 o 4 parametri : ParentId, Degree, CtrlPnts [, sRefType]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
int nDegree ;
|
||||
LuaCheckParam( L, 2, nDegree)
|
||||
PNTVECTOR vPnt ;
|
||||
LuaCheckParam( L, 3, vPnt)
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
LuaGetRefType( L, 4, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// il numero dei punti deve essere pari al grado + 1
|
||||
if ( vPnt.size() != nDegree + 1)
|
||||
return luaL_error( L, "Wrong Control Points Number") ;
|
||||
// creo la curva
|
||||
int nId = EgtCreateCurveBezier( nParentId, nDegree, vPnt) ;
|
||||
int nId = EgtCreateCurveBezier( nParentId, nDegree, vPnt, nRefType) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
@@ -357,19 +356,18 @@ LuaCreateCurveBezier( lua_State* L)
|
||||
static int
|
||||
LuaCreateCurveBezierRational( lua_State* L)
|
||||
{
|
||||
// 3 parametri : ParentId, Degree, CtrlPntWs
|
||||
// 3 o 4 parametri : ParentId, Degree, CtrlPntWs [, sRefType]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
int nDegree ;
|
||||
LuaCheckParam( L, 2, nDegree)
|
||||
PNTUVECTOR vPntW ;
|
||||
LuaCheckParam( L, 3, vPntW)
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
LuaGetRefType( L, 4, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// il numero dei punti deve essere pari al grado + 1
|
||||
if ( vPntW.size() != nDegree + 1)
|
||||
return luaL_error( L, "Wrong Control Points Number") ;
|
||||
// creo la curva
|
||||
int nId = EgtCreateCurveBezierRational( nParentId, nDegree, vPntW) ;
|
||||
int nId = EgtCreateCurveBezierRational( nParentId, nDegree, vPntW, nRefType) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
@@ -382,7 +380,7 @@ LuaCreateCurveBezierRational( lua_State* L)
|
||||
static int
|
||||
LuaCreateCurveBezierFromArc( lua_State* L)
|
||||
{
|
||||
// 3 parametri : ParentId, ArcId[ , Erase]
|
||||
// 2 o 3 parametri : ParentId, ArcId[ , Erase]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
int nArcId ;
|
||||
@@ -428,7 +426,7 @@ LuaCreateCurveCompo( lua_State* L)
|
||||
static int
|
||||
LuaCreateCurveCompoByChain( lua_State* L)
|
||||
{
|
||||
// 3 o 4 parametri : ParentId, nIds, PtNear [, Erase]
|
||||
// 3 o 4 o 5 parametri : ParentId, nIds, PtNear [, Erase] [, sRefType]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
INTVECTOR vIds ;
|
||||
@@ -436,11 +434,14 @@ LuaCreateCurveCompoByChain( lua_State* L)
|
||||
Point3d ptNear ;
|
||||
LuaCheckParam( L, 3, ptNear)
|
||||
bool bErase = true ;
|
||||
if ( lua_gettop( L) >= 4)
|
||||
LuaCheckParam( L, 4, bErase) ;
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
if ( LuaGetParam( L, 4, bErase))
|
||||
LuaGetRefType( L, 5, nRefType) ;
|
||||
else
|
||||
LuaGetRefType( L, 4, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// creo la curva composita
|
||||
int nId = EgtCreateCurveCompoByChain( nParentId, vIds, ptNear, ( bErase ? TRUE : FALSE)) ;
|
||||
int nId = EgtCreateCurveCompoByChain( nParentId, vIds, ptNear, bErase, nRefType) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
@@ -453,17 +454,20 @@ LuaCreateCurveCompoByChain( lua_State* L)
|
||||
static int
|
||||
LuaCreateCurveCompoFromPoints( lua_State* L)
|
||||
{
|
||||
// 2 parametri : ParentId, ptPs
|
||||
// 2 o 3 parametri : ParentId, ptPs [, sRefType]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
PNTVECTOR vPnt ;
|
||||
LuaCheckParam( L, 2, vPnt)
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
LuaGetRefType( L, 3, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
PolyLine PL ;
|
||||
// creo una polilinea a partire dai punti
|
||||
for ( size_t i = 0 ; i < vPnt.size() ; ++ i)
|
||||
PL.AddUPoint( 0, vPnt[i]) ;
|
||||
// creo la curva composita
|
||||
int nId = EgtCreateCurveCompoFromPoints( nParentId, PL) ;
|
||||
int nId = EgtCreateCurveCompoFromPoints( nParentId, PL, nRefType) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
@@ -476,17 +480,20 @@ LuaCreateCurveCompoFromPoints( lua_State* L)
|
||||
static int
|
||||
LuaCreateCurveCompoFromPointBulges( lua_State* L)
|
||||
{
|
||||
// 2 parametri : ParentId, ptPBs
|
||||
// 2 o 3 parametri : ParentId, ptPBs [, sRefType]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
PNTUVECTOR vPntB ;
|
||||
LuaCheckParam( L, 2, vPntB)
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
LuaGetRefType( L, 3, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// creo un poliarco a partire dai punti con bulge
|
||||
PolyArc PA ;
|
||||
for ( size_t i = 0 ; i < vPntB.size() ; ++ i)
|
||||
PA.AddUPoint( 0, vPntB[i].first, vPntB[i].second) ;
|
||||
// creo la curva composita
|
||||
int nId = EgtCreateCurveCompoFromPointBulges( nParentId, PA) ;
|
||||
int nId = EgtCreateCurveCompoFromPointBulges( nParentId, PA, nRefType) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
@@ -499,7 +506,7 @@ LuaCreateCurveCompoFromPointBulges( lua_State* L)
|
||||
static int
|
||||
LuaCreateCurveCompoByApprox( lua_State* L)
|
||||
{
|
||||
// 4 parametri : ParentId, nSouId, sType, dLinTol
|
||||
// 3 o 4 parametri : ParentId, nSouId, sType [, dLinTol]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
int nSouId ;
|
||||
@@ -510,8 +517,9 @@ LuaCreateCurveCompoByApprox( lua_State* L)
|
||||
ToUpper( sTemp) ;
|
||||
if ( sTemp == "LINES")
|
||||
bArcsVsLines = false ;
|
||||
double dLinTol ;
|
||||
LuaCheckParam( L, 4, dLinTol)
|
||||
double dLinTol = 0.01 ;
|
||||
if ( lua_gettop( L) >= 4)
|
||||
LuaCheckParam( L, 4, dLinTol)
|
||||
LuaClearStack( L) ;
|
||||
// creo la curva composita
|
||||
int nId = EgtCreateCurveCompoByApprox( nParentId, nSouId, bArcsVsLines, dLinTol) ;
|
||||
|
||||
Reference in New Issue
Block a user