EgtInterface 1.5k5 :
- aggiunta EgtTrimExtendCurveByLen - aggiunta EgtOffsetCurve - aggiunte EgtCurveLength e EgtCurveLengthAtPoint - aggiunta EgtGetPointFromSelect.
This commit is contained in:
@@ -16,7 +16,14 @@
|
||||
#include "API.h"
|
||||
#include "API_Macro.h"
|
||||
#include "/EgtDev/Include/EInAPI.h"
|
||||
#include "/EgtDev/Include/EInConst.h"
|
||||
#include "/EgtDev/Include/EgkCurveLine.h"
|
||||
#include "/EgtDev/Include/EGkLinePntTgCurve.h"
|
||||
#include "/EgtDev/Include/EGkLinePntPerpCurve.h"
|
||||
#include "/EgtDev/Include/EGkLinePntMinDistCurve.h"
|
||||
#include "/EgtDev/Include/EGkLineTgTwoCurves.h"
|
||||
#include "/EgtDev/Include/EGkLinePerpTwoCurves.h"
|
||||
#include "/EgtDev/Include/EGkLineTgCurvePerpCurve.h"
|
||||
#include "/EgtDev/Include/EgkCurveArc.h"
|
||||
#include "/EgtDev/Include/EgkCurveBezier.h"
|
||||
#include "/EgtDev/Include/EgkCurveComposite.h"
|
||||
@@ -27,6 +34,19 @@
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static ICurveLine* __stdcall CreateLinePointTgCurve( IGeomDB* pGeomDB, int nParentId,
|
||||
const Point3d& ptIni, const Point3d& ptFin, int nIdF) ;
|
||||
static ICurveLine* __stdcall CreateLinePointPerpCurve( IGeomDB* pGeomDB, int nParentId,
|
||||
const Point3d& ptIni, const Point3d& ptFin, int nIdF) ;
|
||||
static ICurveLine* __stdcall CreateLinePointMinDistCurve( IGeomDB* pGeomDB, int nParentId,
|
||||
const Point3d& ptIni, const Point3d& ptFin, int nIdF) ;
|
||||
static ICurveLine* __stdcall CreateLineTgTwoCurves( IGeomDB* pGeomDB, int nParentId,
|
||||
const Point3d& ptIni, int nIdI, const Point3d& ptFin, int nIdF) ;
|
||||
static ICurveLine* __stdcall CreateLinePerpTwoCurves( IGeomDB* pGeomDB, int nParentId,
|
||||
const Point3d& ptIni, int nIdI, const Point3d& ptFin, int nIdF) ;
|
||||
static ICurveLine* __stdcall CreateLineTgCurvePerpCurve( IGeomDB* pGeomDB, int nParentId,
|
||||
const Point3d& ptIni, int nIdI, const Point3d& ptFin, int nIdF) ;
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
@@ -45,6 +65,359 @@ __stdcall EgtCreateCurveLine( int nParentId, const double ptIni[3], const double
|
||||
return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pCrvLine)) ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
__stdcall EgtCreateCurveLineEx( int nParentId, const double ptIni[3], int nSepI, int nIdI,
|
||||
const double ptFin[3], int nSepF, int nIdF)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// puntatore alla linea
|
||||
PtrOwner<ICurveLine> pCrvLine ;
|
||||
// 1 - se punti entrambi definiti
|
||||
if ( nSepI == SEP_STD && nSepF == SEP_STD) {
|
||||
pCrvLine.Set( CreateCurveLine()) ;
|
||||
if ( IsNull( pCrvLine))
|
||||
return GDB_ID_NULL ;
|
||||
if ( ! pCrvLine->Set( ptIni, ptFin))
|
||||
return GDB_ID_NULL ;
|
||||
}
|
||||
// 2 - se primo punto definito e secondo a minima distanza
|
||||
else if ( nSepI == SEP_STD && nSepF == SEP_MINDIST) {
|
||||
pCrvLine.Set( CreateLinePointMinDistCurve( pGeomDB, nParentId, ptIni, ptFin, nIdF)) ;
|
||||
if ( IsNull( pCrvLine))
|
||||
return GDB_ID_NULL ;
|
||||
}
|
||||
// 3 - se primo punto a minima distanza e secondo definito
|
||||
else if ( nSepI == SEP_MINDIST && nSepF == SEP_STD) {
|
||||
pCrvLine.Set( CreateLinePointMinDistCurve( pGeomDB, nParentId, ptFin, ptIni, nIdI)) ;
|
||||
if ( IsNull( pCrvLine))
|
||||
return GDB_ID_NULL ;
|
||||
pCrvLine->Invert() ;
|
||||
}
|
||||
// 4 - se primo punto definito e secondo tangente
|
||||
else if ( nSepI == SEP_STD && nSepF == SEP_TG) {
|
||||
pCrvLine.Set( CreateLinePointTgCurve( pGeomDB, nParentId, ptIni, ptFin, nIdF)) ;
|
||||
if ( IsNull( pCrvLine))
|
||||
return GDB_ID_NULL ;
|
||||
}
|
||||
// 5 - se primo punto tangente e secondo definito
|
||||
else if ( nSepI == SEP_TG && nSepF == SEP_STD) {
|
||||
// costruisco la curva al contrario e poi la inverto
|
||||
pCrvLine.Set( CreateLinePointTgCurve( pGeomDB, nParentId, ptFin, ptIni, nIdI)) ;
|
||||
if ( IsNull( pCrvLine))
|
||||
return GDB_ID_NULL ;
|
||||
pCrvLine->Invert() ;
|
||||
}
|
||||
// 6 - se entrambi i punti tangenti
|
||||
else if ( nSepI == SEP_TG && nSepF == SEP_TG) {
|
||||
pCrvLine.Set( CreateLineTgTwoCurves( pGeomDB, nParentId, ptIni, nIdI, ptFin, nIdF)) ;
|
||||
if ( IsNull( pCrvLine))
|
||||
return GDB_ID_NULL ;
|
||||
}
|
||||
// 7 - se primo punto definito e secondo perpendicolare
|
||||
else if ( nSepI == SEP_STD && nSepF == SEP_PERP) {
|
||||
pCrvLine.Set( CreateLinePointPerpCurve( pGeomDB, nParentId, ptIni, ptFin, nIdF)) ;
|
||||
if ( IsNull( pCrvLine))
|
||||
return GDB_ID_NULL ;
|
||||
}
|
||||
// 8 - se primo punto perpendicolare e secondo definito
|
||||
else if ( nSepI == SEP_PERP && nSepF == SEP_STD) {
|
||||
// costruisco la curva al contrario e poi la inverto
|
||||
pCrvLine.Set( CreateLinePointPerpCurve( pGeomDB, nParentId, ptFin, ptIni, nIdI)) ;
|
||||
if ( IsNull( pCrvLine))
|
||||
return GDB_ID_NULL ;
|
||||
pCrvLine->Invert() ;
|
||||
}
|
||||
// 9 - se entrambi i punti perpendicolari
|
||||
else if ( nSepI == SEP_PERP && nSepF == SEP_PERP) {
|
||||
pCrvLine.Set( CreateLinePerpTwoCurves( pGeomDB, nParentId, ptIni, nIdI, ptFin, nIdF)) ;
|
||||
if ( IsNull( pCrvLine))
|
||||
return GDB_ID_NULL ;
|
||||
}
|
||||
// 10 - se primo punto tangente e secondo perpendicolare
|
||||
else if ( nSepI == SEP_TG && nSepF == SEP_PERP) {
|
||||
pCrvLine.Set( CreateLineTgCurvePerpCurve( pGeomDB, nParentId, ptIni, nIdI, ptFin, nIdF)) ;
|
||||
if ( IsNull( pCrvLine))
|
||||
return GDB_ID_NULL ;
|
||||
}
|
||||
// 11 - se primo punto perpendicolare e secondo tangente
|
||||
else if ( nSepI == SEP_PERP && nSepF == SEP_TG) {
|
||||
// costruisco la curva al contrario e poi la inverto
|
||||
pCrvLine.Set( CreateLineTgCurvePerpCurve( pGeomDB, nParentId, ptFin, nIdF, ptIni, nIdI)) ;
|
||||
if ( IsNull( pCrvLine))
|
||||
return GDB_ID_NULL ;
|
||||
pCrvLine->Invert() ;
|
||||
}
|
||||
// errore
|
||||
else {
|
||||
return GDB_ID_NULL ;
|
||||
}
|
||||
// inserisco la linea nel DB
|
||||
return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pCrvLine)) ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
ICurveLine*
|
||||
__stdcall CreateLinePointTgCurve( IGeomDB* pGeomDB, int nParentId,
|
||||
const Point3d& ptIni, const Point3d& ptFin, int nIdF)
|
||||
{
|
||||
// verifica preliminare Id curva
|
||||
if ( nIdF == GDB_ID_NULL)
|
||||
return nullptr ;
|
||||
// recupero il riferimento del gruppo destinazione
|
||||
Frame3d frDest ;
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frDest))
|
||||
return nullptr ;
|
||||
// recupero il riferimento della curva
|
||||
Frame3d frCurve ;
|
||||
if ( ! pGeomDB->GetGlobFrame( nIdF, frCurve))
|
||||
return nullptr ;
|
||||
// porto il punto iniziale nel riferimento della curva
|
||||
Point3d ptSloc( ptIni) ;
|
||||
ptSloc.LocToLoc( frDest, frCurve) ;
|
||||
// porto il punto vicino al finale nel riferimento della curva
|
||||
Point3d ptNloc( ptFin) ;
|
||||
ptNloc.LocToLoc( frDest, frCurve) ;
|
||||
// recupero la curva
|
||||
const ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nIdF)) ;
|
||||
if ( pCurve == nullptr)
|
||||
return false ;
|
||||
// calcolo la retta tangente alla curva
|
||||
PtrOwner<ICurveLine> pCrvLine ;
|
||||
pCrvLine.Set( GetLinePointTgCurve( ptSloc, *pCurve, ptNloc)) ;
|
||||
if ( IsNull( pCrvLine))
|
||||
return nullptr ;
|
||||
// porto la linea nel riferimento del gruppo destinazione
|
||||
pCrvLine->LocToLoc( frCurve, frDest) ;
|
||||
// restituisco la linea
|
||||
return Release( pCrvLine) ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
ICurveLine*
|
||||
__stdcall CreateLinePointPerpCurve( IGeomDB* pGeomDB, int nParentId,
|
||||
const Point3d& ptIni, const Point3d& ptFin, int nIdF)
|
||||
{
|
||||
// verifica preliminare Id curva
|
||||
if ( nIdF == GDB_ID_NULL)
|
||||
return nullptr ;
|
||||
// recupero il riferimento del gruppo destinazione
|
||||
Frame3d frDest ;
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frDest))
|
||||
return nullptr ;
|
||||
// recupero il riferimento della curva
|
||||
Frame3d frCurve ;
|
||||
if ( ! pGeomDB->GetGlobFrame( nIdF, frCurve))
|
||||
return nullptr ;
|
||||
// porto il punto iniziale nel riferimento della curva
|
||||
Point3d ptSloc( ptIni) ;
|
||||
ptSloc.LocToLoc( frDest, frCurve) ;
|
||||
// porto il punto vicino al finale nel riferimento della curva
|
||||
Point3d ptNloc( ptFin) ;
|
||||
ptNloc.LocToLoc( frDest, frCurve) ;
|
||||
// recupero la curva
|
||||
const ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nIdF)) ;
|
||||
if ( pCurve == nullptr)
|
||||
return nullptr ;
|
||||
// calcolo la retta perpendicolare alla curva
|
||||
PtrOwner<ICurveLine> pCrvLine ;
|
||||
pCrvLine.Set( GetLinePointPerpCurve( ptSloc, *pCurve, ptNloc)) ;
|
||||
if ( IsNull( pCrvLine))
|
||||
return nullptr ;
|
||||
// porto la linea nel riferimento del gruppo destinazione
|
||||
pCrvLine->LocToLoc( frCurve, frDest) ;
|
||||
// restituisco la linea
|
||||
return Release( pCrvLine) ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
ICurveLine*
|
||||
__stdcall CreateLinePointMinDistCurve( IGeomDB* pGeomDB, int nParentId,
|
||||
const Point3d& ptIni, const Point3d& ptFin, int nIdF)
|
||||
{
|
||||
// verifica preliminare Id curva
|
||||
if ( nIdF == GDB_ID_NULL)
|
||||
return nullptr ;
|
||||
// recupero il riferimento del gruppo destinazione
|
||||
Frame3d frDest ;
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frDest))
|
||||
return nullptr ;
|
||||
// recupero il riferimento della curva
|
||||
Frame3d frCurve ;
|
||||
if ( ! pGeomDB->GetGlobFrame( nIdF, frCurve))
|
||||
return nullptr ;
|
||||
// porto il punto iniziale nel riferimento della curva
|
||||
Point3d ptSloc( ptIni) ;
|
||||
ptSloc.LocToLoc( frDest, frCurve) ;
|
||||
// porto il punto vicino al finale nel riferimento della curva
|
||||
Point3d ptNloc( ptFin) ;
|
||||
ptNloc.LocToLoc( frDest, frCurve) ;
|
||||
// recupero la curva
|
||||
const ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nIdF)) ;
|
||||
if ( pCurve == nullptr)
|
||||
return nullptr ;
|
||||
// calcolo la retta perpendicolare alla curva
|
||||
PtrOwner<ICurveLine> pCrvLine ;
|
||||
pCrvLine.Set( GetLinePointMinDistCurve( ptSloc, *pCurve, ptNloc)) ;
|
||||
if ( IsNull( pCrvLine))
|
||||
return nullptr ;
|
||||
// porto la linea nel riferimento del gruppo destinazione
|
||||
pCrvLine->LocToLoc( frCurve, frDest) ;
|
||||
// restituisco la linea
|
||||
return Release( pCrvLine) ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
ICurveLine*
|
||||
__stdcall CreateLineTgTwoCurves( IGeomDB* pGeomDB, int nParentId,
|
||||
const Point3d& ptIni, int nIdI, const Point3d& ptFin, int nIdF)
|
||||
{
|
||||
// verifica preliminare Id curve
|
||||
if ( nIdF == GDB_ID_NULL || nIdI == GDB_ID_NULL)
|
||||
return nullptr ;
|
||||
// recupero il riferimento del gruppo destinazione
|
||||
Frame3d frDest ;
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frDest))
|
||||
return nullptr ;
|
||||
// recupero il riferimento della prima curva
|
||||
Frame3d frCrv1 ;
|
||||
if ( ! pGeomDB->GetGlobFrame( nIdI, frCrv1))
|
||||
return nullptr ;
|
||||
// recupero la prima curva
|
||||
const ICurve* pCrv1 = GetCurve( pGeomDB->GetGeoObj( nIdI)) ;
|
||||
if ( pCrv1 == nullptr)
|
||||
return nullptr ;
|
||||
// porto il punto vicino a iniziale nel riferimento della prima curva
|
||||
Point3d ptN1loc( ptIni) ;
|
||||
ptN1loc.LocToLoc( frDest, frCrv1) ;
|
||||
// recupero il riferimento della seconda curva
|
||||
Frame3d frCrv2 ;
|
||||
if ( ! pGeomDB->GetGlobFrame( nIdF, frCrv2))
|
||||
return nullptr ;
|
||||
// recupero la seconda curva
|
||||
const ICurve* pCrv2 = GetCurve( pGeomDB->GetGeoObj( nIdF)) ;
|
||||
if ( pCrv2 == nullptr)
|
||||
return false ;
|
||||
// porto la seconda curva nel riferimento della prima
|
||||
PtrOwner<ICurve> pCrv2Loc( pCrv2->Clone()) ;
|
||||
if ( IsNull( pCrv2Loc))
|
||||
return nullptr ;
|
||||
pCrv2Loc->LocToLoc( frCrv2, frCrv1) ;
|
||||
// porto il punto vicino al finale nel riferimento della prima curva
|
||||
Point3d ptN2loc( ptFin) ;
|
||||
ptN2loc.LocToLoc( frDest, frCrv1) ;
|
||||
// calcolo la retta tangente alle due curve
|
||||
PtrOwner<ICurveLine> pCrvLine ;
|
||||
pCrvLine.Set( GetLineTgTwoCurves( *pCrv1, ptN1loc, *pCrv2, ptN2loc)) ;
|
||||
if ( IsNull( pCrvLine))
|
||||
return nullptr ;
|
||||
// porto la linea nel riferimento del gruppo destinazione
|
||||
pCrvLine->LocToLoc( frCrv1, frDest) ;
|
||||
// restituisco la linea
|
||||
return Release( pCrvLine) ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
ICurveLine*
|
||||
__stdcall CreateLinePerpTwoCurves( IGeomDB* pGeomDB, int nParentId,
|
||||
const Point3d& ptIni, int nIdI, const Point3d& ptFin, int nIdF)
|
||||
{
|
||||
// verifica preliminare Id curve
|
||||
if ( nIdI == GDB_ID_NULL || nIdF == GDB_ID_NULL)
|
||||
return nullptr ;
|
||||
// recupero il riferimento del gruppo destinazione
|
||||
Frame3d frDest ;
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frDest))
|
||||
return nullptr ;
|
||||
// recupero il riferimento della prima curva
|
||||
Frame3d frCrv1 ;
|
||||
if ( ! pGeomDB->GetGlobFrame( nIdI, frCrv1))
|
||||
return nullptr ;
|
||||
// recupero la prima curva
|
||||
const ICurve* pCrv1 = GetCurve( pGeomDB->GetGeoObj( nIdI)) ;
|
||||
if ( pCrv1 == nullptr)
|
||||
return nullptr ;
|
||||
// porto il punto vicino a iniziale nel riferimento della prima curva
|
||||
Point3d ptN1loc( ptIni) ;
|
||||
ptN1loc.LocToLoc( frDest, frCrv1) ;
|
||||
// recupero il riferimento della seconda curva
|
||||
Frame3d frCrv2 ;
|
||||
if ( ! pGeomDB->GetGlobFrame( nIdF, frCrv2))
|
||||
return nullptr ;
|
||||
// recupero la seconda curva
|
||||
const ICurve* pCrv2 = GetCurve( pGeomDB->GetGeoObj( nIdF)) ;
|
||||
if ( pCrv2 == nullptr)
|
||||
return nullptr ;
|
||||
// porto la seconda curva nel riferimento della prima
|
||||
PtrOwner<ICurve> pCrv2Loc( pCrv2->Clone()) ;
|
||||
if ( IsNull( pCrv2Loc))
|
||||
return nullptr ;
|
||||
pCrv2Loc->LocToLoc( frCrv2, frCrv1) ;
|
||||
// porto il punto vicino al finale nel riferimento della prima curva
|
||||
Point3d ptN2loc( ptFin) ;
|
||||
ptN2loc.LocToLoc( frDest, frCrv1) ;
|
||||
// calcolo la retta perpendicolare alle due curve
|
||||
PtrOwner<ICurveLine> pCrvLine ;
|
||||
pCrvLine.Set( GetLinePerpTwoCurves( *pCrv1, ptN1loc, *pCrv2, ptN2loc)) ;
|
||||
if ( IsNull( pCrvLine))
|
||||
return nullptr ;
|
||||
// porto la linea nel riferimento del gruppo destinazione
|
||||
pCrvLine->LocToLoc( frCrv1, frDest) ;
|
||||
// restituisco la linea
|
||||
return Release( pCrvLine) ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
ICurveLine*
|
||||
__stdcall CreateLineTgCurvePerpCurve( IGeomDB* pGeomDB, int nParentId,
|
||||
const Point3d& ptIni, int nIdI, const Point3d& ptFin, int nIdF)
|
||||
{
|
||||
// verifica preliminare Id curve
|
||||
if ( nIdI == GDB_ID_NULL || nIdF == GDB_ID_NULL)
|
||||
return nullptr ;
|
||||
// recupero il riferimento del gruppo destinazione
|
||||
Frame3d frDest ;
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frDest))
|
||||
return nullptr ;
|
||||
// recupero il riferimento della prima curva
|
||||
Frame3d frCrv1 ;
|
||||
if ( ! pGeomDB->GetGlobFrame( nIdI, frCrv1))
|
||||
return nullptr ;
|
||||
// recupero la prima curva
|
||||
const ICurve* pCrv1 = GetCurve( pGeomDB->GetGeoObj( nIdI)) ;
|
||||
if ( pCrv1 == nullptr)
|
||||
return nullptr ;
|
||||
// porto il punto vicino a iniziale nel riferimento della prima curva
|
||||
Point3d ptN1loc( ptIni) ;
|
||||
ptN1loc.LocToLoc( frDest, frCrv1) ;
|
||||
// recupero il riferimento della seconda curva
|
||||
Frame3d frCrv2 ;
|
||||
if ( ! pGeomDB->GetGlobFrame( nIdF, frCrv2))
|
||||
return nullptr ;
|
||||
// recupero la seconda curva
|
||||
const ICurve* pCrv2 = GetCurve( pGeomDB->GetGeoObj( nIdF)) ;
|
||||
if ( pCrv2 == nullptr)
|
||||
return nullptr ;
|
||||
// porto la seconda curva nel riferimento della prima
|
||||
PtrOwner<ICurve> pCrv2Loc( pCrv2->Clone()) ;
|
||||
if ( IsNull( pCrv2Loc))
|
||||
return nullptr ;
|
||||
pCrv2Loc->LocToLoc( frCrv2, frCrv1) ;
|
||||
// porto il punto vicino al finale nel riferimento della prima curva
|
||||
Point3d ptN2loc( ptFin) ;
|
||||
ptN2loc.LocToLoc( frDest, frCrv1) ;
|
||||
// calcolo la retta perpendicolare alle due curve
|
||||
PtrOwner<ICurveLine> pCrvLine ;
|
||||
pCrvLine.Set( GetLineTgCurvePerpCurve( *pCrv1, ptN1loc, *pCrv2, ptN2loc)) ;
|
||||
if ( IsNull( pCrvLine))
|
||||
return nullptr ;
|
||||
// porto la linea nel riferimento del gruppo destinazione
|
||||
pCrvLine->LocToLoc( frCrv1, frDest) ;
|
||||
// restituisco la linea
|
||||
return Release( pCrvLine) ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
__stdcall EgtCreateCurveLinePVL( int nParentId, const double ptIni[3], const double vtDir[3], double dLen)
|
||||
|
||||
+35
-5
@@ -195,7 +195,7 @@ __stdcall EgtExtendCurveEndByLen( int nId, double dLen)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtExtendCurveByLen( int nId, double dLen, const double ptNear[3])
|
||||
__stdcall EgtTrimExtendCurveByLen( int nId, double dLen, const double ptNear[3])
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
@@ -207,10 +207,26 @@ __stdcall EgtExtendCurveByLen( int nId, double dLen, const double ptNear[3])
|
||||
Point3d ptStart, ptEnd ;
|
||||
if ( ! pCurve->GetStartPoint( ptStart) || ! pCurve->GetEndPoint( ptEnd))
|
||||
return FALSE ;
|
||||
if ( SqDist( ptStart, ptNear) < SqDist( ptEnd, ptNear))
|
||||
return ( pCurve->ExtendStartByLen( dLen) ? TRUE : FALSE) ;
|
||||
else
|
||||
return ( pCurve->ExtendEndByLen( dLen) ? TRUE : FALSE) ;
|
||||
if ( SqDist( ptStart, ptNear) < SqDist( ptEnd, ptNear)) {
|
||||
if ( dLen < - EPS_SMALL)
|
||||
return ( pCurve->TrimStartAtLen( - dLen) ? TRUE : FALSE) ;
|
||||
else if ( dLen > EPS_SMALL)
|
||||
return ( pCurve->ExtendStartByLen( dLen) ? TRUE : FALSE) ;
|
||||
else
|
||||
return TRUE ;
|
||||
}
|
||||
else {
|
||||
if ( dLen < - EPS_SMALL) {
|
||||
double dCrvLen ;
|
||||
if ( ! pCurve->GetLength( dCrvLen))
|
||||
return FALSE ;
|
||||
return ( pCurve->TrimEndAtLen( dCrvLen + dLen) ? TRUE : FALSE) ;
|
||||
}
|
||||
else if ( dLen > EPS_SMALL)
|
||||
return ( pCurve->ExtendEndByLen( dLen) ? TRUE : FALSE) ;
|
||||
else
|
||||
return TRUE ;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -239,6 +255,20 @@ __stdcall EgtSplitCurveAtPoint( int nId, double ptOn[3])
|
||||
return ( EgtTrimCurveStartAtParam( nCopyId, dU) ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtOffsetCurve( int nId, double dDist, int nSide, int nType)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, FALSE)
|
||||
// recupero la curva
|
||||
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pCurve == nullptr)
|
||||
return FALSE ;
|
||||
// eseguo l'offset
|
||||
return ( pCurve->Offset( dDist, nSide, nType) ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtModifyCurveCircleCPN( int nId, const double ptOn[3])
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "/EgtDev/Include/EgkCurve.h"
|
||||
#include "/EgtDev/Include/EgkCurveArc.h"
|
||||
#include "/EgtDev/Include/EgkExtText.h"
|
||||
#include "/EgtDev/Include/EgkDistPointCurve.h"
|
||||
#include "/EgtDev/Include/EgkIntersCurveCurve.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
|
||||
@@ -488,6 +489,45 @@ __stdcall EgtFrame( int nId, Frame3d& frFrame)
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtCurveLength( int nId, double* pdLen)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, FALSE)
|
||||
// verifico il parametro
|
||||
if ( pdLen == nullptr)
|
||||
return FALSE ;
|
||||
// recupero la curva
|
||||
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pCurve == nullptr)
|
||||
return FALSE ;
|
||||
// recupero la lunghezza
|
||||
return ( pCurve->GetLength( *pdLen) ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtCurveLengthAtPoint( int nId, double ptOn[3], double* pdLen)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, FALSE)
|
||||
// verifico il parametro
|
||||
if ( pdLen == nullptr)
|
||||
return FALSE ;
|
||||
// recupero la curva
|
||||
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pCurve == nullptr)
|
||||
return FALSE ;
|
||||
// determino la posizione parametrica del punto sulla curva (con tolleranza)
|
||||
int nFlag ;
|
||||
double dU ;
|
||||
if ( ! DistPointCurve( ptOn, *pCurve).GetParamAtMinDistPoint( 0, dU, nFlag) || nFlag != MDPCI_NORMAL)
|
||||
return FALSE ;
|
||||
// recupero la lunghezza alla posizione parametrica
|
||||
return ( pCurve->GetLengthAtParam( dU, *pdLen) ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtCurveExtrusion( int nId, double vtExtr[3])
|
||||
|
||||
+28
-14
@@ -306,6 +306,20 @@ __stdcall EgtUnselectableClearAll( void)
|
||||
return pGseCtx->m_pScene->UnselectableClearAll() ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtGetPointFromSelect( int nSelId, int nWinX, int nWinY, double ptSel[3])
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_SCENE( pGseCtx, FALSE)
|
||||
// trovo il punto usato in selezione
|
||||
Point3d ptTmp ;
|
||||
if ( ! pGseCtx->m_pScene->GetPointFromSelect( nSelId, Point3d( nWinX, nWinY), ptTmp))
|
||||
return FALSE ;
|
||||
VEC_FROM_3D( ptSel, ptTmp)
|
||||
return TRUE ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtGetGraphicSnapPoint( int nSnap, int nWinX, int nWinY, int nSelW, int nSelH,
|
||||
@@ -606,6 +620,20 @@ __stdcall EgtGetCameraDir( int* pnDir)
|
||||
return TRUE ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtProjectPoint( const double ptP[3], double ptWin[3])
|
||||
{
|
||||
IEGrScene* pScene = GetCurrScene() ;
|
||||
VERIFY_SCENE( pScene, FALSE)
|
||||
// eseguo la proiezione
|
||||
Point3d ptView ;
|
||||
if ( ! pScene->Project( ptP, ptView))
|
||||
return FALSE ;
|
||||
VEC_FROM_3D( ptWin, ptView)
|
||||
return TRUE ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtUnProjectPoint( int nWinX, int nWinY, double ptP[3])
|
||||
@@ -620,17 +648,3 @@ __stdcall EgtUnProjectPoint( int nWinX, int nWinY, double ptP[3])
|
||||
VEC_FROM_3D( ptP, ptWorld)
|
||||
return TRUE ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtProjectPoint( const double ptP[3], double ptWin[3])
|
||||
{
|
||||
IEGrScene* pScene = GetCurrScene() ;
|
||||
VERIFY_SCENE( pScene, FALSE)
|
||||
// eseguo la proiezione
|
||||
Point3d ptView ;
|
||||
if ( ! pScene->Project( ptP, ptView))
|
||||
return FALSE ;
|
||||
VEC_FROM_3D( ptWin, ptView)
|
||||
return TRUE ;
|
||||
}
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user