EgtInterface 1.6d2 :
- in Lua in tutte le operazioni con creazione di più entità restituisco Id prima e numero - in Lua aggiunto oggetto BBox3d (non ancora con tutte le funzionalità) - in Lua aggiunta creazione superficie da BBox3d - in Lua aggiunte funzioni per avere BBox3d di oggetti - in Lua aggiunta OutBox - in Lua aggiunte funzioni per MachMgr.
This commit is contained in:
+66
-7
@@ -29,6 +29,67 @@
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
__stdcall EgtCreateSurfTmBBox( int nParentId, const double ptMin[3], const double ptMax[3], int nRefType)
|
||||
{
|
||||
BBox3d b3Box ;
|
||||
// per conservare un box vuoto
|
||||
if ( ptMin[0] < ( ptMax[0] + EPS_SMALL) &&
|
||||
ptMin[1] < ( ptMax[1] + EPS_SMALL) &&
|
||||
ptMin[2] < ( ptMax[2] + EPS_SMALL))
|
||||
b3Box.Set( ptMin, ptMax) ;
|
||||
// eseguo
|
||||
return EgtCreateSurfTmBBox( nParentId, b3Box, nRefType) ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
EgtCreateSurfTmBBox( int nParentId, const BBox3d& b3Box, int nRefType)
|
||||
{
|
||||
// bounding box orientato come gli assi del riferimento
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
bool bOk = pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
|
||||
// ricavo i punti standard e le dimensioni
|
||||
Point3d ptIni ;
|
||||
double dWidth = 0, dLen = 0, dHeight = 0 ;
|
||||
bOk = bOk && b3Box.GetMinDim( ptIni, dWidth, dLen, dHeight) ;
|
||||
dWidth = max( dWidth, 10 * EPS_SMALL) ;
|
||||
dLen = max( dLen, 10 * EPS_SMALL) ;
|
||||
dHeight = max( dHeight, 10 * EPS_SMALL) ;
|
||||
Point3d ptCross = ptIni + Vector3d( dWidth, dLen) ;
|
||||
Point3d ptDir = ptIni + Vector3d( dWidth, 0) ;
|
||||
// porto in locale i punti
|
||||
Point3d ptIniL = GetPointLocal( pGeomDB, ptIni.v, nRefType, frLoc) ;
|
||||
Point3d ptCrossL = GetPointLocal( pGeomDB, ptCross.v, nRefType, frLoc) ;
|
||||
Point3d ptDirL = GetPointLocal( pGeomDB, ptDir.v, nRefType, frLoc) ;
|
||||
// ne ricavo un riferimento intrinseco
|
||||
Frame3d frBox ;
|
||||
bOk = bOk && frBox.Set( ptIniL, ptDirL, ptCrossL) ;
|
||||
// creo il box nel suo riferimento intrinseco
|
||||
PtrOwner<ISurfTriMesh> pSTM( GetSurfTriMeshBox( dWidth, dLen, dHeight)) ;
|
||||
bOk = bOk && ! IsNull( pSTM) ;
|
||||
// porto il box nel riferimento locale
|
||||
bOk = bOk && pSTM->ToGlob( frBox) ;
|
||||
// inserisco la superficie nel DB
|
||||
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pSTM)) : GDB_ID_NULL) ;
|
||||
EgtSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtSurfTmBBox(" + ToString( nParentId) + ",{{" +
|
||||
ToString( b3Box.GetMin()) + "},{" +
|
||||
ToString( b3Box.GetMax()) + "}}," +
|
||||
RefTypeToString( nRefType) + ")" +
|
||||
" -- Id=" + ToString( nNewId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco l'identificativo della nuova entità
|
||||
return nNewId ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
__stdcall EgtCreateSurfTmBox( int nParentId, const double ptIni[3], const double ptCross[3],
|
||||
@@ -36,12 +97,10 @@ __stdcall EgtCreateSurfTmBox( int nParentId, const double ptIni[3], const double
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
bool bOk = true ;
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
|
||||
return GDB_ID_NULL ;
|
||||
// porto in locale i punti, i versori e il versore estrusione
|
||||
bool bOk = pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
|
||||
// porto in locale i punti
|
||||
Point3d ptIniL = GetPointLocal( pGeomDB, ptIni, nRefType, frLoc) ;
|
||||
Point3d ptCrossL = GetPointLocal( pGeomDB, ptCross, nRefType, frLoc) ;
|
||||
Point3d ptDirL = GetPointLocal( pGeomDB, ptDir, nRefType, frLoc) ;
|
||||
@@ -91,7 +150,7 @@ __stdcall EgtCreateSurfTmPyramid( int nParentId, const double ptIni[3], const do
|
||||
Frame3d frLoc ;
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
|
||||
return GDB_ID_NULL ;
|
||||
// porto in locale i punti, i versori e il versore estrusione
|
||||
// porto in locale i punti
|
||||
Point3d ptIniL = GetPointLocal( pGeomDB, ptIni, nRefType, frLoc) ;
|
||||
Point3d ptCrossL = GetPointLocal( pGeomDB, ptCross, nRefType, frLoc) ;
|
||||
Point3d ptDirL = GetPointLocal( pGeomDB, ptDir, nRefType, frLoc) ;
|
||||
@@ -690,7 +749,7 @@ EgtCreateSurfTmByTriangles( int nParentId, const INTVECTOR& vIds, bool bErase)
|
||||
string sLua = "EgtSurfTmByTriangles(" + ToString( nParentId) + ",{" +
|
||||
sIds + "}," +
|
||||
( bErase ? "true" : "false") + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
" -- Id=" + ToString( nNewId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco il risultato
|
||||
@@ -774,7 +833,7 @@ EgtCreateSurfTmBySewing( int nParentId, const INTVECTOR& vIds, bool bErase)
|
||||
string sLua = "EgtSurfTmBySewing(" + ToString( nParentId) + ",{" +
|
||||
sIds + "}," +
|
||||
( bErase ? "true" : "false") + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
" -- Id=" + ToString( nNewId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco il risultato
|
||||
|
||||
Reference in New Issue
Block a user