wxd20130610 发表于 2013-12-21 15:31:48

可能我没说清楚,我是想利用objectarx扩充activex vba函数库,因为activex中一些函数是没有的,功能不全,但objectarx是个庞大且高效的函数库,因此想到利用arx编写(制作)com接口来供vba调用。

wxd20130610 发表于 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;
页: 1 [2]
查看完整版本: arx的com接口编写