送85分: 求:对dxf文件格式操作的C++类代码

wolf_ 2000-05-08 07:43:00

问题:
哪位高手有对dxf文件格式操作的C++代码类, 能否告诉我在何处下载 或 email 我一个.
...全文
194 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
寒雪叔叔 2001-07-20
  • 打赏
  • 举报
回复
请问KingG_2001():
我也在那儿下了一个,但我不懂Delphi,在我解压后编译出了不少问题,使得我无法研究,请问你有没有修改后的原程。我的Email:02388888@sina.com
KingG_2001 2001-06-05
  • 打赏
  • 举报
回复
http://www.programmersheaven.com/zone2/cat262/2718.htm
这个是可以读出和写成DXF文件的,不过还不是很全,而且还是delphi,不过好像要
改成C++倒不是很难,最近研究了好久,需要的话可以讨论一下!
wolf_ 2000-05-09
  • 打赏
  • 举报
回复
再次谢谢telan提供的资源!
wolf_ 2000-05-09
  • 打赏
  • 举报
回复
telan:
你的code是绘制dxf图形的, 而非我所需的对dxf操作的类.
谢谢你的帮助, 有新的code请e_mail我: wolf721@sina.com
telan 2000-05-09
  • 打赏
  • 举报
回复
我的例子来自:http://www.codeproject.com/file/dxffiles.asp

看看:
http://www3.autodesk.com/adsk/support/item/0,,140239--125452,00.html
telan 2000-05-08
  • 打赏
  • 举报
回复
呵呵,其实我也没有处理过DXF文件,只是手边正好有一个例子,
所以贴上来让你看看有没有用,在网上找一找,应该能够找到
这种资料。
telan 2000-05-08
  • 打赏
  • 举报
回复
// CDxf.h: interface for the CDxf class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_CDXF_H__8A83F957_6127_11D3_BEFE_0000B450A404__INCLUDED_)
#define AFX_CDXF_H__8A83F957_6127_11D3_BEFE_0000B450A404__INCLUDED_

#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000

class CDxf
{
public:
CDxf();
virtual ~CDxf();

// Member function or method
void FichierDxf_Debut ();
void FichierDxf_Fin ();

void Rectangle();
void Circle();



private:
// Member variables or data members.

};

#endif // !defined(AFX_CDXF_H__8A83F957_6127_11D3_BEFE_0000B450A404__INCLUDED_)


//Dxf.cpp

#include "stdafx.h"
#include "CDxf.h"

#include <fstream.h> // For use with I/O files streams

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CDxf::CDxf()
{
}

CDxf::~CDxf()
{
}



void CDxf::FichierDxf_Debut ()
{
// Creation of an output stream objet in text mode.
// ios::out : defaut mode
ofstream FichierDxf ("TestDxf.dxf", ios::out);

FichierDxf << 0 << endl;
FichierDxf << "SECTION" << endl;
FichierDxf << 2 << endl;
FichierDxf << "ENTITIES" << endl;

FichierDxf.close();
}



void CDxf::FichierDxf_Fin ()
{
// Creation of an output stream objet in text mode.
// ios::app : append
ofstream FichierDxf ("TestDxf.dxf", ios::app);

FichierDxf << 0 << endl;
FichierDxf << "ENDSEC" << endl;
FichierDxf << 0 << endl;
FichierDxf << "EOF";

FichierDxf.close();
}



