//---------------------------------------------------------------------------- // EgalTech 2014-2014 //---------------------------------------------------------------------------- // File : ImportCnc.h Data : 15.09.14 Versione : 1.6e3 // Contenuto : Dichiarazione della classe ImportCnc. // // // // Modifiche : 15.09.14 DS Creazione modulo. // // //---------------------------------------------------------------------------- #pragma once #include "/EgtDev/Include/EExImportCsf.h" #include "/EgtDev/Include/EgtStringBase.h" #include class ICurve ; struct CNurbsData ; struct ExtendedText ; //---------------------------------------------------------------------------- #pragma pack( 2) struct CsfHeader { short nFileType ; short nVer ; unsigned short nData ; unsigned nStatus ; unsigned short nOperaz ; short nParts ; char szMachine[9] ; char szTools[9] ; char szSetup[9] ; short nMachineId ; short nUnits ; char szCustomer[21] ; char szMaterial[21] ; char szNotes[81] ; double dThick ; } ; const int CSFHEADER_SIZE = sizeof( CsfHeader) ; // 178 struct CsfEnt { short nType ; short nPar1 ; short nPar2 ; short nPar3 ; short nPart ; short nPath ; double dP1x ; double dP1y ; double dP1z ; double dP2x ; double dP2y ; double dP2z ; double dCenx ; double dCeny ; double dCenz ; double dAng1Deg ; double dAng2Deg ; double dRad ; } ; const int CSFENT_SIZE = sizeof( CsfEnt) ; // 108 const int ATTRIB_LEN = 80 ; struct Attrib { char szText[ATTRIB_LEN] ; int bOnPoint ; int nEntNbr ; } ; const int ATTRIB_SIZE = sizeof( Attrib) ; // 88 #pragma pack() //---------------------------------------------------------------------------- class ImportCsf : public IImportCsf { public : ImportCsf( void) ; virtual bool Import( const std::string& sFile, IGeomDB* pGDB) ; private : bool ReadHeader( const std::string& sHedFile) ; bool ReadAttribs( void) ; bool ProcessEntity( const CsfEnt& csfEnt) ; bool ProcessLine( const CsfEnt& csfEnt) ; bool ProcessArc( const CsfEnt& csfEnt) ; bool ProcessHole( const CsfEnt& csfEnt) ; bool ProcessText( const CsfEnt& csfEnt) ; bool ProcessRectangle( const CsfEnt& csfEnt) ; bool ProcessEllipse( const CsfEnt& csfEnt) ; bool ProcessProperty( const CsfEnt& csfEnt) ; bool ProcessCNurbs( const CsfEnt& csfEnt) ; bool ProcessExtendedText( const CsfEnt& csfEnt) ; private : double ConvertToMM( double dVal) ; Point3d ConvertToPointMM( double dX, double dY, double dZ) ; Vector3d ConvertToVectorMM( double dX, double dY, double dZ) ; int GetPartLayerId( int nPart, int nPath) ; Color CalcColor( int nInd) ; bool AddCurve( ICurve* pCrv, int nGrpId, int nAttribId, bool bSingle) ; bool AddEntAttrib( int nEntId, int nSubEntId, int nAttribId) ; bool ReadCNurbsData( int nPos, CNurbsData& cnData) ; bool ReadExtendedTextData( int nPos, ExtendedText& etData) ; private : typedef std::vector ATTRVECTOR ; private : IGeomDB* m_pGDB ; bool m_bIsMM ; double m_dThick ; int m_nCurrPart ; int m_nCurrLay ; int m_nCurrPartId ; int m_nCurrLayId ; std::ifstream m_InEnsFile ; ATTRVECTOR m_vAttrib ; } ;