diff --git a/EgtExchange.rc b/EgtExchange.rc index 592831b..082f57d 100644 Binary files a/EgtExchange.rc and b/EgtExchange.rc differ diff --git a/ImportCnc.cpp b/ImportCnc.cpp index 980dc28..480bb9c 100644 --- a/ImportCnc.cpp +++ b/ImportCnc.cpp @@ -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 ; diff --git a/ImportCnc.h b/ImportCnc.h index 549f03e..6546f3b 100644 --- a/ImportCnc.h +++ b/ImportCnc.h @@ -71,7 +71,7 @@ class ImportCnc : public IImportCnc return true ; } private : - enum CncName { CNC_STD = 0, CNC_OSAI = 1, CNC_FANUC = 2, CNC_NUM = 3, CNC_SIEMENS = 4, CNC_TPA = 5} ; + enum CncName { CNC_STD = 0, CNC_OSAI = 1, CNC_FANUC = 2, CNC_NUM = 3, CNC_SIEMENS = 4, CNC_TPA = 5, CNC_MAZAK = 6} ; enum InterpPl { XY = 1, YZ = 2, ZX = 3} ; enum Command { NO_CMD = 0, MOVE = 1, IPL = 2, OFFS = 3} ; enum MoveType { RAPID = 0, LINE = 1, ARC_CW = 2, ARC_CCW = 3, ARC_MID_2D = 4, ARC_MID_3D = 5} ; @@ -119,5 +119,8 @@ class ImportCnc : public IImportCnc Color m_colCurr ; std::string m_sToolName ; int m_nExit ; + std::string m_sToolPos ; + std::string m_sToolPos2 ; + std::string m_sSpeed ; STRVECTOR m_vInfos ; } ;