EgtMachKernel 1.6k5 :

- aggiunta gestione DB lavorazioni.
This commit is contained in:
Dario Sassi
2015-11-14 16:24:20 +00:00
parent 2a7370bde8
commit 7640eab85e
23 changed files with 1652 additions and 153 deletions
+203 -8
View File
@@ -51,7 +51,74 @@ static const std::array<std::string,KEY_ZZZ> sDrillingKey = {
"UUID"} ;
//----------------------------------------------------------------------------
MCHDATA_REGISTER( "DRILLING", DrillingData) ;
MCHDATA_REGISTER( MT_DRILLING, "DRILLING", DrillingData) ;
//----------------------------------------------------------------------------
DrillingData*
DrillingData::Clone( void) const
{
// alloco oggetto
DrillingData* pDdata = new(nothrow) DrillingData ;
// copio i dati
if ( pDdata != nullptr) {
if ( ! pDdata->CopyFrom( this)) {
delete pDdata ;
return nullptr ;
}
}
return pDdata ;
}
//----------------------------------------------------------------------------
bool
DrillingData::CopyFrom( const MachiningData* pMdata)
{
// è inutile copiare se sorgente coincide con destinazione
if ( pMdata == this)
return true ;
// la sorgente deve essere dello stesso tipo
const DrillingData* pDdata = dynamic_cast<const DrillingData*>( pMdata) ;
if ( pDdata == nullptr)
return false ;
// eseguo copia
m_Uuid = pDdata->m_Uuid ;
m_sName = pDdata->m_sName ;
m_ToolUuid = pDdata->m_ToolUuid ;
m_sToolName = pDdata->m_sToolName ;
m_bInvert = pDdata->m_bInvert ;
m_dStartPos = pDdata->m_dStartPos ;
m_dStartSlowLen = pDdata->m_dStartSlowLen ;
m_dEndSlowLen = pDdata->m_dEndSlowLen ;
m_dThroughAddLen = pDdata->m_dThroughAddLen ;
m_dStep = pDdata->m_dStep ;
m_dReturnPos = pDdata->m_dReturnPos ;
return true ;
}
//----------------------------------------------------------------------------
bool
DrillingData::SameAs(const MachiningData* pMdata) const
{
// se coincide con altro -> uguali
if ( pMdata == this)
return true ;
// se sono di tipo diverso -> diversi
const DrillingData* pDdata = dynamic_cast<const DrillingData*>( pMdata) ;
if ( pDdata == nullptr)
return false ;
// confronto termine a termine
return ( m_Uuid == pDdata->m_Uuid &&
m_sName == pDdata->m_sName &&
m_ToolUuid == pDdata->m_ToolUuid &&
m_sToolName == pDdata->m_sToolName &&
m_bInvert == pDdata->m_bInvert &&
m_dStartPos == pDdata->m_dStartPos &&
m_dStartSlowLen == pDdata->m_dStartSlowLen &&
m_dEndSlowLen == pDdata->m_dEndSlowLen &&
m_dThroughAddLen == pDdata->m_dThroughAddLen &&
m_dStep == pDdata->m_dStep &&
m_dReturnPos == pDdata->m_dReturnPos) ;
}
//----------------------------------------------------------------------------
int
@@ -116,7 +183,6 @@ DrillingData::FromString( const string& sString, int& nKey)
break ;
case KEY_TNAME :
m_sToolName = sVal ;
bOk = ! m_sToolName.empty() ;
break ;
case KEY_TUUID :
bOk = ::FromString( sVal, m_ToolUuid) ;
@@ -153,14 +219,11 @@ DrillingData::ToString( int nInd) const
//----------------------------------------------------------------------------
bool
DrillingData::VerifyTool( MachMgr* pMachMgr, const std::string& sVal, const ToolData*& pTdata) const
DrillingData::VerifyTool( const ToolsMgr* pToolsMgr, const std::string& sVal, const ToolData*& pTdata) const
{
if ( pMachMgr == nullptr)
if ( pToolsMgr == nullptr)
return false ;
ToolsMgr* pTMgr = pMachMgr->GetCurrToolsMgr() ;
if ( pTMgr == nullptr)
return false ;
pTdata = pTMgr->GetTool( sVal) ;
pTdata = pToolsMgr->GetTool( sVal) ;
if ( pTdata == nullptr)
return false ;
if ( ( pTdata->m_nType & TF_DRILLBIT) == 0 ||
@@ -168,3 +231,135 @@ DrillingData::VerifyTool( MachMgr* pMachMgr, const std::string& sVal, const Tool
return false ;
return true ;
}
//----------------------------------------------------------------------------
bool
DrillingData::SetParam( int nType, bool bVal)
{
switch ( nType) {
case MPA_INVERT :
m_bInvert = bVal ;
return true ;
}
return false ;
}
//----------------------------------------------------------------------------
bool
DrillingData::SetParam( int nType, int nVal)
{
return false ;
}
//----------------------------------------------------------------------------
bool
DrillingData::SetParam( int nType, double dVal)
{
switch ( nType) {
case MPA_STARTPOS :
m_dStartPos = dVal ;
return true ;
case MPA_STARTSLOWLEN :
m_dStartSlowLen = dVal ;
return true ;
case MPA_ENDSLOWLEN :
m_dEndSlowLen = dVal ;
return true ;
case MPA_THROUADDLEN :
m_dThroughAddLen = dVal ;
return true ;
case MPA_STEP :
m_dStep = dVal ;
return true ;
case MPA_RETURNPOS :
m_dReturnPos = dVal ;
return true ;
}
return false ;
}
//----------------------------------------------------------------------------
bool
DrillingData::SetParam( int nType, const string& sVal)
{
switch ( nType) {
case MPA_NAME :
m_sName = sVal ;
return true ;
case MPA_TOOL :
m_sToolName = sVal ;
return true ;
case MPA_TUUID :
return ::FromString( sVal, m_ToolUuid) ;
case MPA_UUID :
return ::FromString( sVal, m_Uuid) ;
}
return false ;
}
//----------------------------------------------------------------------------
bool
DrillingData::GetParam( int nType, bool& bVal) const
{
switch ( nType) {
case MPA_INVERT :
bVal = m_bInvert ;
return true ;
}
return false ;
}
//----------------------------------------------------------------------------
bool
DrillingData::GetParam( int nType, int& nVal) const
{
return false ;
}
//----------------------------------------------------------------------------
bool
DrillingData::GetParam( int nType, double& dVal) const
{
switch ( nType) {
case MPA_STARTPOS :
dVal = m_dStartPos ;
return true ;
case MPA_STARTSLOWLEN :
dVal = m_dStartSlowLen ;
return true ;
case MPA_ENDSLOWLEN :
dVal = m_dEndSlowLen ;
return true ;
case MPA_THROUADDLEN :
dVal = m_dThroughAddLen ;
return true ;
case MPA_STEP :
dVal = m_dStep ;
return true ;
case MPA_RETURNPOS :
dVal = m_dReturnPos ;
return true ;
}
return false ;
}
//----------------------------------------------------------------------------
bool
DrillingData::GetParam( int nType, string& sVal) const
{
switch ( nType) {
case MPA_NAME :
sVal = m_sName ;
return true ;
case MPA_TOOL :
sVal = m_sToolName ;
return true ;
case MPA_TUUID :
sVal = ::ToString( m_ToolUuid) ;
return true ;
case MPA_UUID :
sVal = ::ToString( m_Uuid) ;
return true ;
}
return false ;
}