EgtExecutor 1.6g7 :

- aggiunte ExeCreateCurveCompoByApproximation e la corrispondente per LUA_GdbCreateCurve.cpp
- corretta ExeCurveDomain
This commit is contained in:
Dario Sassi
2015-07-27 13:35:47 +00:00
parent de05786c53
commit b19dc441e7
5 changed files with 90 additions and 8 deletions
+55 -4
View File
@@ -37,6 +37,7 @@
#include "/EgtDev/Include/EgkCurveComposite.h"
#include "/EgtDev/Include/EgkChainCurves.h"
#include "/EgtDev/Include/EGkCurveByInterp.h"
#include "/EgtDev/Include/EGkCurveByApprox.h"
#include "/EgtDev/Include/EgkSurfTriMesh.h"
#include "/EgtDev/Include/EGkDistPointCurve.h"
#include "/EgtDev/Include/EGkStringUtils3d.h"
@@ -1743,23 +1744,21 @@ ExeCreateCurveCompoByInterpolation( int nParentId, const PolyLine& PL, int nType
// assegno metodo di interpolazione e tipo del risultato
int nMethod = CurveByInterp::AKIMA_CORNER ;
int nCrvType = CurveByInterp::BIARCS ;
if ( nType == ITT_AKIMA) {
if ( nType == ITT_ARCS) {
nMethod = CurveByInterp::AKIMA ;
nCrvType = CurveByInterp::BIARCS ;
}
else if ( nType == ITT_BESSEL) {
else if ( nType == ITT_CUBICS) {
nMethod = CurveByInterp::BESSEL ;
nCrvType = CurveByInterp::CUBIC_BEZIERS ;
}
// oggetto interpolatore
CurveByInterp crvByInterp ;
crvByInterp.Start() ;
Point3d ptP ;
for ( bool bFound = PL.GetFirstPoint( ptP) ;
bFound ;
bFound = PL.GetNextPoint( ptP))
crvByInterp.AddPoint( ptP) ;
crvByInterp.End() ;
PtrOwner<ICurve> pCrvCompo( crvByInterp.GetCurve( nMethod, nType)) ;
bOk = bOk && ! IsNull( pCrvCompo) ;
// assegno il versore estrusione
@@ -1791,6 +1790,58 @@ ExeCreateCurveCompoByInterpolation( int nParentId, const PolyLine& PL, int nType
return nId ;
}
//-------------------------------------------------------------------------------
int
ExeCreateCurveCompoByApproximation( int nParentId, const PolyLine& PL, int nType, double dLinTol, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
bool bOk = true ;
// recupero il riferimento del gruppo destinazione
Frame3d frDest ;
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frDest) ;
// eseguo approssimazione
const double ANG_TOL_STD_DEG = 15 ;
const double LIN_FEA_STD = 20 ;
CurveByApprox crvByApprox ;
Point3d ptP ;
for ( bool bFound = PL.GetFirstPoint( ptP) ;
bFound ;
bFound = PL.GetNextPoint( ptP))
crvByApprox.AddPoint( ptP) ;
PtrOwner<ICurve> pCrvCompo( crvByApprox.GetCurve( nType, dLinTol, ANG_TOL_STD_DEG, LIN_FEA_STD)) ;
bOk = bOk && ! IsNull( pCrvCompo) ;
// assegno il versore estrusione
bOk = bOk && pCrvCompo->SetExtrusion( Z_AX) ;
// eventuale trasformazione per riferimento di espressione dei punti
if ( bOk && nRefType == RTY_GLOB)
pCrvCompo->ToLoc( frDest) ;
else if ( bOk && nRefType == RTY_GRID)
pCrvCompo->LocToLoc( pGeomDB->GetGridFrame(), frDest) ;
// inserisco la curva composita nel DB
int nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pCrvCompo)) : GDB_ID_NULL) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sPnt ;
Point3d ptP ;
if ( PL.GetFirstPoint( ptP))
sPnt += "{" + ToString( ptP) + "}" ;
while ( PL.GetNextPoint( ptP))
sPnt += ",{" + ToString( ptP) + "}" ;
string sLua = "EgtCurveCompoByApproximation(" + IdToString( nParentId) + ",{" +
sPnt + "}," +
InterpTypeToString( nType) + "," +
ToString( dLinTol) + "," +
RefTypeToString( nRefType) + ")" +
" -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
return nId ;
}
//-------------------------------------------------------------------------------
int
ExeCreateCurveCompoFromPoints( int nParentId, const PolyLine& PL, int nRefType)