EgtMachKernel 1.6w1 :

- in simulazione si restituiscono info anche su assi ausiliari e info su tipo asse (lineare o rotante)
- in generazione assegnata max speed a EMT.SMAX su evento OnToolData.
This commit is contained in:
Dario Sassi
2016-11-01 19:05:50 +00:00
parent eb313337e4
commit 9819ad1e9f
9 changed files with 88 additions and 23 deletions
+34 -10
View File
@@ -40,6 +40,7 @@ Simulator::Simulator( void)
m_dCoeff = 0 ;
m_AxesName.reserve( 8) ;
m_AxesToken.reserve( 8) ;
m_AxesLinear.reserve( 8) ;
m_AxesVal.reserve( 8) ;
}
@@ -77,6 +78,7 @@ Simulator::Start( void)
m_sTool.clear() ;
m_AxesName.clear() ;
m_AxesToken.clear() ;
m_AxesLinear.clear() ;
// porto la macchina in home
if ( ! GoHome())
return false ;
@@ -386,22 +388,34 @@ Simulator::Move( int& nStatus)
//----------------------------------------------------------------------------
bool
Simulator::GetAxisInfoPos( int nI, string& sToken, double& dVal)
Simulator::GetAxisInfoPos( int nI, string& sToken, bool& bLinear, double& dVal) const
{
// Verifiche
if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr)
return false ;
// numero assi di calcolo e ausiliari
int nAxisCount = int( m_AxesName.size()) ;
int nAuxAxisCount = int( m_AuxAxesName.size()) ;
// recupero i dati dell'asse
if ( nI < 0 || nI >= int( m_AxesName.size()))
if ( nI < 0 || nI >= nAxisCount + nAuxAxisCount)
return false ;
string sName = m_AxesName[nI] ;
sToken = m_AxesToken[nI] ;
string sName ;
if ( nI < nAxisCount) {
sName = m_AxesName[nI] ;
sToken = m_AxesToken[nI] ;
bLinear = m_AxesLinear[nI] ;
}
else {
sName = m_AuxAxesName[ nI - nAxisCount] ;
sToken = m_AuxAxesToken[ nI - nAxisCount] ;
bLinear = m_AuxAxesLinear[ nI - nAxisCount] ;
}
return m_pMchMgr->GetAxisPos( sName, dVal) ;
}
//----------------------------------------------------------------------------
bool
Simulator::GetToolInfo( string& sName, double& dSpeed)
Simulator::GetToolInfo( string& sName, double& dSpeed) const
{
// Verifiche
if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr)
@@ -419,7 +433,7 @@ Simulator::GetToolInfo( string& sName, double& dSpeed)
//----------------------------------------------------------------------------
bool
Simulator::GetMoveInfo( int& nGmove, double& dFeed)
Simulator::GetMoveInfo( int& nGmove, double& dFeed) const
{
// Verifiche
if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr)
@@ -566,9 +580,12 @@ Simulator::UpdateAxes( void)
if ( ! pMachine->GetAllCurrAxesName( m_AxesName) ||
! pMachine->GetAllCurrAxesToken( m_AxesToken))
return false ;
// Aggiorno la posizione corrente degli assi macchina attivi
// Aggiorno il tipo e la posizione corrente degli assi macchina attivi
m_AxesVal.clear() ;
for ( size_t i = 0 ; i < m_AxesName.size() ; ++ i) {
bool bLinear ;
m_pMachine->GetAxisType(m_AxesName[i], bLinear) ;
m_AxesLinear.push_back( bLinear) ;
double dVal ;
m_pMachine->GetAxisPos( m_AxesName[i], dVal) ;
m_AxesVal.emplace_back( dVal) ;
@@ -779,6 +796,8 @@ Simulator::OnMoveStart( const CamData* pCamData)
{
// pulisco dati assi ausiliari
m_AuxAxesName.clear() ;
m_AuxAxesToken.clear() ;
m_AuxAxesLinear.clear() ;
m_AuxAxesVal.clear() ;
m_AuxAxesEnd.clear() ;
@@ -820,16 +839,21 @@ Simulator::OnMoveStart( const CamData* pCamData)
if ( ! m_pMachine->LuaGetGlobVar( GLOB_VAR + GVAR_AUXAXES, nNumAuxAxes) || nNumAuxAxes == 0)
return true ;
m_AuxAxesName.reserve( nNumAuxAxes) ;
m_AuxAxesToken.reserve( nNumAuxAxes) ;
m_AuxAxesVal.reserve( nNumAuxAxes) ;
m_AuxAxesEnd.reserve( nNumAuxAxes) ;
for ( int i = 1 ; i <= nNumAuxAxes && bOk ; ++ i) {
string sName ; double dVal ; double dEnd ;
string sName ; string sToken ; bool bLinear ; double dVal ; double dEnd ;
string sAuxAxVal = GLOB_VAR + GVAR_AN ; ReplaceString( sAuxAxVal, "N", ToString( i)) ;
string sAuxAxName = GLOB_VAR + GVAR_ANN ; ReplaceString( sAuxAxName, "N", ToString( i)) ;
if ( m_pMachine->LuaGetGlobVar( sAuxAxName, sName) &&
m_pMachine->GetAxisPos( sName, dVal) &&
m_pMachine->LuaGetGlobVar( sAuxAxVal, dEnd)) {
m_pMachine->GetAxisToken( sName, sToken) &&
m_pMachine->GetAxisType( sName, bLinear) &&
m_pMachine->GetAxisPos( sName, dVal) &&
m_pMachine->LuaGetGlobVar( sAuxAxVal, dEnd)) {
m_AuxAxesName.emplace_back( sName) ;
m_AuxAxesToken.emplace_back( sToken) ;
m_AuxAxesLinear.push_back( bLinear) ;
m_AuxAxesVal.emplace_back( dVal) ;
m_AuxAxesEnd.emplace_back( dEnd) ;
}