Files
EgtInterface/API_GdbGetCurve.cpp
2025-03-27 10:20:45 +01:00

286 lines
8.9 KiB
C++

//----------------------------------------------------------------------------
// EgalTech 2020-2020
//----------------------------------------------------------------------------
// File : API_GetCurve.cpp Data : 30.03.20 Versione : 2.2c3
// Contenuto : Funzioni di interrogazione delle curve per API.
//
//
//
// Modifiche : 30.03.20 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "API.h"
#include "/EgtDev/Include/EInAPI.h"
#include "/EgtDev/Include/EXeExecutor.h"
using namespace std ;
//----------------------------------------------------------------------------
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 EgtCurveParamAtLength( int nId, double dLen, double* pdU)
{
return ( ExeCurveParamAtLength( nId, dLen, pdU) ? 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 EgtCurveIsClosed( int nId)
{
return ( ExeCurveIsClosed( nId) ? TRUE : FALSE) ;
}
//----------------------------------------------------------------------------
BOOL
__stdcall EgtCurveIsFlat( int nId, BOOL bUseExtrusion, double dToler, double vtN[3], double* pdDist)
{
if ( vtN == nullptr || pdDist == nullptr)
return FALSE ;
Plane3d Plane ;
if ( ! ExeCurveIsFlat( nId, Plane, ( bUseExtrusion != FALSE), dToler))
return FALSE ;
VEC_FROM_3D( vtN, Plane.GetVersN())
*pdDist = Plane.GetDist() ;
return TRUE ;
}
//----------------------------------------------------------------------------
BOOL
__stdcall EgtCurveIsACircle( int nId, double dToler, double ptC[3], double vtN[3], double* pdRad, BOOL* pbCCW)
{
if ( ptC == nullptr || vtN == nullptr || pdRad == nullptr || pbCCW == nullptr)
return FALSE ;
Point3d ptCen ;
Vector3d vtNorm ;
double dRad ;
bool bCCW ;
if ( ! ExeCurveIsACircle( nId, ptCen, vtNorm, dRad, bCCW, dToler))
return FALSE ;
VEC_FROM_3D( ptC, ptCen)
VEC_FROM_3D( vtN, vtNorm)
*pdRad = dRad ;
*pbCCW = ( bCCW ? TRUE : FALSE) ;
return TRUE ;
}
//----------------------------------------------------------------------------
BOOL
__stdcall EgtCurveIsARectangle( int nId, double dToler, double ptP[3], double vtL1[3], double vtL2[3])
{
if ( ptP == nullptr || vtL1 == nullptr || vtL2 == nullptr)
return FALSE ;
Point3d ptPNT ;
Vector3d vtLato1, vtLato2 ;
if ( ! ExeCurveIsARectangle( nId, ptPNT, vtLato1, vtLato2, dToler))
return FALSE ;
VEC_FROM_3D( ptP, ptPNT)
VEC_FROM_3D( vtL1, vtLato1)
VEC_FROM_3D( vtL2, vtLato2)
return TRUE ;
}
//----------------------------------------------------------------------------
BOOL
__stdcall EgtCurveIsATrapezoid( int nId, double dToler, double ptP[3], double vtB1[3], double vtL1[3], double vtB2[3])
{
if ( ptP == nullptr || vtB1 == nullptr || vtL1 == nullptr || vtB2 == nullptr)
return FALSE ;
Point3d ptPNT ;
Vector3d vtBase1, vtLato1, vtBase2 ;
if ( ! ExeCurveIsATrapezoid( nId, ptPNT, vtBase1, vtLato1, vtBase2, dToler))
return FALSE ;
VEC_FROM_3D( ptP, ptPNT)
VEC_FROM_3D( vtB1, vtBase1)
VEC_FROM_3D( vtL1, vtLato1)
VEC_FROM_3D( vtB2, vtBase2)
return TRUE ;
}
//----------------------------------------------------------------------------
BOOL
__stdcall EgtCurveAreaXY( int nId, double* pdArea)
{
return ( ExeCurveAreaXY( nId, *pdArea) ? TRUE : FALSE) ;
}
//----------------------------------------------------------------------------
BOOL
__stdcall EgtCurveArea( int nId, double vtN[3], double* pdDist, double* pdArea)
{
if ( vtN == nullptr || pdDist == nullptr || pdArea == nullptr)
return FALSE ;
Plane3d Plane ;
if ( ! ExeCurveArea( nId, Plane, *pdArea))
return FALSE ;
VEC_FROM_3D( vtN, Plane.GetVersN())
*pdDist = Plane.GetDist() ;
return TRUE ;
}
//----------------------------------------------------------------------------
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 EgtCurveSelfIntersCount( int nId, int* pnCount)
{
return ( ExeCurveSelfIntersCount( nId, pnCount) ? TRUE : FALSE) ;
}
//----------------------------------------------------------------------------
BOOL
__stdcall EgtCurveMinAreaRectangleXY( int nId, int nRefId,
double ptOrig[3], double vtX[3], double vtY[3], double vtZ[3], double* pdDimX, double* pdDimY)
{
// eseguo calcoli
Frame3d frRect ;
double dDimX, dDimY ;
if ( ! ExeCurveMinAreaRectangleXY( nId, nRefId, frRect, dDimX, dDimY))
return FALSE ;
// assegno l'origine
if ( ptOrig != nullptr)
VEC_FROM_3D( ptOrig, frRect.Orig())
// assegno il versore X
if ( vtX != nullptr)
VEC_FROM_3D( vtX, frRect.VersX())
// assegno il versore Y
if ( vtY != nullptr)
VEC_FROM_3D( vtY, frRect.VersY())
// assegno il versore Z
if ( vtZ != nullptr)
VEC_FROM_3D( vtZ, frRect.VersZ())
if ( pdDimX != nullptr)
*pdDimX = dDimX ;
if ( pdDimY != nullptr)
*pdDimY = dDimY ;
return TRUE ;
}
//----------------------------------------------------------------------------
int
__stdcall EgtClosedCurveClassify( int nId1, int nId2)
{
return ExeClosedCurveClassify( nId1, nId2) ;
}
//----------------------------------------------------------------------------
int
__stdcall EgtCurveWithRegionClassify( int nCurveId, int nRegionId)
{
return ExeCurveWithRegionClassify( nCurveId, nRegionId) ;
}
//----------------------------------------------------------------------------
BOOL
__stdcall EgtArcRadius( int nId, double* pdRad)
{
return ( ExeArcRadius( nId, pdRad) ? TRUE : FALSE) ;
}
//----------------------------------------------------------------------------
BOOL
__stdcall EgtArcAngCenter( int nId, double* pdAngDeg)
{
return ( ExeArcAngCenter( nId, pdAngDeg) ? TRUE : FALSE) ;
}
//----------------------------------------------------------------------------
BOOL
__stdcall EgtArcDeltaN( int nId, double* pdDeltaN)
{
return ( ExeArcDeltaN( nId, pdDeltaN) ? TRUE : FALSE) ;
}
//----------------------------------------------------------------------------
BOOL
__stdcall EgtArcNormVersor( int nId, int nRefId, double vtNorm[3])
{
// recupero il vettore normale
Vector3d vtTmp ;
if ( ! ExeArcNormVersor( 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 EgtCopyCompoSubCurve( int nId, int nSubCrvToCopy, int nParentId)
{
return ExeCopyCompoSubCurve( nId, nSubCrvToCopy, nParentId) ;
}
//----------------------------------------------------------------------------
int
__stdcall EgtCopyParamRange( int nId, double dUStart, double dUEnd, int nParentId)
{
return ExeCopyParamRange( nId, dUStart, dUEnd, nParentId) ;
}