EgtInterface 1.6a2 :
- numerose modifiche e correzioni - aggiunta registrazione comandi in formato lua - aggiunto valutatore di espressioni.
This commit is contained in:
+80
-39
@@ -18,6 +18,7 @@
|
||||
#include "/EgtDev/Include/EInAPI.h"
|
||||
#include "/EgtDev/Include/EgkCurve.h"
|
||||
#include "/EgtDev/Include/EgkSurfTriMesh.h"
|
||||
#include "/EgtDev/Include/EgkStringUtils3d.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
|
||||
using namespace std ;
|
||||
@@ -28,23 +29,31 @@ __stdcall EgtCreateSurfTriMeshByContour( int nParentId, int nCrvId, double dLinT
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
bool bOk = true ;
|
||||
// recupero il riferimento del gruppo destinazione
|
||||
Frame3d frDest ;
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frDest))
|
||||
return GDB_ID_NULL ;
|
||||
bOk = false ;
|
||||
// calcolo la polilinea che approssima la curva
|
||||
PolyLine PL ;
|
||||
if ( ! GetPolyLineFromCurve( nCrvId, frDest, dLinTol, PL))
|
||||
return GDB_ID_NULL ;
|
||||
// creo la superficie trimesh
|
||||
bOk = false ;
|
||||
// creo e setto la superficie trimesh
|
||||
PtrOwner<ISurfTriMesh> pSTM( CreateSurfTriMesh()) ;
|
||||
if ( IsNull( pSTM))
|
||||
return GDB_ID_NULL ;
|
||||
// setto la superficie
|
||||
if ( ! pSTM->CreateByFlatContour( PL))
|
||||
return GDB_ID_NULL ;
|
||||
if ( IsNull( pSTM) || ! pSTM->CreateByFlatContour( PL))
|
||||
bOk = false ;
|
||||
// inserisco la superficie nel DB
|
||||
return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pSTM)) ;
|
||||
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pSTM)) : GDB_ID_NULL) ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtSurfTmByContour(" + ToString( nParentId) + "," +
|
||||
ToString( nCrvId) + "," +
|
||||
ToString( dLinTol) + ")" +
|
||||
" -- Id=" + ToString( nNewId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco l'identificativo della nuova entità
|
||||
return nNewId ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
@@ -53,23 +62,32 @@ __stdcall EgtCreateSurfTriMeshByExtrusion( int nParentId, int nCrvId, const doub
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
bool bOk = true ;
|
||||
// recupero il riferimento del gruppo destinazione
|
||||
Frame3d frDest ;
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frDest))
|
||||
return GDB_ID_NULL ;
|
||||
bOk = false ;
|
||||
// calcolo la polilinea che approssima la curva
|
||||
PolyLine PL ;
|
||||
if ( ! GetPolyLineFromCurve( nCrvId, frDest, dLinTol, PL))
|
||||
return GDB_ID_NULL ;
|
||||
// creo la superficie trimesh
|
||||
bOk = false ;
|
||||
// creo e setto la superficie trimesh
|
||||
PtrOwner<ISurfTriMesh> pSTM( CreateSurfTriMesh()) ;
|
||||
if ( IsNull( pSTM))
|
||||
return GDB_ID_NULL ;
|
||||
// setto la superficie
|
||||
if ( ! pSTM->CreateByExtrusion( PL, vtExtr))
|
||||
return GDB_ID_NULL ;
|
||||
if ( IsNull( pSTM) || ! pSTM->CreateByExtrusion( PL, vtExtr))
|
||||
bOk = false ;
|
||||
// inserisco la superficie nel DB
|
||||
return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pSTM)) ;
|
||||
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pSTM)) : GDB_ID_NULL) ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtSurfTmByExtrusion(" + ToString( nParentId) + "," +
|
||||
ToString( nCrvId) + ",{" +
|
||||
ToString( Vector3d( vtExtr)) + "}," +
|
||||
ToString( dLinTol) + ")" +
|
||||
" -- Id=" + ToString( nNewId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco l'identificativo della nuova entità
|
||||
return nNewId ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
@@ -80,29 +98,43 @@ __stdcall EgtCreateSurfTriMeshByScrewing( int nParentId, int nCrvId,
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
bool bOk = true ;
|
||||
// recupero il riferimento del gruppo destinazione
|
||||
Frame3d frDest ;
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frDest))
|
||||
return GDB_ID_NULL ;
|
||||
bOk = false ;
|
||||
// calcolo la polilinea che approssima la curva
|
||||
PolyLine PL ;
|
||||
if ( ! GetPolyLineFromCurve( nCrvId, frDest, dLinTol, PL))
|
||||
return GDB_ID_NULL ;
|
||||
bOk = false ;
|
||||
// calcolo lo step di rotazione
|
||||
double dMaxRad = 0 ;
|
||||
PL.GetMaxDistanceFromLine( dMaxRad, ptAx, vtAx, 1, false) ;
|
||||
if ( dMaxRad < EPS_SMALL)
|
||||
return false ;
|
||||
if ( dMaxRad < EPS_SMALL) {
|
||||
bOk = false ;
|
||||
dMaxRad = EPS_SMALL ;
|
||||
}
|
||||
double dStepRotDeg = sqrt( 8 * dLinTol / dMaxRad) * RADTODEG ;
|
||||
// creo la superficie trimesh
|
||||
// creo e setto la superficie trimesh
|
||||
PtrOwner<ISurfTriMesh> pSTM( CreateSurfTriMesh()) ;
|
||||
if ( IsNull( pSTM))
|
||||
return GDB_ID_NULL ;
|
||||
// setto la superficie
|
||||
if ( ! pSTM->CreateByScrewing( PL, ptAx, vtAx, dAngRotDeg, dStepRotDeg, dMove))
|
||||
return GDB_ID_NULL ;
|
||||
if ( IsNull( pSTM) || ! pSTM->CreateByScrewing( PL, ptAx, vtAx, dAngRotDeg, dStepRotDeg, dMove))
|
||||
bOk = false ;
|
||||
// inserisco la superficie nel DB
|
||||
return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pSTM)) ;
|
||||
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pSTM)) : GDB_ID_NULL) ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtSurfTmByScrewing(" + ToString( nParentId) + "," +
|
||||
ToString( nCrvId) + ",{" +
|
||||
ToString( Point3d( ptAx)) + "},{" +
|
||||
ToString( Vector3d( vtAx)) + "}," +
|
||||
ToString( dAngRotDeg) + "," +
|
||||
ToString( dMove) + "," +
|
||||
ToString( dLinTol) + ")" +
|
||||
" -- Id=" + ToString( nNewId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco l'identificativo della nuova entità
|
||||
return nNewId ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
@@ -111,25 +143,34 @@ __stdcall EgtCreateSurfTriMeshRuled( int nParentId, int nCrvId1, int nCrvId2, do
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
bool bOk = true ;
|
||||
// recupero il riferimento del gruppo destinazione
|
||||
Frame3d frDest ;
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frDest))
|
||||
return GDB_ID_NULL ;
|
||||
bOk = false ;
|
||||
// calcolo la polilinea che approssima la prima curva
|
||||
PolyLine PL1 ;
|
||||
if ( ! GetPolyLineFromCurve( nCrvId1, frDest, dLinTol, PL1))
|
||||
return GDB_ID_NULL ;
|
||||
bOk = false ;
|
||||
// calcolo la polilinea che approssima la seconda curva
|
||||
PolyLine PL2 ;
|
||||
if ( ! GetPolyLineFromCurve( nCrvId2, frDest, dLinTol, PL2))
|
||||
return GDB_ID_NULL ;
|
||||
// creo la superficie trimesh
|
||||
bOk = false ;
|
||||
// creo la superficie trimesh e costruisco la rigata tra le due curve
|
||||
PtrOwner<ISurfTriMesh> pSTM( CreateSurfTriMesh()) ;
|
||||
if ( IsNull( pSTM))
|
||||
return GDB_ID_NULL ;
|
||||
// costruisco la rigata tra le due curve
|
||||
if ( ! pSTM->CreateByTwoCurves( PL1, PL2))
|
||||
return GDB_ID_NULL ;
|
||||
if ( IsNull( pSTM) || ! pSTM->CreateByTwoCurves( PL1, PL2))
|
||||
bOk = false ;
|
||||
// inserisco la superficie trimesh nel DB
|
||||
return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pSTM)) ;
|
||||
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pSTM)) : GDB_ID_NULL) ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtSurfTmRuled(" + ToString( nParentId) + "," +
|
||||
ToString( nCrvId1) + "," +
|
||||
ToString( nCrvId2) + "," +
|
||||
ToString( dLinTol) + ")" +
|
||||
" -- Id=" + ToString( nNewId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco l'identificativo della nuova entità
|
||||
return nNewId ;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user