- 积分
- 2113
- 明经币
- 个
- 注册时间
- 2013-6-10
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
楼主 |
发表于 2013-12-21 15:35:46
|
显示全部楼层
@风树
您说的没错,正是锁定和解锁文档的问题,现将调试好的源码贴出来:
acDocManager->lockDocument(acDocManager->curDocument(), AcAp::kWrite, NULL, NULL, true); //锁定文档
AcGePoint3d ptStart(0, 0, 0);
AcGePoint3d ptEnd(100, 100, 0);
AcDbLine *pLine = new AcDbLine(ptStart, ptEnd);
AcDbBlockTable *pBlockTable;
acDocManager->curDocument()->database()->getBlockTable(pBlockTable, AcDb::kForRead);
//acdbHostApplicationServices()->workingDatabase()->getBlockTable(pBlockTable, AcDb::kForRead);
AcDbBlockTableRecord *pBlockTableRecord;
pBlockTable->getAt(ACDB_MODEL_SPACE, pBlockTableRecord,AcDb::kForWrite);
AcDbObjectId lineId;
pBlockTableRecord->appendAcDbEntity(lineId, pLine);
pBlockTable->close();
pBlockTableRecord->close();
pLine->close();
acDocManager->unlockDocument(acDocManager->curDocument()); //解锁文档
return S_OK; |
|