EgtInterface 1.5k3 :
- esposte ulteriori funzionalità.
This commit is contained in:
+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) {
|
||||
|
||||
Reference in New Issue
Block a user