码迷,mamicode.com
首页 > 其他好文 > 详细

CAD创建一个新的图形文件

时间:2015-07-17 13:25:05      阅读:141      评论:0      收藏:0      [点我收藏+]

标签:

	static void linea(void)
	{
		AcDbDatabase *pDb = new AcDbDatabase(true, false);
		AcGePoint3d pickPoint;
		AcGePoint3d p1(0, 0, 0);
		AcGePoint3d p2(100, 100, 0);
		AcDbLine *line = new AcDbLine(p1, p2);
		AcDbBlockTable *pBt = NULL;
		acdbHostApplicationServices()->workingDatabase()->getBlockTable( pBt,AcDb::kForRead);
		AcDbBlockTableRecord *pBtr = NULL;
		pBt->getAt(ACDB_MODEL_SPACE, pBtr, AcDb::kForWrite);
		AcDbObjectId lineId,pTextId;
		struct resbuf *Xdata = acutBuildList(AcDb::kDxfRegAppName, "test",
			AcDb::kDxfXdAsciiString, TEXT("字符串测试数据"),
			AcDb::kDxfXdInteger32, 2,
			AcDb::kDxfXdReal, 3.14,
			AcDb::kDxfXdWorldXCoord, asDblArray(pickPoint),
			RTNONE);
		line->setXData(Xdata);
		pBtr->appendAcDbEntity(lineId, line);
		AcDbText *pText = new AcDbText(p1, "xiongzhihui");
		pBtr->appendAcDbEntity(pTextId, pText);
		CString name = "C:\\123.dwg";
		acutPrintf(_T(name));
		pDb->saveAs(name);
		pBt->close();
		pBtr->close();
		line->close();
		pText->close();
		delete pDb;

  新建一个图形数据库 然后saveas路径

CAD创建一个新的图形文件

标签:

原文地址:http://www.cnblogs.com/xzh1993/p/4653956.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!