EgtMachKernel 1.6f2 :
- aggiunto UserObj CamData per rappresentare dati tipo CL in entità geometriche - possibilità di ruotare i sottopezzi - aggiunto calcolo percorsi di lavorazione di fori - aggiunte prime versioni parziali di taglio con lama e fresatura.
This commit is contained in:
+106
-5
@@ -18,6 +18,8 @@
|
||||
#include "MachConst.h"
|
||||
#include "Disposition.h"
|
||||
#include "Drilling.h"
|
||||
#include "Sawing.h"
|
||||
#include "Milling.h"
|
||||
#include "/EgtDev/Include/EGkGdbIterator.h"
|
||||
#include "/EgtDev/Include/EGnStringUtils.h"
|
||||
#include "/EgtDev/Include/EGnFileUtils.h"
|
||||
@@ -133,6 +135,50 @@ MachMgr::GetOperationId( const string& sName) const
|
||||
return GDB_ID_NULL ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::SetCurrMachining( int nId)
|
||||
{
|
||||
// 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 = dynamic_cast<Machining*>( m_pGeomDB->GetUserObj( nId)) ;
|
||||
if ( pMch == nullptr)
|
||||
return false ;
|
||||
// gli imposto il manager generale delle lavorazioni
|
||||
pMch->Init( this) ;
|
||||
// imposto la lavorazione corrente
|
||||
m_nCurrMachiningId = nId ;
|
||||
return true ;
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::ResetCurrMachining( void)
|
||||
{
|
||||
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::AddDisposition( const string& sName)
|
||||
@@ -155,15 +201,24 @@ MachMgr::AddDisposition( const string& sName)
|
||||
Disposition* pDisp = new(nothrow) Disposition ;
|
||||
if ( pDisp == nullptr)
|
||||
return GDB_ID_NULL ;
|
||||
m_pGeomDB->SetUserObj( nId, pDisp) ;
|
||||
pDisp->Init( this) ;
|
||||
m_pGeomDB->SetObjUser( nId, pDisp) ;
|
||||
return nId ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
MachMgr::AddDrilling( const string& sName)
|
||||
MachMgr::AddMachining( const string& sName, const std::string& sMachining)
|
||||
{
|
||||
// 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)
|
||||
return GDB_ID_NULL ;
|
||||
int nMchType = pMd->GetType() ;
|
||||
// recupero il gruppo delle operazioni nella macchinata corrente
|
||||
int nOperGrpId = GetCurrOperId() ;
|
||||
if ( nOperGrpId == GDB_ID_NULL)
|
||||
@@ -179,9 +234,55 @@ MachMgr::AddDrilling( const string& sName)
|
||||
// assegno il nome
|
||||
m_pGeomDB->SetName( nId, sNewName) ;
|
||||
// installo il gestore della lavorazione
|
||||
Drilling* pDrilling = new(nothrow) Drilling ;
|
||||
if ( pDrilling == nullptr)
|
||||
Machining* pMch = nullptr ;
|
||||
switch ( nMchType) {
|
||||
case MT_DRILLING : pMch = new( nothrow) Drilling ; break ;
|
||||
case MT_SAWING : pMch = new( nothrow) Sawing ; break ;
|
||||
case MT_MILLING : pMch = new( nothrow) Milling ; break ;
|
||||
}
|
||||
if ( pMch == nullptr) {
|
||||
m_pGeomDB->Erase( nId) ;
|
||||
return GDB_ID_NULL ;
|
||||
m_pGeomDB->SetObjUser( nId, pDrilling) ;
|
||||
}
|
||||
m_pGeomDB->SetUserObj( nId, pMch) ;
|
||||
pMch->Init( this) ;
|
||||
if ( ! pMch->Prepare( sMachining)) {
|
||||
m_pGeomDB->Erase( nId) ;
|
||||
return GDB_ID_NULL ;
|
||||
}
|
||||
// la dichiaro lavorazione corrente
|
||||
m_nCurrMachiningId = nId ;
|
||||
return nId ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::SetMachiningGeometry( const SELVECTOR& vIds)
|
||||
{
|
||||
// recupero la lavorazione corrente
|
||||
int nCurrMchId = GetCurrMachining() ;
|
||||
if ( nCurrMchId == GDB_ID_NULL)
|
||||
return false ;
|
||||
// ne recupero il gestore
|
||||
Machining* pMch = dynamic_cast<Machining*>( m_pGeomDB->GetUserObj( nCurrMchId)) ;
|
||||
if ( pMch == nullptr)
|
||||
return false ;
|
||||
// imposto la geometria
|
||||
return pMch->SetGeometry( vIds) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::Apply( void)
|
||||
{
|
||||
// recupero la lavorazione corrente
|
||||
int nCurrMchId = GetCurrMachining() ;
|
||||
if ( nCurrMchId == GDB_ID_NULL)
|
||||
return false ;
|
||||
// ne recupero il gestore
|
||||
Machining* pMch = dynamic_cast<Machining*>( m_pGeomDB->GetUserObj( nCurrMchId)) ;
|
||||
if ( pMch == nullptr)
|
||||
return false ;
|
||||
// imposto la geometria
|
||||
return pMch->Apply() ;
|
||||
}
|
||||
Reference in New Issue
Block a user