刚接触arx碰到个问题,希望高手指点一下,谢谢 重载AcDbDatabaseReactor监控数据库对象反应器的objectAppended(const AcDbDatabase *db,const AcDbObject *pObj)函数,在该函数中我想创建一条直线 函数如下: AcDbObjectId CreateLine(AcGePoint3d startPt,AcGePoint3d endPt) { // AcGePoint3d startPt(1,1,0),endPt(700,100,0);//定义终点 AcDbBlockTable* pBlockTable;//定义块表指针 acdbCurDwg()->getBlockTable(pBlockTable,AcDb::kForRead);//获得当前图形块标指针 AcDbBlockTableRecord* pBlockTableRecord;//定义块表
Acad::ErrorStatus Entityerror = pBlockTable->getAt(ACDB_MODEL_SPACE,pBlockTableRecord,AcDb::kForWrite); //以写方式打开模型空间,获得块表记录指针 pBlockTable->close();//关闭块表 AcDbLine *pLine = new AcDbLine(startPt,endPt);//创建LINE对象 AcDbObjectId LId;//定义标识符 pBlockTableRecord->appendAcDbEntity(LId,pLine);//将实体写入块表记录 pBlockTableRecord->close();//关闭块表记录 pLine->close(); lineListID.Add(LId); return LId; } 函数运行到Acad::ErrorStatus Entityerror = pBlockTable->getAt(ACDB_MODEL_SPACE,pBlockTableRecord,AcDb::kForWrite);时返回eWasOpenForWrite;请问一下有什么方法解决呀!谢谢 |