From 80b405a1e65b52491d8a4634a5e13ca38900dad3 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Mon, 30 Dec 2019 09:27:37 +0000 Subject: [PATCH] EgtExecutor 2.2a1 : - aggiunte funzioni Exe e Lua CreateHorizontalDimension, CreateVerticalDimension e CreateAlignedDimension. --- EXE_GdbCreate.cpp | 120 ++++++++++++++++++++++++++++++++++++++++++++++ EgtExecutor.rc | Bin 16184 -> 16176 bytes LUA_GdbCreate.cpp | 87 +++++++++++++++++++++++++++++++++ 3 files changed, 207 insertions(+) diff --git a/EXE_GdbCreate.cpp b/EXE_GdbCreate.cpp index 2380cfd..f3f6b90 100644 --- a/EXE_GdbCreate.cpp +++ b/EXE_GdbCreate.cpp @@ -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 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 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 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 ; +} diff --git a/EgtExecutor.rc b/EgtExecutor.rc index 6e11ee56e9ad8c0f06fd6da02e47c7cc65418561..f367abb250caf56ccdac41cc6f04d24fa4fde82e 100644 GIT binary patch delta 273 zcmdl{x1nysCpJza1|0@N5T1NdOq0=Q^KY@WOp~v0W-%KvBu-8gk(^w>DK@!)YX^{T zF!{gKA$vKwUAJUwHE5GG(YwHv6f( Gk^%r7H&5gM delta 267 zcmdl`x1(;uCpK