EgtMachKernel 1.9e2 :

- migliorata gestione velocità simulazione con Virtual Milling.
This commit is contained in:
Dario Sassi
2018-05-06 16:58:17 +00:00
parent 64d4b20f6a
commit afec834281
3 changed files with 36 additions and 3 deletions
+35 -3
View File
@@ -32,6 +32,9 @@ using namespace std ;
//------------------------------ Errors --------------------------------------
// 1001 = "Error with setup : xxx"
//----------------------------------------------------------------------------
const double COEFF_LIM = 0.999 ;
//----------------------------------------------------------------------------
Simulator::Simulator( void)
{
@@ -159,7 +162,7 @@ Simulator::Move( int& nStatus)
}
// Se arrivato alla fine dell'interpolazione
if ( m_dCoeff > 0.999) {
if ( m_dCoeff > COEFF_LIM) {
// recupero una nuova entità
m_nEntId = m_pGeomDB->GetNext( m_nEntId) ;
m_dCoeff = 0 ;
@@ -851,6 +854,32 @@ Simulator::ManagePathEndAux( int& nStatus)
//----------------------------------------------------------------------------
bool
Simulator::ManageMove( int& nStatus)
{
// Imposto lunghezza di movimento effettuata
double dCurrMove = 0 ;
while ( m_nEntId != GDB_ID_NULL) {
// eseguo movimento singolo
double dMove ;
if ( ! ManageSingleMove( nStatus, dMove))
return false ;
if ( Stopped())
return true ;
dCurrMove += dMove ;
// se non raggiunto lo step
if ( m_dCoeff > COEFF_LIM && dCurrMove < 0.9 * m_dStep) {
// recupero una nuova entità
m_nEntId = m_pGeomDB->GetNext( m_nEntId) ;
m_dCoeff = 0 ;
}
else
break ;
}
return true ;
}
//----------------------------------------------------------------------------
bool
Simulator::ManageSingleMove( int& nStatus, double& dMove)
{
// Recupero posizione finale
const CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( m_nEntId)) ;
@@ -909,7 +938,7 @@ Simulator::ManageMove( int& nStatus)
// Calcolo distanza di movimento
double dSqDist = 0 ;
for ( size_t i = 0 ; i < m_AxesName.size() ; ++ i) {
// coefficiente moltiplicativo per differenziare assi lineari (primi3) e rotanti (altri)
// coefficiente moltiplicativo per differenziare assi lineari (primi 3) e rotanti (altri)
double dSqCoeff = (( i < 3) ? 1 : 100) ;
dSqDist += dSqCoeff * ( AxesEnd[i] - m_AxesVal[i]) * ( AxesEnd[i] - m_AxesVal[i]) ;
}
@@ -923,6 +952,7 @@ Simulator::ManageMove( int& nStatus)
}
else
m_dCoeff = 1 ;
dMove = ( m_dCoeff - dPrevCoeff) * dDist ;
// Posizione e direzione attuali dell'utensile e riferimento attuale del pezzo (per Vmill)
Point3d ptNoseI ; Vector3d vtDirI ; Vector3d vtAuxI ; Frame3d frVzmI ;
@@ -992,6 +1022,7 @@ Simulator::ManageMove( int& nStatus)
double dSqCoeff = ( m_AuxAxesLinear[i] ? 1 : 100) ;
dSqDist += dSqCoeff * ( m_AuxAxesEnd[i] - m_AuxAxesVal[i]) * ( m_AuxAxesEnd[i] - m_AuxAxesVal[i]) ;
}
double dPrevCoeff = m_dCoeff ;
double dDist = sqrt( dSqDist) ;
if ( dDist > EPS_SMALL) {
int nStep = int( max( dDist / ( ( nMoveType == 0 ? 4 : 1) * m_dStep), 1.)) ;
@@ -1001,6 +1032,7 @@ Simulator::ManageMove( int& nStatus)
}
else
m_dCoeff = 1 ;
dMove = ( m_dCoeff - dPrevCoeff) * dDist ;
}
// Muovo eventuali assi ausiliari
@@ -1010,7 +1042,7 @@ Simulator::ManageMove( int& nStatus)
}
// Se arrivato a fine interpolazione movimento, salvo posizioni e segnalo
if ( m_dCoeff > 0.999) {
if ( m_dCoeff > COEFF_LIM) {
if ( m_bEnabAxes) {
for ( size_t i = 0 ; i < m_AxesName.size() ; ++ i)
m_AxesVal[i] = AxesEnd[i] ;