[求助]插入指定图形数据库块问题
<p>AcDbObjectId CDraw::CreateBlock(AcDbDatabase *pDb,CString blkName,AcGePoint3d origin,int num,...)<br/>{<br/> // 获得当前图形数据库的块表<br/> AcDbBlockTable *pBlkTbl;<br/> /*acdbHostApplicationServices()->workingDatabase()<br/> ->getBlockTable(pBlkTbl, AcDb::kForWrite);*/<br/> pDb->getSymbolTable(pBlkTbl, AcDb::kForRead);<br/> // 创建新的块表记录<br/> AcDbBlockTableRecord *pBlkTblRcd;<br/> pBlkTblRcd = new AcDbBlockTableRecord();<br/> /* AcDbBlockTableRecord *pBlkTblRcd;<br/> pBlkTbl->getAt(ACDB_MODEL_SPACE,pBlkTblRcd,AcDb::kForWrite);*/</p><p> // 根据用户的输入设置块表记录的名称<br/> //char blkName;<br/> //if (acedGetString(Adesk::kFalse, "\n输入图块的名称:", blkName) !=<br/> // RTNORM)<br/> //{<br/> // pBlkTbl->close();<br/> // delete pBlkTblRcd;<br/> // return;<br/> //}<br/> pBlkTblRcd->setName(blkName);<br/> // 将块表记录添加到块表中<br/> AcDbObjectId blkDefId;<br/> pBlkTblRcd->setOrigin(origin);<br/><font color="#ee3d11"> pBlkTbl->add(blkDefId, pBlkTblRcd); //为什么运行到这出错,提示eNotOpenWrite?高手帮帮忙?</font><br/> pBlkTbl->close();<br/> // 向块表记录中添加实体<br/> AcDbObjectId entId;<br/> va_list pa;<br/> va_start( pa, num ); /* Initialize variable arguments. */<br/> for(int i=0;i<num;i++)<br/> {<br/> AcDbEntity *pEnt;<br/> pEnt = va_arg( pa, AcDbEntity*);<br/> pBlkTblRcd->appendAcDbEntity(entId, pEnt);<br/> pEnt->close();<br/> }<br/> va_end( pa ); <br/> // 关闭实体和块表记录<br/> pBlkTblRcd->close();<br/> return blkDefId;<br/>}</p> <p><font color="#ee3d11"> pBlkTbl->add(blkDefId, pBlkTblRcd); //为什么运行到这出错,提示eNotOpenWrite?高手帮帮忙?</font><br/></p><p>你的块表打开的状态不是【写】的!</p> <p>谢谢!已解决~</p>
页:
[1]