bebcf1ecfe
- migliorie e modifiche in generale, specie su Lua.
653 lines
19 KiB
C++
653 lines
19 KiB
C++
//----------------------------------------------------------------------------
|
|
// 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 ;
|
|
if ( lua_gettop( L) >= 2)
|
|
LuaCheckParam( L, 2, frFrame) ;
|
|
LuaClearStack( L) ;
|
|
// creo il gruppo
|
|
int nId = EgtCreateGroup( 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( 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 ;
|
|
if ( lua_gettop( L) >= 3)
|
|
LuaCheckParam( L, 3, ptB) ;
|
|
double dScale = 1 ;
|
|
if ( lua_gettop( L) >= 4)
|
|
LuaCheckParam( L, 4, dScale) ;
|
|
LuaClearStack( L) ;
|
|
// creo il segmento di retta
|
|
vtV *= dScale ;
|
|
int nId = EgtCreateGeoVector( 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( 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( 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 ;
|
|
if ( lua_gettop( L) >= 4)
|
|
LuaCheckParam( L, 4, dNearPar) ;
|
|
LuaClearStack( L) ;
|
|
// creo il segmento di retta
|
|
int nId = EgtCreateCurveLineMinPointCurve( 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( 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) ;
|
|
// 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( 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( 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) ;
|
|
// 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( 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( 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( 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 ;
|
|
if ( lua_gettop( L) >= 3)
|
|
LuaCheckParam( L, 3, bErase) ;
|
|
LuaClearStack( L) ;
|
|
// creo la curva
|
|
int nId = EgtCreateCurveBezierFromArc( 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 ;
|
|
if ( lua_gettop( L) >= 3)
|
|
LuaCheckParam( L, 3, bErase) ;
|
|
LuaClearStack( L) ;
|
|
// creo la curva composita
|
|
int nId = EgtCreateCurveCompo( 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( 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( nParentId, PA) ;
|
|
// restituisco il risultato
|
|
if ( nId != GDB_ID_NULL)
|
|
LuaSetReturn( L, nId) ;
|
|
else
|
|
LuaSetReturn( L) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
static int
|
|
LuaCreateCurveCompoFromCurveApprox( lua_State* L)
|
|
{
|
|
// 4 parametri : ParentId, nSouId, sType, dLinTol
|
|
int nParentId ;
|
|
LuaCheckParam( L, 1, nParentId)
|
|
int nSouId ;
|
|
LuaCheckParam( L, 2, nSouId)
|
|
bool bArcsVsLines = true ;
|
|
string sTemp ;
|
|
LuaCheckParam( L, 3, sTemp)
|
|
ToUpper( sTemp) ;
|
|
if ( sTemp == "LINES")
|
|
bArcsVsLines = false ;
|
|
double dLinTol ;
|
|
LuaCheckParam( L, 4, dLinTol)
|
|
LuaClearStack( L) ;
|
|
// creo la curva composita
|
|
int nId = EgtCreateCurveCompoFromCurveApprox( nParentId, nSouId, bArcsVsLines, dLinTol) ;
|
|
// 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( 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 ;
|
|
if ( lua_gettop( L) >= 3)
|
|
LuaCheckParam( L, 3, dLinTol) ;
|
|
LuaClearStack( L) ;
|
|
// creo STM riempiendo un contorno piano
|
|
int nId = EgtCreateSurfTriMeshByContour( 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( 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( 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, "EgtCurveCompoFromCurveApprox", LuaCreateCurveCompoFromCurveApprox) ;
|
|
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 ;
|
|
}
|