| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 711 人关注过本帖
标题:求助VC++怎样读取DXF文件格式下的连续直线,急需!!!!!!!!!
只看楼主 加入收藏
cbx2009
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2009-9-27
收藏
 问题点数:0 回复次数:0 
求助VC++怎样读取DXF文件格式下的连续直线,急需!!!!!!!!!
//*************************读取dxf文件*************************************************
//*************************************************************************************
BOOL CDXFDoc::Loadstl(CArchive &ar)
{
     CString str;
     CVertex *p_Vertex=NULL;
     POINT2D Vertex[2];//直线的起点和终点
     do
     {//********
        ar.ReadString(str); //读出一行文本
        if (strnicmp(str , "LINE",4)==0)//调用直线
        {
            CLine* p_Line=new CLine();
   
            do//***************直线读取*********DO***************
             {
                ar.ReadString(str);//读取一行文本10
                if (strnicmp(str," 10",3)==0)
                {
                   ar.ReadString(str);//读取一行文本
                   sscanf(str," %f", &Vertex[0].x);//得到起点X坐标
                }
                if (strnicmp(str," 20",3)==0)
                {
                    ar.ReadString(str);//读取一行文本
                    sscanf(str," %f", &Vertex[0].y);//得到起点X坐标
                }
                if (strnicmp(str," 11",3)==0)
                {
                    ar.ReadString(str);//读取一行文本11
                    sscanf(str," %f", &Vertex[1].x);//得到终点X坐标
                }
                if (strnicmp(str," 21",3)==0)
                {
                    ar.ReadString(str);//读取一行文本21
                    sscanf(str," %f", &Vertex[1].y);//得到终点y坐标
                }
             } while(strnicmp(str,"  0",3)!=0);

  //***************直线读取********DO****************

              for(int j=0; j<2; j++)//直线两点
              LineAddVertex(Vertex[j], p_Line,j);//加入点表
              m_LineArray.Add(p_Line);//加入线表

        }//******************if****************
     
////////////////////////////连续直线的读取////////////////////////////
        else if (strnicmp(str , "AcDbPolyline",12)==0)
        {
   ??????、
  

        }

     }while(strnicmp(str,"EOF",3)!=0);//*****************
      return TRUE;
}
void CDXFDoc::Serialize(CArchive& ar)
{
     if (ar.IsStoring())
     {
        // TODO: add storing code here
        CString str;
        //保存直线代码****************************************8
        CLine* p_Line;
        for(int LineCount = 0; LineCount<m_LineArray.GetSize(); LineCount++)//数量
        {
            p_Line=m_LineArray[LineCount];
            str.Format("LINE\r\n");//保存LINE
            ar.WriteString(str);//
            //起点x部
            str.Format(" 10\r\n");//保存 10
            ar.WriteString(str);//
            str.Format("%f\r\n", p_Line->LineVex[0]->CVertexCoord.x);
            ar.WriteString(str);//保存x方向上向量的信息
            //起点Y部
            str.Format(" 20\r\n");//保存 20
            ar.WriteString(str);//
            str.Format("%f\r\n", p_Line->LineVex[0]->CVertexCoord.y);
            ar.WriteString(str);//保存x方向上向量的信息
            //终点x部
            str.Format(" 11\r\n");//保存 11
            ar.WriteString(str);
            str.Format("%f\r\n", p_Line->LineVex[1]->CVertexCoord.x);
            ar.WriteString(str);//保存x方向上向量的信息
            //终点y部
            str.Format(" 21\r\n");//保存 21
            ar.WriteString(str);
            str.Format("%f\r\n", p_Line->LineVex[1]->CVertexCoord.y);
            ar.WriteString(str);//保存x方向上向量的信息
            str.Format("  0\r\n");//保存 0
            ar.WriteString(str);
        }
             str.Format("EOF\r\n");//保存 EOF
             ar.WriteString(str);
//////////////////////////////////////////////////////////////////////////
        CPline* p_Pline;
        for(int PlineCount = 0; PlineCount<m_PlineArray.GetSize(); PlineCount++)//数量
        {

??????

        }


[ 本帖最后由 cbx2009 于 2010-1-17 15:19 编辑 ]
搜索更多相关主题的帖子: 文件 格式 直线 DXF 
2010-01-17 15:15
快速回复:求助VC++怎样读取DXF文件格式下的连续直线,急需!!!!!!!!!
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017693 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved