EgtMachKernel 1.6x5 :

- ora OnSpecialApplyDisposition gestisce anche TcPos
- aggiunta possibilità di richiamo OnPostApplyMachining al termine ricalcolo lavorazione
- aggiunta funzione Lua EmtGetAxesPos
- piccole migliorie a simulazione.
This commit is contained in:
Dario Sassi
2017-01-03 09:18:22 +00:00
parent 3587b88a61
commit d9c080c6d6
14 changed files with 142 additions and 21 deletions
+23 -11
View File
@@ -44,6 +44,7 @@ static std::string DIS_MVD_FLAG = "MvF" ;
static std::string DIS_NUM = "NUM" ;
static std::string DIS_HEAD = "Head" ;
static std::string DIS_EXIT = "Exit" ;
static std::string DIS_TCPOS = "TcPos" ;
static std::string DIS_SOMEBYHAND = "Sbh" ;
//----------------------------------------------------------------------------
static double DISP_BOX_TOL = - 0.5 ;
@@ -74,6 +75,7 @@ Disposition::Clone( void) const
pDisp->m_vMvrData = m_vMvrData ;
pDisp->m_sHead = m_sHead ;
pDisp->m_nExit = m_nExit ;
pDisp->m_sTcPos = m_sTcPos ;
pDisp->m_nShifts = m_nShifts ;
pDisp->m_bSomeByHand = m_bSomeByHand ;
}
@@ -122,6 +124,7 @@ Disposition::Dump( string& sOut, bool bMM, const char* szNewLine) const
sOut += "Num=" + ToString( m_nShifts) + szNewLine ;
sOut += "Head=" + m_sHead + szNewLine ;
sOut += "Exit=" + ToString( m_nExit) + szNewLine ;
sOut += "TcPos=" + m_sTcPos + szNewLine ;
sOut += "ByHand=" + ToString( m_bSomeByHand) + szNewLine ;
return true ;
}
@@ -136,7 +139,7 @@ Disposition::Save( STRVECTOR& vString) const
int nFxdLines = 1 + 4 * nFxdTot ;
int nMvdTot = int( m_vMvrData.size()) ;
int nMvdLines = 1 + 4 * nMvdTot ;
int nOther = 4 ;
int nOther = 5 ;
vString.insert( vString.begin(), 4 + nFxdLines + nMvdLines + nOther, "") ;
// Nome
if ( ! SetVal( DIS_TABLE, m_sTabName, vString[++k]))
@@ -179,6 +182,8 @@ Disposition::Save( STRVECTOR& vString) const
return false ;
if ( ! SetVal( DIS_SOMEBYHAND, m_bSomeByHand, vString[++k]))
return false ;
if ( ! SetVal( DIS_TCPOS, m_sTcPos, vString[++k]))
return false ;
}
catch( ...) { return false ; }
return true ;
@@ -257,6 +262,10 @@ Disposition::Load( const STRVECTOR& vString, int nBaseGdbId)
if ( ! GetVal( vString[++k], DIS_SOMEBYHAND, m_bSomeByHand))
return false ;
}
if ( k + 1 < int( vString.size())) {
if ( ! GetVal( vString[++k], DIS_TCPOS, m_sTcPos))
return false ;
}
return true ;
}
@@ -1005,16 +1014,12 @@ bool
Disposition::SpecialApply( bool bRecalc)
{
// reset
m_sHead.empty() ;
m_sHead.clear() ;
m_nExit = 0 ;
m_nShifts = 0 ;
// verifico tavola
if ( ! m_bTabOk && ! SetTable( m_sTabName))
return false ;
// recupero la macchina corrente
Machine* pMch = m_pMchMgr->GetCurrMachine() ;
if ( pMch == nullptr)
return false ;
m_bSomeByHand = false ;
m_sTcPos.clear() ;
// costanti
static const string EMC_VAR = "EMC" ; // tabella variabili locali per calcolo
static const string EVAR_TABNAME = ".TABNAME" ; // IN (string) nome della tavola macchina
@@ -1027,10 +1032,17 @@ Disposition::SpecialApply( bool bRecalc)
static const string EVAR_SBH = ".SBH" ; // OUT (bool) flag presenza operazioni manuali
static const string ON_SPECIAL_APPLY = "OnSpecialApplyDisposition" ;
// recupero la macchina corrente
Machine* pMch = m_pMchMgr->GetCurrMachine() ;
if ( pMch == nullptr)
return false ;
// eseguo l'azione
if ( pMch->LuaExistsFunction( ON_SPECIAL_APPLY)) {
bool bOk = true ;
int nErr = 99 ;
// verifico tavola
bOk = ( m_bTabOk || SetTable( m_sTabName)) ;
// imposto valori parametri
bOk = bOk && pMch->LuaCreateGlobTable( EMC_VAR) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TABNAME, m_sTabName) ;
@@ -1044,8 +1056,8 @@ Disposition::SpecialApply( bool bRecalc)
bOk = bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_SHIFTS, m_nShifts) ;
bOk = bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_SBH, m_bSomeByHand) ;
// recupero valori parametri opzionali
if ( ! pMch->LuaGetGlobVar( EMC_VAR + EVAR_TCPOS, m_sTcPos))
m_sTcPos.clear() ;
if ( bOk)
pMch->LuaGetGlobVar( EMC_VAR + EVAR_TCPOS, m_sTcPos) ;
// reset
bOk = bOk && pMch->LuaResetGlobVar( EMC_VAR) ;
// segnalo errori