EgtExecutor 1.6o1 :

- in nesting aggiunta verifica interferenza con atgli inclinati.
This commit is contained in:
Dario Sassi
2016-03-12 18:21:54 +00:00
parent 2e254607d5
commit 4dfc24345f
6 changed files with 486 additions and 16 deletions
+183 -9
View File
@@ -354,7 +354,9 @@ MyVerifyPartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, const BBox3d&
// Determino le regioni dei pezzi
INTVECTOR vReg ;
INTVECTOR vDwnReg ;
INTVECTOR vCutReg ;
INTVECTOR vDwnCutReg ;
BBox3d b3RegCluster ;
for ( int nId : vTrueIds) {
// recupero regione del pezzo
@@ -366,9 +368,14 @@ MyVerifyPartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, const BBox3d&
}
else
return false ;
// recupero eventuale regione in basso del pezzo
int nDwnRegId = GetFlatPartDownRegion( pGeomDB, nId) ;
vDwnReg.emplace_back( nDwnRegId) ;
// recupero regioni dei tagli del pezzo
if ( ! GetFlatPartCutRegions( pGeomDB, nId, bReducedCut, vCutReg))
return false ;
// recupero regioni in basso dei tagli del pezzo
GetFlatPartDownCutRegions( pGeomDB, nId, bReducedCut, vDwnCutReg) ;
}
// Verifico se pezzi sotto la radice o pezzi in altro gruppo
@@ -388,6 +395,11 @@ MyVerifyPartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, const BBox3d&
if ( ExeSurfFrChunkSimpleClassify( nRegId, 0, nBoxId, 0) != REGC_OUT)
return false ;
}
for ( int nDwnRegId : vDwnReg) {
if ( nDwnRegId != GDB_ID_NULL &&
ExeSurfFrChunkSimpleClassify( nDwnRegId, 0, nBoxId, 0) != REGC_OUT)
return false ;
}
// Verifico con le eventuali aree danneggiate
// recupero le aree
@@ -404,10 +416,20 @@ MyVerifyPartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, const BBox3d&
return false ;
}
}
for ( int nDwnRegId : vDwnReg) {
if ( nDwnRegId != GDB_ID_NULL) {
for ( int nDmgRegId : vDmgReg) {
if ( ExeSurfFrChunkSimpleClassify( nDwnRegId, 0, nDmgRegId, 0) != REGC_OUT)
return false ;
}
}
}
// Determino le regioni di tutti gli altri pezzi compresi nella regione di interesse
INTVECTOR vOthReg ;
INTVECTOR vOthDwnReg ;
INTVECTOR vOthCutReg ;
INTVECTOR vOthDwnCutReg ;
int nId2 = ( bInRoot ? ExeGetFirstPart( true) : ExeGetFirstGroupInGroup( nGroupId)) ;
while ( nId2 != GDB_ID_NULL) {
if ( find( vTrueIds.begin(), vTrueIds.end(), nId2) == vTrueIds.end()) {
@@ -420,9 +442,14 @@ MyVerifyPartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, const BBox3d&
vOthReg.emplace_back( nRegId) ;
else
return false ;
// recupero eventuale regione in basso del pezzo
int nDwnRegId = GetFlatPartDownRegion( pGeomDB, nId2) ;
vOthDwnReg.emplace_back( nDwnRegId) ;
// recupero regioni dei tagli del pezzo
if ( ! GetFlatPartCutRegions( pGeomDB, nId2, bReducedCut, vOthCutReg))
return false ;
// recupero regioni in basso dei tagli del pezzo
GetFlatPartDownCutRegions( pGeomDB, nId2, bReducedCut, vOthDwnCutReg) ;
}
}
nId2 = ( bInRoot ? ExeGetNextPart( nId2, true) : ExeGetNextGroup( nId2)) ;
@@ -442,6 +469,27 @@ MyVerifyPartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, const BBox3d&
return false ;
}
}
// regioni sotto dei pezzi
for ( size_t i = 0 ; i < vDwnReg.size() ; ++ i) {
// verifico con le regioni sotto degli altri pezzi
for ( size_t j = 0 ; j < vOthDwnReg.size() ; ++ j) {
if ( vDwnReg[i] != GDB_ID_NULL || vOthDwnReg[j] != GDB_ID_NULL) {
int nDwnRegId = ( vDwnReg[i] != GDB_ID_NULL ? vDwnReg[i] : vReg[i]) ;
int nOthDwnRegId = ( vOthDwnReg[j] != GDB_ID_NULL ? vOthDwnReg[j] : vOthReg[j]) ;
if ( ExeSurfFrChunkSimpleClassify( nDwnRegId, 0, nOthDwnRegId, 0) != REGC_OUT)
return false ;
}
}
// e con le regioni sotto dei tagli degli altri pezzi
for ( size_t j = 0 ; j < vOthDwnCutReg.size() ; ++ j) {
if ( vDwnReg[i] != GDB_ID_NULL || vOthDwnCutReg[j] != GDB_ID_NULL) {
int nDwnRegId = ( vDwnReg[i] != GDB_ID_NULL ? vDwnReg[i] : vReg[i]) ;
int nOthDwnCutRegId = ( vOthDwnCutReg[j] != GDB_ID_NULL ? vOthDwnCutReg[j] : vOthCutReg[j]) ;
if ( ExeSurfFrChunkSimpleClassify( nDwnRegId, 0, nOthDwnCutRegId, 0) != REGC_OUT)
return false ;
}
}
}
// regioni delle lavorazioni dei pezzi
for ( int nCutRegId : vCutReg) {
// le confronto con le regioni degli altri pezzi
@@ -450,6 +498,18 @@ MyVerifyPartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, const BBox3d&
return false ;
}
}
// regioni sotto delle lavorazioni dei pezzi
for ( size_t i = 0 ; i < vDwnCutReg.size() ; ++ i) {
// le confronto con le regioni sotto degli altri pezzi
for ( size_t j = 0 ; j < vOthDwnReg.size() ; ++ j) {
if ( vDwnCutReg[i] != GDB_ID_NULL || vOthDwnReg[j] != GDB_ID_NULL) {
int nDwnCutRegId = ( vDwnCutReg[i] != GDB_ID_NULL ? vDwnCutReg[i] : vCutReg[i]) ;
int nOthDwnRegId = ( vOthDwnReg[j] != GDB_ID_NULL ? vOthDwnReg[j] : vOthReg[j]) ;
if ( ExeSurfFrChunkSimpleClassify( nDwnCutRegId, 0, nOthDwnRegId, 0) != REGC_OUT)
return false ;
}
}
}
return true ;
}
@@ -801,7 +861,9 @@ MyMovePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d b3Cluster
// Determino le regioni di tutti gli altri pezzi compresi nella regione di interesse
INTVECTOR vOthReg ;
INTVECTOR vOthDwnReg ;
INTVECTOR vOthCutReg ;
INTVECTOR vOthDwnCutReg ;
int nId2 = ( bInRoot ? ExeGetFirstPart( true) : ExeGetFirstGroupInGroup( nGroupId)) ;
while ( nId2 != GDB_ID_NULL) {
if ( find( vTrueIds.begin(), vTrueIds.end(), nId2) == vTrueIds.end()) {
@@ -814,9 +876,14 @@ MyMovePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d b3Cluster
vOthReg.emplace_back( nRegId) ;
else
return false ;
// recupero eventuale regione in basso del pezzo
int nDwnRegId = GetFlatPartDownRegion( pGeomDB, nId2) ;
vOthDwnReg.emplace_back( nDwnRegId) ;
// recupero regioni dei tagli del pezzo
if ( ! GetFlatPartCutRegions( pGeomDB, nId2, bReducedCut, vOthCutReg))
return false ;
// recupero regioni in basso dei tagli del pezzo
GetFlatPartDownCutRegions( pGeomDB, nId2, bReducedCut, vOthDwnCutReg) ;
}
}
nId2 = ( bInRoot ? ExeGetNextPart( nId2, true) : ExeGetNextGroup( nId2)) ;
@@ -828,14 +895,15 @@ MyMovePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d b3Cluster
double dPrevLen = dLen ;
Vector3d vtDir = ( dLen > EPS_SMALL ? vtMoveXY / dLen : V_NULL) ;
for ( auto nTrueId : vTrueIds) {
// info di collisione correnti
SCollInfo scInfoCurr ;
// -----------------------------------------
// recupero regione del pezzo
int nRegId = GetFlatPartRegion( pGeomDB, nTrueId) ;
if ( nRegId == GDB_ID_NULL) {
bOk = false ;
break ;
}
// info di collisione correnti
SCollInfo scInfoCurr ;
// la confronto con il box
MySurfFrMoveSimpleNoCollision( nRegId, nBoxId, vtDir, dLen, scInfoCurr) ;
dPrevLen = UpdateCollId( dLen, dPrevLen, nRegId, nBoxId, false, false, scInfoCurr) ;
@@ -854,6 +922,40 @@ MyMovePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d b3Cluster
MySurfFrMoveSimpleNoCollision( nRegId, nOthCutRegId, vtDir, dLen, scInfoCurr) ;
dPrevLen = UpdateCollId( dLen, dPrevLen, nRegId, nOthCutRegId, false, true, scInfoCurr) ;
}
// -----------------------------------------
// recupero regione in basso del pezzo
int nDwnRegId = GetFlatPartDownRegion( pGeomDB, nTrueId) ;
// la confronto con il box
if ( nDwnRegId != GDB_ID_NULL) {
MySurfFrMoveSimpleNoCollision( nDwnRegId, nBoxId, vtDir, dLen, scInfoCurr) ;
dPrevLen = UpdateCollId( dLen, dPrevLen, nDwnRegId, nBoxId, false, false, scInfoCurr) ;
}
// la confronto con le aree danneggiate
if ( nDwnRegId != GDB_ID_NULL) {
for ( int nDmgRegId : vDmgReg) {
MySurfFrMoveSimpleNoCollision( nDwnRegId, nDmgRegId, vtDir, dLen, scInfoCurr) ;
dPrevLen = UpdateCollId( dLen, dPrevLen, nDwnRegId, nDmgRegId, false, false, scInfoCurr) ;
}
}
// la confronto con le regioni in basso degli altri pezzi
for ( size_t j = 0 ; j < vOthDwnReg.size() ; ++ j) {
if ( nDwnRegId != GDB_ID_NULL || vOthDwnReg[j] != GDB_ID_NULL) {
int nTmpDwnRegId = ( nDwnRegId != GDB_ID_NULL ? nDwnRegId : nRegId) ;
int nOthDwnRegId = ( vOthDwnReg[j] != GDB_ID_NULL ? vOthDwnReg[j] : vOthReg[j]) ;
MySurfFrMoveSimpleNoCollision( nTmpDwnRegId, nOthDwnRegId, vtDir, dLen, scInfoCurr) ;
dPrevLen = UpdateCollId( dLen, dPrevLen, nTmpDwnRegId, nOthDwnRegId, false, false, scInfoCurr) ;
}
}
// e con le regioni in basso dei tagli degli altri pezzi
for ( size_t j = 0 ; j < vOthDwnCutReg.size() ; ++ j) {
if ( nDwnRegId != GDB_ID_NULL || vOthDwnCutReg[j] != GDB_ID_NULL) {
int nTmpDwnRegId = ( nDwnRegId != GDB_ID_NULL ? nDwnRegId : nRegId) ;
int nOthDwnCutRegId = ( vOthDwnCutReg[j] != GDB_ID_NULL ? vOthDwnCutReg[j] : vOthCutReg[j]) ;
MySurfFrMoveSimpleNoCollision( nTmpDwnRegId, nOthDwnCutRegId, vtDir, dLen, scInfoCurr) ;
dPrevLen = UpdateCollId( dLen, dPrevLen, nTmpDwnRegId, nOthDwnCutRegId, false, true, scInfoCurr) ;
}
}
// -----------------------------------------
// recupero regioni di lavorazione del pezzo
INTVECTOR vCrId ;
if ( ! GetFlatPartCutRegions( pGeomDB, nTrueId, bReducedCut, vCrId)) {
@@ -867,6 +969,24 @@ MyMovePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d b3Cluster
dPrevLen = UpdateCollId( dLen, dPrevLen, nCrId, nOthRegId, true, false, scInfoCurr) ;
}
}
// -----------------------------------------
// recupero regioni in basso di lavorazione del pezzo
INTVECTOR vDwnCrId ;
if ( ! GetFlatPartDownCutRegions( pGeomDB, nTrueId, bReducedCut, vDwnCrId)) {
bOk = false ;
break ;
}
// le confronto con le regioni in basso degli altri pezzi
for ( size_t j = 0 ; j < vDwnCrId.size() ; ++ j) {
for ( size_t k = 0 ; k < vOthDwnReg.size() ; ++ k) {
if ( vDwnCrId[j] != GDB_ID_NULL || vOthDwnReg[k] != GDB_ID_NULL) {
int nTmpDwnCrId = ( vDwnCrId[j] != GDB_ID_NULL ? vDwnCrId[j] : vCrId[j]) ;
int nOthDwnRegId = ( vOthDwnReg[k] != GDB_ID_NULL ? vOthDwnReg[k] : vOthReg[k]) ;
MySurfFrMoveSimpleNoCollision( nTmpDwnCrId, nOthDwnRegId, vtDir, dLen, scInfoCurr) ;
dPrevLen = UpdateCollId( dLen, dPrevLen, nTmpDwnCrId, nOthDwnRegId, true, false, scInfoCurr) ;
}
}
}
}
// Se errore
@@ -984,8 +1104,10 @@ MyRotatePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d& b3Clus
}
// Determino le regioni di tutti gli altri pezzi compresi nella regione di interesse
INTVECTOR vReg ;
INTVECTOR vCutReg ;
INTVECTOR vOthReg ;
INTVECTOR vOthDwnReg ;
INTVECTOR vOthCutReg ;
INTVECTOR vOthDwnCutReg ;
int nId2 = ( bInRoot ? ExeGetFirstPart( true) : ExeGetFirstGroupInGroup( nGroupId)) ;
while ( nId2 != GDB_ID_NULL) {
if ( find( vTrueIds.begin(), vTrueIds.end(), nId2) == vTrueIds.end()) {
@@ -995,12 +1117,17 @@ MyRotatePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d& b3Clus
// recupero regione del pezzo
int nRegId = GetFlatPartRegion( pGeomDB, nId2) ;
if ( nRegId != GDB_ID_NULL)
vReg.emplace_back( nRegId) ;
vOthReg.emplace_back( nRegId) ;
else
return false ;
// recupero eventuale regione in basso del pezzo
int nDwnRegId = GetFlatPartDownRegion( pGeomDB, nId2) ;
vOthDwnReg.emplace_back( nDwnRegId) ;
// recupero regioni dei tagli del pezzo
if ( ! GetFlatPartCutRegions( pGeomDB, nId2, bReducedCut, vCutReg))
if ( ! GetFlatPartCutRegions( pGeomDB, nId2, bReducedCut, vOthCutReg))
return false ;
// recupero eventuali regioni in basso dei tagli del pezzo
GetFlatPartDownCutRegions( pGeomDB, nId2, bReducedCut, vOthDwnCutReg) ;
}
}
nId2 = ( bInRoot ? ExeGetNextPart( nId2, true) : ExeGetNextGroup( nId2)) ;
@@ -1010,6 +1137,7 @@ MyRotatePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d& b3Clus
bool bOk = true ;
double dAng = dRotAngDeg ;
for ( auto nTrueId : vTrueIds) {
// -----------------------------------------
// recupero regione del pezzo
int nRegId = GetFlatPartRegion( pGeomDB, nTrueId) ;
if ( nRegId == GDB_ID_NULL) {
@@ -1023,13 +1151,42 @@ MyRotatePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d& b3Clus
ExeSurfFrRotateSimpleNoCollision( nRegId, nDmgRegId, ptCen, dAng, RTY_GLOB) ;
}
// la confronto con le regioni degli altri pezzi
for ( int nOthRegId : vReg) {
for ( int nOthRegId : vOthReg) {
ExeSurfFrRotateSimpleNoCollision( nRegId, nOthRegId, ptCen, dAng, RTY_GLOB) ;
}
// e con le regioni dei tagli degli altri pezzi
for ( int nOthCutRegId : vCutReg) {
for ( int nOthCutRegId : vOthCutReg) {
ExeSurfFrRotateSimpleNoCollision( nRegId, nOthCutRegId, ptCen, dAng, RTY_GLOB) ;
}
// -----------------------------------------
// recupero regione in basso del pezzo
int nDwnRegId = GetFlatPartDownRegion( pGeomDB, nTrueId) ;
// la confronto con il box
if ( nDwnRegId != GDB_ID_NULL)
ExeSurfFrRotateSimpleNoCollision( nDwnRegId, nBoxId, ptCen, dAng, RTY_GLOB) ;
// la confronto con le aree danneggiate
if ( nDwnRegId != GDB_ID_NULL) {
for ( int nDmgRegId : vDmgReg) {
ExeSurfFrRotateSimpleNoCollision( nDwnRegId, nDmgRegId, ptCen, dAng, RTY_GLOB) ;
}
}
// la confronto con le regioni in basso degli altri pezzi
for ( size_t j = 0 ; j < vOthDwnReg.size() ; ++ j) {
if ( nDwnRegId != GDB_ID_NULL || vOthDwnReg[j] != GDB_ID_NULL) {
int nTmpDwnRegId = ( nDwnRegId != GDB_ID_NULL ? nDwnRegId : nRegId) ;
int nOthDwnRegId = ( vOthDwnReg[j] != GDB_ID_NULL ? vOthDwnReg[j] : vOthReg[j]) ;
ExeSurfFrRotateSimpleNoCollision( nTmpDwnRegId, nOthDwnRegId, ptCen, dAng, RTY_GLOB) ;
}
}
// e con le regioni in basso dei tagli degli altri pezzi
for ( size_t j = 0 ; j < vOthDwnCutReg.size() ; ++ j) {
if ( nDwnRegId != GDB_ID_NULL || vOthDwnCutReg[j] != GDB_ID_NULL) {
int nTmpDwnRegId = ( nDwnRegId != GDB_ID_NULL ? nDwnRegId : nRegId) ;
int nOthDwnCutRegId = ( vOthDwnCutReg[j] != GDB_ID_NULL ? vOthDwnCutReg[j] : vOthCutReg[j]) ;
ExeSurfFrRotateSimpleNoCollision( nTmpDwnRegId, nOthDwnCutRegId, ptCen, dAng, RTY_GLOB) ;
}
}
// -----------------------------------------
// recupero regioni di lavorazione del pezzo
INTVECTOR vCrId ;
if ( ! GetFlatPartCutRegions( pGeomDB, nTrueId, bReducedCut, vCrId)) {
@@ -1038,10 +1195,27 @@ MyRotatePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d& b3Clus
}
// le confronto con le regioni degli altri pezzi
for ( int nCrId : vCrId) {
for ( int nOthRegId : vReg) {
for ( int nOthRegId : vOthReg) {
ExeSurfFrRotateSimpleNoCollision( nCrId, nOthRegId, ptCen, dAng, RTY_GLOB) ;
}
}
// -----------------------------------------
// recupero regioni in basso di lavorazione del pezzo
INTVECTOR vDwnCrId ;
if ( ! GetFlatPartDownCutRegions( pGeomDB, nTrueId, bReducedCut, vDwnCrId)) {
bOk = false ;
break ;
}
// le confronto con le regioni in basso degli altri pezzi
for ( size_t j = 0 ; j < vDwnCrId.size() ; ++ j) {
for ( size_t k = 0 ; k < vOthDwnReg.size() ; ++ k) {
if ( vDwnCrId[j] != GDB_ID_NULL || vOthDwnReg[k] != GDB_ID_NULL) {
int nTmpDwnCrId = ( vDwnCrId[j] != GDB_ID_NULL ? vDwnCrId[j] : vCrId[j]) ;
int nOthDwnRegId = ( vOthDwnReg[j] != GDB_ID_NULL ? vOthDwnReg[j] : vOthReg[j]) ;
ExeSurfFrRotateSimpleNoCollision( nTmpDwnCrId, nOthDwnRegId, ptCen, dAng, RTY_GLOB) ;
}
}
}
}
// Se errore