void CDxf::Rectangle ()
{
// 500 x 1500 rectangle
// Creation of an output stream objet in text mode.
// ios::app : append
ofstream FichierDxf ("TestDxf.dxf", ios::app);

// Draw the rectangle
FichierDxf << 0 << endl;
FichierDxf << "LINE" << endl;
FichierDxf << 8 << endl; // Group code for layer name
FichierDxf << 0 << endl; // Layer number
FichierDxf << 10 << endl; // Start point of line
FichierDxf << 0.0 << endl; // X in WCS coordinates
FichierDxf << 20 << endl;
FichierDxf << 0.0 << endl; // Y in WCS coordinates
FichierDxf << 30 << endl;
FichierDxf << 0.0 << endl; // Z in WCS coordinates

FichierDxf << 11 << endl; // End point of line
FichierDxf << 1500.0 << endl; // X in WCS coordinates
FichierDxf << 21 << endl;
FichierDxf << 0.0 << endl; // Y in WCS coordinates
FichierDxf << 31 << endl;
FichierDxf << 0.0 << endl; // Z in WCS coordinates

FichierDxf << 0 << endl;
FichierDxf << "LINE" << endl;
FichierDxf << 8 << endl; // Group code for layer name
FichierDxf << 0 << endl; // Layer number
FichierDxf << 10 << endl; // Start point of line
FichierDxf << 1500.0 << endl; // X in WCS coordinates
FichierDxf << 20 << endl;
FichierDxf << 0.0 << endl; // Y in WCS coordinates
FichierDxf << 30 << endl;
FichierDxf << 0.0 << endl; // Z in WCS coordinates

FichierDxf << 11 << endl; // End point of line
FichierDxf << 1500.0 << endl; // X in WCS coordinates
FichierDxf << 21 << endl;
FichierDxf << 500.0 << endl; // Y in WCS coordinates
FichierDxf << 31 << endl;
FichierDxf << 0.0 << endl; // Z in WCS coordinates

FichierDxf << 0 << endl;
FichierDxf << "LINE" << endl;
FichierDxf << 8 << endl; // Group code for layer name
FichierDxf << 0 << endl; // Layer number
FichierDxf << 10 << endl; // Start point of line
FichierDxf << 1500.0 << endl; // X in WCS coordinates
FichierDxf << 20 << endl;
FichierDxf << 500.0 << endl; // Y in WCS coordinates
FichierDxf << 30 << endl;
FichierDxf << 0.0 << endl; // Z in WCS coordinates

FichierDxf << 11 << endl; // End point of line
FichierDxf << 0.0 << endl; // X in WCS coordinates
FichierDxf << 21 << endl;
FichierDxf << 500.0 << endl; // Y in WCS coordinates
FichierDxf << 31 << endl;
FichierDxf << 0.0 << endl; // Z in WCS coordinates

FichierDxf << 0 << endl;
FichierDxf << "LINE" << endl;
FichierDxf << 8 << endl; // Group code for layer name
FichierDxf << 0 << endl; // Layer number
FichierDxf << 10 << endl; // Start point of line
FichierDxf << 0.0 << endl; // X in WCS coordinates
FichierDxf << 20 << endl;
FichierDxf << 500.0 << endl; // Y in WCS coordinates
FichierDxf << 30 << endl;
FichierDxf << 0.0 << endl; // Z in WCS coordinates

FichierDxf << 11 << endl; // End point of line
FichierDxf << 0.0 << endl; // X in WCS coordinates
FichierDxf << 21 << endl;
FichierDxf << 0.0 << endl; // Y in WCS coordinates
FichierDxf << 31 << endl;
FichierDxf << 0.0 << endl; // Z in WCS coordinates

FichierDxf.close();

}



void CDxf::Circle ()
{
// 1000 diameter circle
// Creation of an output stream objet in text mode.
// ios::app : append
ofstream FichierDxf ("TestDxf.dxf", ios::app);

// Draw the circle
FichierDxf << 0 << endl;
FichierDxf << "CIRCLE" << endl;
FichierDxf << 8 << endl; // Group code for layer name
FichierDxf << 0 << endl; // Layer number
FichierDxf << 10 << endl; // Center point of circle
FichierDxf << 0.0 << endl; // X in OCS coordinates
FichierDxf << 20 << endl;
FichierDxf << 0.0 << endl; // Y in OCS coordinates
FichierDxf << 30 << endl;
FichierDxf << 0.0 << endl; // Z in OCS coordinates
FichierDxf << 40 << endl; // radius of circle
FichierDxf << 500.0 << endl;

FichierDxf.close();

}


wolf_ 2000-05-08
  • 打赏
  • 举报
回复
telan:
谢谢大虾提供的代码!
不过, 请大虾好事做到底, 稍作解释如何?

16,466

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Web++
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