EgtExchange 2.2i6 :

- in import CNC aggiunta definzione tipo Mazak
- in import CNC aggiunta gestione informazioni TPos, TPos2 e Speed da commenti.
This commit is contained in:
Dario Sassi
2020-09-29 15:30:07 +00:00
parent 3a2ab85c6b
commit aa45ec050e
3 changed files with 63 additions and 3 deletions
+59 -2
View File
@@ -33,12 +33,15 @@ using namespace std ;
//----------------------------------------------------------------------------
static const string NAME_ERROR = "Error" ;
static const Color COL_RAPID( 0, 192, 192, 50) ;
static const Color COL_ERROR( 255, 0, 0, 100) ;
static const Color COL_RAPID( 0, 192, 192, 50) ;
static const Color COL_ERROR( 255, 0, 0, 100) ;
static const string KEY_TCS = "TCS" ;
static const string KEY_TCOMP = "TCOMP" ;
static const string KEY_TNAME = "TNAME" ;
static const string KEY_EXIT = "EXIT" ;
static const string KEY_TPOS = "TPOS" ;
static const string KEY_TPOS2 = "TPOS2" ;
static const string KEY_SPEED = "SPEED" ;
static const string KEY_ROTAX_A = "A" ;
static const string KEY_ROTAX_B = "B" ;
static const string KEY_ROTAX_C = "C" ;
@@ -129,6 +132,10 @@ ImportCnc::Import( const string& sFile, IGeomDB* pGDB, int nIdGroup, int nFlag)
m_nCNC = CNC_SIEMENS ;
else if ( sFileExt == "ISO")
m_nCNC = CNC_TPA ;
else if ( sFileExt == "CNC")
m_nCNC = CNC_OSAI ;
else if ( sFileExt == "EIA")
m_nCNC = CNC_MAZAK ;
// ciclo di lettura delle linee
bool bOk = true ;
@@ -278,6 +285,8 @@ ImportCnc::ProcessLine( const string& sLine)
bool
ImportCnc::ParseRemark( const string& sLine)
{
// verifico se commento tra parentesi
bool bBrackets = ( sLine[0] == '(') ;
// cerco indicazione tipo controllo numerico
string::size_type iCnc = sLine.find( "CNC/") ;
if ( iCnc == string::npos)
@@ -296,6 +305,8 @@ ImportCnc::ParseRemark( const string& sLine)
m_nCNC = CNC_SIEMENS ;
else if ( sCNC == "TPA")
m_nCNC = CNC_TPA ;
else if ( sCNC == "MAZAK")
m_nCNC = CNC_MAZAK ;
}
// cerco indicazione di posizione Home
string::size_type iFrom = sLine.find( "FROM/") ;
@@ -327,6 +338,8 @@ ImportCnc::ParseRemark( const string& sLine)
iTool = sLine.find( "TOOL=") ;
if ( iTool != string::npos) {
m_sToolName = sLine.substr( iTool + 5) ;
if ( bBrackets)
TrimRight( m_sToolName, " )") ;
return true ;
}
// cerco indicazione uscita in uso
@@ -337,12 +350,44 @@ ImportCnc::ParseRemark( const string& sLine)
FromString( sLine.substr( iExit + 5), m_nExit) ;
return true ;
}
// cerco indicazione posizione nel TC
string::size_type iTpos = sLine.find( "TPOS/") ;
if ( iTpos == string::npos)
iTpos = sLine.find( "TPOS=") ;
if ( iTpos != string::npos) {
m_sToolPos = sLine.substr( iTpos + 5) ;
if ( bBrackets)
TrimRight( m_sToolPos, " )") ;
return true ;
}
// cerco indicazione seconda posizione nel TC
string::size_type iTpos2 = sLine.find( "TPOS2/") ;
if ( iTpos2 == string::npos)
iTpos2 = sLine.find( "TPOS2=") ;
if ( iTpos2 != string::npos) {
m_sToolPos2 = sLine.substr( iTpos2 + 6) ;
if ( bBrackets)
TrimRight( m_sToolPos2, " )") ;
return true ;
}
// cerco indicazione Speed
string::size_type iSpeed = sLine.find( "SPEED/") ;
if ( iSpeed == string::npos)
iSpeed = sLine.find( "SPEED=") ;
if ( iSpeed != string::npos) {
m_sSpeed = sLine.substr( iSpeed + 6) ;
if ( bBrackets)
TrimRight( m_sSpeed, " )") ;
return true ;
}
// cerco informazione da inserire nella prossima entità
string::size_type iInfo = sLine.find( "INFO/") ;
if ( iInfo == string::npos)
iInfo = sLine.find( "INFO=") ;
if ( iInfo != string::npos) {
m_vInfos.push_back( sLine.substr( iInfo + 5)) ;
if ( bBrackets)
TrimRight( m_vInfos.back(), " )") ;
return true ;
}
@@ -1175,6 +1220,18 @@ ImportCnc::GetToolGroup( void)
if ( ! m_sToolName.empty())
m_pGDB->SetInfo( nId, KEY_TNAME, m_sToolName) ;
m_sToolName.clear() ;
// se definita posizione utensile, assegno info relativa
if ( ! m_sToolPos.empty())
m_pGDB->SetInfo( nId, KEY_TPOS, m_sToolPos) ;
m_sToolPos.clear() ;
// se definita seconda posizione utensile, assegno info relativa
if ( ! m_sToolPos2.empty())
m_pGDB->SetInfo( nId, KEY_TPOS2, m_sToolPos2) ;
m_sToolPos2.clear() ;
// se definita speed utensile, assegno info relativa
if ( ! m_sSpeed.empty())
m_pGDB->SetInfo( nId, KEY_SPEED, m_sSpeed) ;
m_sSpeed.clear() ;
// se è il primo, lo salvo
if ( m_nFirstGroup == GDB_ID_NULL)
m_nFirstGroup = nId ;