ShuFeng 发表于 2005-3-24 13:41:00

[求助]请教这是为什么?

void AdeskCreateDim()<BR>{<BR>        AcGePoint3d pt1(0,0,0),pt2(10,0,0),pt3(5,5,0);<BR>        AcDbRotatedDimension *pDim=new AcDbRotatedDimension(0,pt1,pt2,pt3);<BR>        Acad::ErrorStatus es ;<BR>        AcDbBlockTable *pBlockTbl ;<BR>        AcDbBlockTableRecord *pBlkTblRec;<BR>        if ( (es =acdbHostApplicationServices ()-&gt;workingDatabase ()-&gt;getBlockTable (pBlockTbl, AcDb::kForRead)) != Acad::eOk )<BR>        {<BR>                acutPrintf ("\nCouldn't open the block table!") ;<BR>                return;<BR>        }<BR>        if ( (es =pBlockTbl-&gt;getAt (ACDB_MODEL_SPACE, pBlkTblRec, AcDb::kForWrite)) != Acad::eOk ) <BR>        {<BR>                acutPrintf ("\nCouldn't get Model Space! Drawing corrupt.\n") ;<BR>                pBlockTbl-&gt;close () ;<BR>                return;<BR>        }<BR>        if ( (es =pBlkTblRec-&gt;appendAcDbEntity (pDim)) != Acad::eOk ) <BR>        {<BR>                delete pDim ;<BR>                pBlkTblRec-&gt;erase () ;<BR>                pBlkTblRec-&gt;close () ;<BR>                return;<BR>        }<BR>        pDim-&gt;close();<BR>        pBlkTblRec-&gt;close();<BR>}<BR>在Acad中键入命令createdim,出现如下提示:<BR>Regen terminated<BR>键入命令"x"-&gt;"all"则标注显示在屏幕上.<BR>请教这是为什么?

pandoram 发表于 2005-3-24 16:47:00

if ( (es =pBlkTblRec-&gt;appendAcDbEntity (pDim)) != Acad::eOk ) <BR>        {<BR>                delete pDim ;<BR>                pBlkTblRec-&gt;erase () ;<BR>                <FONT color=#ff0000>pBlkTblRec-&gt;close () ;<BR></FONT>                return;<BR>        }<BR>        pDim-&gt;close();<BR>        <FONT color=#ff0000>pBlkTblRec-&gt;close();</FONT><BR>}


这两个地方(直接造成问题的是后一个地方)你只关了block table record, 没有关block table, 所以ACAD就暴走了.<BR>

ShuFeng 发表于 2005-3-25 17:49:00

谢谢啦!
页: [1]
查看完整版本: [求助]请教这是为什么?