EgtInterface 1.5k2 :
- aggiunta EgtCreateSurfTriMeshRuled - aggiunta EgtExplodeText - aggiunte EgtExtendCurve*ByLen e EgtExplodeCurveBezier - aggiunte EgtSelectAll, EgtSelectPartObjs, EgtDeselectPartObjs, EgtSelectLayerObjs, EgtDeselectLayerObjs, EgtGetLastSelectedObj, EgtGetPrevSelectedObj - aggiunte EgtIntersectionPoint, EgtPointToIdGlob.
This commit is contained in:
+106
-17
@@ -18,8 +18,11 @@
|
||||
#include "/EgtDev/Include/EInAPI.h"
|
||||
#include "/EgtDev/Include/EgkCurve.h"
|
||||
#include "/EgtDev/Include/EgkCurveArc.h"
|
||||
#include "/EgtDev/Include/EgkCurveBezier.h"
|
||||
#include "/EgtDev/Include/EgkCurveComposite.h"
|
||||
#include "/EgtDev/Include/EgkDistPointCurve.h"
|
||||
#include "/EgtDev/Include/EgkExtTExt.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -31,7 +34,7 @@ __stdcall EgtInvertCurve( int nId)
|
||||
// recupero la curva
|
||||
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pCurve == nullptr)
|
||||
return false ;
|
||||
return FALSE ;
|
||||
// la inverto
|
||||
return ( pCurve->Invert() ? TRUE : FALSE) ;
|
||||
}
|
||||
@@ -45,7 +48,7 @@ __stdcall EgtModifyCurveStartPoint( int nId, const double ptP[3])
|
||||
// recupero la curva
|
||||
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pCurve == nullptr)
|
||||
return false ;
|
||||
return FALSE ;
|
||||
// ne modifico il punto iniziale
|
||||
return ( pCurve->ModifyStart( ptP) ? TRUE : FALSE) ;
|
||||
}
|
||||
@@ -59,7 +62,7 @@ __stdcall EgtModifyCurveEndPoint( int nId, const double ptP[3])
|
||||
// recupero la curva
|
||||
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pCurve == nullptr)
|
||||
return false ;
|
||||
return FALSE ;
|
||||
// ne modifico il punto finale
|
||||
return ( pCurve->ModifyEnd( ptP) ? TRUE : FALSE) ;
|
||||
}
|
||||
@@ -73,7 +76,7 @@ __stdcall EgtModifyCurveExtrusion( int nId, const double vtExtr[3])
|
||||
// recupero la curva
|
||||
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pCurve == nullptr)
|
||||
return false ;
|
||||
return FALSE ;
|
||||
// ne modifico il vettore estrusione
|
||||
return ( pCurve->SetExtrusion( Vector3d( vtExtr)) ? TRUE : FALSE) ;
|
||||
}
|
||||
@@ -87,7 +90,7 @@ __stdcall EgtModifyCurveThickness( int nId, double dThick)
|
||||
// recupero la curva
|
||||
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pCurve == nullptr)
|
||||
return false ;
|
||||
return FALSE ;
|
||||
// ne modifico lo spessore
|
||||
return ( pCurve->SetThickness( dThick) ? TRUE : FALSE) ;
|
||||
}
|
||||
@@ -101,7 +104,7 @@ __stdcall EgtTrimCurveStartAtLen( int nId, double dLen)
|
||||
// recupero la curva
|
||||
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pCurve == nullptr)
|
||||
return false ;
|
||||
return FALSE ;
|
||||
// taglio la curva all'inizio
|
||||
return ( pCurve->TrimStartAtLen( dLen) ? TRUE : FALSE) ;
|
||||
}
|
||||
@@ -115,7 +118,7 @@ __stdcall EgtTrimCurveEndAtLen( int nId, double dLen)
|
||||
// recupero la curva
|
||||
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pCurve == nullptr)
|
||||
return false ;
|
||||
return FALSE ;
|
||||
// taglio la curva alla fine
|
||||
return ( pCurve->TrimEndAtLen( dLen) ? TRUE : FALSE) ;
|
||||
}
|
||||
@@ -129,7 +132,7 @@ __stdcall EgtTrimCurveStartAtParam( int nId, double dPar)
|
||||
// recupero la curva
|
||||
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pCurve == nullptr)
|
||||
return false ;
|
||||
return FALSE ;
|
||||
// taglio la curva all'inizio
|
||||
return ( pCurve->TrimStartAtParam( dPar) ? TRUE : FALSE) ;
|
||||
}
|
||||
@@ -143,7 +146,7 @@ __stdcall EgtTrimCurveEndAtParam( int nId, double dPar)
|
||||
// recupero la curva
|
||||
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pCurve == nullptr)
|
||||
return false ;
|
||||
return FALSE ;
|
||||
// taglio la curva alla fine
|
||||
return ( pCurve->TrimEndAtParam( dPar) ? TRUE : FALSE) ;
|
||||
}
|
||||
@@ -157,11 +160,59 @@ __stdcall EgtTrimCurveStartEndAtParam( int nId, double dParS, double dParE)
|
||||
// recupero la curva
|
||||
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pCurve == nullptr)
|
||||
return false ;
|
||||
// taglio la curva all'inizio
|
||||
return FALSE ;
|
||||
// taglio la curva agli estremi
|
||||
return ( pCurve->TrimStartEndAtParam( dParS, dParE) ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtExtendCurveStartByLen( int nId, double dLen)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// recupero la curva
|
||||
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pCurve == nullptr)
|
||||
return FALSE ;
|
||||
// estendo la curva all'inizio
|
||||
return ( pCurve->ExtendStartByLen( dLen) ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtExtendCurveEndByLen( int nId, double dLen)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// recupero la curva
|
||||
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pCurve == nullptr)
|
||||
return FALSE ;
|
||||
// estendo la curva alla fine
|
||||
return ( pCurve->ExtendEndByLen( dLen) ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtExtendCurveByLen( int nId, double dLen, const double ptNear[3])
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// recupero la curva
|
||||
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pCurve == nullptr)
|
||||
return FALSE ;
|
||||
// cerco l'estremo più vicino al punto passato
|
||||
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) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtSplitCurveAtPoint( int nId, double ptOn[3])
|
||||
@@ -271,15 +322,11 @@ __stdcall EgtSeparateCurveCompo( int nId)
|
||||
ICurveComposite* pCompo = GetCurveComposite( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pCompo == nullptr)
|
||||
return FALSE ;
|
||||
// ne recupero il padre
|
||||
int nParentId = pGeomDB->GetParentId( nId) ;
|
||||
if ( nParentId == GDB_ID_NULL)
|
||||
return FALSE ;
|
||||
// estraggo tutte le curve
|
||||
ICurve* pCrv ;
|
||||
while ( ( pCrv = pCompo->RemoveFirstOrLastCurve( false)) != nullptr) {
|
||||
// inserisco la curva nello stesso gruppo del GeomDB
|
||||
int nCrvId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, pCrv) ;
|
||||
// inserisco la curva nello stesso gruppo e nello stesso posto del GeomDB
|
||||
int nCrvId = pGeomDB->InsertGeoObj( GDB_ID_NULL, nId, GDB_BEFORE, pCrv) ;
|
||||
if ( nCrvId == GDB_ID_NULL)
|
||||
return FALSE ;
|
||||
// copio gli attributi
|
||||
@@ -288,4 +335,46 @@ __stdcall EgtSeparateCurveCompo( int nId)
|
||||
}
|
||||
// elimino la curva composita ormai vuota
|
||||
return ( pGeomDB->Erase( nId) ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtExplodeCurveBezier( int nId, double dLinTol, BOOL bArcsVsLines)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, FALSE)
|
||||
// recupero la curva di Bezier
|
||||
ICurveBezier* pCBezier = GetCurveBezier( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pCBezier == nullptr)
|
||||
return FALSE ;
|
||||
// eseguo l'approssimazione
|
||||
const double ANG_TOL_STD_DEG = 15 ;
|
||||
PtrOwner<ICurveComposite> pCC( CreateCurveComposite()) ;
|
||||
if ( IsNull( pCC))
|
||||
return FALSE ;
|
||||
if ( bArcsVsLines) { // con bi-archi
|
||||
PolyArc PA ;
|
||||
if ( ! pCBezier->ApproxWithArcs( dLinTol, ANG_TOL_STD_DEG, PA) ||
|
||||
! pCC->FromPolyArc( PA))
|
||||
return FALSE ;
|
||||
}
|
||||
else { // con linee
|
||||
PolyLine PL ;
|
||||
if ( ! pCBezier->ApproxWithLines( dLinTol, ANG_TOL_STD_DEG, PL) ||
|
||||
! pCC->FromPolyLine( PL))
|
||||
return FALSE ;
|
||||
}
|
||||
// inserisco le curve elementari nel DB
|
||||
ICurve* pCrv ;
|
||||
while ( ( pCrv = pCC->RemoveFirstOrLastCurve( false)) != nullptr) {
|
||||
// inserisco la curva nello stesso gruppo e nello stesso posto del GeomDB
|
||||
int nCrvId = pGeomDB->InsertGeoObj( GDB_ID_NULL, nId, GDB_BEFORE, pCrv) ;
|
||||
if ( nCrvId == GDB_ID_NULL)
|
||||
return FALSE ;
|
||||
// copio gli attributi
|
||||
if ( ! pGeomDB->CopyAttributes( nId, nCrvId))
|
||||
return FALSE ;
|
||||
}
|
||||
// elimino la curva di Bezier
|
||||
return ( pGeomDB->Erase( nId) ? TRUE : FALSE) ;
|
||||
}
|
||||
Reference in New Issue
Block a user