Merge commit '029ed15541dcfec1cde901ab33ed4fe4d62f7e19' into feature/Svuotature
This commit is contained in:
+39
-21
@@ -1901,6 +1901,7 @@ Operation::CalculateClPathAxesValues( int nClPathId, int nLinAxes, int nRotAxes,
|
||||
Vector3d vtAuxPrec ;
|
||||
Vector3d vtCorrPrec ;
|
||||
DBLVECTOR vAxPrec ;
|
||||
int nFlag2Prec = 0 ;
|
||||
// ciclo su tutte le entità del percorso CL
|
||||
nOutStrC = 0 ;
|
||||
bool bOk = true ;
|
||||
@@ -1988,19 +1989,23 @@ Operation::CalculateClPathAxesValues( int nClPathId, int nLinAxes, int nRotAxes,
|
||||
int nMoveType = pCamData->GetMoveType() ;
|
||||
// se punto finale di linea
|
||||
if ( ! bFirst && pCamData->IsLine()) {
|
||||
// Verifica ricorsiva del punto medio
|
||||
bool bMidAdded ;
|
||||
bool bAxesError ;
|
||||
if ( ! VerifyLineMidPoint( ptPrec, vtDirPrec, vtAuxPrec, vtCorrPrec, vAxPrec,
|
||||
ptP, vtDir, vtAux, vtCorr, vAxVal,
|
||||
0, nEntId, dRot1W, nMoveType, bMidAdded, bAxesError)) {
|
||||
string sOut = "Error : VerifyLineMidPoint of CalculateClPathAxesValues failed (EntId=" + ToString( nEntId) + ")" ;
|
||||
LOG_ERROR( GetEMkLogger(), sOut.c_str())
|
||||
return false ;
|
||||
}
|
||||
if ( bAxesError) {
|
||||
bOk = false ;
|
||||
continue ;
|
||||
// Verifica ricorsiva del punto medio (se non già fatta)
|
||||
bool bMidAdded = false ;
|
||||
if ( nFlag2Prec == -1 || pCamData->GetFlag2() == -1)
|
||||
bMidAdded = true ;
|
||||
else {
|
||||
bool bAxesError ;
|
||||
if ( ! VerifyLineMidPoint( ptPrec, vtDirPrec, vtAuxPrec, vtCorrPrec, vAxPrec,
|
||||
ptP, vtDir, vtAux, vtCorr, vAxVal,
|
||||
1, nEntId, dRot1W, nMoveType, bMidAdded, bAxesError)) {
|
||||
string sOut = "Error : VerifyLineMidPoint of CalculateClPathAxesValues failed (EntId=" + ToString( nEntId) + ")" ;
|
||||
LOG_ERROR( GetEMkLogger(), sOut.c_str())
|
||||
return false ;
|
||||
}
|
||||
if ( bAxesError) {
|
||||
bOk = false ;
|
||||
continue ;
|
||||
}
|
||||
}
|
||||
// Se esistono aree protette, devo comunque verificare i punti intermedi
|
||||
if ( ! bMidAdded && m_pMchMgr->ExistProtectedAreas()) {
|
||||
@@ -2145,6 +2150,7 @@ Operation::CalculateClPathAxesValues( int nClPathId, int nLinAxes, int nRotAxes,
|
||||
vtCorrPrec = vtCorr ;
|
||||
vAxPrec = vAxVal ;
|
||||
vAxRotPrec = vAxRot ;
|
||||
nFlag2Prec = pCamData->GetFlag2() ;
|
||||
}
|
||||
|
||||
return bOk ;
|
||||
@@ -2316,7 +2322,7 @@ Operation::VerifyLineMidPoint( const Point3d& ptPrec, const Vector3d& vtDirPrec,
|
||||
return true ;
|
||||
|
||||
// se superato il limite di ricursioni, non devo fare alcunché
|
||||
const int MAX_RECURSION = 6 ;
|
||||
const int MAX_RECURSION = 8 ;
|
||||
if ( nCnt > MAX_RECURSION)
|
||||
return true ;
|
||||
|
||||
@@ -2379,16 +2385,27 @@ Operation::VerifyLineMidPoint( const Point3d& ptPrec, const Vector3d& vtDirPrec,
|
||||
vtCorrMid.ToGlob( refMid) ;
|
||||
}
|
||||
}
|
||||
// inserisco nuova entità e modifico vecchia
|
||||
int nMidEntId = m_pGeomDB->Copy( nEntId, GDB_ID_NULL, nEntId, GDB_BEFORE) ;
|
||||
// inserisco nuova entità punto (per evitare problemi di lunghezza linea)
|
||||
// creo oggetto punto per DB geometrico
|
||||
PtrOwner<IGeoPoint3d> pGP( CreateGeoPoint3d()) ;
|
||||
if ( IsNull( pGP))
|
||||
return false ;
|
||||
// assegno le coordinate del punto
|
||||
pGP->Set( ptP) ;
|
||||
// inserisco l'oggetto nel DB geometrico
|
||||
int nMidEntId = m_pGeomDB->InsertGeoObj( GDB_ID_NULL, nEntId, GDB_BEFORE, Release( pGP)) ;
|
||||
if ( nMidEntId == GDB_ID_NULL)
|
||||
return false ;
|
||||
ICurve* pCurve = GetCurve( m_pGeomDB->GetGeoObj( nEntId)) ;
|
||||
if ( pCurve == nullptr || ! pCurve->ModifyStart( ptMid))
|
||||
// creo oggetto dati Cam
|
||||
const CamData* pEntCam = GetCamData( m_pGeomDB->GetUserObj( nEntId)) ;
|
||||
if ( pEntCam == nullptr)
|
||||
return false ;
|
||||
ICurve* pMidCurve = GetCurve( m_pGeomDB->GetGeoObj( nMidEntId)) ;
|
||||
if ( pMidCurve == nullptr || ! pMidCurve->ModifyEnd( ptMid))
|
||||
PtrOwner<CamData> pCam( pEntCam->Clone()) ;
|
||||
if ( IsNull( pCam))
|
||||
return false ;
|
||||
// associo questo oggetto a quello geometrico
|
||||
m_pGeomDB->SetUserObj( nMidEntId, Release( pCam)) ;
|
||||
// assegno valori
|
||||
CamData* pMidCamData = GetCamData( m_pGeomDB->GetUserObj( nMidEntId)) ;
|
||||
if ( pMidCamData == nullptr)
|
||||
return false ;
|
||||
@@ -2397,6 +2414,7 @@ Operation::VerifyLineMidPoint( const Point3d& ptPrec, const Vector3d& vtDirPrec,
|
||||
pMidCamData->SetAuxDir( vtAuxMid) ;
|
||||
pMidCamData->SetCorrDir( vtCorrMid) ;
|
||||
pMidCamData->SetFlag2( -1) ;
|
||||
pMidCamData->SetToolShow( nCnt < 4) ;
|
||||
// calcolo gli assi rotanti per il punto medio
|
||||
DBLVECTOR vAxRotHome( int( vAxVal.size() - 3)) ;
|
||||
DBLVECTOR vAxRotPrec( int( vAxVal.size() - 3)) ;
|
||||
@@ -2435,7 +2453,7 @@ Operation::VerifyLineMidPoint( const Point3d& ptPrec, const Vector3d& vtDirPrec,
|
||||
pMidCamData->SetBackAuxDir( vtBackAux) ;
|
||||
|
||||
// devo verificare le due nuove parti
|
||||
nCnt ++ ;
|
||||
++ nCnt ;
|
||||
bool bAdded1, bAxError1, bAdded2, bAxError2 ;
|
||||
if ( ! VerifyLineMidPoint( ptPrec, vtDirPrec, vtAuxPrec, vtCorrPrec, vAxPrec,
|
||||
ptMid, vtDirMid, vtAuxMid, vtCorrMid, vAxMid,
|
||||
|
||||
Reference in New Issue
Block a user