EgtInterface 1.5i5 :
- aggiunto interprete Lua - portate in interfaccia API molte funzioni di base.
This commit is contained in:
@@ -0,0 +1,616 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2014-2014
|
||||
//----------------------------------------------------------------------------
|
||||
// File : LUA_GdbCreate.cpp Data : 30.09.14 Versione : 1.5i5
|
||||
// Contenuto : Funzioni di creazione geometrica per LUA.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 30.09.14 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "LUA.h"
|
||||
#include "API.h"
|
||||
#include "/EgtDev/Include/EInAPI.h"
|
||||
#include "/EgtDev/Include/EGkExtText.h"
|
||||
#include "/EgtDev/Include/EgnStringUtils.h"
|
||||
#include "/EgtDev/Extern/Lua/Include/lua.hpp"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateGroup( lua_State* L)
|
||||
{
|
||||
// 1 o 2 parametri : ParentId [, Frame]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
Frame3d frFrame ;
|
||||
LuaGetParam( L, 2, frFrame) ;
|
||||
LuaClearStack( L) ;
|
||||
// creo il gruppo
|
||||
int nId = EgtCreateGroup( LuaGetGseContext(), nParentId, frFrame.Orig().v,
|
||||
frFrame.VersX().v, frFrame.VersY().v, frFrame.VersZ().v) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateGeoPoint( lua_State* L)
|
||||
{
|
||||
// 2 parametri : ParentId, PtP
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
Point3d ptP ;
|
||||
LuaCheckParam( L, 2, ptP)
|
||||
LuaClearStack( L) ;
|
||||
// creo il segmento di retta
|
||||
int nId = EgtCreateGeoPoint( LuaGetGseContext(), nParentId, ptP.v) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateGeoVector( lua_State* L)
|
||||
{
|
||||
// 2 o 3 o 4 parametri : ParentId, VtV [, PtB [, Scale]]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
Vector3d vtV ;
|
||||
LuaCheckParam( L, 2, vtV)
|
||||
Point3d ptB ;
|
||||
LuaGetParam( L, 3, ptB) ;
|
||||
double dScale = 1 ;
|
||||
LuaGetParam( L, 4, dScale) ;
|
||||
LuaClearStack( L) ;
|
||||
// creo il segmento di retta
|
||||
vtV *= dScale ;
|
||||
int nId = EgtCreateGeoVector( LuaGetGseContext(), nParentId, vtV.v, ptB.v) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateGeoFrame( lua_State* L)
|
||||
{
|
||||
// 2 parametri : ParentId, Frame
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
Frame3d frFrame ;
|
||||
LuaCheckParam( L, 2, frFrame) ;
|
||||
LuaClearStack( L) ;
|
||||
// creo il gruppo
|
||||
int nId = EgtCreateGeoFrame( LuaGetGseContext(), nParentId, frFrame.Orig().v,
|
||||
frFrame.VersX().v, frFrame.VersY().v, frFrame.VersZ().v) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateCurveLine( lua_State* L)
|
||||
{
|
||||
// 3 parametri : ParentId, PtIni, PtFin
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
Point3d ptIni ;
|
||||
LuaCheckParam( L, 2, ptIni)
|
||||
Point3d ptFin ;
|
||||
LuaCheckParam( L, 3, ptFin)
|
||||
LuaClearStack( L) ;
|
||||
// creo il segmento di retta
|
||||
int nId = EgtCreateCurveLine( LuaGetGseContext(), nParentId, ptIni.v, ptFin.v) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateCurveLineMinPointCurve( lua_State* L)
|
||||
{
|
||||
// 3 o 4 parametri : ParentId, PtIni, CrvId [, NearPar]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
Point3d ptIni ;
|
||||
LuaCheckParam( L, 2, ptIni)
|
||||
int nCrvId ;
|
||||
LuaCheckParam( L, 3, nCrvId)
|
||||
double dNearPar = 0 ;
|
||||
LuaGetParam( L, 4, dNearPar) ;
|
||||
LuaClearStack( L) ;
|
||||
// creo il segmento di retta
|
||||
int nId = EgtCreateCurveLineMinPointCurve( LuaGetGseContext(), nParentId, ptIni.v, nCrvId, dNearPar) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateCurveCircle( lua_State* L)
|
||||
{
|
||||
// 4 parametri : ParentId, PtCen, VtN, Rad
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
Point3d ptCen ;
|
||||
LuaCheckParam( L, 2, ptCen)
|
||||
Vector3d vtN ;
|
||||
LuaCheckParam( L, 3, vtN)
|
||||
double dRad ;
|
||||
LuaCheckParam( L, 4, dRad)
|
||||
LuaClearStack( L) ;
|
||||
// creo l'arco
|
||||
int nId = EgtCreateCurveCircle( LuaGetGseContext(), 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( LuaGetGseContext(), nParentId, ptCen.v, dRad) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateCurveCircle3P( lua_State* L)
|
||||
{
|
||||
// 3 parametri : ParentId, PtP1, PtP2, PtP3
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
Point3d ptP1 ;
|
||||
LuaCheckParam( L, 2, ptP1)
|
||||
Point3d ptP2 ;
|
||||
LuaCheckParam( L, 3, ptP2)
|
||||
Point3d ptP3 ;
|
||||
LuaCheckParam( L, 4, ptP3)
|
||||
LuaClearStack( L) ;
|
||||
// creo l'arco
|
||||
int nId = EgtCreateCurveCircle3P( LuaGetGseContext(), nParentId, ptP1.v, ptP2.v, ptP3.v) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateCurveArc( lua_State* L)
|
||||
{
|
||||
// 7 parametri : ParentId, PtCen, VtN, Rad, VtS, AngCenDeg, DeltaN
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
Point3d ptCen ;
|
||||
LuaCheckParam( L, 2, ptCen)
|
||||
Vector3d vtN ;
|
||||
LuaCheckParam( L, 3, vtN)
|
||||
double dRad ;
|
||||
LuaCheckParam( L, 4, dRad)
|
||||
Vector3d vtS ;
|
||||
LuaCheckParam( L, 5, vtS)
|
||||
double dAngCenDeg ;
|
||||
LuaCheckParam( L, 6, dAngCenDeg)
|
||||
double dDeltaN ;
|
||||
LuaCheckParam( L, 7, dDeltaN)
|
||||
LuaClearStack( L) ;
|
||||
// creo l'arco
|
||||
int nId = EgtCreateCurveArc( LuaGetGseContext(), 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( LuaGetGseContext(), nParentId, ptCen.v, dRad, dAngStartDeg, dAngCenDeg, dDeltaZ) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateCurveArc3P( lua_State* L)
|
||||
{
|
||||
// 3 parametri : ParentId, PtP1, PtP2, PtP3
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
Point3d ptP1 ;
|
||||
LuaCheckParam( L, 2, ptP1)
|
||||
Point3d ptP2 ;
|
||||
LuaCheckParam( L, 3, ptP2)
|
||||
Point3d ptP3 ;
|
||||
LuaCheckParam( L, 4, ptP3)
|
||||
LuaClearStack( L) ;
|
||||
// creo l'arco
|
||||
int nId = EgtCreateCurveArc3P( LuaGetGseContext(), nParentId, ptP1.v, ptP2.v, ptP3.v) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateCurveBezier( lua_State* L)
|
||||
{
|
||||
// 3 parametri : ParentId, Degree, CtrlPnts
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
int nDegree ;
|
||||
LuaCheckParam( L, 2, nDegree)
|
||||
PNTVECTOR vPnt ;
|
||||
LuaCheckParam( L, 3, vPnt)
|
||||
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( LuaGetGseContext(), nParentId, nDegree, vPnt) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateCurveBezierRational( lua_State* L)
|
||||
{
|
||||
// 3 parametri : ParentId, Degree, CtrlPntWs
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
int nDegree ;
|
||||
LuaCheckParam( L, 2, nDegree)
|
||||
PNTUVECTOR vPntW ;
|
||||
LuaCheckParam( L, 3, vPntW)
|
||||
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( LuaGetGseContext(), nParentId, nDegree, vPntW) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateCurveBezierFromArc( lua_State* L)
|
||||
{
|
||||
// 3 parametri : ParentId, ArcId[ , Erase]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
int nArcId ;
|
||||
LuaCheckParam( L, 2, nArcId)
|
||||
bool bErase = true ;
|
||||
LuaGetParam( L, 3, bErase) ;
|
||||
LuaClearStack( L) ;
|
||||
// creo la curva
|
||||
int nId = EgtCreateCurveBezierFromArc( LuaGetGseContext(), nParentId, nArcId, bErase) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateCurveCompo( lua_State* L)
|
||||
{
|
||||
// 2 o 3 parametri : ParentId, nIds [, Erase]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
INTVECTOR vIds ;
|
||||
LuaCheckParam( L, 2, vIds)
|
||||
bool bErase = true ;
|
||||
LuaGetParam( L, 3, bErase) ;
|
||||
LuaClearStack( L) ;
|
||||
// creo la curva composita
|
||||
int nId = EgtCreateCurveCompo( LuaGetGseContext(), nParentId, vIds, ( bErase ? TRUE : FALSE)) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateCurveCompoFromPoints( lua_State* L)
|
||||
{
|
||||
// 2 parametri : ParentId, ptPs
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
PNTVECTOR vPnt ;
|
||||
LuaCheckParam( L, 2, vPnt)
|
||||
LuaClearStack( L) ;
|
||||
PolyLine PL ;
|
||||
for ( size_t i = 0 ; i < vPnt.size() ; ++ i)
|
||||
PL.AddUPoint( 0, vPnt[i]) ;
|
||||
// creo la curva composita
|
||||
int nId = EgtCreateCurveCompoFromPoints( LuaGetGseContext(), nParentId, PL) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateCurveCompoFromPointBulges( lua_State* L)
|
||||
{
|
||||
// 2 parametri : ParentId, ptPBs
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
PNTUVECTOR vPntB ;
|
||||
LuaCheckParam( L, 2, vPntB)
|
||||
LuaClearStack( L) ;
|
||||
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( LuaGetGseContext(), nParentId, PA) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateCurveCompoFromPolygonSide( lua_State* L)
|
||||
{
|
||||
// 4 parametri : ParentId, nNumSides, PtIni, PtFin
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
int nNumSides ;
|
||||
LuaCheckParam( L, 2, nNumSides)
|
||||
Point3d ptIni ;
|
||||
LuaCheckParam( L, 3, ptIni)
|
||||
Point3d ptFin ;
|
||||
LuaCheckParam( L, 4, ptFin)
|
||||
LuaClearStack( L) ;
|
||||
// creo il poligono
|
||||
int nId = EgtCreateCurveCompoFromPolygonSide( LuaGetGseContext(), nParentId, nNumSides, ptIni.v, ptFin.v) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateSurfTriMeshByContour( lua_State* L)
|
||||
{
|
||||
// 2 o 3 parametri : ParentId, CrvId [, dTol]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
int nCrvId ;
|
||||
LuaCheckParam( L, 2, nCrvId)
|
||||
double dLinTol = 0.1 ;
|
||||
LuaGetParam( L, 3, dLinTol) ;
|
||||
LuaClearStack( L) ;
|
||||
// creo STM riempiendo un contorno piano
|
||||
int nId = EgtCreateSurfTriMeshByContour( LuaGetGseContext(), nParentId, nCrvId, dLinTol) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateText( lua_State* L)
|
||||
{
|
||||
// 5 parametri : ParentId, Text, ptP, AngRotDeg, H
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
string sText ;
|
||||
LuaCheckParam( L, 2, sText)
|
||||
Point3d ptP ;
|
||||
LuaCheckParam( L, 3, ptP) ;
|
||||
double dAngRotDeg ;
|
||||
LuaCheckParam( L, 4, dAngRotDeg) ;
|
||||
double dH ;
|
||||
LuaCheckParam( L, 5, dH) ;
|
||||
LuaClearStack( L) ;
|
||||
// creo il testo
|
||||
int nId = EgtCreateText( LuaGetGseContext(), nParentId, sText, ptP, dAngRotDeg, dH) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateTextEx( lua_State* L)
|
||||
{
|
||||
// 11 parametri : ParentId, Text, ptP, AngRotDeg, Font, W, sItalic, H, Rat, AddAdv, InsPos
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
string sText ;
|
||||
LuaCheckParam( L, 2, sText)
|
||||
Point3d ptP ;
|
||||
LuaCheckParam( L, 3, ptP) ;
|
||||
double dAngRotDeg ;
|
||||
LuaCheckParam( L, 4, dAngRotDeg) ;
|
||||
string sFont ;
|
||||
LuaCheckParam( L, 5, sFont)
|
||||
int nW ;
|
||||
LuaCheckParam( L, 6, nW)
|
||||
string sItalic ;
|
||||
LuaCheckParam( L, 7, sItalic)
|
||||
ToUpper( sItalic) ;
|
||||
bool bItalic = ( sItalic == "I") ;
|
||||
double dH ;
|
||||
LuaCheckParam( L, 8, dH) ;
|
||||
double dRat ;
|
||||
LuaCheckParam( L, 9, dRat) ;
|
||||
double dAddAdv ;
|
||||
LuaCheckParam( L, 10, dAddAdv) ;
|
||||
string sInsPos ;
|
||||
LuaCheckParam( L, 11, sInsPos) ;
|
||||
int nInsPos = ETXT_IPBL ;
|
||||
ToUpper( sInsPos) ;
|
||||
if ( sInsPos == "TL")
|
||||
nInsPos = ETXT_IPTL ;
|
||||
else if ( sInsPos == "TC")
|
||||
nInsPos = ETXT_IPTC ;
|
||||
else if ( sInsPos == "TR")
|
||||
nInsPos = ETXT_IPTR ;
|
||||
else if ( sInsPos == "ML")
|
||||
nInsPos = ETXT_IPML ;
|
||||
else if ( sInsPos == "MC")
|
||||
nInsPos = ETXT_IPMC ;
|
||||
else if ( sInsPos == "MR")
|
||||
nInsPos = ETXT_IPMR ;
|
||||
else if ( sInsPos == "BL")
|
||||
nInsPos = ETXT_IPBL ;
|
||||
else if ( sInsPos == "BC")
|
||||
nInsPos = ETXT_IPBC ;
|
||||
else if ( sInsPos == "BR")
|
||||
nInsPos = ETXT_IPBR ;
|
||||
LuaClearStack( L) ;
|
||||
// creo il testo in modo esteso
|
||||
int nId = EgtCreateTextEx( LuaGetGseContext(), nParentId, sText, ptP, dAngRotDeg,
|
||||
sFont, nW, bItalic, dH, dRat, dAddAdv, nInsPos) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
LuaInstallGdbCreate( lua_State* L)
|
||||
{
|
||||
try {
|
||||
lua_register( L, "EgtGroup", LuaCreateGroup) ;
|
||||
lua_register( L, "EgtPoint", LuaCreateGeoPoint) ;
|
||||
lua_register( L, "EgtVector", LuaCreateGeoVector) ;
|
||||
lua_register( L, "EgtFrame", LuaCreateGeoFrame) ;
|
||||
lua_register( L, "EgtLine", LuaCreateCurveLine) ;
|
||||
lua_register( L, "EgtLineMinPointCurve", LuaCreateCurveLineMinPointCurve) ;
|
||||
lua_register( L, "EgtCircle", LuaCreateCurveCircle) ;
|
||||
lua_register( L, "EgtCircleXY", LuaCreateCurveCircleXY) ;
|
||||
lua_register( L, "EgtCircle3P", LuaCreateCurveCircle3P) ;
|
||||
lua_register( L, "EgtArc", LuaCreateCurveArc) ;
|
||||
lua_register( L, "EgtArcXY", LuaCreateCurveArcXY) ;
|
||||
lua_register( L, "EgtArc3P", LuaCreateCurveArc3P) ;
|
||||
lua_register( L, "EgtCurveBezier", LuaCreateCurveBezier) ;
|
||||
lua_register( L, "EgtCurveBezierRat", LuaCreateCurveBezierRational) ;
|
||||
lua_register( L, "EgtCurveBezierFromArc", LuaCreateCurveBezierFromArc) ;
|
||||
lua_register( L, "EgtCurveCompo", LuaCreateCurveCompo) ;
|
||||
lua_register( L, "EgtCurveCompoFromPoints", LuaCreateCurveCompoFromPoints) ;
|
||||
lua_register( L, "EgtCurveCompoFromPointBulges", LuaCreateCurveCompoFromPointBulges) ;
|
||||
lua_register( L, "EgtCurveCompoFromPolygonSide", LuaCreateCurveCompoFromPolygonSide) ;
|
||||
lua_register( L, "EgtSurfTmByContour", LuaCreateSurfTriMeshByContour) ;
|
||||
lua_register( L, "EgtText", LuaCreateText) ;
|
||||
lua_register( L, "EgtTextEx", LuaCreateTextEx) ;
|
||||
}
|
||||
catch ( ...) {
|
||||
return false ;
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
Reference in New Issue
Block a user