From 2ca704432a803bad5235e77baada360c0fa14df8 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Mon, 21 Sep 2015 10:40:39 +0000 Subject: [PATCH] EgtExecutor : - aggiunto text dimensioni a FlatParts. --- EXE_Nesting.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/EXE_Nesting.cpp b/EXE_Nesting.cpp index 33a64a5..2d8d035 100644 --- a/EXE_Nesting.cpp +++ b/EXE_Nesting.cpp @@ -20,6 +20,7 @@ #include "/EgtDev/Include/EGkCurveComposite.h" #include "/EgtDev/Include/EGkIntersCurves.h" #include "/EgtDev/Include/EGkSfrCreate.h" +#include "/EgtDev/Include/EGkExtText.h" #include "/EgtDev/Include/EGkGdbIterator.h" #include "/EgtDev/Include/EGkIntervals.h" #include "/EgtDev/Include/EgtPointerOwner.h" @@ -390,10 +391,30 @@ VerifyAndAdjustFlatParts( void) } // inserisco la superficie nel DB int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nRegId, pSfr) : GDB_ID_NULL) ; + bOk = bOk && nNewId != GDB_ID_NULL ; // assegno il colore Color cCol = AQUA ; cCol.SetAlpha( 0.3) ; bOk = bOk && pGeomDB->SetMaterial( nNewId, cCol) ; + // scrittura delle dimensioni nel layer della regione + if ( bOk) { + BBox3d b3Reg ; + pGeomDB->GetGlobalBBox( nNewId, b3Reg) ; + Point3d ptMin, ptMax ; + b3Reg.GetMinMax( ptMin, ptMax) ; + double dDimX = ptMax.x - ptMin.x ; + double dDimY = ptMax.y - ptMin.y ; + string sOut = ToString( ExeToUiUnits( dDimX), 2) + "x" + ToString( ExeToUiUnits( dDimY), 2) ; + Point3d ptCen = Media( ptMin, ptMax, 0.5) ; + Vector3d vtDir = ( dDimX >= dDimY ? X_AX : Y_AX) ; + double dDimT = min( 0.05 * max( dDimX, dDimY), 0.5 * min( dDimX, dDimY)) ; + PtrOwner pText( CreateExtText()) ; + if ( ! IsNull( pText) && + pText->Set( ptCen, Z_AX, vtDir, sOut, "", 100, false, dDimT, 1, 0, ETXT_IPMC)) { + int nTextId = pGeomDB->AddGeoObj( GDB_ID_NULL, nRegId, Release( pText)) ; + pGeomDB->SetMaterial( nTextId, BLACK) ; + } + } // taglio le curve aperte con la regione for ( int i = 0 ; bOk && i < int( vOpenIds.size()) ; ++i) { ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( vOpenIds[i])) ;