EgtExecutor :
- modifiche per nesting pezzi piani con bordi a doppia pendenza.
This commit is contained in:
@@ -1220,6 +1220,7 @@ GetFlatPartFromRegion( IGeomDB* pGeomDB, int nId)
|
||||
string sName ;
|
||||
if ( ! pGeomDB->GetName( nLayerId, sName) &&
|
||||
! EqualNoCase( sName, NST_PARTREG_LAYER) &&
|
||||
! EqualNoCase( sName, NST_PARTUPREG_LAYER) &&
|
||||
! EqualNoCase( sName, NST_PARTDOWNREG_LAYER))
|
||||
return GDB_ID_NULL ;
|
||||
// restituisco il padre del layer
|
||||
|
||||
+46
-17
@@ -194,45 +194,71 @@ ExeVerifyMachining( int nMchId, int& nResult)
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static bool
|
||||
GetExtraCut( int nMchId, double& dExtraCut)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
|
||||
// recupero gruppo preview lavorazioni nella lavorazione
|
||||
int nPVGrp = pGeomDB->GetFirstNameInGroup( nMchId, MCH_PV) ;
|
||||
if ( nPVGrp == GDB_ID_NULL)
|
||||
return false ;
|
||||
// se vuoto, cerco il rimando al preview nel pezzo
|
||||
if ( pGeomDB->GetGroupObjs( nPVGrp) == 0 &&
|
||||
! pGeomDB->GetInfo( nPVGrp, MCH_PV_KEY_RELOCATE, nPVGrp))
|
||||
return false ;
|
||||
// recupero il primo percorso utensile (CL)
|
||||
int nClId = pGeomDB->GetFirstGroupInGroup( nPVGrp) ;
|
||||
return pGeomDB->GetInfo( nClId, MCH_PV_KEY_EC, dExtraCut) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
ExeVerifyCutAsSplitting( int nMchId)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_MACHMGR( pGseCtx, CAR_INTERF)
|
||||
IMachMgr* pMachMgr = pGseCtx->m_pMachMgr ;
|
||||
|
||||
// verifico che la lavorazione indicata sia veramente un taglio con lama
|
||||
if ( pGseCtx->m_pMachMgr->GetOperationType( nMchId) != OPER_SAWING)
|
||||
if ( pMachMgr->GetOperationType( nMchId) != OPER_SAWING)
|
||||
return CAR_INTERF ;
|
||||
|
||||
// determino se passante (solo se preview già calcolato)
|
||||
double dExtraCut = 0 ;
|
||||
if ( GetExtraCut( nMchId, dExtraCut) && dExtraCut < EPS_SMALL)
|
||||
return CAR_INTERF ;
|
||||
|
||||
// recupero la lavorazione corrente
|
||||
int nCurrMch = pGseCtx->m_pMachMgr->GetCurrMachining() ;
|
||||
// imposto la nuova lavorazione corrente
|
||||
pGseCtx->m_pMachMgr->SetCurrMachining( nMchId) ;
|
||||
// determino se ha preview
|
||||
bool bIsPV = pGseCtx->m_pMachMgr->ExistsMachiningPreview() ;
|
||||
pMachMgr->SetCurrMachining( nMchId) ;
|
||||
// determino se ha preview nella lavorazione
|
||||
bool bIsPV = pMachMgr->ExistsMachiningPreview() ;
|
||||
// risultato
|
||||
int nResult = CAR_INTERF ;
|
||||
// recupero attacco e uscita correnti della lavorazione
|
||||
int nLiType ;
|
||||
pGseCtx->m_pMachMgr->GetMachiningParam( MPA_LEADINTYPE, nLiType) ;
|
||||
pMachMgr->GetMachiningParam( MPA_LEADINTYPE, nLiType) ;
|
||||
int nLoType ;
|
||||
pGseCtx->m_pMachMgr->GetMachiningParam( MPA_LEADOUTTYPE, nLoType) ;
|
||||
pMachMgr->GetMachiningParam( MPA_LEADOUTTYPE, nLoType) ;
|
||||
// verifico se posso portare attacco al bordo grezzo
|
||||
bool bLiToModif = ( nLiType != SAW_LI_EXT_CENT && nLiType != SAW_LI_EXT_OUT) ;
|
||||
if ( bLiToModif) {
|
||||
// cambio attacco
|
||||
pGseCtx->m_pMachMgr->SetMachiningParam( MPA_LEADINTYPE, SAW_LI_EXT_CENT) ;
|
||||
pMachMgr->SetMachiningParam( MPA_LEADINTYPE, SAW_LI_EXT_CENT) ;
|
||||
// aggiorno preview
|
||||
pGseCtx->m_pMachMgr->MachiningPreview( true) ;
|
||||
pMachMgr->MachiningPreview( true) ;
|
||||
// verifico interferenza
|
||||
int nRes ;
|
||||
if ( ExeVerifyMachining( nMchId, nRes) && nRes == FMI_NONE)
|
||||
nResult += CAR_LI_OK ;
|
||||
// ripristino attacco originale
|
||||
pGseCtx->m_pMachMgr->SetMachiningParam( MPA_LEADINTYPE, nLiType) ;
|
||||
pMachMgr->SetMachiningParam( MPA_LEADINTYPE, nLiType) ;
|
||||
// ripristino preview originale
|
||||
pGseCtx->m_pMachMgr->MachiningPreview( true) ;
|
||||
pMachMgr->MachiningPreview( true) ;
|
||||
}
|
||||
// altrimenti verifico con già al bordo grezzo
|
||||
else {
|
||||
@@ -244,17 +270,17 @@ ExeVerifyCutAsSplitting( int nMchId)
|
||||
// verifico se posso portare uscita al bordo grezzo
|
||||
bool bLoToModif = ( nLoType != SAW_LO_EXT_CENT && nLoType != SAW_LO_EXT_OUT) ;
|
||||
if ( bLoToModif) {
|
||||
pGseCtx->m_pMachMgr->SetMachiningParam( MPA_LEADOUTTYPE, SAW_LO_EXT_CENT) ;
|
||||
pMachMgr->SetMachiningParam( MPA_LEADOUTTYPE, SAW_LO_EXT_CENT) ;
|
||||
// aggiorno preview
|
||||
pGseCtx->m_pMachMgr->MachiningPreview( true) ;
|
||||
pMachMgr->MachiningPreview( true) ;
|
||||
// verifico interferenza
|
||||
int nRes ;
|
||||
if ( ExeVerifyMachining( nMchId, nRes) && nRes == FMI_NONE)
|
||||
nResult += CAR_LO_OK ;
|
||||
// ripristino uscita originale
|
||||
pGseCtx->m_pMachMgr->SetMachiningParam( MPA_LEADOUTTYPE, nLoType) ;
|
||||
pMachMgr->SetMachiningParam( MPA_LEADOUTTYPE, nLoType) ;
|
||||
// ripristino preview originale
|
||||
pGseCtx->m_pMachMgr->MachiningPreview( true) ;
|
||||
pMachMgr->MachiningPreview( true) ;
|
||||
}
|
||||
// altrimenti verifico con già al bordo grezzo
|
||||
else {
|
||||
@@ -263,11 +289,14 @@ ExeVerifyCutAsSplitting( int nMchId)
|
||||
if ( ExeVerifyMachining( nMchId, nRes) && nRes == FMI_NONE)
|
||||
nResult += CAR_LO_OK ;
|
||||
}
|
||||
// se non c'era preview, lo cancello
|
||||
// verifico se taglio non passante
|
||||
if ( ! GetExtraCut( nMchId, dExtraCut) || dExtraCut < EPS_SMALL)
|
||||
nResult = CAR_INTERF ;
|
||||
// se non c'era preview nella lavorazione, lo cancello
|
||||
if ( ! bIsPV)
|
||||
pGseCtx->m_pMachMgr->RemoveMachiningPreview() ;
|
||||
pMachMgr->RemoveMachiningPreview() ;
|
||||
// ripristino lavorazione corrente
|
||||
pGseCtx->m_pMachMgr->SetCurrMachining( nCurrMch) ;
|
||||
pMachMgr->SetCurrMachining( nCurrMch) ;
|
||||
|
||||
// restituisco il risultato
|
||||
return nResult ;
|
||||
|
||||
+38
-12
@@ -674,6 +674,7 @@ MyVerifyPartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, const BBox3d&
|
||||
|
||||
// Determino le regioni dei pezzi
|
||||
INTVECTOR vReg ;
|
||||
INTVECTOR vUpReg ;
|
||||
INTVECTOR vDwnReg ;
|
||||
INTVECTOR vCutReg ;
|
||||
INTVECTOR vDwnCutReg ;
|
||||
@@ -688,6 +689,9 @@ MyVerifyPartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, const BBox3d&
|
||||
}
|
||||
else
|
||||
return false ;
|
||||
// recupero eventuale regione in alto del pezzo
|
||||
int nUpRegId = GetFlatPartUpRegion( pGeomDB, nId) ;
|
||||
vUpReg.emplace_back( nUpRegId) ;
|
||||
// recupero eventuale regione in basso del pezzo
|
||||
int nDwnRegId = GetFlatPartDownRegion( pGeomDB, nId) ;
|
||||
vDwnReg.emplace_back( nDwnRegId) ;
|
||||
@@ -768,6 +772,7 @@ MyVerifyPartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, const BBox3d&
|
||||
|
||||
// Determino le regioni di tutti gli altri pezzi compresi nella regione di interesse
|
||||
INTVECTOR vOthReg ;
|
||||
INTVECTOR vOthUpReg ;
|
||||
INTVECTOR vOthDwnReg ;
|
||||
INTVECTOR vOthCutReg ;
|
||||
INTVECTOR vOthDwnCutReg ;
|
||||
@@ -783,6 +788,9 @@ MyVerifyPartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, const BBox3d&
|
||||
vOthReg.emplace_back( nRegId) ;
|
||||
else
|
||||
return false ;
|
||||
// recupero eventuale regione in alto del pezzo
|
||||
int nUpRegId = GetFlatPartUpRegion( pGeomDB, nId2) ;
|
||||
vOthUpReg.emplace_back( nUpRegId) ;
|
||||
// recupero eventuale regione in basso del pezzo
|
||||
int nDwnRegId = GetFlatPartDownRegion( pGeomDB, nId2) ;
|
||||
vOthDwnReg.emplace_back( nDwnRegId) ;
|
||||
@@ -798,15 +806,16 @@ MyVerifyPartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, const BBox3d&
|
||||
|
||||
// Eseguo verifiche
|
||||
// regioni dei pezzi
|
||||
for ( int nRegId : vReg) {
|
||||
// verifico con le regioni degli altri pezzi
|
||||
for ( size_t i = 0 ; i < vReg.size() ; ++ i) {
|
||||
// verifico con le regioni degli altri pezzi (sempre regioni standard)
|
||||
for ( int nOthRegId : vOthReg) {
|
||||
if ( ExeSurfFrChunkSimpleClassify( nRegId, 0, nOthRegId, 0) != REGC_OUT)
|
||||
if ( ExeSurfFrChunkSimpleClassify( vReg[i], 0, nOthRegId, 0) != REGC_OUT)
|
||||
return false ;
|
||||
}
|
||||
// e con le regioni dei tagli degli altri pezzi
|
||||
// e con le regioni dei tagli degli altri pezzi (se esistono le regioni up devo usarle)
|
||||
int nRegUpId = ((vUpReg[i] == GDB_ID_NULL) ? vReg[i] : vUpReg[i]) ;
|
||||
for ( int nOthCutRegId : vOthCutReg) {
|
||||
if ( ExeSurfFrChunkSimpleClassify( nRegId, 0, nOthCutRegId, 0) != REGC_OUT)
|
||||
if ( ExeSurfFrChunkSimpleClassify( nRegUpId, 0, nOthCutRegId, 0) != REGC_OUT)
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
@@ -834,8 +843,9 @@ MyVerifyPartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, const BBox3d&
|
||||
// regioni delle lavorazioni dei pezzi
|
||||
for ( int nCutRegId : vCutReg) {
|
||||
// le confronto con le regioni degli altri pezzi
|
||||
for ( int nOthRegId : vOthReg) {
|
||||
if ( ExeSurfFrChunkSimpleClassify( nCutRegId, 0, nOthRegId, 0) != REGC_OUT)
|
||||
for ( size_t j = 0 ; j < vOthReg.size() ; ++ j) {
|
||||
int nOthUpRegId = (( vOthUpReg[j] == GDB_ID_NULL) ? vOthReg[j] : vOthUpReg[j]) ;
|
||||
if ( ExeSurfFrChunkSimpleClassify( nCutRegId, 0, nOthUpRegId, 0) != REGC_OUT)
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
@@ -1247,6 +1257,7 @@ MyMovePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d b3Cluster
|
||||
|
||||
// Determino le regioni di tutti gli altri pezzi compresi nella regione di interesse
|
||||
INTVECTOR vOthReg ;
|
||||
INTVECTOR vOthUpReg ;
|
||||
INTVECTOR vOthDwnReg ;
|
||||
INTVECTOR vOthCutReg ;
|
||||
INTVECTOR vOthDwnCutReg ;
|
||||
@@ -1262,6 +1273,9 @@ MyMovePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d b3Cluster
|
||||
vOthReg.emplace_back( nRegId) ;
|
||||
else
|
||||
return false ;
|
||||
// recupero eventuale regione in alto del pezzo
|
||||
int nUpRegId = GetFlatPartUpRegion( pGeomDB, nId2) ;
|
||||
vOthUpReg.emplace_back( nUpRegId) ;
|
||||
// recupero eventuale regione in basso del pezzo
|
||||
int nDwnRegId = GetFlatPartDownRegion( pGeomDB, nId2) ;
|
||||
vOthDwnReg.emplace_back( nDwnRegId) ;
|
||||
@@ -1309,9 +1323,12 @@ MyMovePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d b3Cluster
|
||||
dPrevLen = UpdateCollId( dLen, dPrevLen, nRegId, nOthRegId, false, false, scInfoCurr) ;
|
||||
}
|
||||
// e con le regioni dei tagli degli altri pezzi
|
||||
// recupero regione in alto del pezzo
|
||||
int nUpRegId = GetFlatPartUpRegion( pGeomDB, nTrueId) ;
|
||||
int nTestRegId = (( nUpRegId == GDB_ID_NULL) ? nRegId : nUpRegId) ;
|
||||
for ( int nOthCutRegId : vOthCutReg) {
|
||||
MySurfFrMoveSimpleNoCollision( nRegId, nOthCutRegId, vtDir, dLen, scInfoCurr) ;
|
||||
dPrevLen = UpdateCollId( dLen, dPrevLen, nRegId, nOthCutRegId, false, true, scInfoCurr) ;
|
||||
MySurfFrMoveSimpleNoCollision( nTestRegId, nOthCutRegId, vtDir, dLen, scInfoCurr) ;
|
||||
dPrevLen = UpdateCollId( dLen, dPrevLen, nTestRegId, nOthCutRegId, false, true, scInfoCurr) ;
|
||||
}
|
||||
// -----------------------------------------
|
||||
// recupero regione in basso del pezzo
|
||||
@@ -1360,7 +1377,8 @@ MyMovePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d b3Cluster
|
||||
}
|
||||
// le confronto con le regioni degli altri pezzi
|
||||
for ( int nCrId : vCrId) {
|
||||
for ( int nOthRegId : vOthReg) {
|
||||
for ( size_t k = 0 ; k < vOthReg.size() ; ++ k) {
|
||||
int nOthRegId = ( vOthUpReg[k] == GDB_ID_NULL ? vOthReg[k] : vOthUpReg[k]) ;
|
||||
MySurfFrMoveSimpleNoCollision( nCrId, nOthRegId, vtDir, dLen, scInfoCurr) ;
|
||||
dPrevLen = UpdateCollId( dLen, dPrevLen, nCrId, nOthRegId, true, false, scInfoCurr) ;
|
||||
}
|
||||
@@ -1506,6 +1524,7 @@ MyRotatePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d& b3Clus
|
||||
|
||||
// Determino le regioni di tutti gli altri pezzi compresi nella regione di interesse
|
||||
INTVECTOR vOthReg ;
|
||||
INTVECTOR vOthUpReg ;
|
||||
INTVECTOR vOthDwnReg ;
|
||||
INTVECTOR vOthCutReg ;
|
||||
INTVECTOR vOthDwnCutReg ;
|
||||
@@ -1521,6 +1540,9 @@ MyRotatePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d& b3Clus
|
||||
vOthReg.emplace_back( nRegId) ;
|
||||
else
|
||||
return false ;
|
||||
// recupero eventuale regione in alto del pezzo
|
||||
int nUpRegId = GetFlatPartUpRegion( pGeomDB, nId2) ;
|
||||
vOthUpReg.emplace_back( nUpRegId) ;
|
||||
// recupero eventuale regione in basso del pezzo
|
||||
int nDwnRegId = GetFlatPartDownRegion( pGeomDB, nId2) ;
|
||||
vOthDwnReg.emplace_back( nDwnRegId) ;
|
||||
@@ -1560,8 +1582,11 @@ MyRotatePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d& b3Clus
|
||||
ExeSurfFrRotateSimpleNoCollision( nRegId, nOthRegId, ptCen, dAng, RTY_GLOB) ;
|
||||
}
|
||||
// e con le regioni dei tagli degli altri pezzi
|
||||
// recupero regione in alto del pezzo
|
||||
int nUpRegId = GetFlatPartUpRegion( pGeomDB, nTrueId) ;
|
||||
int nTestRegId = (( nUpRegId == GDB_ID_NULL) ? nRegId : nUpRegId) ;
|
||||
for ( int nOthCutRegId : vOthCutReg) {
|
||||
ExeSurfFrRotateSimpleNoCollision( nRegId, nOthCutRegId, ptCen, dAng, RTY_GLOB) ;
|
||||
ExeSurfFrRotateSimpleNoCollision( nTestRegId, nOthCutRegId, ptCen, dAng, RTY_GLOB) ;
|
||||
}
|
||||
// -----------------------------------------
|
||||
// recupero regione in basso del pezzo
|
||||
@@ -1604,7 +1629,8 @@ MyRotatePartCluster( IGeomDB* pGeomDB, const INTVECTOR& vTrueIds, BBox3d& b3Clus
|
||||
}
|
||||
// le confronto con le regioni degli altri pezzi
|
||||
for ( int nCrId : vCrId) {
|
||||
for ( int nOthRegId : vOthReg) {
|
||||
for ( size_t k = 0 ; k < vOthReg.size() ; ++ k) {
|
||||
int nOthRegId = ( vOthUpReg[k] == GDB_ID_NULL ? vOthReg[k] : vOthUpReg[k]) ;
|
||||
ExeSurfFrRotateSimpleNoCollision( nCrId, nOthRegId, ptCen, dAng, RTY_GLOB) ;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user