EgtInterface 1.5j4 :

- ora si imposta un context corrente anche per le API come per LUA
- il context corrente di LUA coincide con quello delle API.
This commit is contained in:
Dario Sassi
2014-10-15 15:31:00 +00:00
parent 3b1e139286
commit 46c5fce044
29 changed files with 594 additions and 528 deletions
+58 -59
View File
@@ -36,10 +36,10 @@ static bool GetPolyLineFromCurve( IGeomDB* pGeomDB, int nId, const Frame3d& frDe
//-------------------------------------------------------------------------------
int
__stdcall EgtCreateGroup( int nGseCtx, int nParentId, const double ptOrig[3],
__stdcall EgtCreateGroup( int nParentId, const double ptOrig[3],
const double vX[3], const double vY[3], const double vZ[3])
{
IGeomDB* pGeomDB = GetGeomDB( nGseCtx) ;
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// costruisco il riferimento
Frame3d frFrame ;
@@ -51,9 +51,9 @@ __stdcall EgtCreateGroup( int nGseCtx, int nParentId, const double ptOrig[3],
//-------------------------------------------------------------------------------
int
__stdcall EgtCreateGeoPoint( int nGseCtx, int nParentId, const double ptP[3])
__stdcall EgtCreateGeoPoint( int nParentId, const double ptP[3])
{
IGeomDB* pGeomDB = GetGeomDB( nGseCtx) ;
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// creo il punto
PtrOwner<IGeoPoint3d> pGeoPnt( CreateGeoPoint3d()) ;
@@ -68,9 +68,9 @@ __stdcall EgtCreateGeoPoint( int nGseCtx, int nParentId, const double ptP[3])
//-------------------------------------------------------------------------------
int
__stdcall EgtCreateGeoVector( int nGseCtx, int nParentId, const double vtV[3], const double ptB[3])
__stdcall EgtCreateGeoVector( int nParentId, const double vtV[3], const double ptB[3])
{
IGeomDB* pGeomDB = GetGeomDB( nGseCtx) ;
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// creo il vettore
PtrOwner<IGeoVector3d> pGeoVct( CreateGeoVector3d()) ;
@@ -85,10 +85,10 @@ __stdcall EgtCreateGeoVector( int nGseCtx, int nParentId, const double vtV[3], c
//-------------------------------------------------------------------------------
int
__stdcall EgtCreateGeoFrame( int nGseCtx, int nParentId, const double ptOrig[3],
__stdcall EgtCreateGeoFrame( int nParentId, const double ptOrig[3],
const double vX[3], const double vY[3], const double vZ[3])
{
IGeomDB* pGeomDB = GetGeomDB( nGseCtx) ;
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// creo il riferimento
PtrOwner<IGeoFrame3d> pGeoFrm( CreateGeoFrame3d()) ;
@@ -103,10 +103,9 @@ __stdcall EgtCreateGeoFrame( int nGseCtx, int nParentId, const double ptOrig[3],
//-------------------------------------------------------------------------------
int
__stdcall EgtCreateCurveLine( int nGseCtx, int nParentId,
const double ptIni[3], const double ptFin[3])
__stdcall EgtCreateCurveLine( int nParentId, const double ptIni[3], const double ptFin[3])
{
IGeomDB* pGeomDB = GetGeomDB( nGseCtx) ;
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// creo la linea
PtrOwner<ICurveLine> pCrvLine( CreateCurveLine()) ;
@@ -121,10 +120,10 @@ __stdcall EgtCreateCurveLine( int nGseCtx, int nParentId,
//-------------------------------------------------------------------------------
int
__stdcall EgtCreateCurveLineMinPointCurve( int nGseCtx, int nParentId,
__stdcall EgtCreateCurveLineMinPointCurve( int nParentId,
const double ptStart[3], int nCrvId, double dNearPar)
{
IGeomDB* pGeomDB = GetGeomDB( nGseCtx) ;
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// recupero il riferimento del gruppo destinazione
Frame3d frPoint ;
@@ -162,10 +161,10 @@ __stdcall EgtCreateCurveLineMinPointCurve( int nGseCtx, int nParentId,
//-------------------------------------------------------------------------------
int
__stdcall EgtCreateCurveCircle( int nGseCtx, int nParentId,
__stdcall EgtCreateCurveCircle( int nParentId,
const double ptCen[3], const double vtN[3], double dRad)
{
IGeomDB* pGeomDB = GetGeomDB( nGseCtx) ;
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// creo l'arco
PtrOwner<ICurveArc> pCrvArc( CreateCurveArc()) ;
@@ -180,10 +179,10 @@ __stdcall EgtCreateCurveCircle( int nGseCtx, int nParentId,
//-------------------------------------------------------------------------------
int
__stdcall EgtCreateCurveCircleXY( int nGseCtx, int nParentId,
__stdcall EgtCreateCurveCircleXY( int nParentId,
const double ptCen[3], double dRad)
{
IGeomDB* pGeomDB = GetGeomDB( nGseCtx) ;
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// creo l'arco
PtrOwner<ICurveArc> pCrvArc( CreateCurveArc()) ;
@@ -198,10 +197,10 @@ __stdcall EgtCreateCurveCircleXY( int nGseCtx, int nParentId,
//-------------------------------------------------------------------------------
int
__stdcall EgtCreateCurveCircle3P( int nGseCtx, int nParentId,
__stdcall EgtCreateCurveCircle3P( int nParentId,
const double ptP1[3], const double ptP2[3], const double ptP3[3])
{
IGeomDB* pGeomDB = GetGeomDB( nGseCtx) ;
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// creo l'arco
PtrOwner<ICurveArc> pCrvArc( CreateCurveArc()) ;
@@ -216,11 +215,11 @@ __stdcall EgtCreateCurveCircle3P( int nGseCtx, int nParentId,
//-------------------------------------------------------------------------------
int
__stdcall EgtCreateCurveArc( int nGseCtx, int nParentId,
__stdcall EgtCreateCurveArc( int nParentId,
const double ptCen[3], const double vtN[3], double dRad,
const double vtS[3], double dAngCenDeg, double dDeltaN)
{
IGeomDB* pGeomDB = GetGeomDB( nGseCtx) ;
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// creo l'arco
PtrOwner<ICurveArc> pCrvArc( CreateCurveArc()) ;
@@ -235,11 +234,11 @@ __stdcall EgtCreateCurveArc( int nGseCtx, int nParentId,
//-------------------------------------------------------------------------------
int
__stdcall EgtCreateCurveArcXY( int nGseCtx, int nParentId,
__stdcall EgtCreateCurveArcXY( int nParentId,
const double ptCen[3], double dRad,
double dAngStartDeg, double dAngCenDeg, double dDeltaZ)
{
IGeomDB* pGeomDB = GetGeomDB( nGseCtx) ;
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// creo l'arco
PtrOwner<ICurveArc> pCrvArc( CreateCurveArc()) ;
@@ -254,10 +253,10 @@ __stdcall EgtCreateCurveArcXY( int nGseCtx, int nParentId,
//-------------------------------------------------------------------------------
int
__stdcall EgtCreateCurveArc3P( int nGseCtx, int nParentId,
__stdcall EgtCreateCurveArc3P( int nParentId,
const double ptP1[3], const double ptP2[3], const double ptP3[3])
{
IGeomDB* pGeomDB = GetGeomDB( nGseCtx) ;
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// creo l'arco
PtrOwner<ICurveArc> pCrvArc( CreateCurveArc()) ;
@@ -272,21 +271,21 @@ __stdcall EgtCreateCurveArc3P( int nGseCtx, int nParentId,
//-------------------------------------------------------------------------------
int
__stdcall EgtCreateCurveBezier( int nGseCtx, int nParentId, int nDegree, const double ptCtrls[])
__stdcall EgtCreateCurveBezier( int nParentId, int nDegree, const double ptCtrls[])
{
PNTVECTOR vPnt ;
vPnt.reserve( nDegree + 1) ;
for ( int i = 0 ; i <= nDegree ; ++i) {
vPnt.push_back( Point3d( ptCtrls[3*i], ptCtrls[3*i+1], ptCtrls[3*i+2])) ;
}
return EgtCreateCurveBezier( nGseCtx, nParentId, nDegree, vPnt) ;
return EgtCreateCurveBezier( nParentId, nDegree, vPnt) ;
}
//-------------------------------------------------------------------------------
int
__stdcall EgtCreateCurveBezier( int nGseCtx, int nParentId, int nDegree, const PNTVECTOR& vPnt)
__stdcall EgtCreateCurveBezier( int nParentId, int nDegree, const PNTVECTOR& vPnt)
{
IGeomDB* pGeomDB = GetGeomDB( nGseCtx) ;
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// il numero dei punti deve essere pari al grado + 1
if ( vPnt.size() != nDegree + 1)
@@ -312,21 +311,21 @@ __stdcall EgtCreateCurveBezier( int nGseCtx, int nParentId, int nDegree, const P
//-------------------------------------------------------------------------------
int
__stdcall EgtCreateCurveBezierRational( int nGseCtx, int nParentId, int nDegree, const double ptCtrlWs[])
__stdcall EgtCreateCurveBezierRational( int nParentId, int nDegree, const double ptCtrlWs[])
{
PNTUVECTOR vPntW ;
vPntW.reserve( nDegree + 1) ;
for ( int i = 0 ; i <= nDegree ; ++i) {
vPntW.push_back( make_pair( Point3d( ptCtrlWs[4*i], ptCtrlWs[4*i+1], ptCtrlWs[4*i+2]), ptCtrlWs[4*i+3])) ;
}
return EgtCreateCurveBezierRational( nGseCtx, nParentId, nDegree, vPntW) ;
return EgtCreateCurveBezierRational( nParentId, nDegree, vPntW) ;
}
//-------------------------------------------------------------------------------
int
__stdcall EgtCreateCurveBezierRational( int nGseCtx, int nParentId, int nDegree, const PNTUVECTOR& vPntW)
__stdcall EgtCreateCurveBezierRational( int nParentId, int nDegree, const PNTUVECTOR& vPntW)
{
IGeomDB* pGeomDB = GetGeomDB( nGseCtx) ;
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// il numero dei punti deve essere pari al grado + 1
if ( vPntW.size() != nDegree + 1)
@@ -352,9 +351,9 @@ __stdcall EgtCreateCurveBezierRational( int nGseCtx, int nParentId, int nDegree,
//-------------------------------------------------------------------------------
int
__stdcall EgtCreateCurveBezierFromArc( int nGseCtx, int nParentId, int nArcId, BOOL bErase)
__stdcall EgtCreateCurveBezierFromArc( int nParentId, int nArcId, BOOL bErase)
{
IGeomDB* pGeomDB = GetGeomDB( nGseCtx) ;
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// creo la curva di Bezier
PtrOwner<ICurveBezier> pCrvBez( CreateCurveBezier()) ;
@@ -397,21 +396,21 @@ __stdcall EgtCreateCurveBezierFromArc( int nGseCtx, int nParentId, int nArcId, B
//-------------------------------------------------------------------------------
int
__stdcall EgtCreateCurveCompo( int nGseCtx, int nParentId, int nNumId, const int nIds[], BOOL bErase)
__stdcall EgtCreateCurveCompo( int nParentId, int nNumId, const int nIds[], BOOL bErase)
{
INTVECTOR vIds ;
vIds.reserve( nNumId) ;
for ( int i = 0 ; i < nNumId ; ++i) {
vIds.push_back( nIds[i]) ;
}
return EgtCreateCurveCompo( nGseCtx, nParentId, vIds, ( bErase != FALSE)) ;
return EgtCreateCurveCompo( nParentId, vIds, ( bErase != FALSE)) ;
}
//-------------------------------------------------------------------------------
int
__stdcall EgtCreateCurveCompo( int nGseCtx, int nParentId, const INTVECTOR& vIds, bool bErase)
__stdcall EgtCreateCurveCompo( int nParentId, const INTVECTOR& vIds, bool bErase)
{
IGeomDB* pGeomDB = GetGeomDB( nGseCtx) ;
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// creo la curva composita
PtrOwner<ICurveComposite> pCrvCompo( CreateCurveComposite()) ;
@@ -468,20 +467,20 @@ __stdcall EgtCreateCurveCompo( int nGseCtx, int nParentId, const INTVECTOR& vIds
//-------------------------------------------------------------------------------
int
__stdcall EgtCreateCurveCompoFromPoints( int nGseCtx, int nParentId, int nP, const double ptPs[])
__stdcall EgtCreateCurveCompoFromPoints( int nParentId, int nP, const double ptPs[])
{
PolyLine PL ;
for ( int i = 0 ; i < nP ; ++i) {
PL.AddUPoint( 0, Point3d( ptPs[3*i], ptPs[3*i+1], ptPs[3*i+2])) ;
}
return EgtCreateCurveCompoFromPoints( nGseCtx, nParentId, PL) ;
return EgtCreateCurveCompoFromPoints( nParentId, PL) ;
}
//-------------------------------------------------------------------------------
int
__stdcall EgtCreateCurveCompoFromPoints( int nGseCtx, int nParentId, const PolyLine& PL)
__stdcall EgtCreateCurveCompoFromPoints( int nParentId, const PolyLine& PL)
{
IGeomDB* pGeomDB = GetGeomDB( nGseCtx) ;
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// creo la curva composita
PtrOwner<ICurveComposite> pCrvCompo( CreateCurveComposite()) ;
@@ -496,20 +495,20 @@ __stdcall EgtCreateCurveCompoFromPoints( int nGseCtx, int nParentId, const PolyL
//-------------------------------------------------------------------------------
int
__stdcall EgtCreateCurveCompoFromPointBulges( int nGseCtx, int nParentId, int nPB, const double ptPBs[])
__stdcall EgtCreateCurveCompoFromPointBulges( int nParentId, int nPB, const double ptPBs[])
{
PolyArc PA ;
for ( int i = 0 ; i < nPB ; ++i) {
PA.AddUPoint( 0, Point3d( ptPBs[4*i], ptPBs[4*i+1], ptPBs[4*i+2]), ptPBs[4*i+3]) ;
}
return EgtCreateCurveCompoFromPointBulges( nGseCtx, nParentId, PA) ;
return EgtCreateCurveCompoFromPointBulges( nParentId, PA) ;
}
//-------------------------------------------------------------------------------
int
__stdcall EgtCreateCurveCompoFromPointBulges( int nGseCtx, int nParentId, const PolyArc& PA)
__stdcall EgtCreateCurveCompoFromPointBulges( int nParentId, const PolyArc& PA)
{
IGeomDB* pGeomDB = GetGeomDB( nGseCtx) ;
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// creo la curva composita
PtrOwner<ICurveComposite> pCrvCompo( CreateCurveComposite()) ;
@@ -524,10 +523,10 @@ __stdcall EgtCreateCurveCompoFromPointBulges( int nGseCtx, int nParentId, const
//-------------------------------------------------------------------------------
int
__stdcall EgtCreateCurveCompoFromPolygonSide( int nGseCtx, int nParentId, int nNumSides,
__stdcall EgtCreateCurveCompoFromPolygonSide( int nParentId, int nNumSides,
const double ptIni[3], const double ptFin[3])
{
IGeomDB* pGeomDB = GetGeomDB( nGseCtx) ;
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// creo la curva composita
PtrOwner<ICurveComposite> pCrvCompo( CreateCurveComposite()) ;
@@ -542,9 +541,9 @@ __stdcall EgtCreateCurveCompoFromPolygonSide( int nGseCtx, int nParentId, int nN
//-------------------------------------------------------------------------------
int
__stdcall EgtCreateSurfTriMeshByContour( int nGseCtx, int nParentId, int nCrvId, double dLinTol)
__stdcall EgtCreateSurfTriMeshByContour( int nParentId, int nCrvId, double dLinTol)
{
IGeomDB* pGeomDB = GetGeomDB( nGseCtx) ;
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// recupero il riferimento del gruppo destinazione
Frame3d frDest ;
@@ -567,18 +566,18 @@ __stdcall EgtCreateSurfTriMeshByContour( int nGseCtx, int nParentId, int nCrvId,
//-------------------------------------------------------------------------------
int
__stdcall EgtCreateText( int nGseCtx, int nParentId, const wchar_t* wsText,
__stdcall EgtCreateText( int nParentId, const wchar_t* wsText,
const double ptP[3], double dAngRotDeg, double dH)
{
return EgtCreateText( nGseCtx, nParentId, wstrztoA( wsText), Point3d( ptP), dAngRotDeg, dH) ;
return EgtCreateText( nParentId, wstrztoA( wsText), Point3d( ptP), dAngRotDeg, dH) ;
}
//-------------------------------------------------------------------------------
int
__stdcall EgtCreateText( int nGseCtx, int nParentId, const string& sText,
__stdcall EgtCreateText( int nParentId, const string& sText,
const Point3d& ptP, double dAngRotDeg, double dH)
{
IGeomDB* pGeomDB = GetGeomDB( nGseCtx) ;
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// creo il testo
PtrOwner<IExtText> pTXT( CreateExtText()) ;
@@ -593,21 +592,21 @@ __stdcall EgtCreateText( int nGseCtx, int nParentId, const string& sText,
//-------------------------------------------------------------------------------
int
__stdcall EgtCreateTextEx( int nGseCtx, int nParentId, const wchar_t* wsText,
__stdcall EgtCreateTextEx( int nParentId, const wchar_t* wsText,
const double ptP[3], double dAngRotDeg, const wchar_t* wsFont,
int nW, BOOL bItalic, double dH, double dRat, double dAddAdv, int nInsPos)
{
return EgtCreateTextEx( nGseCtx, nParentId, wstrztoA( wsText), Point3d( ptP), dAngRotDeg,
return EgtCreateTextEx( nParentId, wstrztoA( wsText), Point3d( ptP), dAngRotDeg,
wstrztoA( wsFont), nW, ( bItalic != FALSE), dH, dRat, dAddAdv, nInsPos) ;
}
//-------------------------------------------------------------------------------
int
__stdcall EgtCreateTextEx( int nGseCtx, int nParentId, const string& sText,
__stdcall EgtCreateTextEx( int nParentId, const string& sText,
const Point3d& ptP, double dAngRotDeg, const string& sFont,
int nW, bool bItalic, double dH, double dRat, double dAddAdv, int nInsPos)
{
IGeomDB* pGeomDB = GetGeomDB( nGseCtx) ;
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// creo il testo
PtrOwner<IExtText> pTXT( CreateExtText()) ;