EgtExecutor :

- migliorie a ExePackPartCluster.
This commit is contained in:
Dario Sassi
2016-02-23 08:47:38 +00:00
parent 3bfb359101
commit 39a388e148
+7 -4
View File
@@ -511,9 +511,11 @@ ExePackPartCluster( const INTVECTOR& vIds, bool bReducedCut, bool bBottomUp)
// Calcolo il box di ingombro della regione valida
int nBoxId = pGeomDB->GetFirstNameInGroup( nGroupId, NST_SHEET_OUTREG) ;
BBox3d b3Box ;
if ( ! pGeomDB->GetGlobalBBox( nGroupId, b3Box))
if ( ! pGeomDB->GetGlobalBBox( nBoxId, b3Box))
return false ;
b3Box.Expand( - SPESS, - SPESS, 0) ;
if ( b3Box.IsEmpty())
return false ;
// Flag per calcolo box
const int BBF_PART_MY_FLAG = BBF_ONLY_VISIBLE | BBF_IGNORE_TEXT | BBF_IGNORE_DIM ;
@@ -536,16 +538,17 @@ ExePackPartCluster( const INTVECTOR& vIds, bool bReducedCut, bool bBottomUp)
// Procedo per tentativi
const double STEP = 50 ;
bool bFit = false ;
Point3d ptOrig = b3Cluster.GetMin() ;
Point3d ptOrig = b3RegCluster.GetMin() ;
Point3d ptLineStart = ( bBottomUp ? b3Box.GetMin() : b3Box.GetMax() - Vector3d(0, -dRegClDimY, 0)) ;
Point3d ptIns = ptLineStart ;
while ( true) {
// porto nella posizione di prova
Vector3d vtMove = ptIns - b3Cluster.GetMin() ;
Vector3d vtMove = ptIns - b3RegCluster.GetMin() ;
vtMove.z = 0 ;
for ( auto nId : vTrueIds)
pGeomDB->TranslateGlob( nId, vtMove) ;
b3Cluster.Translate( vtMove) ;
b3RegCluster.Translate( vtMove) ;
// verifico
if ( MyVerifyPartCluster( pGeomDB, vTrueIds, b3Cluster, bReducedCut)) {
bFit = true ;
@@ -565,7 +568,7 @@ ExePackPartCluster( const INTVECTOR& vIds, bool bReducedCut, bool bBottomUp)
// Se inserimento non riuscito
if ( ! bFit) {
// riporto nella posizione originale
Vector3d vtMove = ptOrig - b3Cluster.GetMin() ;
Vector3d vtMove = ptOrig - b3RegCluster.GetMin() ;
for ( auto nId : vTrueIds)
pGeomDB->TranslateGlob( nId, vtMove) ;
return false ;