我认为这将在arx中划清界限,我没有编译它以供检查...
- AcDbDatabase *pCurrentDB; // pointer to hole current drawing database
- AcGePoint3d stpt(0.0,0.0,0.0); //3d starting point
- AcGePoint3d endpt(5.0,5.0,0.0);; //3d ending point
- AcDbLine *acLine = new AcDbLine(stpt, endpt); // create a new newline
- pCurrentDB = acdbHostApplicationServices()->workingDatabase(); // set pointer to workling database
- AcDbBlockTable *pBlockTable;
- pCurrentDB->getBlockTable(pBlockTable, AcDb::kForRead); //get the block table
- AcDbBlockTableRecord *pBlockTableRecord;
- pBlockTable->getAt(ACDB_MODEL_SPACE, pBlockTableRecord, AcDb::kForWrite); // get a blocktablerecord
- pBlockTable->close();
- AcDbObjectId lineId;
- pBlockTableRecord->appendAcDbEntity(lineId, acLine); // Actually adds the line to the drawing
- pBlockTableRecord->close();
- acLine->close();
[code][/code] |