EgtInterface 1.6a3 :

- modifiche varie per gestire GLOB, LOC e GRID sui dati geometrici
- aggiornamenti e miglirie varie
- eliminate alcune funzioni lua ormai obsolete (ArcXY e CircleXY).
This commit is contained in:
Dario Sassi
2015-01-19 18:21:58 +00:00
parent e23999b6a3
commit 4e5a81c493
19 changed files with 945 additions and 415 deletions
+60 -80
View File
@@ -17,6 +17,7 @@
#include "API.h"
#include "AuxTools.h"
#include "/EgtDev/Include/EInAPI.h"
#include "/EgtDev/Include/EInConst.h"
#include "/EgtDev/Include/EgkPolyLine.h"
#include "/EgtDev/Include/EgnStringUtils.h"
#include "/EgtDev/Extern/Lua/Include/lua.hpp"
@@ -27,16 +28,18 @@ using namespace std ;
static int
LuaCreateCurveLine( lua_State* L)
{
// 3 parametri : ParentId, PtIni, PtFin
// 3 o 4 parametri : ParentId, PtIni, PtFin [, sRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
Point3d ptIni ;
LuaCheckParam( L, 2, ptIni)
Point3d ptFin ;
LuaCheckParam( L, 3, ptFin)
int nRefType = RTY_DEFAULT ;
LuaGetRefType( L, 4, nRefType) ;
LuaClearStack( L) ;
// creo il segmento di retta
int nId = EgtCreateCurveLine( nParentId, ptIni.v, ptFin.v) ;
int nId = EgtCreateCurveLine( nParentId, ptIni.v, ptFin.v, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetReturn( L, nId) ;
@@ -49,7 +52,7 @@ LuaCreateCurveLine( lua_State* L)
static int
LuaCreateCurveLineEx( lua_State* L)
{
// 7 parametri : ParentId, PtIni, sSepI, nIdI, PtFin, sSEpF, nIdF
// 7 o 8 parametri : ParentId, PtIni, sSepI, nIdI, PtFin, sSEpF, nIdF [, sRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
Point3d ptIni ;
@@ -64,9 +67,13 @@ LuaCreateCurveLineEx( lua_State* L)
LuaCheckParam( L, 6, sSepF)
int nIdF ;
LuaCheckParam( L, 7, nIdF)
int nRefType = RTY_DEFAULT ;
LuaGetRefType( L, 8, nRefType) ;
LuaClearStack( L) ;
// creo il segmento di retta
int nId = EgtCreateCurveLineEx( nParentId, ptIni.v, StringToSep( sSepI), nIdI, ptFin.v, StringToSep( sSepF), nIdF) ;
int nId = EgtCreateCurveLineEx( nParentId,
ptIni.v, StringToSep( sSepI), nIdI,
ptFin.v, StringToSep( sSepF), nIdF, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetReturn( L, nId) ;
@@ -79,7 +86,7 @@ LuaCreateCurveLineEx( lua_State* L)
static int
LuaCreateCurveLinePVL( lua_State* L)
{
// 4 parametri : ParentId, PtIni, VtDir, dLen
// 4 o 5 parametri : ParentId, PtIni, VtDir, dLen [, sRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
Point3d ptIni ;
@@ -88,9 +95,11 @@ LuaCreateCurveLinePVL( lua_State* L)
LuaCheckParam( L, 3, vtDir)
double dLen ;
LuaCheckParam( L, 4, dLen)
int nRefType = RTY_DEFAULT ;
LuaGetRefType( L, 5, nRefType) ;
LuaClearStack( L) ;
// creo il segmento di retta
int nId = EgtCreateCurveLinePVL( nParentId, ptIni.v, vtDir.v, dLen) ;
int nId = EgtCreateCurveLinePVL( nParentId, ptIni.v, vtDir.v, dLen, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetReturn( L, nId) ;
@@ -103,7 +112,7 @@ LuaCreateCurveLinePVL( lua_State* L)
static int
LuaCreateCurveLineMinPointCurve( lua_State* L)
{
// 3 o 4 parametri : ParentId, PtIni, CrvId [, NearPar]
// 3 o 4 o 5 parametri : ParentId, PtIni, CrvId [, NearPar] [, sRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
Point3d ptIni ;
@@ -111,11 +120,14 @@ LuaCreateCurveLineMinPointCurve( lua_State* L)
int nCrvId ;
LuaCheckParam( L, 3, nCrvId)
double dNearPar = 0 ;
if ( lua_gettop( L) >= 4)
LuaCheckParam( L, 4, dNearPar) ;
int nRefType = RTY_DEFAULT ;
if ( LuaGetParam( L, 4, dNearPar))
LuaGetRefType( L, 5, nRefType) ;
else
LuaGetRefType( L, 4, nRefType) ;
LuaClearStack( L) ;
// creo il segmento di retta
int nId = EgtCreateCurveLineMinPointCurve( nParentId, ptIni.v, nCrvId, dNearPar) ;
int nId = EgtCreateCurveLineMinPointCurve( nParentId, ptIni.v, nCrvId, dNearPar, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetReturn( L, nId) ;
@@ -128,7 +140,7 @@ LuaCreateCurveLineMinPointCurve( lua_State* L)
static int
LuaCreateCurveCircle( lua_State* L)
{
// 4 parametri : ParentId, PtCen, VtN, Rad
// 4 o 5 parametri : ParentId, PtCen, VtN, Rad [, sRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
Point3d ptCen ;
@@ -137,31 +149,11 @@ LuaCreateCurveCircle( lua_State* L)
LuaCheckParam( L, 3, vtN)
double dRad ;
LuaCheckParam( L, 4, dRad)
int nRefType = RTY_DEFAULT ;
LuaGetRefType( L, 5, nRefType) ;
LuaClearStack( L) ;
// creo l'arco
int nId = EgtCreateCurveCircle( nParentId, ptCen.v, vtN.v, dRad) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetReturn( L, nId) ;
else
LuaSetReturn( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateCurveCircleXY( lua_State* L)
{
// 3 parametri : ParentId, PtCen, Rad
int nParentId ;
LuaCheckParam( L, 1, nParentId)
Point3d ptCen ;
LuaCheckParam( L, 2, ptCen)
double dRad ;
LuaCheckParam( L, 3, dRad)
LuaClearStack( L) ;
// creo l'arco
int nId = EgtCreateCurveCircleXY( nParentId, ptCen.v, dRad) ;
int nId = EgtCreateCurveCircle( nParentId, ptCen.v, vtN.v, dRad, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetReturn( L, nId) ;
@@ -174,7 +166,7 @@ LuaCreateCurveCircleXY( lua_State* L)
static int
LuaCreateCurveCircleCPN( lua_State* L)
{
// 4 parametri : ParentId, PtCen, PtOn, VtN
// 4 o 5 parametri : ParentId, PtCen, PtOn, VtN [, sRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
Point3d ptCen ;
@@ -183,9 +175,11 @@ LuaCreateCurveCircleCPN( lua_State* L)
LuaCheckParam( L, 3, ptOn)
Vector3d vtN ;
LuaCheckParam( L, 4, vtN)
int nRefType = RTY_DEFAULT ;
LuaGetRefType( L, 5, nRefType) ;
LuaClearStack( L) ;
// creo l'arco
int nId = EgtCreateCurveCircleCPN( nParentId, ptCen.v, ptOn.v, vtN.v) ;
int nId = EgtCreateCurveCircleCPN( nParentId, ptCen.v, ptOn.v, vtN.v, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetReturn( L, nId) ;
@@ -198,7 +192,7 @@ LuaCreateCurveCircleCPN( lua_State* L)
static int
LuaCreateCurveCircle3P( lua_State* L)
{
// 4 parametri : ParentId, PtP1, PtP2, PtP3
// 4 o 5 parametri : ParentId, PtP1, PtP2, PtP3 [, sRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
Point3d ptP1 ;
@@ -207,9 +201,11 @@ LuaCreateCurveCircle3P( lua_State* L)
LuaCheckParam( L, 3, ptP2)
Point3d ptP3 ;
LuaCheckParam( L, 4, ptP3)
int nRefType = RTY_DEFAULT ;
LuaGetRefType( L, 5, nRefType) ;
LuaClearStack( L) ;
// creo l'arco
int nId = EgtCreateCurveCircle3P( nParentId, ptP1.v, ptP2.v, ptP3.v) ;
int nId = EgtCreateCurveCircle3P( nParentId, ptP1.v, ptP2.v, ptP3.v, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetReturn( L, nId) ;
@@ -222,7 +218,7 @@ LuaCreateCurveCircle3P( lua_State* L)
static int
LuaCreateCurveArc( lua_State* L)
{
// 7 parametri : ParentId, PtCen, VtN, Rad, VtS, AngCenDeg, DeltaN
// 7 o 8 parametri : ParentId, PtCen, VtN, Rad, VtS, AngCenDeg, DeltaN [, sRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
Point3d ptCen ;
@@ -237,37 +233,11 @@ LuaCreateCurveArc( lua_State* L)
LuaCheckParam( L, 6, dAngCenDeg)
double dDeltaN ;
LuaCheckParam( L, 7, dDeltaN)
int nRefType = RTY_DEFAULT ;
LuaGetRefType( L, 8, nRefType) ;
LuaClearStack( L) ;
// creo l'arco
int nId = EgtCreateCurveArc( nParentId, ptCen.v, vtN.v, dRad, vtS.v, dAngCenDeg, dDeltaN) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetReturn( L, nId) ;
else
LuaSetReturn( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateCurveArcXY( lua_State* L)
{
// 6 parametri : ParentId, PtCen, Rad, AngStartDeg, AngCenDeg, DeltaN
int nParentId ;
LuaCheckParam( L, 1, nParentId)
Point3d ptCen ;
LuaCheckParam( L, 2, ptCen)
double dRad ;
LuaCheckParam( L, 3, dRad)
double dAngStartDeg ;
LuaCheckParam( L, 4, dAngStartDeg)
double dAngCenDeg ;
LuaCheckParam( L, 5, dAngCenDeg)
double dDeltaZ ;
LuaCheckParam( L, 6, dDeltaZ)
LuaClearStack( L) ;
// creo l'arco
int nId = EgtCreateCurveArcXY( nParentId, ptCen.v, dRad, dAngStartDeg, dAngCenDeg, dDeltaZ) ;
int nId = EgtCreateCurveArc( nParentId, ptCen.v, vtN.v, dRad, vtS.v, dAngCenDeg, dDeltaN, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetReturn( L, nId) ;
@@ -280,7 +250,7 @@ LuaCreateCurveArcXY( lua_State* L)
static int
LuaCreateCurveArcC2PN( lua_State* L)
{
// 5 parametri : ParentId, PtCen, PtStart, PtNearEnd, VtNorm
// 5 o 6 parametri : ParentId, PtCen, PtStart, PtNearEnd, VtNorm [, sRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
Point3d ptCen ;
@@ -291,9 +261,11 @@ LuaCreateCurveArcC2PN( lua_State* L)
LuaCheckParam( L, 4, ptNearEnd)
Vector3d vtNorm ;
LuaCheckParam( L, 5, vtNorm)
int nRefType = RTY_DEFAULT ;
LuaGetRefType( L, 6, nRefType) ;
LuaClearStack( L) ;
// creo l'arco
int nId = EgtCreateCurveArcC2PN( nParentId, ptCen.v, ptStart.v, ptNearEnd.v, vtNorm.v) ;
int nId = EgtCreateCurveArcC2PN( nParentId, ptCen.v, ptStart.v, ptNearEnd.v, vtNorm.v, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetReturn( L, nId) ;
@@ -306,7 +278,7 @@ LuaCreateCurveArcC2PN( lua_State* L)
static int
LuaCreateCurveArc3P( lua_State* L)
{
// 4 parametri : ParentId, PtP1, PtP2, PtP3
// 4 o 5 parametri : ParentId, PtP1, PtP2, PtP3 [, sRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
Point3d ptP1 ;
@@ -315,9 +287,11 @@ LuaCreateCurveArc3P( lua_State* L)
LuaCheckParam( L, 3, ptP2)
Point3d ptP3 ;
LuaCheckParam( L, 4, ptP3)
int nRefType = RTY_DEFAULT ;
LuaGetRefType( L, 5, nRefType) ;
LuaClearStack( L) ;
// creo l'arco
int nId = EgtCreateCurveArc3P( nParentId, ptP1.v, ptP2.v, ptP3.v) ;
int nId = EgtCreateCurveArc3P( nParentId, ptP1.v, ptP2.v, ptP3.v, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetReturn( L, nId) ;
@@ -330,7 +304,7 @@ LuaCreateCurveArc3P( lua_State* L)
static int
LuaCreateCurveArc2PVN( lua_State* L)
{
// 5 parametri : ParentId, PtStart, PtEnd, VtDirS, VtNorm
// 5 o 6 parametri : ParentId, PtStart, PtEnd, VtDirS, VtNorm [, sRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
Point3d ptStart ;
@@ -341,9 +315,11 @@ LuaCreateCurveArc2PVN( lua_State* L)
LuaCheckParam( L, 4, vtDirS)
Vector3d vtNorm ;
LuaCheckParam( L, 5, vtNorm)
int nRefType = RTY_DEFAULT ;
LuaGetRefType( L, 6, nRefType) ;
LuaClearStack( L) ;
// creo l'arco
int nId = EgtCreateCurveArc2PVN( nParentId, ptStart.v, ptEnd.v, vtDirS.v, vtNorm.v) ;
int nId = EgtCreateCurveArc2PVN( nParentId, ptStart.v, ptEnd.v, vtDirS.v, vtNorm.v, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetReturn( L, nId) ;
@@ -551,7 +527,7 @@ LuaCreateCurveCompoByApprox( lua_State* L)
static int
LuaCreateRectangle3P( lua_State* L)
{
// 4 parametri : ParentId, PtIni, PtCross, PtDir
// 4 o 5 parametri : ParentId, PtIni, PtCross, PtDir [, sRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
Point3d ptIni ;
@@ -560,9 +536,11 @@ LuaCreateRectangle3P( lua_State* L)
LuaCheckParam( L, 3, ptCross)
Point3d ptDir ;
LuaCheckParam( L, 4, ptDir)
int nRefType = RTY_DEFAULT ;
LuaGetRefType( L, 5, nRefType) ;
LuaClearStack( L) ;
// creo il poligono
int nId = EgtCreateRectangle3P( nParentId, ptIni.v, ptCross.v, ptDir.v) ;
int nId = EgtCreateRectangle3P( nParentId, ptIni.v, ptCross.v, ptDir.v, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetReturn( L, nId) ;
@@ -575,7 +553,7 @@ LuaCreateRectangle3P( lua_State* L)
static int
LuaCreatePolygonFromSide( lua_State* L)
{
// 4 parametri : ParentId, nNumSides, PtIni, PtFin
// 5 o 6 parametri : ParentId, nNumSides, PtIni, PtFin, VtN [, sRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
int nNumSides ;
@@ -584,9 +562,13 @@ LuaCreatePolygonFromSide( lua_State* L)
LuaCheckParam( L, 3, ptIni)
Point3d ptFin ;
LuaCheckParam( L, 4, ptFin)
Vector3d vtN ;
LuaCheckParam( L, 5, vtN)
int nRefType = RTY_DEFAULT ;
LuaGetRefType( L, 6, nRefType) ;
LuaClearStack( L) ;
// creo il poligono
int nId = EgtCreatePolygonFromSide( nParentId, nNumSides, ptIni.v, ptFin.v) ;
int nId = EgtCreatePolygonFromSide( nParentId, nNumSides, ptIni.v, ptFin.v, vtN.v, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetReturn( L, nId) ;
@@ -605,11 +587,9 @@ LuaInstallGdbCreateCurve( lua_State* L)
lua_register( L, "EgtLinePVL", LuaCreateCurveLinePVL) ;
lua_register( L, "EgtLineMinPointCurve", LuaCreateCurveLineMinPointCurve) ;
lua_register( L, "EgtCircle", LuaCreateCurveCircle) ;
lua_register( L, "EgtCircleXY", LuaCreateCurveCircleXY) ;
lua_register( L, "EgtCircleCPN", LuaCreateCurveCircleCPN) ;
lua_register( L, "EgtCircle3P", LuaCreateCurveCircle3P) ;
lua_register( L, "EgtArc", LuaCreateCurveArc) ;
lua_register( L, "EgtArcXY", LuaCreateCurveArcXY) ;
lua_register( L, "EgtArcC2PN", LuaCreateCurveArcC2PN) ;
lua_register( L, "EgtArc3P", LuaCreateCurveArc3P) ;
lua_register( L, "EgtArc2PVN", LuaCreateCurveArc2PVN) ;