c935ebbf35
- introdotte prime funzioni Exe e Lua per solidi Zmap.
68 lines
2.8 KiB
C++
68 lines
2.8 KiB
C++
//----------------------------------------------------------------------------
|
|
// EgalTech 2016-2016
|
|
//----------------------------------------------------------------------------
|
|
// File : EXE_GdbCreateVol.cpp Data : 27.10.16 Versione : 1.6v7
|
|
// Contenuto : Funzioni di creazione solidi del DB geometrico per EXE.
|
|
//
|
|
//
|
|
//
|
|
// Modifiche : 27.10.16 DS Creazione modulo.
|
|
//
|
|
//
|
|
//----------------------------------------------------------------------------
|
|
|
|
//--------------------------- Include ----------------------------------------
|
|
#include "stdafx.h"
|
|
#include "EXE.h"
|
|
#include "EXE_Macro.h"
|
|
#include "AuxTools.h"
|
|
#include "GeoTools.h"
|
|
#include "/EgtDev/Include/EXeExecutor.h"
|
|
#include "/EgtDev/Include/EGkVolZmap.h"
|
|
#include "/EgtDev/Include/EgkStringUtils3d.h"
|
|
#include "/EgtDev/Include/EgtPointerOwner.h"
|
|
|
|
using namespace std ;
|
|
|
|
//-------------------------------------------------------------------------------
|
|
int
|
|
ExeCreateVolZmap( int nParentId, const Point3d& ptIni, double dDimX, double dDimY, double dDimZ,
|
|
double dPrec, int nRefType)
|
|
{
|
|
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
|
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
|
nParentId = AdjustId( nParentId) ;
|
|
// recupero il riferimento locale
|
|
Frame3d frLoc ;
|
|
bool bOk = pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
|
|
// porto in locale i punti
|
|
Point3d ptIniL = GetPointLocal( pGeomDB, ptIni, nRefType, frLoc) ;
|
|
Point3d ptOnXL = GetPointLocal( pGeomDB, ptIni + X_AX, nRefType, frLoc) ;
|
|
Point3d ptOnYL = GetPointLocal( pGeomDB, ptIni + Y_AX, nRefType, frLoc) ;
|
|
// ne ricavo un riferimento intrinseco
|
|
Frame3d frBox ;
|
|
bOk = bOk && frBox.Set( ptIniL, ptOnXL, ptOnYL) ;
|
|
// creo lo Zmap nel suo riferimento intrinseco
|
|
PtrOwner<IVolZmap> pVZM( CreateVolZmap()) ;
|
|
bOk = bOk && ! IsNull( pVZM) ;
|
|
bOk = bOk && pVZM->CreateMap( ORIG, dDimX, dDimY, dDimZ, dPrec) ;
|
|
// lo porto nel riferimento locale
|
|
bOk = bOk && pVZM->ToGlob( frBox) ;
|
|
// inserisco lo Zmap nel DB
|
|
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pVZM)) : GDB_ID_NULL) ;
|
|
ExeSetModified() ;
|
|
// se richiesto, salvo il comando Lua equivalente
|
|
if ( IsCmdLog()) {
|
|
string sLua = "EgtVolZmapBox(" + IdToString( nParentId) + ",{" +
|
|
ToString( ptIni) + "}," +
|
|
ToString( dDimX) + "," +
|
|
ToString( dDimY) + "," +
|
|
ToString( dDimZ) + "," +
|
|
ToString( dPrec) + "," +
|
|
RefTypeToString( nRefType) + ")" +
|
|
" -- Id=" + ToString( nNewId) ;
|
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
|
}
|
|
// restituisco l'identificativo della nuova entità
|
|
return nNewId ;
|
|
} |