Files
EgtMachKernel/MachMgrOperations.cpp
T
Riccardo Elitropi 984f206d56 EgtMachKernel (NewLink) :
- primo commit per codice NewLink.
2026-03-13 17:28:21 +01:00

1379 lines
47 KiB
C++

//----------------------------------------------------------------------------
// EgalTech 2015-2015
//----------------------------------------------------------------------------
// File : MachMgrOperations.cpp Data : 21.05.15 Versione : 1.6e7
// Contenuto : Implementazione gestione operazioni della classe MachMgr.
//
//
//
// Modifiche : 16.04.15 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "DllMain.h"
#include "MachMgr.h"
#include "MachConst.h"
#include "Disposition.h"
#include "Machining.h"
#include "MachiningCreate.h"
#include "SetTempPhase.h"
#include "SetTempMachLook.h"
#include "/EgtDev/Include/EGkGdbIterator.h"
#include "/EgtDev/Include/EGnStringKeyVal.h"
#include "/EgtDev/Include/EGnFileUtils.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
using namespace std ;
//----------------------------------------------------------------------------
int
MachMgr::GetOperationCount( void) const
{
// recupero il gruppo delle operazioni nella macchinata corrente
int nOperGrpId = GetCurrOperId() ;
if ( nOperGrpId == GDB_ID_NULL)
return 0 ;
// ritorno numero di operazioni
return m_pGeomDB->GetGroupObjs( nOperGrpId) ;
}
//----------------------------------------------------------------------------
int
MachMgr::GetFirstOperation( void) const
{
// recupero il gruppo delle operazioni nella macchinata corrente
int nOperGrpId = GetCurrOperId() ;
if ( nOperGrpId == GDB_ID_NULL)
return GDB_ID_NULL ;
// recupero il primo sottogruppo
int nId = m_pGeomDB->GetFirstGroupInGroup( nOperGrpId) ;
return nId ;
}
//----------------------------------------------------------------------------
int
MachMgr::GetNextOperation( int nId) const
{
// recupero il gruppo delle operazioni nella macchinata corrente
int nOperGrpId = GetCurrOperId() ;
if ( nOperGrpId == GDB_ID_NULL)
return GDB_ID_NULL ;
// verifico che il gruppo ricevuto sia corretto
if ( m_pGeomDB->GetParentId( nId) != nOperGrpId)
return GDB_ID_NULL ;
// recupero il successivo sottogruppo
int nNextId = m_pGeomDB->GetNextGroup( nId) ;
return nNextId ;
}
//----------------------------------------------------------------------------
int
MachMgr::GetLastOperation( void) const
{
// recupero il gruppo delle operazioni nella macchinata corrente
int nOperGrpId = GetCurrOperId() ;
if ( nOperGrpId == GDB_ID_NULL)
return GDB_ID_NULL ;
// recupero l'ultimo sottogruppo
int nId = m_pGeomDB->GetLastGroupInGroup( nOperGrpId) ;
return nId ;
}
//----------------------------------------------------------------------------
int
MachMgr::GetPrevOperation( int nId) const
{
// recupero il gruppo delle operazioni nella macchinata corrente
int nOperGrpId = GetCurrOperId() ;
if ( nOperGrpId == GDB_ID_NULL)
return GDB_ID_NULL ;
// verifico che il gruppo ricevuto sia corretto
if ( m_pGeomDB->GetParentId( nId) != nOperGrpId)
return GDB_ID_NULL ;
// recupero il precedente sottogruppo
int nPrevId = m_pGeomDB->GetPrevGroup( nId) ;
return nPrevId ;
}
//----------------------------------------------------------------------------
int
MachMgr::GetFirstActiveOperation( bool bNeedMachNotEmpty) const
{
int nId = GetFirstOperation() ;
int nMode ;
while ( nId != GDB_ID_NULL &&
(( m_pGeomDB->GetCalcMode( nId, nMode) && nMode == GDB_MD_HIDDEN) ||
( bNeedMachNotEmpty && IsValidMachiningType( GetOperationType( nId)) && IsOperationEmpty( nId, NEED_ONE_TP_OK))))
nId = GetNextOperation( nId) ;
return nId ;
}
//----------------------------------------------------------------------------
int
MachMgr::GetNextActiveOperation( int nId, bool bNeedMachNotEmpty) const
{
int nNextId = GetNextOperation( nId) ;
int nMode ;
while ( nNextId != GDB_ID_NULL &&
(( m_pGeomDB->GetCalcMode( nNextId, nMode) && nMode == GDB_MD_HIDDEN) ||
( bNeedMachNotEmpty && IsValidMachiningType( GetOperationType( nNextId)) && IsOperationEmpty( nNextId, NEED_ONE_TP_OK))))
nNextId = GetNextOperation( nNextId) ;
return nNextId ;
}
//----------------------------------------------------------------------------
int
MachMgr::GetLastActiveOperation( bool bNeedMachNotEmpty) const
{
int nId = GetLastOperation() ;
int nMode ;
while ( nId != GDB_ID_NULL &&
(( m_pGeomDB->GetCalcMode( nId, nMode) && nMode == GDB_MD_HIDDEN) ||
( bNeedMachNotEmpty && IsValidMachiningType( GetOperationType( nId)) && IsOperationEmpty( nId, NEED_ONE_TP_OK))))
nId = GetPrevOperation( nId) ;
return nId ;
}
//----------------------------------------------------------------------------
int
MachMgr::GetPrevActiveOperation( int nId, bool bNeedMachNotEmpty) const
{
int nPrevId = GetPrevOperation( nId) ;
int nMode ;
while ( nPrevId != GDB_ID_NULL &&
(( m_pGeomDB->GetCalcMode( nPrevId, nMode) && nMode == GDB_MD_HIDDEN) ||
( bNeedMachNotEmpty && IsValidMachiningType( GetOperationType( nPrevId)) && IsOperationEmpty( nPrevId, NEED_ONE_TP_OK))))
nPrevId = GetPrevOperation( nPrevId) ;
return nPrevId ;
}
//----------------------------------------------------------------------------
int
MachMgr::GetOperationType( int nId) const
{
// verifiche
if ( m_pGeomDB == nullptr || m_pGeomDB->GetParentId( nId) != GetCurrOperId())
return 0 ;
// recupero l'operazione
const Operation* pOpe = GetOperation( m_pGeomDB->GetUserObj( nId)) ;
if ( pOpe == nullptr)
return OPER_NULL ;
// restituisco il tipo
return pOpe->GetType() ;
}
//----------------------------------------------------------------------------
int
MachMgr::GetOperationPhase( int nId) const
{
// verifiche
if ( m_pGeomDB == nullptr || m_pGeomDB->GetParentId( nId) != GetCurrOperId())
return 0 ;
// recupero operazione
const Operation* pOpe = GetOperation( m_pGeomDB->GetUserObj( nId)) ;
if ( pOpe == nullptr)
return 0 ;
// restituisco la fase
return pOpe->GetPhase() ;
}
//----------------------------------------------------------------------------
bool
MachMgr::GetOperationNewName( string& sName) const
{
// il gruppo per le operazioni deve essere presente nella macchinata corrente
if ( GetCurrOperId() == GDB_ID_NULL)
return false ;
// se nome vuoto, assegno radice standard
if ( ! IsValidVal( sName))
sName = "Oper" ;
// se presenti caratteri vietati, li sostituisco
ValidateVal( sName) ;
// verifico che il nome sia unico
int nCount = 0 ;
string sOrigName = sName ;
if ( sOrigName.length() > 2 && sOrigName.rfind( "_1") == sOrigName.length() - 2)
sOrigName.erase( sOrigName.length() - 2) ;
while ( GetOperationId( sName) != GDB_ID_NULL) {
++ nCount ;
sName = sOrigName + "_" + ToString( nCount) ;
}
return true ;
}
//----------------------------------------------------------------------------
bool
MachMgr::SetOperationName( int nId, const string& sName)
{
// recupero l'operazione
PtrOwner<IGdbIterator> pIter( CreateGdbIterator( m_pGeomDB)) ;
if ( IsNull( pIter) || ! pIter->GoTo( nId))
return false ;
// verifico che faccia parte del gruppo delle operazioni
if ( pIter->GetParentId() != GetCurrOperId())
return false ;
// verifico che il nome sia valido
if ( ! IsValidVal( sName))
return false ;
// verifico che il nome non sia già usato da una operazione
if ( GetOperationId( sName) != GDB_ID_NULL)
return false ;
// assegno il nome
return pIter->SetName( sName) ;
}
//----------------------------------------------------------------------------
string
MachMgr::GetOperationName( int nId) const
{
// recupero l'operazione
PtrOwner<IGdbIterator> pIter( CreateGdbIterator( m_pGeomDB)) ;
if ( IsNull( pIter) || ! pIter->GoTo( nId))
return "" ;
// verifico che faccia parte del gruppo delle operazioni
if ( pIter->GetParentId() != GetCurrOperId())
return "" ;
// recupero il nome dell'operazione riferita
string sName ;
pIter->GetName( sName) ;
return sName ;
}
//----------------------------------------------------------------------------
int
MachMgr::GetOperationId( const string& sName) const
{
// verifica dei parametri
if ( ! IsValidVal( sName))
return GDB_ID_NULL ;
// recupero l'identificativo dell'operazione con il nome indicato
PtrOwner<IGdbIterator> pIter( CreateGdbIterator( m_pGeomDB)) ;
if ( IsNull( pIter))
return GDB_ID_NULL ;
bool bIter = pIter->GoToFirstInGroup( GetCurrOperId()) ;
while ( bIter) {
// verifico il nome
string sOperName ;
if ( pIter->GetName( sOperName) && EqualNoCase( sOperName, sName))
return pIter->GetId() ;
// passo al successivo
bIter = pIter->GoToNext() ;
}
return GDB_ID_NULL ;
}
//----------------------------------------------------------------------------
bool
MachMgr::IsOperationEmpty( int nId, int nEmptyType) const
{
// verifiche
if ( m_pGeomDB == nullptr || m_pGeomDB->GetParentId( nId) != GetCurrOperId())
return true ;
// recupero operazione
const Operation* pOpe = GetOperation( m_pGeomDB->GetUserObj( nId)) ;
if ( pOpe == nullptr)
return true ;
// restituisco se vuota
return pOpe->IsEmpty( nEmptyType) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::InitOperation(int nId)
{
Operation* pOpe = GetOperation( m_pGeomDB->GetUserObj( nId)) ;
if ( pOpe == nullptr)
return false ;
return pOpe->Init( this) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::RemoveOperation( int nId)
{
// verifico sia una Operazione diversa da Disposizione
int nType = GetOperationType( nId) ;
if ( nType == OPER_NULL || nType == OPER_DISP)
return false ;
// verifico appartenga al gruppo delle operazioni della macchinata corrente
int nOperGrpId = GetCurrOperId() ;
if ( nOperGrpId == GDB_ID_NULL || m_pGeomDB->GetParentId( nId) != nOperGrpId)
return false ;
// garantisco l'inizializzazione dell'operazione
InitOperation( nId) ;
// se lavorazione corrente, resetto
if ( m_nCurrMachiningId == nId)
m_nCurrMachiningId = GDB_ID_NULL ;
// eseguo la rimozione
m_pGeomDB->Erase( nId) ;
return true ;
}
//----------------------------------------------------------------------------
bool
MachMgr::RemoveAllPhaseOperations( int nPhase)
{
// recupero la disposizione di inizio fase
int nDispId = GetPhaseDisposition( nPhase) ;
if ( nDispId == GDB_ID_NULL)
return true ;
// elimino tutte le operazioni successive della stessa fase
int nOperId = m_pGeomDB->GetNext( nDispId) ;
while ( nOperId != GDB_ID_NULL) {
int nNextOperId = m_pGeomDB->GetNext( nOperId) ;
if ( GetOperationPhase( nOperId) == nPhase) {
// garantisco l'inizializzazione dell'operazione
InitOperation( nOperId) ;
// se lavorazione corrente, resetto
if ( m_nCurrMachiningId == nOperId)
m_nCurrMachiningId = GDB_ID_NULL ;
// eseguo la rimozione
m_pGeomDB->Erase( nOperId) ;
}
else
break ;
nOperId = nNextOperId ;
}
return true ;
}
//----------------------------------------------------------------------------
bool
MachMgr::RemoveAllOperations( void)
{
// indice terminazione ciclo
int nStopId = GetFirstOperation() ;
// rimuovo tutte le operazioni a partire dalla fine
int nId = GetLastOperation() ;
while ( nId != GDB_ID_NULL && nId != nStopId) {
// garantisco l'inizializzazione dell'operazione
InitOperation( nId) ;
// se disposizione, elimino la fase
if ( GetOperationType( nId) == OPER_DISP)
RemoveLastPhase() ;
// altrimenti...
else {
// se lavorazione corrente, resetto
if ( m_nCurrMachiningId == nId)
m_nCurrMachiningId = GDB_ID_NULL ;
// eseguo la rimozione
m_pGeomDB->Erase( nId) ;
}
// recupero la nuova ultima (deve essere diversa dalla precedente)
int nPrevId = GetLastOperation() ;
if ( nPrevId == nId)
return false ;
nId = nPrevId ;
}
return true ;
}
//----------------------------------------------------------------------------
bool
MachMgr::SetOperationMode( int nId, bool bActive)
{
// verifico sia una Operazione
if ( GetOperationType( nId) == OPER_NULL)
return false ;
// recupero lo stato di attivazione corrente
int nMode ;
if ( ! m_pGeomDB->GetMode( nId, nMode))
return false ;
bool bPrevActive = ( nMode == GDB_MD_STD) ;
// eseguo attivazione/disattivazione
m_pGeomDB->SetMode( nId, ( bActive ? GDB_MD_STD : GDB_MD_HIDDEN)) ;
// se non cambia l'attivazione, esco
if ( bActive == bPrevActive)
return true ;
// dichiaro da aggiornare questa lavorazione
Operation* pOpe = GetOperation( m_pGeomDB->GetUserObj( nId)) ;
if ( pOpe != nullptr)
pOpe->UpdateStatus( MCH_ST_OTH_MODIF) ;
// da aggiornare post apply della precedente attiva
int nOpeId = GetPrevActiveOperation( nId) ;
if ( nOpeId != GDB_ID_NULL) {
Operation* pOpe = GetOperation( m_pGeomDB->GetUserObj( nOpeId)) ;
if ( pOpe != nullptr)
pOpe->UpdateStatus( MCH_ST_NO_POSTAPPL) ;
}
// forzo aggiornamento della successiva, le altre seguiranno automaticamente
nOpeId = GetNextActiveOperation( nId) ;
if ( nOpeId != GDB_ID_NULL) {
Operation* pOpe = GetOperation( m_pGeomDB->GetUserObj( nOpeId)) ;
if ( pOpe != nullptr)
pOpe->UpdateStatus( MCH_ST_OTH_MODIF) ;
}
return true ;
}
//----------------------------------------------------------------------------
bool
MachMgr::GetOperationMode( int nId, bool& bActive) const
{
// verifico sia una Operazione
if ( GetOperationType( nId) == OPER_NULL)
return false ;
// recupero stato di attivazione/disattivazione
int nMode ;
if ( ! m_pGeomDB->GetMode( nId, nMode))
return false ;
bActive = ( nMode == GDB_MD_STD) ;
return true ;
}
//----------------------------------------------------------------------------
bool
MachMgr::SetAllOperationsMode( bool bExceptFirstDisp, bool bActive)
{
// modifico lo stato di tutte le operazioni
int nId = ( bExceptFirstDisp ? GetNextOperation( GetFirstOperation()) : GetFirstOperation()) ;
while ( nId != GDB_ID_NULL) {
// eseguo attivazione/disattivazione
m_pGeomDB->SetMode( nId, ( bActive ? GDB_MD_STD : GDB_MD_HIDDEN)) ;
// passo alla successiva
nId = GetNextOperation( nId) ;
}
return true ;
}
//----------------------------------------------------------------------------
bool
MachMgr::SetOperationStatus( int nId, bool bShow)
{
// verifico sia una Operazione
if ( GetOperationType( nId) == OPER_NULL)
return false ;
// eseguo cambio di stato di visualizzazione
m_pGeomDB->SetStatus( nId, ( bShow ? GDB_ST_ON : GDB_ST_OFF)) ;
return true ;
}
//----------------------------------------------------------------------------
bool
MachMgr::GetOperationStatus( int nId, bool& bShow) const
{
// verifico sia una Operazione
if ( GetOperationType( nId) == OPER_NULL)
return false ;
// recupero stato di visualizzazione
int nStat ;
if ( ! m_pGeomDB->GetStatus( nId, nStat))
return false ;
bShow = ( nStat == GDB_ST_ON) ;
return true ;
}
//----------------------------------------------------------------------------
bool
MachMgr::SetAllOperationsStatus( bool bExceptFirstDisp, bool bShow)
{
// modifico lo stato di tutte le operazioni
int nId = ( bExceptFirstDisp ? GetNextOperation( GetFirstOperation()) : GetFirstOperation()) ;
while ( nId != GDB_ID_NULL) {
// eseguo cambio di stato di visualizzazione
m_pGeomDB->SetStatus( nId, ( bShow ? GDB_ST_ON : GDB_ST_OFF)) ;
// passo alla successiva
nId = GetNextOperation( nId) ;
}
return true ;
}
//----------------------------------------------------------------------------
bool
MachMgr::AdjustOperationPhase( int nMchId)
{
// l'operazione deve esistere e non essere una disposizione
int nType = GetOperationType( nMchId) ;
if ( nType == OPER_NULL || nType == OPER_DISP)
return false ;
// cerco l'ultima disposizione che la precede
int nCurrId = GetPrevOperation( nMchId) ;
while ( nCurrId != GDB_ID_NULL) {
if ( GetOperationType( nCurrId) == OPER_DISP)
break ;
nCurrId = GetPrevOperation( nCurrId) ;
}
if ( nCurrId == GDB_ID_NULL)
return false ;
// recupero la fase di questa disposizione e la assegno alla lavorazione
int nDispPhase = GetOperationPhase( nCurrId) ;
if ( nDispPhase == 0)
return false ;
// recupero la lavorazione
Machining* pMch = GetMachining( m_pGeomDB->GetUserObj( nMchId)) ;
if ( pMch == nullptr)
return false ;
// assegno nuova fase
return pMch->SetPhase( nDispPhase) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::ChangeOperationPhase( int nMchId, int nNewPhase)
{
// l'operazione deve esistere e non essere una disposizione
int nType = GetOperationType( nMchId) ;
if ( nType == OPER_NULL || nType == OPER_DISP)
return false ;
// verifico che la nuova fase esista
if ( nNewPhase <= 0 || nNewPhase > m_nPhasesCount)
return false ;
// se la fase dell'operazione è già giusta, esco subito con successo
if ( GetOperationPhase( nMchId) == nNewPhase)
return true ;
// cerco l'ultima operazione della nuova fase
int nRefId = GetPhaseLastOperation( nNewPhase) ;
if ( nRefId == GDB_ID_NULL)
return false ;
// recupero la lavorazione
Machining* pMch = GetMachining( m_pGeomDB->GetUserObj( nMchId)) ;
if ( pMch == nullptr)
return false ;
// sposto la lavorazione
if ( ! m_pGeomDB->Relocate( nMchId, nRefId, GDB_AFTER))
return false ;
// assegno nuova fase
return pMch->SetPhase( nNewPhase) ;
}
//----------------------------------------------------------------------------
int
MachMgr::GetPhaseLastOperation( int nPhase) const
{
// verifico esistenza fase
if ( nPhase <= 0 || nPhase > m_nPhasesCount)
return GDB_ID_NULL ;
// cerco l'ultima operazione della fase
int nOperId = GDB_ID_NULL ;
int nCurrId = GetFirstOperation() ;
while ( nCurrId != GDB_ID_NULL) {
int nOperPhase = GetOperationPhase( nCurrId) ;
if ( nPhase == nOperPhase)
nOperId = nCurrId ;
else if ( nPhase < nOperPhase)
break ;
nCurrId = GetNextOperation( nCurrId) ;
}
return nOperId ;
}
//----------------------------------------------------------------------------
bool
MachMgr::RemoveOperationHome( int nId)
{
// l'operazione deve esistere
int nType = GetOperationType( nId) ;
if ( nType == OPER_NULL)
return false ;
// ne recupero il gestore
Operation* pOper = GetOperation( m_pGeomDB->GetUserObj( nId)) ;
if ( pOper == nullptr)
return false ;
// rimuovo il posizionamento finale in home
return pOper->RemoveHome() ;
}
//----------------------------------------------------------------------------
// Dispositions
//----------------------------------------------------------------------------
int
MachMgr::AddDisposition( const string& sName)
{
// recupero il gruppo delle operazioni nella macchinata corrente
int nOperGrpId = GetCurrOperId() ;
if ( nOperGrpId == GDB_ID_NULL)
return GDB_ID_NULL ;
// recupero nome originale, partendo da quello proposto
string sNewName = sName ;
if ( ! GetOperationNewName( sNewName))
return GDB_ID_NULL ;
// inserisco il gruppo
int nId = m_pGeomDB->AddGroup( GDB_ID_NULL, nOperGrpId, GLOB_FRM) ;
if ( nId == GDB_ID_NULL)
return GDB_ID_NULL ;
// assegno il nome
m_pGeomDB->SetName( nId, sName) ;
// installo il gestore della disposizione
Disposition* pDisp = new(nothrow) Disposition ;
if ( pDisp == nullptr) {
m_pGeomDB->Erase( nId) ;
return GDB_ID_NULL ;
}
m_pGeomDB->SetUserObj( nId, pDisp) ;
pDisp->Init( this) ;
pDisp->SetPhase( m_nCurrPhase) ;
ResetAllAxesPos( false, true) ;
return nId ;
}
//----------------------------------------------------------------------------
int
MachMgr::GetPhaseDisposition( int nPhase) const
{
// verifico esista la fase
if ( nPhase > m_nPhasesCount)
return GDB_ID_NULL ;
// cerco la disposizione nel gruppo delle operazioni
PtrOwner<IGdbIterator> pIter( CreateGdbIterator( m_pGeomDB)) ;
if ( IsNull( pIter))
return GDB_ID_NULL ;
bool bIter = pIter->GoToFirstInGroup( GetCurrOperId()) ;
while ( bIter) {
const Disposition* pDisp = ::GetDisposition( pIter->GetUserObj()) ;
if ( pDisp != nullptr && pDisp->GetPhase() == nPhase)
return pIter->GetId() ;
bIter = pIter->GoToNext() ;
}
return GDB_ID_NULL ;
}
//----------------------------------------------------------------------------
bool
MachMgr::DispositionSpecialApply( int nId, bool bRecalc)
{
ResetLastError() ;
ResetWarnings() ;
// verifico sia attiva
bool bActive ;
if ( ! GetOperationMode( nId, bActive))
return false ;
if ( ! bActive)
return true ;
// recupero la disposizione
Disposition* pDisp = ::GetDisposition( m_pGeomDB->GetUserObj( nId)) ;
if ( pDisp == nullptr)
return false ;
// Eventuale log
string sOut = "DispositionSpecialApply start --> " + pDisp->GetName() ;
LOG_DBG_INFO( GetEMkLogger(), sOut.c_str()) ;
// lancio l'azione
return pDisp->SpecialApply( bRecalc) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::DispositionSpecialUpdate( int nId)
{
ResetLastError() ;
ResetWarnings() ;
// verifico sia attiva
bool bActive ;
if ( ! GetOperationMode( nId, bActive))
return false ;
if ( ! bActive)
return true ;
// recupero la disposizione
Disposition* pDisp = ::GetDisposition( m_pGeomDB->GetUserObj( nId)) ;
if ( pDisp == nullptr)
return false ;
// Eventuale log
string sOut = "DispositionSpecialUpdate start --> " + pDisp->GetName() ;
LOG_DBG_INFO( GetEMkLogger(), sOut.c_str()) ;
// lancio l'azione
return pDisp->SpecialUpdate() ;
}
//----------------------------------------------------------------------------
bool
MachMgr::GetDispositionToolData( int nId, string& sName, string& sHead, int& nExit, string& sTcPos)
{
// recupero la disposizione
Disposition* pDisp = ::GetDisposition( m_pGeomDB->GetUserObj( nId)) ;
if ( pDisp == nullptr)
return false ;
// recupero i dati utensile
return pDisp->GetToolData( sName, sHead, nExit, sTcPos) ;
}
//----------------------------------------------------------------------------
// Machinings
//----------------------------------------------------------------------------
bool
MachMgr::SetCurrMachining( int nId)
{
// se corrente esiste ed è diversa, ne eseguo il reset
if ( m_nCurrMachiningId != GDB_ID_NULL && nId != m_nCurrMachiningId)
ResetCurrMachining() ;
// recupero il gruppo delle operazioni nella macchinata corrente
int nOperGrpId = GetCurrOperId() ;
if ( nOperGrpId == GDB_ID_NULL)
return false ;
// verifico che il gruppo di indice nId appartenga a questo gruppo
if ( m_pGeomDB->GetParentId( nId) != nOperGrpId)
return false ;
// verifico che questo gruppo sia realmente una lavorazione
Machining* pMch = GetMachining( m_pGeomDB->GetUserObj( nId)) ;
if ( pMch == nullptr)
return false ;
// gli imposto il manager generale delle lavorazioni
pMch->Init( this) ;
// non imposto la fase della lavorazione come corrente :
// spesso si vuole solo conoscere alcuni parametri
// su Preview, Apply e Update viene temporanemente fatto
// in ogni caso si può impostare direttamente
// imposto la lavorazione corrente
m_nCurrMachiningId = nId ;
return true ;
}
//----------------------------------------------------------------------------
bool
MachMgr::ResetCurrMachining( void)
{
// disabilito preview utensile
RemovePreviewMachiningTool() ;
// reset
m_nCurrMachiningId = GDB_ID_NULL ;
return true ;
}
//----------------------------------------------------------------------------
int
MachMgr::GetCurrMachining( void) const
{
// recupero il gruppo delle operazioni nella macchinata corrente
int nOperGrpId = GetCurrOperId() ;
if ( nOperGrpId == GDB_ID_NULL)
return GDB_ID_NULL ;
// verifico che la lavorazione corrente appartenga a questo gruppo
if ( m_pGeomDB->GetParentId( m_nCurrMachiningId) == nOperGrpId)
return m_nCurrMachiningId ;
else
return GDB_ID_NULL ;
}
//----------------------------------------------------------------------------
int
MachMgr::AddMachining( const string& sName, const string& sMachining)
{
// nessuna lavorazione corrente
ResetCurrMachining() ;
// recupero il gestore delle lavorazioni della macchina corrente
MachiningsMgr* pMMgr = GetCurrMachiningsMgr() ;
if ( pMMgr == nullptr)
return GDB_ID_NULL ;
// recupero il tipo di lavorazione
const MachiningData* pMd = pMMgr->GetMachining( sMachining) ;
if ( pMd == nullptr) {
string sOut = "AddMachining error : " + sMachining + " not found" ;
LOG_ERROR( GetEMkLogger(), sOut.c_str())
return GDB_ID_NULL ;
}
int nMchType = pMd->GetType() ;
// recupero il gruppo delle operazioni nella macchinata corrente
int nOperGrpId = GetCurrOperId() ;
if ( nOperGrpId == GDB_ID_NULL)
return GDB_ID_NULL ;
// recupero nome originale, partendo da quello proposto
string sNewName = sName ;
if ( ! GetOperationNewName( sNewName))
return GDB_ID_NULL ;
// inserisco il gruppo della lavorazione alla fine della fase corrente
int nRefId = GetPhaseLastOperation( m_nCurrPhase) ;
if ( nRefId == GDB_ID_NULL)
return GDB_ID_NULL ;
int nId = m_pGeomDB->InsertGroup( GDB_ID_NULL, nRefId, GDB_AFTER, GLOB_FRM) ;
if ( nId == GDB_ID_NULL)
return GDB_ID_NULL ;
// assegno il nome
if ( ! m_pGeomDB->SetName( nId, sNewName)) {
string sOut = "AddMachining error : " + sNewName + " invalid name " ;
LOG_ERROR( GetEMkLogger(), sOut.c_str())
m_pGeomDB->Erase( nId) ;
return GDB_ID_NULL ;
}
// installo il gestore della lavorazione
Machining* pMch = CreateMachining( nMchType) ;
m_pGeomDB->SetUserObj( nId, pMch) ;
if ( pMch == nullptr || ! pMch->Init( this) ||
! pMch->SetPhase( m_nCurrPhase) || ! pMch->Prepare( sMachining)) {
string sOut = "AddMachining error : " + sMachining + " on " + sName ;
LOG_ERROR( GetEMkLogger(), sOut.c_str())
m_pGeomDB->Erase( nId) ;
return GDB_ID_NULL ;
}
// la dichiaro lavorazione corrente
m_nCurrMachiningId = nId ;
return nId ;
}
//----------------------------------------------------------------------------
int
MachMgr::AddMachining( const string& sName, int nMchType, const string& sTool)
{
// nessuna lavorazione corrente
ResetCurrMachining() ;
// recupero il gestore delle lavorazioni della macchina corrente
MachiningsMgr* pMMgr = GetCurrMachiningsMgr() ;
if ( pMMgr == nullptr)
return GDB_ID_NULL ;
// recupero il gruppo delle operazioni nella macchinata corrente
int nOperGrpId = GetCurrOperId() ;
if ( nOperGrpId == GDB_ID_NULL)
return GDB_ID_NULL ;
// recupero nome originale, partendo da quello proposto
string sNewName = sName ;
if ( ! GetOperationNewName( sNewName))
return GDB_ID_NULL ;
// inserisco il gruppo della lavorazione alla fine della fase corrente
int nRefId = GetPhaseLastOperation( m_nCurrPhase) ;
if ( nRefId == GDB_ID_NULL)
return GDB_ID_NULL ;
int nId = m_pGeomDB->InsertGroup( GDB_ID_NULL, nRefId, GDB_AFTER, GLOB_FRM) ;
if ( nId == GDB_ID_NULL)
return GDB_ID_NULL ;
// assegno il nome
if ( ! m_pGeomDB->SetName( nId, sNewName)) {
string sOut = "AddMachining error : " + sNewName + " invalid name " ;
LOG_ERROR( GetEMkLogger(), sOut.c_str())
m_pGeomDB->Erase( nId) ;
return GDB_ID_NULL ;
}
// installo il gestore della lavorazione
Machining* pMch = CreateMachining( nMchType) ;
m_pGeomDB->SetUserObj( nId, pMch) ;
if ( pMch == nullptr || ! pMch->Init( this) ||
! pMch->SetPhase( m_nCurrPhase) || ! pMch->SetParam( MPA_TOOL, sTool)) {
string sOut = "AddMachining error : " + GetMachiningTitle( nMchType) + "/" + sTool + " on " + sName ;
LOG_ERROR( GetEMkLogger(), sOut.c_str())
m_pGeomDB->Erase( nId) ;
return GDB_ID_NULL ;
}
// la dichiaro lavorazione corrente
m_nCurrMachiningId = nId ;
return nId ;
}
//----------------------------------------------------------------------------
int
MachMgr::CopyMachining( const string& sName, const string& sSouName)
{
// recupero la lavorazione sorgente e la imposto come corrente
int nSouId = GetOperationId( sSouName) ;
if ( ! SetCurrMachining( nSouId))
return GDB_ID_NULL ;
// ne imposto la fase di lavorazione come corrente
if ( ! SetCurrPhase( GetOperationPhase( m_nCurrMachiningId)))
return GDB_ID_NULL ;
// nessuna lavorazione corrente
ResetCurrMachining() ;
// recupero il gruppo delle operazioni nella macchinata corrente
int nOperGrpId = GetCurrOperId() ;
if ( nOperGrpId == GDB_ID_NULL)
return GDB_ID_NULL ;
// recupero nome originale, partendo da quello proposto
string sNewName = sName ;
if ( ! GetOperationNewName( sNewName))
return GDB_ID_NULL ;
// inserisco il gruppo della lavorazione alla fine della fase corrente
int nRefId = GetPhaseLastOperation( m_nCurrPhase) ;
if ( nRefId == GDB_ID_NULL)
return GDB_ID_NULL ;
int nId = m_pGeomDB->Copy( nSouId, GDB_ID_NULL, nRefId, GDB_AFTER) ;
if ( nId == GDB_ID_NULL)
return GDB_ID_NULL ;
// assegno il nome
if ( ! m_pGeomDB->SetName( nId, sNewName)) {
string sOut = "CopyMachining error : " + sNewName + " invalid name " ;
LOG_ERROR( GetEMkLogger(), sOut.c_str())
m_pGeomDB->Erase( nId) ;
return GDB_ID_NULL ;
}
// la dichiaro lavorazione corrente
m_nCurrMachiningId = nId ;
return nId ;
}
//----------------------------------------------------------------------------
bool
MachMgr::SetMachiningParam( int nType, bool bVal, bool* pbChanged)
{
// recupero la lavorazione corrente
int nCurrMchId = GetCurrMachining() ;
if ( nCurrMchId == GDB_ID_NULL)
return false ;
// ne recupero il gestore
Machining* pMch = GetMachining( m_pGeomDB->GetUserObj( nCurrMchId)) ;
if ( pMch == nullptr)
return false ;
// se richiesto, ne recupero il valore corrente, per verificare se modificato
if ( pbChanged != nullptr) {
bool bOldVal ;
*pbChanged = ( pMch->GetParam( nType, bOldVal) && bOldVal != bVal) ;
}
// imposto il parametro
return pMch->SetParam( nType, bVal) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::SetMachiningParam( int nType, int nVal, bool* pbChanged)
{
// recupero la lavorazione corrente
int nCurrMchId = GetCurrMachining() ;
if ( nCurrMchId == GDB_ID_NULL)
return false ;
// ne recupero il gestore
Machining* pMch = GetMachining( m_pGeomDB->GetUserObj( nCurrMchId)) ;
if ( pMch == nullptr)
return false ;
// ne recupero il valore corrente, per verificare se modificato
if ( pbChanged != nullptr) {
int nOldVal ;
*pbChanged = ( pMch->GetParam( nType, nOldVal) && nOldVal != nVal) ;
}
// imposto il parametro
return pMch->SetParam( nType, nVal) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::SetMachiningParam( int nType, double dVal, bool* pbChanged)
{
// recupero la lavorazione corrente
int nCurrMchId = GetCurrMachining() ;
if ( nCurrMchId == GDB_ID_NULL)
return false ;
// ne recupero il gestore
Machining* pMch = GetMachining( m_pGeomDB->GetUserObj( nCurrMchId)) ;
if ( pMch == nullptr)
return false ;
// ne recupero il valore corrente, per verificare se modificato
if ( pbChanged != nullptr) {
double dOldVal ;
*pbChanged = ( pMch->GetParam( nType, dOldVal) && abs( dOldVal - dVal) > EPS_SMALL) ;
}
// imposto il parametro
return pMch->SetParam( nType, dVal) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::SetMachiningParam( int nType, const string& sVal, bool* pbChanged)
{
// recupero la lavorazione corrente
int nCurrMchId = GetCurrMachining() ;
if ( nCurrMchId == GDB_ID_NULL)
return false ;
// ne recupero il gestore
Machining* pMch = GetMachining( m_pGeomDB->GetUserObj( nCurrMchId)) ;
if ( pMch == nullptr)
return false ;
// ne recupero il valore corrente, per verificare se modificato
if ( pbChanged != nullptr) {
string sOldVal ;
*pbChanged = ( pMch->GetParam( nType, sOldVal) && sOldVal != sVal) ;
}
// imposto il parametro
return pMch->SetParam( nType, sVal) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::SetMachiningGeometry( const SELVECTOR& vIds)
{
ResetLastError() ;
ResetWarnings() ;
// recupero la lavorazione corrente
int nCurrMchId = GetCurrMachining() ;
if ( nCurrMchId == GDB_ID_NULL)
return false ;
// ne recupero il gestore
Machining* pMch = GetMachining( m_pGeomDB->GetUserObj( nCurrMchId)) ;
if ( pMch == nullptr)
return false ;
// imposto fase della lavorazione come temporaneamente corrente
SetTempPhase TmpPhase( this, pMch->GetPhase()) ;
// imposto la geometria
return pMch->SetGeometry( vIds) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::MachiningPreview( bool bRecalc)
{
ResetLastError() ;
ResetWarnings() ;
// recupero la lavorazione corrente
int nCurrMchId = GetCurrMachining() ;
if ( nCurrMchId == GDB_ID_NULL)
return false ;
// ne recupero il gestore
Machining* pMch = GetMachining( m_pGeomDB->GetUserObj( nCurrMchId)) ;
if ( pMch == nullptr)
return false ;
// imposto fase della lavorazione come temporaneamente corrente
SetTempPhase TmpPhase( this, pMch->GetPhase()) ;
// calcolo l'anteprima della lavorazione
return pMch->Preview( bRecalc) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::ExistsMachiningPreview( void)
{
// recupero la lavorazione corrente (verifica anche GeomDB)
int nCurrMchId = GetCurrMachining() ;
if ( nCurrMchId == GDB_ID_NULL)
return false ;
// se esiste gruppo di preview, lo svuoto
int nPvId = m_pGeomDB->GetFirstNameInGroup( nCurrMchId, MCH_PV) ;
if ( nPvId == GDB_ID_NULL)
return false ;
return ( m_pGeomDB->GetGroupObjs( nPvId) > 0) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::RemoveMachiningPreview( void)
{
// recupero la lavorazione corrente (verifica anche GeomDB)
int nCurrMchId = GetCurrMachining() ;
if ( nCurrMchId == GDB_ID_NULL)
return false ;
// se esiste gruppo di preview, lo svuoto
int nPvId = m_pGeomDB->GetFirstNameInGroup( nCurrMchId, MCH_PV) ;
if ( nPvId == GDB_ID_NULL)
return true ;
return m_pGeomDB->EmptyGroup( nPvId) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::MachiningApply( bool bRecalc, bool bPostApply)
{
ResetLastError() ;
ResetWarnings() ;
if ( GetCurrMachine() != nullptr)
GetCurrMachine()->ResetOutstrokeInfo() ;
// recupero la lavorazione corrente
int nCurrMchId = GetCurrMachining() ;
if ( nCurrMchId == GDB_ID_NULL)
return false ;
// verifico sia attiva
bool bActive ;
if ( ! GetOperationMode( nCurrMchId, bActive))
return false ;
if ( ! bActive)
return true ;
// ne recupero il gestore
Machining* pMch = GetMachining( m_pGeomDB->GetUserObj( nCurrMchId)) ;
if ( pMch == nullptr)
return false ;
// Log
string sOut = "MachiningApply start --> " + pMch->GetName() ;
LOG_DBG_INFO( GetEMkLogger(), sOut.c_str()) ;
// imposto fase della lavorazione come temporaneamente corrente
SetTempPhase TmpPhase( this, pMch->GetPhase()) ;
// imposto visualizzazione completa della macchina come temporaneamente corrente
SetTempMachLook TmpMachLook( this, MCH_LOOK_ALL) ;
// calcolo la lavorazione
return pMch->Apply( bRecalc, bPostApply) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::MachiningUpdate( bool bPostApply)
{
ResetLastError() ;
ResetWarnings() ;
// recupero la lavorazione corrente
int nCurrMchId = GetCurrMachining() ;
if ( nCurrMchId == GDB_ID_NULL)
return false ;
// verifico sia attiva
bool bActive ;
if ( ! GetOperationMode( nCurrMchId, bActive))
return false ;
if ( ! bActive)
return true ;
// ne recupero il gestore
Machining* pMch = GetMachining( m_pGeomDB->GetUserObj( nCurrMchId)) ;
if ( pMch == nullptr)
return false ;
// Log
string sOut = "MachiningUpdate start --> " + pMch->GetName() ;
LOG_DBG_INFO( GetEMkLogger(), sOut.c_str()) ;
// imposto fase della lavorazione come temporaneamente corrente
SetTempPhase TmpPhase( this, pMch->GetPhase()) ;
// imposto visualizzazione completa della macchina come temporaneamente corrente
SetTempMachLook TmpMachLook( this, MCH_LOOK_ALL) ;
// aggiorno valori assi macchina e collegamento con operazione precedente
return pMch->Update( bPostApply) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::ChangePreviewMachiningToolShow( int nLookFlag)
{
// recupero la lavorazione corrente
int nCurrMchId = GetCurrMachining() ;
if ( nCurrMchId == GDB_ID_NULL)
return false ;
// ne recupero il gestore
Machining* pMch = GetMachining( m_pGeomDB->GetUserObj( nCurrMchId)) ;
if ( pMch == nullptr)
return false ;
// eseguo
return pMch->ChangeToolPreviewShow( nLookFlag) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::PreparePreviewMachiningTool( void) const
{
// recupero la lavorazione corrente
int nCurrMchId = GetCurrMachining() ;
if ( nCurrMchId == GDB_ID_NULL)
return false ;
// ne recupero il gestore
Machining* pMch = GetMachining( m_pGeomDB->GetUserObj( nCurrMchId)) ;
if ( pMch == nullptr)
return false ;
// eseguo
return pMch->PrepareToolPreview() ;
}
//----------------------------------------------------------------------------
bool
MachMgr::RemovePreviewMachiningTool( void) const
{
// verifico la lavorazione corrente (salto volutamente altri controlli)
if ( m_nCurrMachiningId == GDB_ID_NULL)
return false ;
// ne recupero il gestore
Machining* pMch = GetMachining( m_pGeomDB->GetUserObj( m_nCurrMachiningId)) ;
if ( pMch == nullptr)
return false ;
// eseguo
return pMch->RemoveToolPreview() ;
}
//----------------------------------------------------------------------------
int
MachMgr::GetPreviewMachiningToolStepCount( void) const
{
// recupero la lavorazione corrente
int nCurrMchId = GetCurrMachining() ;
if ( nCurrMchId == GDB_ID_NULL)
return 0 ;
// ne recupero il gestore
Machining* pMch = GetMachining( m_pGeomDB->GetUserObj( nCurrMchId)) ;
if ( pMch == nullptr)
return 0 ;
// eseguo
return pMch->GetToolPreviewStepCount() ;
}
//----------------------------------------------------------------------------
int
MachMgr::PreviewMachiningTool( int nEntId, int nStep) const
{
// recupero la lavorazione corrente
int nCurrMchId = GetCurrMachining() ;
if ( nCurrMchId == GDB_ID_NULL)
return GDB_ID_NULL ;
// ne recupero il gestore
Machining* pMch = GetMachining( m_pGeomDB->GetUserObj( nCurrMchId)) ;
if ( pMch == nullptr)
return GDB_ID_NULL ;
// eseguo
return pMch->ToolPreview( nEntId, nStep) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::GetMachiningParam( int nType, bool& bVal) const
{
// recupero la lavorazione corrente
int nCurrMchId = GetCurrMachining() ;
if ( nCurrMchId == GDB_ID_NULL)
return false ;
// ne recupero il gestore
Machining* pMch = GetMachining( m_pGeomDB->GetUserObj( nCurrMchId)) ;
if ( pMch == nullptr)
return false ;
// recupero il parametro
return pMch->GetParam( nType, bVal) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::GetMachiningParam( int nType, int& nVal) const
{
// recupero la lavorazione corrente
int nCurrMchId = GetCurrMachining() ;
if ( nCurrMchId == GDB_ID_NULL)
return false ;
// ne recupero il gestore
Machining* pMch = GetMachining( m_pGeomDB->GetUserObj( nCurrMchId)) ;
if ( pMch == nullptr)
return false ;
// recupero il parametro
return pMch->GetParam( nType, nVal) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::GetMachiningParam( int nType, double& dVal) const
{
// recupero la lavorazione corrente
int nCurrMchId = GetCurrMachining() ;
if ( nCurrMchId == GDB_ID_NULL)
return false ;
// ne recupero il gestore
Machining* pMch = GetMachining( m_pGeomDB->GetUserObj( nCurrMchId)) ;
if ( pMch == nullptr)
return false ;
// recupero il parametro
return pMch->GetParam( nType, dVal) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::GetMachiningParam( int nType, string& sVal) const
{
// recupero la lavorazione corrente
int nCurrMchId = GetCurrMachining() ;
if ( nCurrMchId == GDB_ID_NULL)
return false ;
// ne recupero il gestore
Machining* pMch = GetMachining( m_pGeomDB->GetUserObj( nCurrMchId)) ;
if ( pMch == nullptr)
return false ;
// recupero il parametro
return pMch->GetParam( nType, sVal) ;
}
//----------------------------------------------------------------------------
const ToolData*
MachMgr::GetMachiningToolData( void) const
{
// recupero la lavorazione corrente
int nCurrMchId = GetCurrMachining() ;
if ( nCurrMchId == GDB_ID_NULL)
return nullptr ;
// ne recupero il gestore
Machining* pMch = GetMachining( m_pGeomDB->GetUserObj( nCurrMchId)) ;
if ( pMch == nullptr)
return nullptr ;
// recupero il parametro
return &( pMch->GetToolData()) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::GetMachiningGeometry( SELVECTOR& vIds) const
{
// recupero la lavorazione corrente
int nCurrMchId = GetCurrMachining() ;
if ( nCurrMchId == GDB_ID_NULL)
return false ;
// ne recupero il gestore
Machining* pMch = GetMachining( m_pGeomDB->GetUserObj( nCurrMchId)) ;
if ( pMch == nullptr)
return false ;
// restituisco la geometria originale
return pMch->GetGeometry( vIds) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::GetMachiningSkippedGeometry( SELVECTOR& vIds) const
{
// recupero la lavorazione corrente
int nCurrMchId = GetCurrMachining() ;
if ( nCurrMchId == GDB_ID_NULL)
return false ;
// ne recupero il gestore
Machining* pMch = GetMachining( m_pGeomDB->GetUserObj( nCurrMchId)) ;
if ( pMch == nullptr)
return false ;
// restituisco la geometria non lavorata
return pMch->GetSkippedGeometry( vIds) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::IsMachiningEmpty( int nEmptyType) const
{
// recupero la lavorazione corrente
int nCurrMchId = GetCurrMachining() ;
if ( nCurrMchId == GDB_ID_NULL)
return true ;
// ne recupero il gestore
Machining* pMch = GetMachining( m_pGeomDB->GetUserObj( nCurrMchId)) ;
if ( pMch == nullptr)
return true ;
// restituisco lo stato
return pMch->IsEmpty( nEmptyType) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::GetMachiningStartPoint( Point3d& ptStart) const
{
// recupero la lavorazione corrente
int nCurrMchId = GetCurrMachining() ;
if ( nCurrMchId == GDB_ID_NULL)
return false ;
// ne recupero il gestore
Machining* pMch = GetMachining( m_pGeomDB->GetUserObj( nCurrMchId)) ;
if ( pMch == nullptr)
return false ;
// restituisco il punto iniziale del primo percorso di lavorazione
return pMch->GetStartPoint( ptStart) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::GetMachiningEndPoint( Point3d& ptEnd) const
{
// recupero la lavorazione corrente
int nCurrMchId = GetCurrMachining() ;
if ( nCurrMchId == GDB_ID_NULL)
return false ;
// ne recupero il gestore
Machining* pMch = GetMachining( m_pGeomDB->GetUserObj( nCurrMchId)) ;
if ( pMch == nullptr)
return false ;
// restituisco il punto finale dell'ultimo percorso di lavorazione
return pMch->GetEndPoint( ptEnd) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::GetMachiningStartAxes( bool bSkipClimb, DBLVECTOR& vAxVal) const
{
// recupero la lavorazione corrente
int nCurrMchId = GetCurrMachining() ;
if ( nCurrMchId == GDB_ID_NULL)
return false ;
// ne recupero il gestore
Machining* pMch = GetMachining( m_pGeomDB->GetUserObj( nCurrMchId)) ;
if ( pMch == nullptr)
return false ;
// recupero i valori
return pMch->GetInitialAxesValues( bSkipClimb, true, vAxVal) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::GetMachiningEndAxes( bool bSkipRise, DBLVECTOR& vAxVal) const
{
// recupero la lavorazione corrente
int nCurrMchId = GetCurrMachining() ;
if ( nCurrMchId == GDB_ID_NULL)
return false ;
// ne recupero il gestore
Machining* pMch = GetMachining( m_pGeomDB->GetUserObj( nCurrMchId)) ;
if ( pMch == nullptr)
return false ;
// recupero i valori
return pMch->GetFinalAxesValues( bSkipRise, true, vAxVal) ;
}