EgtExecutor 2.2a1 :
- aggiunte funzioni Exe e Lua CreateHorizontalDimension, CreateVerticalDimension e CreateAlignedDimension.
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
#include "/EgtDev/Include/EGkGeoPoint3d.h"
|
||||
#include "/EgtDev/Include/EGkGeoVector3d.h"
|
||||
#include "/EgtDev/Include/EGkExtText.h"
|
||||
#include "/EgtDev/Include/EGkExtDimension.h"
|
||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||
#include "/EgtDev/Include/EgtStringConverter.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
@@ -310,3 +311,122 @@ ExeCreateTextAdv( int nParentId, const Point3d& ptP, double dAngRotDeg,
|
||||
// restituisco l'identificativo del oggetto
|
||||
return nId ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
ExeCreateHorizontalDimension( int nParentId, const Point3d& ptP1, const Point3d& ptP2,
|
||||
const Point3d& ptDim, const string& sText, int nRefType)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
nParentId = AdjustId( nParentId) ;
|
||||
bool bOk = true ;
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
|
||||
// porto in locale i punti e assegno i versori
|
||||
Point3d ptP1L = GetPointLocal( pGeomDB, ptP1, nRefType, frLoc) ;
|
||||
Point3d ptP2L = GetPointLocal( pGeomDB, ptP2, nRefType, frLoc) ;
|
||||
Point3d ptDimL = GetPointLocal( pGeomDB, ptDim, nRefType, frLoc) ;
|
||||
Vector3d vtNL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ;
|
||||
Vector3d vtDL = GetVectorLocal( pGeomDB, X_AX, nRefType, frLoc) ;
|
||||
// creo la quota
|
||||
PtrOwner<IExtDimension> pDim( CreateExtDimension()) ;
|
||||
bOk = bOk && ! IsNull( pDim) ;
|
||||
bOk = bOk && pDim->SetLinear( ptP1L, ptP2L, ptDimL, vtNL, vtDL, sText) ;
|
||||
// inserisco la quota nel DB
|
||||
int nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pDim)) : GDB_ID_NULL) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtHorizontalDimension(" + IdToString( nParentId) + ",{" +
|
||||
ToString( ptP1) + "},{" +
|
||||
ToString( ptP2) + "},{" +
|
||||
ToString( ptDim) + "}," +
|
||||
StringToLuaString( sText) + "','" +
|
||||
RefTypeToString( nRefType) + ")" +
|
||||
" -- Id=" + ToString( nId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco l'identificativo del oggetto
|
||||
return nId ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
ExeCreateVerticalDimension( int nParentId, const Point3d& ptP1, const Point3d& ptP2,
|
||||
const Point3d& ptDim, const string& sText, int nRefType)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
nParentId = AdjustId( nParentId) ;
|
||||
bool bOk = true ;
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
|
||||
// porto in locale i punti e assegno i versori
|
||||
Point3d ptP1L = GetPointLocal( pGeomDB, ptP1, nRefType, frLoc) ;
|
||||
Point3d ptP2L = GetPointLocal( pGeomDB, ptP2, nRefType, frLoc) ;
|
||||
Point3d ptDimL = GetPointLocal( pGeomDB, ptDim, nRefType, frLoc) ;
|
||||
Vector3d vtNL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ;
|
||||
Vector3d vtDL = GetVectorLocal( pGeomDB, Y_AX, nRefType, frLoc) ;
|
||||
// creo la quota
|
||||
PtrOwner<IExtDimension> pDim( CreateExtDimension()) ;
|
||||
bOk = bOk && ! IsNull( pDim) ;
|
||||
bOk = bOk && pDim->SetLinear( ptP1L, ptP2L, ptDimL, vtNL, vtDL, sText) ;
|
||||
// inserisco la quota nel DB
|
||||
int nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pDim)) : GDB_ID_NULL) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtVerticalDimension(" + IdToString( nParentId) + ",{" +
|
||||
ToString( ptP1) + "},{" +
|
||||
ToString( ptP2) + "},{" +
|
||||
ToString( ptDim) + "}," +
|
||||
StringToLuaString( sText) + "','" +
|
||||
RefTypeToString( nRefType) + ")" +
|
||||
" -- Id=" + ToString( nId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco l'identificativo del oggetto
|
||||
return nId ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
ExeCreateAlignedDimension( int nParentId, const Point3d& ptP1, const Point3d& ptP2,
|
||||
const Point3d& ptDim, const string& sText, int nRefType)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
nParentId = AdjustId( nParentId) ;
|
||||
bool bOk = true ;
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
|
||||
// porto in locale i punti e assegno i versori
|
||||
Point3d ptP1L = GetPointLocal( pGeomDB, ptP1, nRefType, frLoc) ;
|
||||
Point3d ptP2L = GetPointLocal( pGeomDB, ptP2, nRefType, frLoc) ;
|
||||
Point3d ptDimL = GetPointLocal( pGeomDB, ptDim, nRefType, frLoc) ;
|
||||
Vector3d vtNL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ;
|
||||
// creo la quota
|
||||
PtrOwner<IExtDimension> pDim( CreateExtDimension()) ;
|
||||
bOk = bOk && ! IsNull( pDim) ;
|
||||
bOk = bOk && pDim->SetLinear( ptP1L, ptP2L, ptDimL, vtNL, V_NULL, sText) ;
|
||||
// inserisco la quota nel DB
|
||||
int nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pDim)) : GDB_ID_NULL) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtAlignedDimension(" + IdToString( nParentId) + ",{" +
|
||||
ToString( ptP1) + "},{" +
|
||||
ToString( ptP2) + "},{" +
|
||||
ToString( ptDim) + "}," +
|
||||
StringToLuaString( sText) + "','" +
|
||||
RefTypeToString( nRefType) + ")" +
|
||||
" -- Id=" + ToString( nId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco l'identificativo del oggetto
|
||||
return nId ;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user