//---------------------------------------------------------------------------- // EgalTech 2014-2014 //---------------------------------------------------------------------------- // File : ImportCnc.h Data : 15.09.14 Versione : 1.5i3 // Contenuto : Dichiarazione della classe ImportCnc. // // // // Modifiche : 15.09.14 DS Creazione modulo. // // //---------------------------------------------------------------------------- #pragma once #include "/EgtDev/Include/EExImportCnc.h" #include "/EgtDev/Include/EgtStringBase.h" class ICurveArc ; class ICurveComposite ; //---------------------------------------------------------------------------- class ImportCnc : public IImportCnc { public : virtual bool Import( const std::string& sFile, IGeomDB* pGDB, int nIdGroup, int nFlag = 0) ; private : bool ProcessLine( const std::string& sLine) ; bool ParseRemark( const std::string& sLine) ; bool ParseG( const std::string& sToken) ; bool ParseX( const std::string& sToken) ; bool ParseY( const std::string& sToken) ; bool ParseZ( const std::string& sToken) ; bool ParseI( const std::string& sToken) ; bool ParseJ( const std::string& sToken) ; bool ParseK( const std::string& sToken) ; bool ParseP( const std::string& sToken) ; bool ParseQ( const std::string& sToken) ; bool ParseR( const std::string& sToken) ; bool ParseA( const std::string& sToken) ; bool ParseB( const std::string& sToken) ; bool ParseC( const std::string& sToken) ; bool ParseT( const std::string& sToken) ; bool ParseM( const std::string& sToken) ; bool ParseH( const std::string& sToken) ; bool ExecSetIPL( void) ; bool ExecMovement( void) ; bool AddPoint( int nPntType) ; bool AddLine( int nLineType) ; bool AddArc( bool bCCW) ; bool AddArc3P( bool bIs2D) ; int VerifyArcCenter( const Vector3d& vtN) ; bool SetCircC2PN( const Point3d& ptCen, const Point3d& ptStart, const Point3d& ptNearEnd, const Vector3d& vtN, ICurveArc* pCrvArc) ; int GetToolGroup( void) ; bool PostProcess( void) ; bool IsRapid( int nId) ; bool InsertCurveComposite( ICurveComposite* pCompo, Color cCol, int nComp, int nSide, int nIdRef, int nSonBeforeAfter) ; bool SetInfos( int nId) ; private : bool RotAxesChanged( void) { return ( ! isnan( m_dRotAxA) && abs( m_dRotAxA - m_dLastRotAxA) > EPS_ANG_SMALL) || ( ! isnan( m_dRotAxB) && abs( m_dRotAxB - m_dLastRotAxB) > EPS_ANG_SMALL) || ( ! isnan( m_dRotAxC) && abs( m_dRotAxC - m_dLastRotAxC) > EPS_ANG_SMALL) ; } bool SaveRotAxes( void) { m_dLastRotAxA = m_dRotAxA ; m_dLastRotAxB = m_dRotAxB ; m_dLastRotAxC = m_dRotAxC ; return true ; } private : enum CncName { CNC_STD = 0, CNC_OSAI = 1, CNC_FANUC = 2, CNC_NUM = 3, CNC_SIEMENS = 4, CNC_TPA = 5, CNC_MAZAK = 6, CNC_FAGOR} ; 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} ; enum PntType { P_RAPID = 0, P_PNT = 1, P_ERROR = 2} ; enum LineType { L_RAPID = 0, L_LINE = 1, L_ERROR = 2} ; enum ArcType { NO_ARCTYPE = 0, RADIUS = 1, CENTER = 2} ; enum ArcCtType { A_ARC = 0, A_CIRC =1, A_ERROR = 2} ; enum CompType { NO_COMP = 0, G40 = 40, G41 = 41, G42 = 42} ; enum CharOn { X_ON = 1, Y_ON = 2, Z_ON = 4 } ; private : IGeomDB* m_pGDB ; int m_nIdGroup ; Frame3d m_frGroup ; int m_nFlag ; int m_nLine ; int m_nCNC ; bool m_bToMove ; bool m_bLoadTool ; int m_nTool ; int m_nNextTool ; int m_nFirstGroup ; int m_nCommand ; int m_nCharsOn ; int m_nMoveType ; bool m_bZeroMach ; bool m_bAbsCoord ; int m_nComp ; int m_nCompSide ; int m_nInterpPl ; int m_nArcType ; Point3d m_ptHome ; Point3d m_ptLast ; Point3d m_ptNext ; Point3d m_ptCen ; Vector3d m_vtOffs ; double m_dLinCoeff ; double m_dRadius ; double m_dRotAxA ; double m_dRotAxB ; double m_dRotAxC ; double m_dLastRotAxA ; double m_dLastRotAxB ; double m_dLastRotAxC ; double m_dOffsAxA ; double m_dOffsAxB ; double m_dOffsAxC ; 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 ; } ;