Files
EgtInterface/API_GeoSnap.cpp
T
Dario Sassi 73d0639ea9 EgtInterface 1.6f1 :
- aggiornata interfaccia.
2015-06-06 17:55:44 +00:00

441 lines
13 KiB
C++

//----------------------------------------------------------------------------
// EgalTech 2014-2014
//----------------------------------------------------------------------------
// File : API_GeoSnap.cpp Data : 02.10.14 Versione : 1.5i5
// Contenuto : Funzioni di snap ad oggetti del DB geometrico per API.
//
//
//
// Modifiche : 02.10.14 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "API.h"
#include "/EgtDev/Include/EInAPI.h"
#include "/EgtDev/Include/EXeExecutor.h"
//----------------------------------------------------------------------------
BOOL
__stdcall EgtStartPoint( int nId, int nRefId, double ptP[3])
{
// recupero il punto
Point3d ptStart ;
if ( ! ExeStartPoint( nId, nRefId, ptStart))
return FALSE ;
// ritorno il punto
VEC_FROM_3D( ptP, ptStart)
return TRUE ;
}
//----------------------------------------------------------------------------
BOOL
__stdcall EgtEndPoint( int nId, int nRefId, double ptP[3])
{
// recupero il punto
Point3d ptEnd ;
if ( ! ExeEndPoint( nId, nRefId, ptEnd))
return FALSE ;
// ritorno il punto
VEC_FROM_3D( ptP, ptEnd)
return TRUE ;
}
//----------------------------------------------------------------------------
BOOL
__stdcall EgtMidPoint( int nId, int nRefId, double ptP[3])
{
// recupero il punto
Point3d ptMid ;
if ( ! ExeMidPoint( nId, nRefId, ptMid))
return FALSE ;
// ritorno il punto
VEC_FROM_3D( ptP, ptMid)
return TRUE ;
}
//----------------------------------------------------------------------------
BOOL
__stdcall EgtCenterPoint( int nId, int nRefId, double ptP[3])
{
// recupero il punto
Point3d ptCent ;
if ( ! ExeCenterPoint( nId, nRefId, ptCent))
return FALSE ;
// ritorno il punto
VEC_FROM_3D( ptP, ptCent)
return TRUE ;
}
//----------------------------------------------------------------------------
BOOL
__stdcall EgtCentroid( int nId, int nRefId, double ptP[3])
{
// recupero il punto
Point3d ptCent ;
if ( ! ExeCentroid( nId, nRefId, ptCent))
return FALSE ;
// ritorno il punto
VEC_FROM_3D( ptP, ptCent)
return TRUE ;
}
//----------------------------------------------------------------------------
BOOL
__stdcall EgtAtParamPoint( int nId, double dU, int nRefId, double ptP[3])
{
// recupero il punto
Point3d ptAtPar ;
if ( ! ExeAtParamPoint( nId, dU, nRefId, ptAtPar))
return FALSE ;
// ritorno il punto
VEC_FROM_3D( ptP, ptAtPar)
return TRUE ;
}
//----------------------------------------------------------------------------
BOOL
__stdcall EgtNearPoint( int nId, const double ptNear[3], int nRefId, double ptP[3])
{
// recupero il punto
Point3d ptInt ;
if ( ! ExeNearPoint( nId, ptNear, nRefId, ptInt))
return FALSE ;
// ritorno il punto
VEC_FROM_3D( ptP, ptInt)
return TRUE ;
}
//----------------------------------------------------------------------------
BOOL
__stdcall EgtIntersectionPoint( int nId1, int nId2, const double ptNear[3], int nRefId, double ptP[3])
{
// recupero il punto
Point3d ptInt ;
if ( ! ExeIntersectionPoint( nId1, nId2, ptNear, nRefId, ptInt))
return FALSE ;
// ritorno il punto
VEC_FROM_3D( ptP, ptInt)
return TRUE ;
}
//----------------------------------------------------------------------------
BOOL
__stdcall EgtStartVector( int nId, int nRefId, double vtV[3])
{
// recupero il vettore
Vector3d vtStart ;
if ( ! ExeStartVector( nId, nRefId, vtStart))
return FALSE ;
// ritorno il vettore
VEC_FROM_3D( vtV, vtStart)
return TRUE ;
}
//----------------------------------------------------------------------------
BOOL
__stdcall EgtEndVector( int nId, int nRefId, double vtV[3])
{
// recupero il vettore
Vector3d vtEnd ;
if ( ! ExeEndVector( nId, nRefId, vtEnd))
return FALSE ;
// ritorno il vettore
VEC_FROM_3D( vtV, vtEnd)
return TRUE ;
}
//----------------------------------------------------------------------------
BOOL
__stdcall EgtMidVector( int nId, int nRefId, double vtV[3])
{
// recupero il vettore
Vector3d vtMid ;
if ( ! ExeMidVector( nId, nRefId, vtMid))
return FALSE ;
// ritorno il vettore
VEC_FROM_3D( vtV, vtMid)
return TRUE ;
}
//----------------------------------------------------------------------------
BOOL
__stdcall EgtAtParamVector( int nId, double dU, int nSide, int nRefId, double vtV[3])
{
// recupero il vettore
Vector3d vtAtPar ;
if ( ! ExeAtParamVector( nId, dU, nSide, nRefId, vtAtPar))
return FALSE ;
// ritorno il vettore
VEC_FROM_3D( vtV, vtAtPar)
return TRUE ;
}
//----------------------------------------------------------------------------
BOOL
__stdcall EgtFrame( int nId, int nRefId, double ptOrig[3], double vtX[3], double vtY[3], double vtZ[3])
{
// recupero il frame
Frame3d frFrame ;
if ( ! ExeFrame( nId, nRefId, frFrame))
return FALSE ;
// assegno l'origine
VEC_FROM_3D( ptOrig, frFrame.Orig())
// assegno il versore X
VEC_FROM_3D( vtX, frFrame.VersX())
// assegno il versore Y
VEC_FROM_3D( vtY, frFrame.VersY())
// assegno il versore Z
VEC_FROM_3D( vtZ, frFrame.VersZ())
return TRUE ;
}
//----------------------------------------------------------------------------
BOOL
__stdcall EgtCurveDomain( int nId, double* pdStart, double* pdEnd)
{
return ( ExeCurveDomain( nId, pdStart, pdEnd) ? TRUE : FALSE) ;
}
//----------------------------------------------------------------------------
BOOL
__stdcall EgtCurveLength( int nId, double* pdLen)
{
return ( ExeCurveLength( nId, pdLen) ? TRUE : FALSE) ;
}
//----------------------------------------------------------------------------
BOOL
__stdcall EgtCurveLengthAtPoint( int nId, const double ptOn[3], double dExtend, double* pdLen)
{
return ( ExeCurveLengthAtPoint( nId, ptOn, dExtend, pdLen) ? TRUE : FALSE) ;
}
//----------------------------------------------------------------------------
BOOL
__stdcall EgtCurveNearestExtremityToPoint( int nId, const double ptP[3], BOOL* pbStart)
{
if ( pbStart == nullptr)
return FALSE ;
bool bStart ;
if ( ! ExeCurveNearestExtremityToPoint( nId, ptP, bStart))
return FALSE ;
*pbStart = ( bStart ? TRUE : FALSE) ;
return TRUE ;
}
//----------------------------------------------------------------------------
BOOL
__stdcall EgtCurveExtrusion( int nId, int nRefId, double vtExtr[3])
{
// recupero il vettore estrusione
Vector3d vtTmp ;
if ( ! ExeCurveExtrusion( nId, nRefId, vtTmp))
return FALSE ;
// lo assegno
VEC_FROM_3D( vtExtr, vtTmp)
return TRUE ;
}
//----------------------------------------------------------------------------
BOOL
__stdcall EgtCurveThickness( int nId, double* pdThick)
{
return ( ExeCurveThickness( nId, pdThick) ? TRUE : FALSE) ;
}
//----------------------------------------------------------------------------
BOOL
__stdcall EgtGetMinDistPointCurve( const double ptP[3], int nId, double* pdDist, double* pdU)
{
return ( ExeGetMinDistPointCurve( ptP, nId, pdDist, pdU) ? TRUE : FALSE) ;
}
//----------------------------------------------------------------------------
BOOL
__stdcall EgtGetMinDistPntSidePointCurve( const double ptP[3], int nId, const double vtN[3],
double* pdDist, double ptMin[3], int* pnSide)
{
if ( pdDist == nullptr || ptMin == nullptr || pnSide == nullptr)
return FALSE ;
Point3d ptTmp ;
if ( ! ExeGetMinDistPntSidePointCurve( ptP, nId, vtN, pdDist, ptTmp, pnSide))
return FALSE ;
VEC_FROM_3D( ptMin, ptTmp)
return TRUE ;
}
//----------------------------------------------------------------------------
BOOL
__stdcall EgtCurveArcRadius( int nId, double* pdRad)
{
return ( ExeCurveArcRadius( nId, pdRad) ? TRUE : FALSE) ;
}
//----------------------------------------------------------------------------
BOOL
__stdcall EgtCurveArcNormVersor( int nId, int nRefId, double vtNorm[3])
{
// recupero il vettore normale
Vector3d vtTmp ;
if ( ! ExeCurveArcNormVersor( nId, nRefId, vtTmp))
return FALSE ;
// lo assegno
VEC_FROM_3D( vtNorm, vtTmp)
return TRUE ;
}
//----------------------------------------------------------------------------
BOOL
__stdcall EgtCurveCompoCenter( int nId, int nSimpCrv, int nRefId, double ptCen[3])
{
// recupero il centro
Point3d ptTmp ;
if ( ! ExeCurveCompoCenter( nId, nSimpCrv, nRefId, ptTmp))
return FALSE ;
// lo assegno
VEC_FROM_3D( ptCen, ptTmp)
return TRUE ;
}
//----------------------------------------------------------------------------
int
__stdcall EgtSurfTmFacetNbr( int nId)
{
return ExeSurfTmFacetNbr( nId) ;
}
//----------------------------------------------------------------------------
int
__stdcall EgtSurfTmFacetFromTria( int nId, int nT)
{
return ExeSurfTmFacetFromTria( nId, nT) ;
}
//----------------------------------------------------------------------------
BOOL
__stdcall EgtSurfTmFacetNearestEndPoint( int nId, int nFacet, const double ptNear[3], int nRefId,
double ptEnd[3], double vtNorm[3])
{
// recupero il punto e la normale
Point3d ptTmp ;
Vector3d vtN ;
if ( ! ExeSurfTmFacetNearestEndPoint( nId, nFacet, ptNear, nRefId, ptTmp, vtN))
return FALSE ;
// li assegno
VEC_FROM_3D( ptEnd, ptTmp)
VEC_FROM_3D( vtNorm, vtN)
return TRUE ;
}
//----------------------------------------------------------------------------
BOOL
__stdcall EgtSurfTmFacetNearestMidPoint( int nId, int nFacet, const double ptNear[3], int nRefId,
double ptMid[3], double vtNorm[3])
{
// recupero il punto e la normale
Point3d ptTmp ;
Vector3d vtN ;
if ( ! ExeSurfTmFacetNearestMidPoint( nId, nFacet, ptNear, nRefId, ptTmp, vtN))
return FALSE ;
// li assegno
VEC_FROM_3D( ptMid, ptTmp)
VEC_FROM_3D( vtNorm, vtN)
return TRUE ;
}
//----------------------------------------------------------------------------
BOOL
__stdcall EgtSurfTmFacetCenter( int nId, int nFacet, int nRefId, double ptCen[3], double vtNorm[3])
{
// recupero il centro e la normale
Point3d ptTmp ;
Vector3d vtN ;
if ( ! ExeSurfTmFacetCenter( nId, nFacet, nRefId, ptTmp, vtN))
return FALSE ;
// li assegno
VEC_FROM_3D( ptCen, ptTmp)
VEC_FROM_3D( vtNorm, vtN)
return TRUE ;
}
//----------------------------------------------------------------------------
BOOL
__stdcall EgtSurfTmFacetNormVersor( int nId, int nFacet, int nRefId, double vtNorm[3])
{
// recupero il vettore normale
Vector3d vtTmp ;
if ( ! ExeSurfTmFacetNormVersor( nId, nFacet, nRefId, vtTmp))
return FALSE ;
// lo assegno
VEC_FROM_3D( vtNorm, vtTmp)
return TRUE ;
}
//----------------------------------------------------------------------------
BOOL
__stdcall EgtExtTextNormVersor( int nId, int nRefId, double vtNorm[3])
{
// recupero il vettore normale
Vector3d vtTmp ;
if ( ! ExeExtTextNormVersor( nId, nRefId, vtTmp))
return FALSE ;
// lo assegno
VEC_FROM_3D( vtNorm, vtTmp)
return TRUE ;
}
//-------------------------------------------------------------------------------
BOOL
__stdcall EgtPointToIdGlob( double ptP[3], int nId)
{
// trasformo il punto
Point3d ptTmp( ptP) ;
if ( ! ExePointToIdGlob( ptTmp, nId))
return FALSE ;
// ritorno il punto
VEC_FROM_3D( ptP, ptTmp)
return TRUE ;
}
//-------------------------------------------------------------------------------
BOOL
__stdcall EgtPointToIdLoc( double ptP[3], int nId)
{
// trasformo il punto
Point3d ptTmp( ptP) ;
if ( ! ExePointToIdLoc( ptTmp, nId))
return FALSE ;
// ritorno il punto
VEC_FROM_3D( ptP, ptTmp)
return TRUE ;
}
//-------------------------------------------------------------------------------
BOOL
__stdcall EgtVectorToIdGlob( double vtV[3], int nId)
{
// trasformo il vettore
Vector3d vtTmp( vtV) ;
if ( ! ExeVectorToIdGlob( vtTmp, nId))
return FALSE ;
// ritorno il punto
VEC_FROM_3D( vtV, vtTmp)
return TRUE ;
}
//-------------------------------------------------------------------------------
BOOL
__stdcall EgtVectorToIdLoc( double vtV[3], int nId)
{
// trasformo il vettore
Vector3d vtTmp( vtV) ;
if ( ! ExeVectorToIdLoc( vtTmp, nId))
return FALSE ;
// ritorno il punto
VEC_FROM_3D( vtV, vtTmp)
return TRUE ;
}