diff --git a/MachMgr.h b/MachMgr.h index 626c357..cec5c7a 100644 --- a/MachMgr.h +++ b/MachMgr.h @@ -290,7 +290,7 @@ class MachMgr : public IMachMgr bool LimitAngleToStroke( int nInd, double& dAng) const override ; bool VerifyOutstroke( double dX, double dY, double dZ, double dAngA, double dAngB, int& nStat) override ; bool VerifyOutstroke( double dX, double dY, double dZ, const DBLVECTOR& vAng, int& nStat) ; - const std::string& GetOutstrokeInfo( void) const override ; + std::string GetOutstrokeInfo( bool bMM = true) const override ; // Machine int GetBaseId( const std::string& sBase) const override ; int GetTableId( const std::string& sTable) const override ; diff --git a/MachMgrMachines.cpp b/MachMgrMachines.cpp index 367176f..381c01f 100644 --- a/MachMgrMachines.cpp +++ b/MachMgrMachines.cpp @@ -630,15 +630,15 @@ MachMgr::VerifyOutstroke( double dX, double dY, double dZ, const DBLVECTOR& vAng } //---------------------------------------------------------------------------- -const std::string& -MachMgr::GetOutstrokeInfo( void) const +std::string +MachMgr::GetOutstrokeInfo( bool bMM) const { Machine* pMch = GetCurrMachine() ; if ( pMch == nullptr) { static string sNull = "" ; return sNull ; } - return pMch->GetOutstrokeInfo() ; + return pMch->GetOutstrokeInfo( bMM) ; } //---------------------------------------------------------------------------- diff --git a/Machine.h b/Machine.h index 7d1faf7..e60e8a7 100644 --- a/Machine.h +++ b/Machine.h @@ -122,8 +122,7 @@ class Machine bool LimitAngleToStroke( int nInd, double& dAng) const ; bool VerifyAngleOutstroke( int nInd, double dAng) const ; bool VerifyOutstroke( double dX, double dY, double dZ, const DBLVECTOR& vAng, int& nStat) const ; - const std::string& GetOutstrokeInfo( void) const - { return m_sOutstrokeInfo ; } + std::string GetOutstrokeInfo( bool bMM = true) const ; bool SetLook( int nFlag) ; int GetLook( void) { return m_nMachineLook ; } @@ -252,7 +251,7 @@ class Machine double m_dCalcTOvRad ; // raggio di ingombro utensile corrente per calcoli KINAXISVECTOR m_vCalcLinAx ; // vettore assi lineari attivi per calcoli KINAXISVECTOR m_vCalcRotAx ; // vettore assi rotanti attivi per calcoli - mutable std::string m_sOutstrokeInfo ; // informazioni su ultimo extra corsa + mutable OutStroke m_OutstrokeInfo ; // informazioni su ultima extra corsa // stato di visualizzazione int m_nMachineLook ; // stato di visualizzazione della macchina diff --git a/MachineCalc.cpp b/MachineCalc.cpp index e566ac6..b3730de 100644 --- a/MachineCalc.cpp +++ b/MachineCalc.cpp @@ -1230,41 +1230,59 @@ Machine::VerifyOutstroke( double dX, double dY, double dZ, const DBLVECTOR& vAng { // default tutto ok nStat = 0 ; - m_sOutstrokeInfo.clear() ; + m_OutstrokeInfo.Clear() ; // verifica degli assi lineari DBLVECTOR vLin( 3) ; vLin[0] = dX ; vLin[1] = dY ; vLin[2] = dZ ; for ( size_t i = 0 ; i < m_vCalcLinAx.size() && i < vLin.size() ; ++ i) { if ( vLin[i] < m_vCalcLinAx[i].stroke.Min) { nStat += ( 1 << ( 2 * i)) ; - string sAxName = GetAxis( m_vCalcLinAx[i].nGrpId)->GetName() ; - m_sOutstrokeInfo += sAxName + "=" + ToString( vLin[i] - m_vCalcLinAx[i].stroke.Min, 1) + - " (L" + ToString( int(i) + 1) + "-) " ; + m_OutstrokeInfo.sAxName = GetAxis( m_vCalcLinAx[i].nGrpId)->GetName() ; + m_OutstrokeInfo.sAxToken = GetAxis( m_vCalcLinAx[i].nGrpId)->GetToken() ; + m_OutstrokeInfo.bLinear = true ; + m_OutstrokeInfo.dExtra = vLin[i] - m_vCalcLinAx[i].stroke.Min ; + m_OutstrokeInfo.sAuxInfo = " (L" + ToString( int(i) + 1) + "-) " ; } else if( vLin[i] > m_vCalcLinAx[i].stroke.Max) { nStat += ( 2 << ( 2 * i)) ; - string sAxName = GetAxis( m_vCalcLinAx[i].nGrpId)->GetName() ; - m_sOutstrokeInfo += sAxName + "=" + ToString( vLin[i] - m_vCalcLinAx[i].stroke.Max, 1) + - " (L" + ToString( int(i) + 1) + "+) " ; + m_OutstrokeInfo.sAxName = GetAxis( m_vCalcLinAx[i].nGrpId)->GetName() ; + m_OutstrokeInfo.sAxToken = GetAxis( m_vCalcLinAx[i].nGrpId)->GetToken() ; + m_OutstrokeInfo.bLinear = true ; + m_OutstrokeInfo.dExtra = vLin[i] - m_vCalcLinAx[i].stroke.Max ; + m_OutstrokeInfo.sAuxInfo = " (L" + ToString( int(i) + 1) + "+) " ; } } // verifica degli assi rotanti for ( size_t i = 0 ; i < m_vCalcRotAx.size() && i < vAng.size() ; ++ i) { if ( vAng[i] < m_vCalcRotAx[i].stroke.Min) { nStat += ( 64 << ( 2 * i)) ; - string sAxName = GetAxis( m_vCalcRotAx[i].nGrpId)->GetName() ; - m_sOutstrokeInfo += sAxName + "=" + ToString( vAng[i] - m_vCalcRotAx[i].stroke.Min, 1) + - " (R" + ToString( int(i) + 1) + "-) " ; + m_OutstrokeInfo.sAxName = GetAxis( m_vCalcRotAx[i].nGrpId)->GetName() ; + m_OutstrokeInfo.sAxToken = GetAxis( m_vCalcRotAx[i].nGrpId)->GetToken() ; + m_OutstrokeInfo.bLinear = false ; + m_OutstrokeInfo.dExtra = vAng[i] - m_vCalcRotAx[i].stroke.Min ; + m_OutstrokeInfo.sAuxInfo = " (R" + ToString( int(i) + 1) + "-) " ; } else if( vAng[i] > m_vCalcRotAx[i].stroke.Max) { nStat += ( 128 << ( 2 * i)) ; - string sAxName = GetAxis( m_vCalcRotAx[i].nGrpId)->GetName() ; - m_sOutstrokeInfo += sAxName + "=" + ToString( vAng[i] - m_vCalcRotAx[i].stroke.Max, 1) + - " (R" + ToString( int(i) + 1) + "+) " ; + m_OutstrokeInfo.sAxName = GetAxis( m_vCalcRotAx[i].nGrpId)->GetName() ; + m_OutstrokeInfo.sAxToken = GetAxis( m_vCalcRotAx[i].nGrpId)->GetToken() ; + m_OutstrokeInfo.bLinear = false ; + m_OutstrokeInfo.dExtra = vAng[i] - m_vCalcRotAx[i].stroke.Max ; + m_OutstrokeInfo.sAuxInfo = " (R" + ToString( int(i) + 1) + "+) " ; } } return true ; } +//---------------------------------------------------------------------------- +std::string +Machine::GetOutstrokeInfo( bool bMM) const +{ + if ( bMM || ! m_OutstrokeInfo.bLinear) + return m_OutstrokeInfo.sAxToken + "=" + ToString( m_OutstrokeInfo.dExtra, 1) + m_OutstrokeInfo.sAuxInfo ; + else + return m_OutstrokeInfo.sAxToken + "=" + ToString( m_OutstrokeInfo.dExtra / ONEINCH, 2) + m_OutstrokeInfo.sAuxInfo ; +} + //---------------------------------------------------------------------------- int Machine::GetCurrLinAxes( void) const diff --git a/MachineStruConst.h b/MachineStruConst.h index 0edd5f8..3efef06 100644 --- a/MachineStruConst.h +++ b/MachineStruConst.h @@ -56,6 +56,19 @@ struct KinAxis { } ; typedef std::vector KINAXISVECTOR ; +//---------------------------------------------------------------------------- +// Dati extra corsa di un asse +struct OutStroke { + std::string sAxName ; + std::string sAxToken ; + bool bLinear ; + double dExtra ; + std::string sAuxInfo ; + OutStroke( void) : bLinear( false), dExtra( 0) {} + void Clear( void) + { sAxName.clear() ; sAxToken.clear() ; bLinear = false ; dExtra = 0 ; sAuxInfo.clear() ; } +} ; + //---------------------------------------------------------------------------- // Tipo di tavola della macchina enum MchTabType { MCH_TT_NONE = 0,