64c0e3826c
- GetFirst/GetNextFixture ora operano sui soli bloccaggi della fase corrente - esportate RemoveFixture, MoveFixture, RotateFixture e MoveFixtureMobile - aggiunta GetRawPartFromPart - gestione bloccaggi con diverse fasi - corretta inizializzazione tavola in simulazione alla seconda disposizione e successive - in fresatura a spirale si ignora overlap - in fresatura se parametri tang e perp di attacco o uscita sono nulli si mette attacco/uscita nullo.
177 lines
5.8 KiB
C++
177 lines
5.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 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) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
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) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
int
|
|
MachMgr::AddFixture( const string& sName, const Point3d& ptPos, double dAngRotDeg, double dMov)
|
|
{
|
|
// recupero l'oggetto disposizione corrente
|
|
Disposition* pDisp = ::GetDisposition( m_pGeomDB->GetUserObj( m_nCurrDispId)) ;
|
|
if ( pDisp == nullptr)
|
|
return GDB_ID_NULL ;
|
|
// eseguo l'operazione
|
|
return pDisp->AddFixture( sName, ptPos, dAngRotDeg, dMov) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
MachMgr::RemoveFixture( int nFxtId)
|
|
{
|
|
// recupero l'oggetto disposizione corrente
|
|
Disposition* pDisp = ::GetDisposition( m_pGeomDB->GetUserObj( m_nCurrDispId)) ;
|
|
if ( pDisp == nullptr)
|
|
return false ;
|
|
// eseguo l'operazione
|
|
return pDisp->RemoveFixture( nFxtId) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
int
|
|
MachMgr::GetFirstFixture( void)
|
|
{
|
|
// recupero l'oggetto disposizione corrente
|
|
Disposition* pDisp = ::GetDisposition( m_pGeomDB->GetUserObj( m_nCurrDispId)) ;
|
|
if ( pDisp == nullptr)
|
|
return GDB_ID_NULL ;
|
|
// eseguo l'operazione
|
|
return pDisp->GetFirstFixture() ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
int
|
|
MachMgr::GetNextFixture( int nFxtId)
|
|
{
|
|
// recupero l'oggetto disposizione corrente
|
|
Disposition* pDisp = ::GetDisposition( m_pGeomDB->GetUserObj( m_nCurrDispId)) ;
|
|
if ( pDisp == nullptr)
|
|
return GDB_ID_NULL ;
|
|
// eseguo l'operazione
|
|
return pDisp->GetNextFixture( nFxtId) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
MachMgr::MoveFixture( int nId, const Vector3d& vtMove)
|
|
{
|
|
// recupero l'oggetto disposizione corrente
|
|
Disposition* pDisp = ::GetDisposition( m_pGeomDB->GetUserObj( m_nCurrDispId)) ;
|
|
if ( pDisp == nullptr)
|
|
return false ;
|
|
// eseguo l'operazione
|
|
return pDisp->MoveFixture( nId, vtMove) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
MachMgr::RotateFixture( int nId, double dDeltaAngDeg)
|
|
{
|
|
// recupero l'oggetto disposizione corrente
|
|
Disposition* pDisp = ::GetDisposition( m_pGeomDB->GetUserObj( m_nCurrDispId)) ;
|
|
if ( pDisp == nullptr)
|
|
return false ;
|
|
// eseguo l'operazione
|
|
return pDisp->RotateFixture( nId, dDeltaAngDeg) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
MachMgr::MoveFixtureMobile( int nId, double dDeltaMov)
|
|
{
|
|
// recupero l'oggetto disposizione corrente
|
|
Disposition* pDisp = ::GetDisposition( m_pGeomDB->GetUserObj( m_nCurrDispId)) ;
|
|
if ( pDisp == nullptr)
|
|
return false ;
|
|
// eseguo l'operazione
|
|
return pDisp->MoveFixtureMobile( nId, dDeltaMov) ;
|
|
}
|