6065c07c98
- aggiunta funzione TdbGetToolFromUUID per avere nome utensile da UUID - aggiunta funzione GetTable per avere nome tavola corrente.
132 lines
4.4 KiB
C++
132 lines
4.4 KiB
C++
//----------------------------------------------------------------------------
|
|
// EgalTech 2015-2015
|
|
//----------------------------------------------------------------------------
|
|
// File : MachMgrFixtures.cpp Data : 13.05.15 Versione : 1.6e6
|
|
// Contenuto : Implementazione gestione ventose e morse della classe MachMgr.
|
|
//
|
|
//
|
|
//
|
|
// Modifiche : 13.05.15 DS Creazione modulo.
|
|
//
|
|
//
|
|
//----------------------------------------------------------------------------
|
|
|
|
//--------------------------- Include ----------------------------------------
|
|
#include "stdafx.h"
|
|
#include "DllMain.h"
|
|
#include "MachMgr.h"
|
|
#include "MachConst.h"
|
|
#include "Disposition.h"
|
|
#include "/EgtDev/Include/EGkGdbIterator.h"
|
|
#include "/EgtDev/Include/EGnFileUtils.h"
|
|
#include "/EgtDev/Include/EgtPointerOwner.h"
|
|
|
|
using namespace std ;
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
MachMgr::SetTable( const string& sTable)
|
|
{
|
|
// imposto la tavola per la prima disposizione ( e il calcolo)
|
|
Disposition* pDisp = ::GetDisposition( m_pGeomDB->GetUserObj( GetFirstOperation())) ;
|
|
return ( pDisp != nullptr && pDisp->SetTable( sTable)) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
MachMgr::GetTable( string& sTable)
|
|
{
|
|
// recupero la prima operazione, deve essere la prima disposizione
|
|
Disposition* pDisp = ::GetDisposition( m_pGeomDB->GetUserObj( GetFirstOperation())) ;
|
|
if ( pDisp == nullptr)
|
|
return false ;
|
|
// recupero la tavola
|
|
return pDisp->GetTable( sTable) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
MachMgr::GetTableRef( int nInd, Point3d& ptPos)
|
|
{
|
|
// attualmente previsto solo il riferimento 1
|
|
if ( nInd != 1)
|
|
return false ;
|
|
// recupero la prima operazione, deve essere la prima disposizione
|
|
Disposition* pDisp = ::GetDisposition( m_pGeomDB->GetUserObj( GetFirstOperation())) ;
|
|
if ( pDisp == nullptr)
|
|
return false ;
|
|
// recupero il punto
|
|
return pDisp->GetTableRef1( ptPos) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
MachMgr::GetTableArea( int nInd, BBox3d& b3Area1)
|
|
{
|
|
// attualmente prevista solo l'area 1
|
|
if ( nInd != 1)
|
|
return false ;
|
|
// recupero la prima operazione, deve essere la prima disposizione
|
|
Disposition* pDisp = ::GetDisposition( m_pGeomDB->GetUserObj( GetFirstOperation())) ;
|
|
if ( pDisp == nullptr)
|
|
return false ;
|
|
// recupero il bounding box
|
|
return pDisp->GetTableArea1( b3Area1) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
int
|
|
MachMgr::AddFixture( const string& sName, const Point3d& ptPos, double dAngRotDeg)
|
|
{
|
|
// recupero l'oggetto disposizione corrente
|
|
Disposition* pDisp = ::GetDisposition( m_pGeomDB->GetUserObj( m_nCurrDispId)) ;
|
|
if ( pDisp == nullptr)
|
|
return false ;
|
|
// eseguo l'operazione
|
|
return pDisp->AddFixture( sName, ptPos, dAngRotDeg) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
int
|
|
MachMgr::GetFirstFixture( void)
|
|
{
|
|
// recupero il gruppo delle fixtures nella macchinata corrente
|
|
int nFixtGrpId = GetCurrFixtGroupId() ;
|
|
if ( nFixtGrpId == GDB_ID_NULL)
|
|
return GDB_ID_NULL ;
|
|
// restituisco identificativo del primo oggetto nel gruppo
|
|
return m_pGeomDB->GetFirstInGroup( nFixtGrpId) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
int
|
|
MachMgr::GetNextFixture( int nFxtId)
|
|
{
|
|
// recupero il gruppo delle fixtures nella macchinata corrente
|
|
int nFixtGrpId = GetCurrFixtGroupId() ;
|
|
if ( nFixtGrpId == GDB_ID_NULL)
|
|
return GDB_ID_NULL ;
|
|
// verifico che l'oggetto ricevuto appartenga al gruppo delle fixtures
|
|
if ( m_pGeomDB->GetParentId( nFxtId) != nFixtGrpId)
|
|
return GDB_ID_NULL ;
|
|
// restituisco identificativo del primo oggetto nel gruppo
|
|
return m_pGeomDB->GetNext( nFxtId) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
MachMgr::ShowOnlyTable( bool bVal)
|
|
{
|
|
// verifico DB geometrico
|
|
if ( m_pGeomDB == nullptr)
|
|
return false ;
|
|
|
|
// recupero la macchina corrente
|
|
Machine* pMch = GetCurrMachine() ;
|
|
if ( pMch == nullptr)
|
|
return false ;
|
|
|
|
// imposto visualizzazione della sola tavola o di tutto
|
|
return pMch->SetLook( bVal ? MCH_LOOK_TAB : MCH_LOOK_ALL) ;
|
|
}
|