EgtMachKernel :

- corretta gestione inserimento/cancellazione punti intermedi aggiunti per cambio direzione utensile.
This commit is contained in:
Dario Sassi
2025-04-23 12:20:03 +02:00
parent fc03d2f737
commit 34e96d1f06
2 changed files with 44 additions and 17 deletions
+27
View File
@@ -1870,11 +1870,17 @@ Operation::CalculateClPathCenterAxesValues( int nClPathId, int nLinAxes, int nRo
const DBLVECTOR& vAxRotHome, DBLVECTOR& vAxRotPrec)
{
DBLVECTOR vAxRotPrecOri = vAxRotPrec ;
// cancello eventuali punti aggiunti
EraseAddedPoints( nClPathId) ;
// calcolo
int nOutStrC = 0 ;
if ( ! CalculateClPathAxesValues( nClPathId, nLinAxes, nRotAxes, dRot1W, bMaxDeltaR2OnFirst,
bRotContOnNext, dAngDeltaMinForHome, vAxRotHome, vAxRotPrec, nOutStrC)) {
// se attivata scelta angolo iniziale vicino ad home ed extra corsa C, provo a rifarlo disattivando
if ( dAngDeltaMinForHome < ANG_FULL && nOutStrC != 0) {
// cancello eventuali punti aggiunti
EraseAddedPoints( nClPathId) ;
// ricalcolo
m_pMchMgr->GetCurrMachine()->ResetOutstrokeInfo() ;
if ( CalculateClPathAxesValues( nClPathId, nLinAxes, nRotAxes, dRot1W, bMaxDeltaR2OnFirst,
bRotContOnNext, INFINITO, vAxRotHome, vAxRotPrec, nOutStrC))
@@ -1882,6 +1888,9 @@ Operation::CalculateClPathCenterAxesValues( int nClPathId, int nLinAxes, int nRo
}
// se extracorsa dell'asse C, provo a precaricarlo al contrario
if ( nOutStrC != 0) {
// cancello eventuali punti aggiunti
EraseAddedPoints( nClPathId) ;
// ricalcolo
vAxRotPrec = vAxRotPrecOri ;
vAxRotPrec[0] = vAxRotPrecOri[0] + ( nOutStrC > 0 ? - ANG_FULL : ANG_FULL) ;
m_pMchMgr->GetCurrMachine()->ResetOutstrokeInfo() ;
@@ -1895,6 +1904,24 @@ Operation::CalculateClPathCenterAxesValues( int nClPathId, int nLinAxes, int nRo
return true ;
}
//----------------------------------------------------------------------------
bool
Operation::EraseAddedPoints( int nClPathId)
{
int nEntId = m_pGeomDB->GetFirstInGroup( nClPathId) ;
while ( nEntId != GDB_ID_NULL) {
// salvo successivo
int nNextId = m_pGeomDB->GetNext( nEntId) ;
// recupero i dati Cam dell'entità
CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nEntId)) ;
// se punto aggiunto, lo elimino
if ( pCamData != nullptr && pCamData->GetFlag2() == -1)
m_pGeomDB->Erase( nEntId) ;
nEntId = nNextId ;
}
return true ;
}
//----------------------------------------------------------------------------
bool
Operation::CalculateClPathAxesValues( int nClPathId, int nLinAxes, int nRotAxes, double dRot1W,