RgtMachKernel :

- resa funzionante GetToolPreviewStepCount.
This commit is contained in:
Dario Sassi
2024-05-31 07:58:27 +02:00
parent 719bb994bd
commit 9c73479441
2 changed files with 62 additions and 6 deletions
+52 -5
View File
@@ -178,7 +178,36 @@ Machining::RemoveToolPreview( void) const
int
Machining::GetToolPreviewStepCount( void) const
{
return -1 ;
// verifico validità gestori DB geometrico e CAM
if ( m_pGeomDB == nullptr || m_pMchMgr == nullptr)
return 0 ;
// recupero gruppo per geometria di lavorazione (Cutter Location)
int nClId = m_pGeomDB->GetFirstNameInGroup( GetOwner(), MCH_CL) ;
if ( nClId == GDB_ID_NULL)
return 0 ;
// determino il numero di entità di tutti i sottogruppi, escludendo CLIMB e RISE
int nCount = 0 ;
int nPxId = m_pGeomDB->GetFirstGroupInGroup( nClId) ;
while ( nPxId != GDB_ID_NULL) {
// aggiungo tutte le entità del truppo
nCount += m_pGeomDB->GetGroupObjs( nPxId) ;
// tolgo le entità CLIMB
int nClimbId = m_pGeomDB->GetFirstNameInGroup( nPxId, MCH_CL_CLIMB) ;
while ( nClimbId != GDB_ID_NULL) {
-- nCount ;
nClimbId = m_pGeomDB->GetNextName( nClimbId, MCH_CL_CLIMB) ;
}
// tolgo le entità RISE
int nRiseId = m_pGeomDB->GetFirstNameInGroup( nPxId, MCH_CL_RISE) ;
while ( nRiseId != GDB_ID_NULL) {
-- nCount ;
nRiseId = m_pGeomDB->GetNextName( nRiseId, MCH_CL_RISE) ;
}
// passo al successivo sottogruppo
nPxId = m_pGeomDB->GetNextGroup( nPxId) ;
}
return nCount ;
}
//----------------------------------------------------------------------------
@@ -270,11 +299,29 @@ Machining::ToolPreview( int nEntId, int nStep) const
nParentId = m_pGeomDB->GetParentId( nEntId) ;
if ( m_pGeomDB->GetParentId( nParentId) == nClId) {
// se richiesta successiva
if ( nStep > 0)
nEntId = GetToolPreviewNext( m_pGeomDB, nEntId, nParentId) ;
if ( nStep > 0) {
while ( nStep > 0) {
int nOldId = nEntId ;
nEntId = GetToolPreviewNext( m_pGeomDB, nEntId, nParentId) ;
-- nStep ;
if ( nEntId == GDB_ID_NULL) {
nEntId = nOldId ;
break ;
}
}
}
// se richiesta precedente
else if ( nStep < 0)
nEntId = GetToolPreviewPrev( m_pGeomDB, nEntId, nParentId) ;
else if ( nStep < 0) {
while ( nStep < 0) {
int nOldId = nEntId ;
nEntId = GetToolPreviewPrev( m_pGeomDB, nEntId, nParentId) ;
++ nStep ;
if ( nEntId == GDB_ID_NULL) {
nEntId = nOldId ;
break ;
}
}
}
}
else
nEntId = GDB_ID_NULL ;