EgtMachKernel 2.4i :

- aggiunta gestione offset assi per visualizzazione
- correzioni in Milling e Pocketing per approcci e retrazioni con TiltingTab (comprende asse rotante tipo ralla).
This commit is contained in:
DarioS
2022-09-24 18:53:47 +02:00
parent dffc7ec956
commit ff6aae071a
14 changed files with 103 additions and 41 deletions
+26 -5
View File
@@ -70,6 +70,7 @@ Simulator::Simulator( void)
m_dVmTdOffs = 0 ;
m_dVmAdOffs = 0 ;
m_dSafeDist = SAFEDIST_STD ;
m_nAxesMask = 0 ;
m_bEnabAxes = true ;
m_bShowAxes = true ;
m_AxesName.reserve( 8) ;
@@ -208,6 +209,7 @@ Simulator::ResetInterpolation( void)
m_dVmTdOffs = 0 ;
m_dVmAdOffs = 0 ;
m_dSafeDist = SAFEDIST_STD ;
m_nAxesMask = 0 ;
m_bEnabAxes = true ;
m_bShowAxes = true ;
return true ;
@@ -311,14 +313,16 @@ Simulator::GetAxisInfoPos( int nI, string& sName, string& sToken, bool& bLinear,
// recupero la posizione
if ( ! m_pMchMgr->GetAxisPos( sName, dVal))
return false ;
// verifico se da invertire
// verifico se da invertire o offsettare
if ( nI < nAxisCount) {
if ( m_AxesInvert[nI])
dVal = - dVal ;
dVal += m_AxesOffset[nI] ;
}
else {
if ( m_AuxAxesInvert[nI - nAxisCount])
dVal = - dVal ;
dVal += m_AxesOffset[nI - nAxisCount] ;
}
return true ;
}
@@ -552,6 +556,9 @@ Simulator::UpdateAxes( void)
bool bInvert ;
m_pMachine->GetAxisInvert( m_AxesName[i], bInvert) ;
m_AxesInvert.push_back( bInvert) ;
double dOffset ;
m_pMachine->GetAxisOffset( m_AxesName[i], dOffset) ;
m_AxesOffset.push_back( dOffset) ;
bool bLinear ;
m_pMachine->GetAxisType( m_AxesName[i], bLinear) ;
m_AxesLinear.push_back( bLinear) ;
@@ -590,6 +597,7 @@ Simulator::ResetAxes( void)
m_AxesInvert.clear() ;
m_AxesLinear.clear() ;
m_AxesVal.clear() ;
m_nAxesMask = 0 ;
return true ;
}
@@ -601,6 +609,7 @@ Simulator::ResetAuxAxes( void)
m_AuxAxesName.clear() ;
m_AuxAxesToken.clear() ;
m_AuxAxesInvert.clear() ;
m_AuxAxesOffset.clear() ;
m_AuxAxesLinear.clear() ;
m_AuxAxesVal.clear() ;
m_AuxAxesEnd.clear() ;
@@ -943,10 +952,13 @@ Simulator::ManageSingleMove( int& nStatus, double& dMove)
DBLVECTOR AxesEnd = pCamData->GetAxesVal() ;
// Tipo di movimento
int nMoveType = pCamData->GetMoveType() ;
// Se inizio di nuova entità, mascheratura movimento
if ( m_nEntId != GDB_ID_NULL && m_dCoeff < EPS_ZERO)
m_nAxesMask = pCamData->GetAxesMask() ;
// Se movimento in rapido muovo solo gli assi abilitati dal mask
if ( nMoveType == 0) {
for ( size_t i = 0 ; i < m_AxesName.size() ; ++ i) {
if ( ( pCamData->GetAxesMask() & 1 << i) == 0)
if ( ( m_nAxesMask & 1 << i) == 0)
AxesEnd[i] = m_AxesVal[i] ;
}
}
@@ -962,7 +974,7 @@ Simulator::ManageSingleMove( int& nStatus, double& dMove)
// Se movimento in rapido aggiorno quote degli assi disabilitati dal mask
if ( nMoveType == 0) {
for ( size_t i = 0 ; i < m_AxesName.size() ; ++ i) {
if ( ( pCamData->GetAxesMask() & 1 << i) == 0)
if ( ( m_nAxesMask & 1 << i) == 0)
AxesEnd[i] = m_AxesVal[i] ;
}
}
@@ -1511,15 +1523,17 @@ Simulator::OnToolSelect( const string& sTool, const string& sHead, int nExit, co
m_AuxAxesName.reserve( nNumAuxAxes) ;
m_AuxAxesToken.reserve( nNumAuxAxes) ;
m_AuxAxesInvert.reserve( nNumAuxAxes) ;
m_AuxAxesOffset.reserve( nNumAuxAxes) ;
m_AuxAxesLinear.reserve( nNumAuxAxes) ;
m_AuxAxesVal.reserve( nNumAuxAxes) ;
m_AuxAxesEnd.reserve( nNumAuxAxes) ;
for ( int i = 1 ; i <= nNumAuxAxes && bOk ; ++ i) {
string sName ; string sToken ; bool bInvert ; bool bLinear ; double dVal ;
string sName ; string sToken ; bool bInvert ; double dOffset ; bool bLinear ; double dVal ;
string sAuxAxName = GLOB_VAR + GVAR_ANN ; ReplaceString( sAuxAxName, "N", ToString( i)) ;
if ( m_pMachine->LuaGetGlobVar( sAuxAxName, sName) &&
m_pMachine->GetAxisToken( sName, sToken) &&
m_pMachine->GetAxisInvert( sName, bInvert) &&
m_pMachine->GetAxisOffset( sName, dOffset) &&
m_pMachine->GetAxisType( sName, bLinear) &&
m_pMachine->GetAxisPos( sName, dVal)) {
// se non è già negli assi principali, lo aggiungo
@@ -1527,6 +1541,7 @@ Simulator::OnToolSelect( const string& sTool, const string& sHead, int nExit, co
m_AuxAxesName.emplace_back( sName) ;
m_AuxAxesToken.emplace_back( sToken) ;
m_AuxAxesInvert.push_back( bInvert) ;
m_AuxAxesOffset.push_back( dOffset) ;
m_AuxAxesLinear.push_back( bLinear) ;
m_AuxAxesVal.emplace_back( dVal) ;
m_AuxAxesEnd.emplace_back( dVal) ;
@@ -1713,6 +1728,7 @@ Simulator::OnMoveStart( const CamData* pCamData, int& nErr)
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVEID, m_nEntId) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVEIND, m_nEntInd) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVE, pCamData->GetMoveType()) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_AXESMASK, pCamData->GetAxesMask()) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_FLAG, pCamData->GetFlag()) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_FLAG2, pCamData->GetFlag2()) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_INDEX, pCamData->GetIndex()) ;
@@ -1764,6 +1780,7 @@ Simulator::OnMoveStart( const CamData* pCamData, int& nErr)
ResetAuxAxes() ;
// recupero i dati di ritorno
m_pMachine->LuaGetGlobVar( GLOB_VAR + GVAR_AXESMASK, m_nAxesMask) ;
if ( ! m_pMachine->LuaGetGlobVar( GLOB_VAR + GVAR_ENABAXES, m_bEnabAxes))
m_bEnabAxes = true ;
if ( ! m_pMachine->LuaGetGlobVar( GLOB_VAR + GVAR_SHOWAXES, m_bShowAxes))
@@ -1774,17 +1791,19 @@ Simulator::OnMoveStart( const CamData* pCamData, int& nErr)
m_AuxAxesName.reserve( nNumAuxAxes) ;
m_AuxAxesToken.reserve( nNumAuxAxes) ;
m_AuxAxesInvert.reserve( nNumAuxAxes) ;
m_AuxAxesOffset.reserve( nNumAuxAxes) ;
m_AuxAxesLinear.reserve( nNumAuxAxes) ;
m_AuxAxesVal.reserve( nNumAuxAxes) ;
m_AuxAxesEnd.reserve( nNumAuxAxes) ;
for ( int i = 1 ; i <= nNumAuxAxes && bOk ; ++ i) {
string sName ; string sToken ; bool bInvert ; bool bLinear ; double dVal ; double dEnd ; string sLink ;
string sName ; string sToken ; bool bInvert ; double dOffset ; bool bLinear ; double dVal ; double dEnd ; string sLink ;
string sAuxAxVal = GLOB_VAR + GVAR_AN ; ReplaceString( sAuxAxVal, "N", ToString( i)) ;
string sAuxAxName = GLOB_VAR + GVAR_ANN ; ReplaceString( sAuxAxName, "N", ToString( i)) ;
string sAuxAxMaster = GLOB_VAR + GVAR_ANM ; ReplaceString( sAuxAxMaster, "N", ToString( i)) ;
if ( m_pMachine->LuaGetGlobVar( sAuxAxName, sName) &&
m_pMachine->GetAxisToken( sName, sToken) &&
m_pMachine->GetAxisInvert( sName, bInvert) &&
m_pMachine->GetAxisOffset( sName, dOffset) &&
m_pMachine->GetAxisType( sName, bLinear) &&
m_pMachine->GetAxisPos( sName, dVal)) {
// se assi principali abilitati e da agganciare ad asse principale
@@ -1801,6 +1820,7 @@ Simulator::OnMoveStart( const CamData* pCamData, int& nErr)
m_AuxAxesName.emplace_back( sName) ;
m_AuxAxesToken.emplace_back( sToken) ;
m_AuxAxesInvert.push_back( bInvert) ;
m_AuxAxesOffset.push_back( dOffset) ;
m_AuxAxesLinear.push_back( bLinear) ;
m_AuxAxesVal.emplace_back( 0) ;
m_AuxAxesEnd.emplace_back( 0) ;
@@ -1814,6 +1834,7 @@ Simulator::OnMoveStart( const CamData* pCamData, int& nErr)
m_AuxAxesName.emplace_back( sName) ;
m_AuxAxesToken.emplace_back( sToken) ;
m_AuxAxesInvert.push_back( bInvert) ;
m_AuxAxesOffset.push_back( dOffset) ;
m_AuxAxesLinear.push_back( bLinear) ;
m_AuxAxesVal.emplace_back( dVal) ;
m_AuxAxesEnd.emplace_back( dEnd) ;