static void swtArxProject5createLine(void) { // Add your code for command swtArxProject5.createLine here //创建新的CAD数据库 AcDbDatabase *pDb=new AcDbDatabase(); //定义块表指针 AcDbBlockTable *pBlkTbl; //获取块表 pDb->getSymbolTable(pBlkTbl,AcDb::kForRead); //定义块表记录 AcDbBlockTableRecord *pBlkTblRcd; //获取块表记录 pBlkTbl->getAt(ACDB_MODEL_SPACE,pBlkTblRcd,kForWrite); //关闭块表 pBlkTbl->close(); //定义点 AcGePoint3d pt(10,10,0); AcGePoint3d pt1(20,10,0); //定义线指针并创建线 AcDbLine *pLine=new AcDbLine(pt,pt1); //将线添加到块表记录中 pBlkTblRcd->appendAcDbEntity(pLine); //关闭线和块表记录 pLine->close(); pBlkTblRcd->close(); //将图形另存 pDb->saveAs(_T("c:/TEST.DWG")); //删除图形数据库指针 delete pDb; }
ObjectARX2010 学习笔记001:在新数据库中创建直线并将此数据库保存成DWG文件,布布扣,bubuko.com