EgtInterface 1.5k3 :
- esposte ulteriori funzionalità.
This commit is contained in:
@@ -22,8 +22,8 @@
|
||||
ILogger* GetLogger( void) ;
|
||||
|
||||
//--------------------------- GeomDB -----------------------------------------
|
||||
BOOL __stdcall EgtOpenFile( const std::string& sFilePath) ;
|
||||
BOOL __stdcall EgtSaveFile( const std::string& sFilePath, int nFlag) ;
|
||||
bool __stdcall EgtOpenFile( const std::string& sFilePath) ;
|
||||
bool __stdcall EgtSaveFile( const std::string& sFilePath, int nFlag) ;
|
||||
|
||||
//--------------------------- GeomDB Create ----------------------------------
|
||||
int __stdcall EgtCreateCurveBezier( int nParentId, int nDegree, const PNTVECTOR& vPnt) ;
|
||||
@@ -46,13 +46,33 @@ BOOL __stdcall EgtChangeTextFont( int nId, const std::string& sNewFont) ;
|
||||
BOOL __stdcall EgtStdColor( const std::string& sName, Color& StdCol) ;
|
||||
BOOL __stdcall EgtSetName( int nId, const std::string& sName) ;
|
||||
BOOL __stdcall EgtGetName( int nId, std::string& sName) ;
|
||||
BOOL __stdcall EgtSetInfo( int nId, const std::string& sKey, const std::string& sInfo) ;
|
||||
BOOL __stdcall EgtGetInfo( int nId, const std::string& sKey, std::string& sInfo) ;
|
||||
bool __stdcall EgtSetInfo( int nId, const std::string& sKey, const std::string& sInfo) ;
|
||||
bool __stdcall EgtSetInfo( int nId, const std::string& sKey, int nInfo) ;
|
||||
bool __stdcall EgtGetInfo( int nId, const std::string& sKey, std::string& sInfo) ;
|
||||
bool __stdcall EgtGetInfo( int nId, const std::string& sKey, int& nInfo) ;
|
||||
BOOL __stdcall EgtExistsInfo( int nId, const std::string& sKey) ;
|
||||
BOOL __stdcall EgtRemoveInfo( int nId, const std::string& sKey) ;
|
||||
|
||||
//--------------------------- GeoSnap ----------------------------------------
|
||||
BOOL __stdcall EgtFrame( int nId, Frame3d& frFrame) ;
|
||||
bool __stdcall EgtStartPoint( int nId, Point3d& ptP) ;
|
||||
bool __stdcall EgtEndPoint( int nId, Point3d& ptP) ;
|
||||
bool __stdcall EgtMidPoint( int nId, Point3d& ptP) ;
|
||||
bool __stdcall EgtCenterPoint( int nId, Point3d& ptP) ;
|
||||
bool __stdcall EgtAtParamPoint( int nId, double dU, Point3d& ptP) ;
|
||||
bool __stdcall EgtIntersectionPoint( int nId1, int nId2, const Point3d& ptNear, Point3d& ptP) ;
|
||||
bool __stdcall EgtStartVector( int nId, Vector3d& vtV) ;
|
||||
bool __stdcall EgtEndVector( int nId, Vector3d& vtV) ;
|
||||
bool __stdcall EgtMidVector( int nId, Vector3d& vtV) ;
|
||||
bool __stdcall EgtAtParamVector( int nId, double dU, int nSide, Vector3d& vtV) ;
|
||||
bool __stdcall EgtFrame( int nId, Frame3d& frFrame) ;
|
||||
bool __stdcall EgtCurveExtrusion( int nId, Vector3d& vtExtr) ;
|
||||
// EgtCurveThickness vedi EinAPI.h
|
||||
bool __stdcall EgtCurveArcNormVersor( int nId, Vector3d& vtNorm) ;
|
||||
bool __stdcall EgtExtTextNormVersor( int nId, Vector3d& vtNorm) ;
|
||||
bool __stdcall EgtPointToIdGlob( Point3d& ptP, int nId) ;
|
||||
bool __stdcall EgtPointToIdLoc( Point3d& ptP, int nId) ;
|
||||
bool __stdcall EgtVectorToIdGlob( Vector3d& vtV, int nId) ;
|
||||
bool __stdcall EgtVectorToIdLoc( Vector3d& vtV, int nId) ;
|
||||
|
||||
//--------------------------- Scene ------------------------------------------
|
||||
BOOL __stdcall EgtSetBackground( Color TopCol, Color BottomCol, BOOL bRedraw) ;
|
||||
|
||||
+73
-14
@@ -45,6 +45,23 @@ __stdcall EgtCreateCurveLine( int nParentId, const double ptIni[3], const double
|
||||
return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pCrvLine)) ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
__stdcall EgtCreateCurveLinePVL( int nParentId, const double ptIni[3], const double vtDir[3], double dLen)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// creo la linea
|
||||
PtrOwner<ICurveLine> pCrvLine( CreateCurveLine()) ;
|
||||
if ( IsNull( pCrvLine))
|
||||
return GDB_ID_NULL ;
|
||||
// setto la linea
|
||||
if ( ! pCrvLine->SetPVL( ptIni, vtDir, dLen))
|
||||
return GDB_ID_NULL ;
|
||||
// inserisco la linea nel DB
|
||||
return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pCrvLine)) ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
__stdcall EgtCreateCurveLineMinPointCurve( int nParentId,
|
||||
@@ -210,10 +227,14 @@ __stdcall EgtCreateCurveArc3P( int nParentId,
|
||||
if ( IsNull( pCrvArc))
|
||||
return GDB_ID_NULL ;
|
||||
// setto l'arco
|
||||
if ( ! pCrvArc->Set3P( ptP1, ptP2, ptP3, false))
|
||||
return GDB_ID_NULL ;
|
||||
// inserisco l'arco nel DB
|
||||
return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pCrvArc)) ;
|
||||
if ( pCrvArc->Set3P( ptP1, ptP2, ptP3, false))
|
||||
// inserisco l'arco nel DB
|
||||
return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pCrvArc)) ;
|
||||
// se risulta essere una retta
|
||||
if ( ( Point3d( ptP2) - Point3d( ptP1)) * ( Point3d( ptP3) - Point3d( ptP2)) > EPS_ZERO)
|
||||
return EgtCreateCurveLine( nParentId, ptP1, ptP3) ;
|
||||
// errore
|
||||
return GDB_ID_NULL ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
@@ -234,6 +255,28 @@ __stdcall EgtCreateCurveArcC2PN( int nParentId,
|
||||
return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pCrvArc)) ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
__stdcall EgtCreateCurveArc2PVN( int nParentId,
|
||||
const double ptStart[3], const double ptEnd[3], const double vtDirS[3], const double vtNorm[3])
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// creo l'arco
|
||||
PtrOwner<ICurveArc> pCrvArc( CreateCurveArc()) ;
|
||||
if ( IsNull( pCrvArc))
|
||||
return GDB_ID_NULL ;
|
||||
// setto l'arco
|
||||
if ( pCrvArc->Set2PVN( ptStart, ptEnd, vtDirS, vtNorm))
|
||||
// inserisco l'arco nel DB
|
||||
return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pCrvArc)) ;
|
||||
// se risulta essere una retta
|
||||
if ( ( Point3d( ptEnd) - Point3d( ptStart)) * Vector3d( vtDirS) > EPS_ZERO)
|
||||
return EgtCreateCurveLine( nParentId, ptStart, ptEnd) ;
|
||||
// errore
|
||||
return GDB_ID_NULL ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
__stdcall EgtCreateCurveBezier( int nParentId, int nDegree, const double ptCtrls[])
|
||||
@@ -491,6 +534,10 @@ __stdcall EgtCreateCurveCompoByChain( int nParentId, const INTVECTOR& vIds, cons
|
||||
PtrOwner<ICurveComposite> pCrvCompo( CreateCurveComposite()) ;
|
||||
if ( IsNull( pCrvCompo))
|
||||
return GDB_ID_NULL ;
|
||||
// eventuali estrusione e spessore
|
||||
bool bExtr = false ;
|
||||
Vector3d vtExtr ;
|
||||
double dThick = 0 ;
|
||||
// recupero le curve semplici e le inserisco nella curva composita
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vId2s.begin() ; Iter != vId2s.end() ; ++Iter) {
|
||||
@@ -512,21 +559,33 @@ __stdcall EgtCreateCurveCompoByChain( int nParentId, const INTVECTOR& vIds, cons
|
||||
pCopCrv->Invert() ;
|
||||
// la sistemo per i riferimenti
|
||||
pCopCrv->LocToLoc( frCrv, frDest) ;
|
||||
// recupero eventuali estrusione (già nel riferimento destinazione) e spessore
|
||||
if ( pCopCrv->GetExtrusion( vtExtr)) {
|
||||
bExtr = true ;
|
||||
double dTemp ;
|
||||
if ( pCopCrv->GetThickness( dTemp) && fabs( dTemp) > fabs( dThick))
|
||||
dThick = dTemp ;
|
||||
}
|
||||
// la aggiungo alla curva composta
|
||||
if ( ! pCrvCompo->AddCurve( ::Release( pCopCrv), true, dToler))
|
||||
return GDB_ID_NULL ;
|
||||
}
|
||||
// aggiorno il nuovo punto vicino
|
||||
if ( pCrvCompo->GetCurveNumber() > 0)
|
||||
pCrvCompo->GetEndPoint( ptNearStart) ;
|
||||
// inserisco la curva composita nel gruppo destinazione
|
||||
if ( pCrvCompo->GetCurveNumber() > 0) {
|
||||
int nNewId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, ::Release( pCrvCompo)) ;
|
||||
if ( nNewId == GDB_ID_NULL)
|
||||
return GDB_ID_NULL ;
|
||||
if ( nFirstId == GDB_ID_NULL)
|
||||
nFirstId = nNewId ;
|
||||
// se non sono state inserite curve, vado oltre
|
||||
if ( pCrvCompo->GetCurveNumber() == 0)
|
||||
continue ;
|
||||
// se necessario, imposto estrusione e spessore
|
||||
if ( bExtr) {
|
||||
pCrvCompo->SetExtrusion( vtExtr) ;
|
||||
pCrvCompo->SetThickness( dThick) ;
|
||||
}
|
||||
// aggiorno il nuovo punto vicino
|
||||
pCrvCompo->GetEndPoint( ptNearStart) ;
|
||||
// inserisco la curva composita nel gruppo destinazione
|
||||
int nNewId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, ::Release( pCrvCompo)) ;
|
||||
if ( nNewId == GDB_ID_NULL)
|
||||
return GDB_ID_NULL ;
|
||||
if ( nFirstId == GDB_ID_NULL)
|
||||
nFirstId = nNewId ;
|
||||
}
|
||||
// se richiesto, cancello le curve originali
|
||||
if ( bErase) {
|
||||
|
||||
@@ -264,6 +264,27 @@ __stdcall EgtModifyCurveCircleCPN( int nId, const double ptOn[3])
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtModifyCurveArcRadius( int nId, double dRad)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, FALSE)
|
||||
// recupero l'arco e i suoi dati
|
||||
ICurveArc* pArc = GetCurveArc( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pArc == nullptr)
|
||||
return FALSE ;
|
||||
double dOldRad = pArc->GetRadius() ;
|
||||
// imposto il nuovo raggio
|
||||
if ( pArc->ChangeRadius( dRad))
|
||||
return TRUE ;
|
||||
// in caso di errore, ripristino i vecchi dati
|
||||
else {
|
||||
pArc->ChangeRadius( dOldRad) ;
|
||||
return FALSE ;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtModifyCurveArcC2PN( int nId, const double ptEnd[3])
|
||||
|
||||
+43
-5
@@ -378,17 +378,34 @@ __stdcall EgtRemoveName( int nId)
|
||||
BOOL
|
||||
__stdcall EgtSetInfo( int nId, const wchar_t* wsKey, const wchar_t* wsInfo)
|
||||
{
|
||||
return EgtSetInfo( nId, wstrztoA( wsKey), wstrztoA( wsInfo)) ;
|
||||
return ( EgtSetInfo( nId, wstrztoA( wsKey), wstrztoA( wsInfo)) ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL
|
||||
bool
|
||||
__stdcall EgtSetInfo( int nId, const string& sKey, const string& sInfo)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, FALSE)
|
||||
// assegno la info
|
||||
return ( pGeomDB->SetInfo( nId, sKey, sInfo) ? TRUE : FALSE) ;
|
||||
return pGeomDB->SetInfo( nId, sKey, sInfo) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtSetInfoInt( int nId, const wchar_t* wsKey, int nInfo)
|
||||
{
|
||||
return ( EgtSetInfo( nId, wstrztoA( wsKey), nInfo) ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
__stdcall EgtSetInfo( int nId, const string& sKey, int nInfo)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, FALSE)
|
||||
// assegno la info
|
||||
return pGeomDB->SetInfo( nId, sKey, nInfo) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -403,15 +420,36 @@ __stdcall EgtGetInfo( int nId, const wchar_t* wsKey, wchar_t*& wsInfo)
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL
|
||||
bool
|
||||
__stdcall EgtGetInfo( int nId, const string& sKey, string& sInfo)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, FALSE)
|
||||
// recupero la info
|
||||
// recupero info
|
||||
return pGeomDB->GetInfo( nId, sKey, sInfo) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtGetInfoInt( int nId, const wchar_t* wsKey, int* pnInfo)
|
||||
{
|
||||
// verifico il parametro
|
||||
if ( pnInfo == nullptr)
|
||||
return FALSE ;
|
||||
// recupero info
|
||||
return ( EgtGetInfo( nId, wstrztoA( wsKey), *pnInfo) ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
__stdcall EgtGetInfo( int nId, const string& sKey, int& nInfo)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, FALSE)
|
||||
// recupero la info
|
||||
return pGeomDB->GetInfo( nId, sKey, nInfo) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtExistsInfo( int nId, const wchar_t* wsKey)
|
||||
|
||||
@@ -355,6 +355,23 @@ __stdcall EgtFrameFrom3Points( double ptO[3], double ptOnX[3], double ptNearY[3]
|
||||
return TRUE ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtFrameOCS( double ptO[3], double vtDirZ[3],
|
||||
double ptOrig[3], double vtX[3], double vtY[3], double vtZ[3])
|
||||
{
|
||||
// calcolo il riferimento
|
||||
Frame3d frTemp ;
|
||||
if ( ! frTemp.Set( Point3d( ptO), Vector3d( vtDirZ)))
|
||||
return FALSE ;
|
||||
// aggiorno i parametri del frame
|
||||
VEC_FROM_3D( ptOrig, frTemp.Orig())
|
||||
VEC_FROM_3D( vtX, frTemp.VersX())
|
||||
VEC_FROM_3D( vtY, frTemp.VersY())
|
||||
VEC_FROM_3D( vtZ, frTemp.VersZ())
|
||||
return TRUE ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtFrameTranslate( double ptOrig[3], double vtX[3], double vtY[3], double vtZ[3],
|
||||
|
||||
+402
-231
@@ -19,6 +19,7 @@
|
||||
#include "/EgtDev/Include/EgkGeoPoint3d.h"
|
||||
#include "/EgtDev/Include/EgkGeoVector3d.h"
|
||||
#include "/EgtDev/Include/EgkCurve.h"
|
||||
#include "/EgtDev/Include/EgkCurveArc.h"
|
||||
#include "/EgtDev/Include/EgkExtText.h"
|
||||
#include "/EgtDev/Include/EgkIntersCurveCurve.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
@@ -27,231 +28,243 @@
|
||||
//----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtStartPoint( int nId, double ptP[3])
|
||||
{
|
||||
// recupero il punto
|
||||
Point3d ptStart ;
|
||||
if ( ! EgtStartPoint( nId, ptStart))
|
||||
return FALSE ;
|
||||
// ritorno il punto
|
||||
VEC_FROM_3D( ptP, ptStart)
|
||||
return TRUE ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
__stdcall EgtStartPoint( int nId, Point3d& ptP)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, FALSE)
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// se non è entità geometrica
|
||||
const IGeoObj* pGObj ;
|
||||
if ( ( pGObj = pGeomDB->GetGeoObj( nId)) == nullptr)
|
||||
return FALSE ;
|
||||
return false ;
|
||||
// se punto
|
||||
if ( pGObj->GetType() == GEO_PNT3D) {
|
||||
// recupero il geo-punto
|
||||
const IGeoPoint3d* pGP = GetGeoPoint3d( pGObj) ;
|
||||
Point3d ptStart = pGP->GetPoint() ;
|
||||
// assegno il punto
|
||||
ptP[0] = ptStart.x ;
|
||||
ptP[1] = ptStart.y ;
|
||||
ptP[2] = ptStart.z ;
|
||||
return TRUE ;
|
||||
ptP = pGP->GetPoint() ;
|
||||
return true ;
|
||||
}
|
||||
// se vettore
|
||||
else if ( pGObj->GetType() == GEO_VECT3D) {
|
||||
// recupero il geo-vettore
|
||||
const IGeoVector3d* pGV = GetGeoVector3d( pGObj) ;
|
||||
Point3d ptStart = pGV->GetBase() ;
|
||||
// assegno il punto
|
||||
ptP[0] = ptStart.x ;
|
||||
ptP[1] = ptStart.y ;
|
||||
ptP[2] = ptStart.z ;
|
||||
return TRUE ;
|
||||
ptP = pGV->GetBase() ;
|
||||
return true ;
|
||||
}
|
||||
// se frame
|
||||
else if ( pGObj->GetType() == GEO_FRAME3D) {
|
||||
// recupero il frame
|
||||
const IGeoFrame3d* pGF = GetGeoFrame3d( pGObj) ;
|
||||
Point3d ptStart = pGF->GetFrame().Orig() ;
|
||||
// assegno il punto
|
||||
ptP[0] = ptStart.x ;
|
||||
ptP[1] = ptStart.y ;
|
||||
ptP[2] = ptStart.z ;
|
||||
return TRUE ;
|
||||
ptP = pGF->GetFrame().Orig() ;
|
||||
return true ;
|
||||
}
|
||||
// se curva
|
||||
else if ( ( pGObj->GetType() & GEO_CURVE) != 0) {
|
||||
// recupero la curva
|
||||
const ICurve* pCrv = GetCurve( pGObj) ;
|
||||
Point3d ptStart ;
|
||||
if ( ! pCrv->GetStartPoint( ptStart))
|
||||
return FALSE ;
|
||||
// assegno il punto
|
||||
ptP[0] = ptStart.x ;
|
||||
ptP[1] = ptStart.y ;
|
||||
ptP[2] = ptStart.z ;
|
||||
return TRUE ;
|
||||
return pCrv->GetStartPoint( ptP) ;
|
||||
}
|
||||
// se testo
|
||||
else if ( pGObj->GetType() == EXT_TEXT) {
|
||||
// recupero il testo
|
||||
const IExtText* pTxt = GetExtText( pGObj) ;
|
||||
Point3d ptStart ;
|
||||
if ( ! pTxt->GetStartPoint( ptStart))
|
||||
return false ;
|
||||
// assegno il punto
|
||||
ptP[0] = ptStart.x ;
|
||||
ptP[1] = ptStart.y ;
|
||||
ptP[2] = ptStart.z ;
|
||||
return TRUE ;
|
||||
return pTxt->GetStartPoint( ptP) ;
|
||||
}
|
||||
return FALSE ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtEndPoint( int nId, double ptP[3])
|
||||
{
|
||||
// recupero il punto
|
||||
Point3d ptEnd ;
|
||||
if ( ! EgtEndPoint( nId, ptEnd))
|
||||
return FALSE ;
|
||||
// ritorno il punto
|
||||
VEC_FROM_3D( ptP, ptEnd)
|
||||
return TRUE ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
__stdcall EgtEndPoint( int nId, Point3d& ptP)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, FALSE)
|
||||
// se non è entità geometrica
|
||||
const IGeoObj* pGObj ;
|
||||
if ( ( pGObj = pGeomDB->GetGeoObj( nId)) == nullptr)
|
||||
return FALSE ;
|
||||
return false ;
|
||||
// se curva
|
||||
if ( ( pGObj->GetType() & GEO_CURVE) != 0) {
|
||||
// recupero la curva
|
||||
const ICurve* pCrv = GetCurve( pGObj) ;
|
||||
Point3d ptEnd ;
|
||||
if ( ! pCrv->GetEndPoint( ptEnd))
|
||||
return FALSE ;
|
||||
// assegno il punto
|
||||
ptP[0] = ptEnd.x ;
|
||||
ptP[1] = ptEnd.y ;
|
||||
ptP[2] = ptEnd.z ;
|
||||
return TRUE ;
|
||||
return pCrv->GetEndPoint( ptP) ;
|
||||
}
|
||||
// se testo
|
||||
else if ( pGObj->GetType() == EXT_TEXT) {
|
||||
// recupero il testo
|
||||
const IExtText* pTxt = GetExtText( pGObj) ;
|
||||
Point3d ptEnd ;
|
||||
if ( ! pTxt->GetEndPoint( ptEnd))
|
||||
return false ;
|
||||
// assegno il punto
|
||||
ptP[0] = ptEnd.x ;
|
||||
ptP[1] = ptEnd.y ;
|
||||
ptP[2] = ptEnd.z ;
|
||||
return TRUE ;
|
||||
return pTxt->GetEndPoint( ptP) ;
|
||||
}
|
||||
return FALSE ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtMidPoint( int nId, double ptP[3])
|
||||
{
|
||||
// recupero il punto
|
||||
Point3d ptMid ;
|
||||
if ( ! EgtMidPoint( nId, ptMid))
|
||||
return FALSE ;
|
||||
// ritorno il punto
|
||||
VEC_FROM_3D( ptP, ptMid)
|
||||
return TRUE ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
__stdcall EgtMidPoint( int nId, Point3d& ptP)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, FALSE)
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// se non è entità geometrica
|
||||
const IGeoObj* pGObj ;
|
||||
if ( ( pGObj = pGeomDB->GetGeoObj( nId)) == nullptr)
|
||||
return FALSE ;
|
||||
return false ;
|
||||
// se curva
|
||||
if ( ( pGObj->GetType() & GEO_CURVE) != 0) {
|
||||
// recupero la curva
|
||||
const ICurve* pCrv = GetCurve( pGObj) ;
|
||||
Point3d ptEnd ;
|
||||
if ( ! pCrv->GetMidPoint( ptEnd))
|
||||
return FALSE ;
|
||||
// assegno il punto
|
||||
ptP[0] = ptEnd.x ;
|
||||
ptP[1] = ptEnd.y ;
|
||||
ptP[2] = ptEnd.z ;
|
||||
return TRUE ;
|
||||
return pCrv->GetMidPoint( ptP) ;
|
||||
}
|
||||
// se testo
|
||||
else if ( pGObj->GetType() == EXT_TEXT) {
|
||||
// recupero il testo
|
||||
const IExtText* pTxt = GetExtText( pGObj) ;
|
||||
Point3d ptEnd ;
|
||||
if ( ! pTxt->GetMidPoint( ptEnd))
|
||||
return false ;
|
||||
// assegno il punto
|
||||
ptP[0] = ptEnd.x ;
|
||||
ptP[1] = ptEnd.y ;
|
||||
ptP[2] = ptEnd.z ;
|
||||
return TRUE ;
|
||||
return pTxt->GetMidPoint( ptP) ;
|
||||
}
|
||||
return FALSE ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtCenterPoint( int nId, double ptP[3])
|
||||
{
|
||||
// recupero il punto
|
||||
Point3d ptCent ;
|
||||
if ( ! EgtCenterPoint( nId, ptCent))
|
||||
return FALSE ;
|
||||
// ritorno il punto
|
||||
VEC_FROM_3D( ptP, ptCent)
|
||||
return TRUE ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
__stdcall EgtCenterPoint( int nId, Point3d& ptP)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, FALSE)
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// se non è entità geometrica
|
||||
const IGeoObj* pGObj ;
|
||||
if ( ( pGObj = pGeomDB->GetGeoObj( nId)) == nullptr)
|
||||
return FALSE ;
|
||||
return false ;
|
||||
// se curva
|
||||
if ( ( pGObj->GetType() & GEO_CURVE) != 0) {
|
||||
// recupero la curva
|
||||
const ICurve* pCrv = GetCurve( pGObj) ;
|
||||
Point3d ptEnd ;
|
||||
if ( ! pCrv->GetCenterPoint( ptEnd))
|
||||
return FALSE ;
|
||||
// assegno il punto
|
||||
ptP[0] = ptEnd.x ;
|
||||
ptP[1] = ptEnd.y ;
|
||||
ptP[2] = ptEnd.z ;
|
||||
return TRUE ;
|
||||
return pCrv->GetCenterPoint( ptP) ;
|
||||
}
|
||||
// se testo
|
||||
else if ( pGObj->GetType() == EXT_TEXT) {
|
||||
// recupero il testo
|
||||
const IExtText* pTxt = GetExtText( pGObj) ;
|
||||
Point3d ptEnd ;
|
||||
if ( ! pTxt->GetCenterPoint( ptEnd))
|
||||
return false ;
|
||||
// assegno il punto
|
||||
ptP[0] = ptEnd.x ;
|
||||
ptP[1] = ptEnd.y ;
|
||||
ptP[2] = ptEnd.z ;
|
||||
return TRUE ;
|
||||
return pTxt->GetCenterPoint( ptP) ;
|
||||
}
|
||||
return FALSE ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtAtParamPoint( int nId, double dU, double ptP[3])
|
||||
{
|
||||
// recupero il punto
|
||||
Point3d ptAtPar ;
|
||||
if ( ! EgtAtParamPoint( nId, dU, ptAtPar))
|
||||
return FALSE ;
|
||||
// ritorno il punto
|
||||
VEC_FROM_3D( ptP, ptAtPar)
|
||||
return TRUE ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
__stdcall EgtAtParamPoint( int nId, double dU, Point3d& ptP)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, FALSE)
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// se non è entità geometrica
|
||||
const IGeoObj* pGObj ;
|
||||
if ( ( pGObj = pGeomDB->GetGeoObj( nId)) == nullptr)
|
||||
return FALSE ;
|
||||
return false ;
|
||||
// se curva
|
||||
if ( ( pGObj->GetType() & GEO_CURVE) != 0) {
|
||||
// recupero la curva
|
||||
const ICurve* pCrv = GetCurve( pGObj) ;
|
||||
Point3d ptStart ;
|
||||
if ( ! pCrv->GetPointD1D2( dU, ICurve::FROM_MINUS, ptStart))
|
||||
return FALSE ;
|
||||
// assegno il punto
|
||||
ptP[0] = ptStart.x ;
|
||||
ptP[1] = ptStart.y ;
|
||||
ptP[2] = ptStart.z ;
|
||||
return TRUE ;
|
||||
return pCrv->GetPointD1D2( dU, ICurve::FROM_MINUS, ptP) ;
|
||||
}
|
||||
return FALSE ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtIntersectionPoint( int nId1, int nId2, const double ptNear[3], double ptP[3])
|
||||
{
|
||||
// recupero il punto
|
||||
Point3d ptInt ;
|
||||
if ( ! EgtIntersectionPoint( nId1, nId2, ptNear, ptInt))
|
||||
return FALSE ;
|
||||
// ritorno il punto
|
||||
VEC_FROM_3D( ptP, ptInt)
|
||||
return TRUE ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
__stdcall EgtIntersectionPoint( int nId1, int nId2, const Point3d& ptNear, Point3d& ptP)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, FALSE)
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// devono essere entità geometriche
|
||||
const IGeoObj* pGObj1 ;
|
||||
if ( ( pGObj1 = pGeomDB->GetGeoObj( nId1)) == nullptr)
|
||||
return FALSE ;
|
||||
return false ;
|
||||
const IGeoObj* pGObj2 ;
|
||||
if ( ( pGObj2 = pGeomDB->GetGeoObj( nId2)) == nullptr)
|
||||
return FALSE ;
|
||||
return false ;
|
||||
// se curve
|
||||
if ( ( pGObj1->GetType() & GEO_CURVE) != 0 && ( pGObj2->GetType() & GEO_CURVE) != 0) {
|
||||
// recupero le curve
|
||||
@@ -260,135 +273,167 @@ __stdcall EgtIntersectionPoint( int nId1, int nId2, const double ptNear[3], doub
|
||||
// recupero i riferimenti in cui sono immerse
|
||||
Frame3d frEnt1 ;
|
||||
if ( ! pGeomDB->GetGlobFrame( nId1, frEnt1))
|
||||
return FALSE ;
|
||||
return false ;
|
||||
Frame3d frEnt2 ;
|
||||
if ( ! pGeomDB->GetGlobFrame( nId2, frEnt2))
|
||||
return FALSE ;
|
||||
return false ;
|
||||
// se il riferimento della seconda curva è diverso da quello della prima entità, devo trasformarla
|
||||
PtrOwner<ICurve> crvTrans( nullptr) ;
|
||||
if ( ! AreSameFrame( frEnt1, frEnt2)) {
|
||||
crvTrans.Set( pCrv2->Clone()) ;
|
||||
if ( IsNull( crvTrans))
|
||||
return FALSE ;
|
||||
return false ;
|
||||
crvTrans->LocToLoc( frEnt2, frEnt1) ;
|
||||
pCrv2 = ::Get( crvTrans) ;
|
||||
}
|
||||
// porto il punto vicino nel riferimento della prima curva
|
||||
Point3d ptN( ptNear) ;
|
||||
ptN.ToLoc( frEnt1) ;
|
||||
Point3d ptNearLoc( ptNear) ;
|
||||
ptNearLoc.ToLoc( frEnt1) ;
|
||||
// calcolo il punto di intersezione sulla prima curva più vicino al punto di riferimento
|
||||
IntersCurveCurve intCC( *pCrv1, *pCrv2, true) ;
|
||||
Point3d ptI ;
|
||||
if ( ! intCC.GetIntersPointNearTo( 0, ptN, ptI))
|
||||
return FALSE ;
|
||||
// assegno il punto
|
||||
ptP[0] = ptI.x ;
|
||||
ptP[1] = ptI.y ;
|
||||
ptP[2] = ptI.z ;
|
||||
return TRUE ;
|
||||
return intCC.GetIntersPointNearTo( 0, ptNearLoc, ptP) ;
|
||||
}
|
||||
return FALSE ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtStartVector( int nId, double vtV[3])
|
||||
{
|
||||
// recupero il vettore
|
||||
Vector3d vtStart ;
|
||||
if ( ! EgtStartVector( nId, vtStart))
|
||||
return FALSE ;
|
||||
// ritorno il vettore
|
||||
VEC_FROM_3D( vtV, vtStart)
|
||||
return TRUE ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
__stdcall EgtStartVector( int nId, Vector3d& vtV)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, FALSE)
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// se non è entità geometrica
|
||||
const IGeoObj* pGObj ;
|
||||
if ( ( pGObj = pGeomDB->GetGeoObj( nId)) == nullptr)
|
||||
return FALSE ;
|
||||
return false ;
|
||||
// se vettore
|
||||
if ( pGObj->GetType() == GEO_VECT3D) {
|
||||
// recupero il geo-vettore
|
||||
const IGeoVector3d* pGV = GetGeoVector3d( pGObj) ;
|
||||
Vector3d vtDir = pGV->GetVector() ;
|
||||
// assegno il vettore
|
||||
vtV[0] = vtDir.x ;
|
||||
vtV[1] = vtDir.y ;
|
||||
vtV[2] = vtDir.z ;
|
||||
return TRUE ;
|
||||
vtV = pGV->GetVector() ;
|
||||
return true ;
|
||||
}
|
||||
// se curva
|
||||
else if ( ( pGObj->GetType() & GEO_CURVE) != 0) {
|
||||
// recupero la curva
|
||||
const ICurve* pCrv = GetCurve( pGObj) ;
|
||||
Vector3d vtDir ;
|
||||
if ( ! pCrv->GetStartDir( vtDir))
|
||||
return FALSE ;
|
||||
// assegno il vettore
|
||||
vtV[0] = vtDir.x ;
|
||||
vtV[1] = vtDir.y ;
|
||||
vtV[2] = vtDir.z ;
|
||||
return TRUE ;
|
||||
return pCrv->GetStartDir( vtV) ;
|
||||
}
|
||||
return FALSE ;
|
||||
// se testo
|
||||
else if ( pGObj->GetType() == EXT_TEXT) {
|
||||
// recupero il testo
|
||||
const IExtText* pTxt = GetExtText( pGObj) ;
|
||||
// assegno il vettore
|
||||
vtV = pTxt->GetDirVersor() ;
|
||||
return true ;
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtEndVector( int nId, double vtV[3])
|
||||
{
|
||||
// recupero il vettore
|
||||
Vector3d vtEnd ;
|
||||
if ( ! EgtEndVector( nId, vtEnd))
|
||||
return FALSE ;
|
||||
// ritorno il vettore
|
||||
VEC_FROM_3D( vtV, vtEnd)
|
||||
return TRUE ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
__stdcall EgtEndVector( int nId, Vector3d& vtV)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, FALSE)
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// se non è entità geometrica
|
||||
const IGeoObj* pGObj ;
|
||||
if ( ( pGObj = pGeomDB->GetGeoObj( nId)) == nullptr)
|
||||
return FALSE ;
|
||||
return false ;
|
||||
// se curva
|
||||
if ( ( pGObj->GetType() & GEO_CURVE) != 0) {
|
||||
// recupero la curva
|
||||
const ICurve* pCrv = GetCurve( pGObj) ;
|
||||
Vector3d vtDir ;
|
||||
if ( ! pCrv->GetEndDir( vtDir))
|
||||
return FALSE ;
|
||||
// assegno il vettore
|
||||
vtV[0] = vtDir.x ;
|
||||
vtV[1] = vtDir.y ;
|
||||
vtV[2] = vtDir.z ;
|
||||
return TRUE ;
|
||||
return pCrv->GetEndDir( vtV) ;
|
||||
}
|
||||
return FALSE ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtMidVector( int nId, double vtV[3])
|
||||
{
|
||||
// recupero il vettore
|
||||
Vector3d vtMid ;
|
||||
if ( ! EgtMidVector( nId, vtMid))
|
||||
return FALSE ;
|
||||
// ritorno il vettore
|
||||
VEC_FROM_3D( vtV, vtMid)
|
||||
return TRUE ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
__stdcall EgtMidVector( int nId, Vector3d& vtV)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, FALSE)
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// se non è entità geometrica
|
||||
const IGeoObj* pGObj ;
|
||||
if ( ( pGObj = pGeomDB->GetGeoObj( nId)) == nullptr)
|
||||
return FALSE ;
|
||||
return false ;
|
||||
// se curva
|
||||
if ( ( pGObj->GetType() & GEO_CURVE) != 0) {
|
||||
// recupero la curva
|
||||
const ICurve* pCrv = GetCurve( pGObj) ;
|
||||
Vector3d vtDir ;
|
||||
if ( ! pCrv->GetMidDir( vtDir))
|
||||
return FALSE ;
|
||||
// assegno il vettore
|
||||
vtV[0] = vtDir.x ;
|
||||
vtV[1] = vtDir.y ;
|
||||
vtV[2] = vtDir.z ;
|
||||
return TRUE ;
|
||||
return pCrv->GetMidDir( vtV) ;
|
||||
}
|
||||
return FALSE ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtAtParamVector( int nId, double dU, int nSide, double vtV[3])
|
||||
{
|
||||
// recupero il vettore
|
||||
Vector3d vtAtPar ;
|
||||
if ( ! EgtAtParamVector( nId, dU, nSide, vtAtPar))
|
||||
return FALSE ;
|
||||
// ritorno il vettore
|
||||
VEC_FROM_3D( vtV, vtAtPar)
|
||||
return TRUE ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
__stdcall EgtAtParamVector( int nId, double dU, int nSide, Vector3d& vtV)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, FALSE)
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// se non è entità geometrica
|
||||
const IGeoObj* pGObj ;
|
||||
if ( ( pGObj = pGeomDB->GetGeoObj( nId)) == nullptr)
|
||||
return FALSE ;
|
||||
return false ;
|
||||
// se curva
|
||||
if ( ( pGObj->GetType() & GEO_CURVE) != 0) {
|
||||
// recupero la curva
|
||||
@@ -398,17 +443,10 @@ __stdcall EgtAtParamVector( int nId, double dU, int nSide, double vtV[3])
|
||||
if ( nSide >0)
|
||||
nSide = ICurve::FROM_PLUS ;
|
||||
// recupero la direzione
|
||||
Vector3d vtDir ;
|
||||
Point3d ptP ;
|
||||
if ( ! pCrv->GetPointTang( dU, nSide, ptP, vtDir))
|
||||
return false ;
|
||||
// assegno il vettore
|
||||
vtV[0] = vtDir.x ;
|
||||
vtV[1] = vtDir.y ;
|
||||
vtV[2] = vtDir.z ;
|
||||
return TRUE ;
|
||||
return pCrv->GetPointTang( dU, nSide, ptP, vtV) ;
|
||||
}
|
||||
return FALSE ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -420,126 +458,259 @@ __stdcall EgtFrame( int nId, double ptOrig[3], double vtX[3], double vtY[3], dou
|
||||
if ( ! EgtFrame( nId, frFrame))
|
||||
return FALSE ;
|
||||
// assegno l'origine
|
||||
ptOrig[0] = frFrame.Orig().x ;
|
||||
ptOrig[1] = frFrame.Orig().y ;
|
||||
ptOrig[2] = frFrame.Orig().z ;
|
||||
VEC_FROM_3D( ptOrig, frFrame.Orig())
|
||||
// assegno il versore X
|
||||
vtX[0] = frFrame.VersX().x ;
|
||||
vtX[1] = frFrame.VersX().y ;
|
||||
vtX[2] = frFrame.VersX().z ;
|
||||
VEC_FROM_3D( vtX, frFrame.VersX())
|
||||
// assegno il versore Y
|
||||
vtY[0] = frFrame.VersY().x ;
|
||||
vtY[1] = frFrame.VersY().y ;
|
||||
vtY[2] = frFrame.VersY().z ;
|
||||
VEC_FROM_3D( vtY, frFrame.VersY())
|
||||
// assegno il versore Z
|
||||
vtZ[0] = frFrame.VersZ().x ;
|
||||
vtZ[1] = frFrame.VersZ().y ;
|
||||
vtZ[2] = frFrame.VersZ().z ;
|
||||
VEC_FROM_3D( vtZ, frFrame.VersZ())
|
||||
return TRUE ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
BOOL
|
||||
bool
|
||||
__stdcall EgtFrame( int nId, Frame3d& frFrame)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, FALSE)
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// se gruppo
|
||||
if ( pGeomDB->GetGroupFrame( nId, frFrame))
|
||||
return TRUE ;
|
||||
return true ;
|
||||
// se geo frame
|
||||
const IGeoObj* pGObj ;
|
||||
if ( ( pGObj = pGeomDB->GetGeoObj( nId)) != nullptr &&
|
||||
pGObj->GetType() == GEO_FRAME3D) {
|
||||
frFrame = GetGeoFrame3d( pGObj)->GetFrame() ;
|
||||
return TRUE ;
|
||||
return true ;
|
||||
}
|
||||
// altrimenti errore
|
||||
return FALSE ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtCurveExtrusion( int nId, double vtExtr[3])
|
||||
{
|
||||
// recupero il vettore estrusione
|
||||
Vector3d vtTmp ;
|
||||
if ( ! EgtCurveExtrusion( nId, vtTmp))
|
||||
return FALSE ;
|
||||
// lo assegno
|
||||
VEC_FROM_3D( vtExtr, vtTmp)
|
||||
return TRUE ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
__stdcall EgtCurveExtrusion( int nId, Vector3d& vtExtr)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero la curva
|
||||
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pCurve == nullptr)
|
||||
return false ;
|
||||
// ne ricavo il vettore estrusione
|
||||
return pCurve->GetExtrusion( vtExtr) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtCurveThickness( int nId, double* pdThick)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, FALSE)
|
||||
// verifico il parametro
|
||||
if ( pdThick == nullptr)
|
||||
return FALSE ;
|
||||
// recupero la curva
|
||||
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pCurve == nullptr)
|
||||
return FALSE ;
|
||||
// recupero lo spessore
|
||||
return ( pCurve->GetThickness( *pdThick) ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtCurveArcNormVersor( int nId, double vtNorm[3])
|
||||
{
|
||||
// recupero il vettore normale
|
||||
Vector3d vtTmp ;
|
||||
if ( ! EgtCurveArcNormVersor( nId, vtTmp))
|
||||
return FALSE ;
|
||||
// lo assegno
|
||||
VEC_FROM_3D( vtNorm, vtTmp)
|
||||
return TRUE ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
__stdcall EgtCurveArcNormVersor( int nId, Vector3d& vtNorm)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, FALSE)
|
||||
// recupero l'arco
|
||||
ICurveArc* pArc = GetCurveArc( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pArc == nullptr)
|
||||
return false ;
|
||||
// recupero la normale
|
||||
vtNorm = pArc->GetNormVersor() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtExtTextNormVersor( int nId, double vtNorm[3])
|
||||
{
|
||||
// recupero il vettore normale
|
||||
Vector3d vtTmp ;
|
||||
if ( ! EgtExtTextNormVersor( nId, vtTmp))
|
||||
return FALSE ;
|
||||
// lo assegno
|
||||
VEC_FROM_3D( vtNorm, vtTmp)
|
||||
return TRUE ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
__stdcall EgtExtTextNormVersor( int nId, Vector3d& vtNorm)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, FALSE)
|
||||
// recupero il testo
|
||||
const IExtText* pTxt = GetExtText( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pTxt == nullptr)
|
||||
return false ;
|
||||
// recupero la normale
|
||||
vtNorm = pTxt->GetNormVersor() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
// Geo Transforms
|
||||
//-------------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtVectorToIdGlob( double vtV[3], int nId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, FALSE)
|
||||
// recupero il riferimento
|
||||
// se gruppo -> il suo proprio espresso in globale
|
||||
// se oggetto -> quello del gruppo cui appartiene in globale
|
||||
Frame3d frRef ;
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nId, frRef) &&
|
||||
! pGeomDB->GetGlobFrame( nId, frRef))
|
||||
return FALSE ;
|
||||
// eseguo la trasformazione
|
||||
Vector3d vtVG( vtV) ;
|
||||
vtVG.ToGlob( frRef) ;
|
||||
// aggiorno il parametro punto
|
||||
VEC_FROM_3D( vtV, vtVG)
|
||||
return TRUE ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtVectorToIdLoc( double vtV[3], int nId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, FALSE)
|
||||
// recupero il riferimento
|
||||
// se gruppo -> il suo proprio espresso in globale
|
||||
// se oggetto -> quello del gruppo cui appartiene in globale
|
||||
Frame3d frRef ;
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nId, frRef) &&
|
||||
! pGeomDB->GetGlobFrame( nId, frRef))
|
||||
return FALSE ;
|
||||
// eseguo la trasformazione
|
||||
Vector3d vtVG( vtV) ;
|
||||
vtVG.ToLoc( frRef) ;
|
||||
// aggiorno il parametro punto
|
||||
VEC_FROM_3D( vtV, vtVG)
|
||||
return TRUE ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtPointToIdGlob( double ptP[3], int nId)
|
||||
{
|
||||
// trasformo il punto
|
||||
Point3d ptTmp( ptP) ;
|
||||
if ( ! EgtPointToIdGlob( ptTmp, nId))
|
||||
return FALSE ;
|
||||
// ritorno il punto
|
||||
VEC_FROM_3D( ptP, ptTmp)
|
||||
return TRUE ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
__stdcall EgtPointToIdGlob( Point3d& ptP, int nId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, FALSE)
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero il riferimento
|
||||
// se gruppo -> il suo proprio espresso in globale
|
||||
// se oggetto -> quello del gruppo cui appartiene in globale
|
||||
Frame3d frRef ;
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nId, frRef) &&
|
||||
! pGeomDB->GetGlobFrame( nId, frRef))
|
||||
return FALSE ;
|
||||
return false ;
|
||||
// eseguo la trasformazione
|
||||
Point3d ptPL( ptP) ;
|
||||
ptPL.ToGlob( frRef) ;
|
||||
// aggiorno il parametro punto
|
||||
VEC_FROM_3D( ptP, ptPL)
|
||||
return TRUE ;
|
||||
ptP.ToGlob( frRef) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtPointToIdLoc( double ptP[3], int nId)
|
||||
{
|
||||
// trasformo il punto
|
||||
Point3d ptTmp( ptP) ;
|
||||
if ( ! EgtPointToIdLoc( ptTmp, nId))
|
||||
return FALSE ;
|
||||
// ritorno il punto
|
||||
VEC_FROM_3D( ptP, ptTmp)
|
||||
return TRUE ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
__stdcall EgtPointToIdLoc( Point3d& ptP, int nId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, FALSE)
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero il riferimento
|
||||
// se gruppo -> il suo proprio espresso in globale
|
||||
// se oggetto -> quello del gruppo cui appartiene in globale
|
||||
Frame3d frRef ;
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nId, frRef) &&
|
||||
! pGeomDB->GetGlobFrame( nId, frRef))
|
||||
return FALSE ;
|
||||
return false ;
|
||||
// eseguo la trasformazione
|
||||
Point3d ptPL( ptP) ;
|
||||
ptPL.ToLoc( frRef) ;
|
||||
// aggiorno il parametro punto
|
||||
VEC_FROM_3D( ptP, ptPL)
|
||||
return TRUE ;
|
||||
ptP.ToLoc( frRef) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtVectorToIdGlob( double vtV[3], int nId)
|
||||
{
|
||||
// trasformo il vettore
|
||||
Vector3d vtTmp( vtV) ;
|
||||
if ( ! EgtVectorToIdGlob( vtTmp, nId))
|
||||
return FALSE ;
|
||||
// ritorno il punto
|
||||
VEC_FROM_3D( vtV, vtTmp)
|
||||
return TRUE ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
__stdcall EgtVectorToIdGlob( Vector3d& vtV, int nId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero il riferimento
|
||||
// se gruppo -> il suo proprio espresso in globale
|
||||
// se oggetto -> quello del gruppo cui appartiene in globale
|
||||
Frame3d frRef ;
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nId, frRef) &&
|
||||
! pGeomDB->GetGlobFrame( nId, frRef))
|
||||
return false ;
|
||||
// eseguo la trasformazione
|
||||
vtV.ToGlob( frRef) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtVectorToIdLoc( double vtV[3], int nId)
|
||||
{
|
||||
// trasformo il vettore
|
||||
Vector3d vtTmp( vtV) ;
|
||||
if ( ! EgtVectorToIdLoc( vtTmp, nId))
|
||||
return FALSE ;
|
||||
// ritorno il punto
|
||||
VEC_FROM_3D( vtV, vtTmp)
|
||||
return TRUE ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
__stdcall EgtVectorToIdLoc( Vector3d& vtV, int nId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero il riferimento
|
||||
// se gruppo -> il suo proprio espresso in globale
|
||||
// se oggetto -> quello del gruppo cui appartiene in globale
|
||||
Frame3d frRef ;
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nId, frRef) &&
|
||||
! pGeomDB->GetGlobFrame( nId, frRef))
|
||||
return false ;
|
||||
// eseguo la trasformazione
|
||||
vtV.ToLoc( frRef) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
+8
-8
@@ -99,33 +99,33 @@ __stdcall EgtNewFile( void)
|
||||
BOOL
|
||||
__stdcall EgtOpenFile( const wchar_t* wsFilePath)
|
||||
{
|
||||
return EgtOpenFile( wstrztoA( wsFilePath)) ;
|
||||
return ( EgtOpenFile( wstrztoA( wsFilePath)) ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL
|
||||
bool
|
||||
__stdcall EgtOpenFile( const string& sFilePath)
|
||||
{
|
||||
// reinizializzazione (con pulizia) del DB geometrico
|
||||
if ( ! EgtNewFile())
|
||||
return FALSE ;
|
||||
return false ;
|
||||
// carico il file
|
||||
return ( GetCurrGeomDB()->Load( sFilePath) ? TRUE : FALSE) ;
|
||||
return GetCurrGeomDB()->Load( sFilePath) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtSaveFile( const wchar_t* wsFilePath, int nFlag)
|
||||
{
|
||||
return EgtSaveFile( wstrztoA( wsFilePath), nFlag) ;
|
||||
return ( EgtSaveFile( wstrztoA( wsFilePath), nFlag) ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL
|
||||
bool
|
||||
__stdcall EgtSaveFile( const string& sFilePath, int nFlag)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, FALSE)
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// salvo il file
|
||||
return ( pGeomDB->Save( sFilePath, nFlag) ? TRUE : FALSE) ;
|
||||
return pGeomDB->Save( sFilePath, nFlag) ;
|
||||
}
|
||||
|
||||
@@ -318,6 +318,32 @@ __stdcall EgtGetGridSnapPointZ( BOOL bSketch, int nWinX, int nWinY, const double
|
||||
return TRUE ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
__stdcall EgtGetLastSnapId( void)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_SCENE( pGseCtx, FALSE)
|
||||
// restituisco Id di ultima entità generatrice di punto snap
|
||||
return pGseCtx->m_pScene->GetLastSnapId() ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtGetLastSnapDir( double vtV[3])
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_SCENE( pGseCtx, FALSE)
|
||||
// restituisco, se definita, direzione associata ad ultimo punto di snap
|
||||
Vector3d vtDir ;
|
||||
if ( pGseCtx->m_pScene->GetLastSnapDir( vtDir)) {
|
||||
VEC_FROM_3D( vtV, vtDir)
|
||||
return TRUE ;
|
||||
}
|
||||
else
|
||||
return FALSE ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtSetShowMode( int nShowMode, BOOL bRedraw)
|
||||
|
||||
Binary file not shown.
@@ -146,6 +146,7 @@ copy $(TargetPath) \EgtProg\DllD64</Command>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<OmitFramePointers>true</OmitFramePointers>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
|
||||
@@ -470,7 +470,7 @@ LuaSetInfo( lua_State* L)
|
||||
LuaCheckParam( L, 3, sInfo)
|
||||
LuaClearStack( L) ;
|
||||
// assegno la info
|
||||
bool bOk = ( EgtSetInfo( nId, sKey, sInfo) ? true : false) ;
|
||||
bool bOk = EgtSetInfo( nId, sKey, sInfo) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
@@ -488,7 +488,7 @@ LuaGetInfo( lua_State* L)
|
||||
LuaClearStack( L) ;
|
||||
// recupero l'info
|
||||
string sInfo ;
|
||||
bool bOk = ( EgtGetInfo( nId, sKey, sInfo) ? true : false) ;
|
||||
bool bOk = EgtGetInfo( nId, sKey, sInfo) ;
|
||||
// restituisco il risultato
|
||||
if ( bOk)
|
||||
LuaSetReturn( L, sInfo) ;
|
||||
|
||||
+9
-9
@@ -31,7 +31,7 @@ LuaStartPoint( lua_State* L)
|
||||
LuaClearStack( L) ;
|
||||
// recupero il punto iniziale dell'entità
|
||||
Point3d ptP ;
|
||||
if ( EgtStartPoint( nId, ptP.v))
|
||||
if ( EgtStartPoint( nId, ptP))
|
||||
LuaSetReturn( L, ptP) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
@@ -48,7 +48,7 @@ LuaEndPoint( lua_State* L)
|
||||
LuaClearStack( L) ;
|
||||
// recupero il punto finale dell'entità
|
||||
Point3d ptP ;
|
||||
if ( EgtEndPoint( nId, ptP.v))
|
||||
if ( EgtEndPoint( nId, ptP))
|
||||
LuaSetReturn( L, ptP) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
@@ -65,7 +65,7 @@ LuaMidPoint( lua_State* L)
|
||||
LuaClearStack( L) ;
|
||||
// recupero il punto centrale dell'entità
|
||||
Point3d ptP ;
|
||||
if ( EgtMidPoint( nId, ptP.v))
|
||||
if ( EgtMidPoint( nId, ptP))
|
||||
LuaSetReturn( L, ptP) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
@@ -82,7 +82,7 @@ LuaCenterPoint( lua_State* L)
|
||||
LuaClearStack( L) ;
|
||||
// recupero il punto centrale dell'entità
|
||||
Point3d ptP ;
|
||||
if ( EgtCenterPoint( nId, ptP.v))
|
||||
if ( EgtCenterPoint( nId, ptP))
|
||||
LuaSetReturn( L, ptP) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
@@ -101,7 +101,7 @@ LuaAtParamPoint( lua_State* L)
|
||||
LuaClearStack( L) ;
|
||||
// recupero il punto in posizione parametrica U della curva
|
||||
Point3d ptP ;
|
||||
if ( EgtAtParamPoint( nId, dU, ptP.v))
|
||||
if ( EgtAtParamPoint( nId, dU, ptP))
|
||||
LuaSetReturn( L, ptP) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
@@ -118,7 +118,7 @@ LuaStartVector( lua_State* L)
|
||||
LuaClearStack( L) ;
|
||||
// recupero il vettore tangente all'inizio della curva
|
||||
Vector3d vtV ;
|
||||
if ( EgtStartVector( nId, vtV.v))
|
||||
if ( EgtStartVector( nId, vtV))
|
||||
LuaSetReturn( L, vtV) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
@@ -135,7 +135,7 @@ LuaEndVector( lua_State* L)
|
||||
LuaClearStack( L) ;
|
||||
// recupero il vettore tangente alla fine della curva
|
||||
Vector3d vtV ;
|
||||
if ( EgtEndVector( nId, vtV.v))
|
||||
if ( EgtEndVector( nId, vtV))
|
||||
LuaSetReturn( L, vtV) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
@@ -152,7 +152,7 @@ LuaMidVector( lua_State* L)
|
||||
LuaClearStack( L) ;
|
||||
// recupero il vettore tangente nel punto medio della curva
|
||||
Vector3d vtV ;
|
||||
if ( EgtMidVector( nId, vtV.v))
|
||||
if ( EgtMidVector( nId, vtV))
|
||||
LuaSetReturn( L, vtV) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
@@ -175,7 +175,7 @@ LuaAtParamVector( lua_State* L)
|
||||
LuaClearStack( L) ;
|
||||
// recupero il punto in posizione parametrica U della curva
|
||||
Vector3d vtV ;
|
||||
if ( EgtAtParamVector( nId, dU, nSide, vtV.v))
|
||||
if ( EgtAtParamVector( nId, dU, nSide, vtV))
|
||||
LuaSetReturn( L, vtV) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
|
||||
+2
-2
@@ -62,7 +62,7 @@ LuaOpenFile( lua_State* L)
|
||||
LuaCheckParam( L, 1, sFilePath)
|
||||
LuaClearStack( L) ;
|
||||
// apro il file
|
||||
bool bOk = ( EgtOpenFile( sFilePath) != FALSE) ;
|
||||
bool bOk = EgtOpenFile( sFilePath) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
@@ -86,7 +86,7 @@ LuaSaveFile( lua_State* L)
|
||||
LuaClearStack( L) ;
|
||||
}
|
||||
// salvo il file
|
||||
bool bOk = ( EgtSaveFile( sFilePath, nFlag) != FALSE) ;
|
||||
bool bOk = EgtSaveFile( sFilePath, nFlag) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
|
||||
Reference in New Issue
Block a user