EgtInterface 1.6a3 :
- modifiche varie per gestire GLOB, LOC e GRID sui dati geometrici - aggiornamenti e miglirie varie - eliminate alcune funzioni lua ormai obsolete (ArcXY e CircleXY).
This commit is contained in:
+39
-21
@@ -15,7 +15,9 @@
|
||||
#include "stdafx.h"
|
||||
#include "API.h"
|
||||
#include "API_Macro.h"
|
||||
#include "AuxTools.h"
|
||||
#include "/EgtDev/Include/EInAPI.h"
|
||||
#include "/EgtDev/Include/EInConst.h"
|
||||
#include "/EgtDev/Include/EgkCurve.h"
|
||||
#include "/EgtDev/Include/EgkSurfTriMesh.h"
|
||||
#include "/EgtDev/Include/EgkStringUtils3d.h"
|
||||
@@ -58,23 +60,29 @@ __stdcall EgtCreateSurfTriMeshByContour( int nParentId, int nCrvId, double dLinT
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
__stdcall EgtCreateSurfTriMeshByExtrusion( int nParentId, int nCrvId, const double vtExtr[3], double dLinTol)
|
||||
__stdcall EgtCreateSurfTriMeshByExtrusion( int nParentId, int nCrvId, const double vtExtr[3],
|
||||
double dLinTol, int nRefType)
|
||||
{
|
||||
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))
|
||||
bOk = false ;
|
||||
// porto in locale il vettore estrusione
|
||||
Vector3d vtExtrL( vtExtr) ;
|
||||
Frame3d frLoc ;
|
||||
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
|
||||
if ( nRefType == RTY_GLOB) {
|
||||
vtExtrL.ToLoc( frLoc) ;
|
||||
}
|
||||
else if ( nRefType == RTY_GRID) {
|
||||
vtExtrL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
}
|
||||
// calcolo la polilinea che approssima la curva
|
||||
PolyLine PL ;
|
||||
if ( ! GetPolyLineFromCurve( nCrvId, frDest, dLinTol, PL))
|
||||
bOk = false ;
|
||||
bOk = bOk && GetPolyLineFromCurve( nCrvId, frLoc, dLinTol, PL) ;
|
||||
// creo e setto la superficie trimesh
|
||||
PtrOwner<ISurfTriMesh> pSTM( CreateSurfTriMesh()) ;
|
||||
if ( IsNull( pSTM) || ! pSTM->CreateByExtrusion( PL, vtExtr))
|
||||
bOk = false ;
|
||||
bOk = bOk && ! IsNull( pSTM) ;
|
||||
bOk = bOk && pSTM->CreateByExtrusion( PL, vtExtrL) ;
|
||||
// inserisco la superficie nel DB
|
||||
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pSTM)) : GDB_ID_NULL) ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
@@ -82,7 +90,8 @@ __stdcall EgtCreateSurfTriMeshByExtrusion( int nParentId, int nCrvId, const doub
|
||||
string sLua = "EgtSurfTmByExtrusion(" + ToString( nParentId) + "," +
|
||||
ToString( nCrvId) + ",{" +
|
||||
ToString( Vector3d( vtExtr)) + "}," +
|
||||
ToString( dLinTol) + ")" +
|
||||
ToString( dLinTol) + "," +
|
||||
RefTypeToString( nRefType) + ")" +
|
||||
" -- Id=" + ToString( nNewId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
@@ -94,22 +103,30 @@ __stdcall EgtCreateSurfTriMeshByExtrusion( int nParentId, int nCrvId, const doub
|
||||
int
|
||||
__stdcall EgtCreateSurfTriMeshByScrewing( int nParentId, int nCrvId,
|
||||
const double ptAx[3], const double vtAx[3],
|
||||
double dAngRotDeg, double dMove, double dLinTol)
|
||||
double dAngRotDeg, double dMove, double dLinTol, int nRefType)
|
||||
{
|
||||
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))
|
||||
bOk = false ;
|
||||
// porto in locale punto e vettore asse
|
||||
Point3d ptAxL( ptAx) ;
|
||||
Vector3d vtAxL( vtAx) ;
|
||||
Frame3d frLoc ;
|
||||
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
|
||||
if ( nRefType == RTY_GLOB) {
|
||||
ptAxL.ToLoc( frLoc) ;
|
||||
vtAxL.ToLoc( frLoc) ;
|
||||
}
|
||||
else if ( nRefType == RTY_GRID) {
|
||||
ptAxL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
vtAxL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
}
|
||||
// calcolo la polilinea che approssima la curva
|
||||
PolyLine PL ;
|
||||
if ( ! GetPolyLineFromCurve( nCrvId, frDest, dLinTol, PL))
|
||||
bOk = false ;
|
||||
bOk = bOk && GetPolyLineFromCurve( nCrvId, frLoc, dLinTol, PL) ;
|
||||
// calcolo lo step di rotazione
|
||||
double dMaxRad = 0 ;
|
||||
PL.GetMaxDistanceFromLine( dMaxRad, ptAx, vtAx, 1, false) ;
|
||||
bOk = bOk && PL.GetMaxDistanceFromLine( dMaxRad, ptAx, vtAx, 1, false) ;
|
||||
if ( dMaxRad < EPS_SMALL) {
|
||||
bOk = false ;
|
||||
dMaxRad = EPS_SMALL ;
|
||||
@@ -117,8 +134,8 @@ __stdcall EgtCreateSurfTriMeshByScrewing( int nParentId, int nCrvId,
|
||||
double dStepRotDeg = sqrt( 8 * dLinTol / dMaxRad) * RADTODEG ;
|
||||
// creo e setto la superficie trimesh
|
||||
PtrOwner<ISurfTriMesh> pSTM( CreateSurfTriMesh()) ;
|
||||
if ( IsNull( pSTM) || ! pSTM->CreateByScrewing( PL, ptAx, vtAx, dAngRotDeg, dStepRotDeg, dMove))
|
||||
bOk = false ;
|
||||
bOk = bOk && ! IsNull( pSTM) ;
|
||||
bOk = bOk && pSTM->CreateByScrewing( PL, ptAxL, vtAxL, dAngRotDeg, dStepRotDeg, dMove) ;
|
||||
// inserisco la superficie nel DB
|
||||
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pSTM)) : GDB_ID_NULL) ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
@@ -129,7 +146,8 @@ __stdcall EgtCreateSurfTriMeshByScrewing( int nParentId, int nCrvId,
|
||||
ToString( Vector3d( vtAx)) + "}," +
|
||||
ToString( dAngRotDeg) + "," +
|
||||
ToString( dMove) + "," +
|
||||
ToString( dLinTol) + ")" +
|
||||
ToString( dLinTol) + "," +
|
||||
RefTypeToString( nRefType) + ")" +
|
||||
" -- Id=" + ToString( nNewId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user