Files
EgtMachKernel/MachMgrFixtures.cpp
T
Dario Sassi 2324a8b3f4 EgtMachKernel 1.6j4 :
- modifiche a DB utensili per gestione utensile corrente
- prima versione generatore codice.
2015-10-31 09:45:57 +00:00

114 lines
3.8 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 disposizione ( e il calcolo)
int nDispId = GetFirstOperation() ;
Disposition* pDisp = dynamic_cast<Disposition*>( m_pGeomDB->GetUserObj( nDispId)) ;
return ( pDisp != nullptr && pDisp->SetTable( sTable)) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::GetTableRef1( Point3d& ptPos)
{
// recupero la prima operazione, deve essere la disposizione
int nDispId = GetFirstOperation() ;
// recupero l'oggetto disposizione
Disposition* pDisp = dynamic_cast<Disposition*>( m_pGeomDB->GetUserObj( nDispId)) ;
if ( pDisp == nullptr)
return false ;
// recupero il punto
return pDisp->GetTableRef1( ptPos) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::GetTableArea1( int& nAreaId)
{
// verifico DB geometrico
if ( m_pGeomDB == nullptr)
return false ;
// recupero la macchina corrente
Machine* pMch = GetCurrMachine() ;
if ( pMch == nullptr)
return false ;
// recupero la tavola corrente
int nTabId = pMch->GetCurrTable() ;
if ( nTabId == GDB_ID_NULL)
return false ;
// recupero l'oggetto che ne definisce l'area utile
nAreaId = m_pGeomDB->GetFirstNameInGroup( nTabId, MCH_TAREA + "1") ;
return ( nAreaId != GDB_ID_NULL) ;
}
//----------------------------------------------------------------------------
int
MachMgr::AddFixture( const string& sName, const Point3d& ptPos, double dAngRotDeg)
{
// recupero la prima operazione, deve essere la disposizione
int nDispId = GetFirstOperation() ;
// recupero l'oggetto disposizione
Disposition* pDisp = dynamic_cast<Disposition*>( m_pGeomDB->GetUserObj( nDispId)) ;
if ( pDisp == nullptr)
return false ;
// eseguo l'operazione
return pDisp->AddFixture( sName, ptPos, dAngRotDeg) ;
}
//----------------------------------------------------------------------------
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 ;
// recupero la tavola corrente
int nTabId = pMch->GetCurrTable() ;
if ( nTabId == GDB_ID_NULL)
return false ;
// nascondo o visualizzo i fratelli e tutti i fratelli degli ascendenti
int nCurrId = nTabId ;
int nParentId = m_pGeomDB->GetParentId( nCurrId) ;
while ( nParentId != GDB_ID_NULL && nParentId != GetMachAuxId()) {
int nId = m_pGeomDB->GetFirstInGroup( nParentId) ;
while ( nId != GDB_ID_NULL) {
if ( nId != nCurrId)
m_pGeomDB->SetStatus( nId, ( bVal ? GDB_ST_OFF : GDB_ST_ON)) ;
nId = m_pGeomDB->GetNext( nId) ;
}
nCurrId = nParentId ;
nParentId = m_pGeomDB->GetParentId( nParentId) ;
}
return true ;
}