[ARX]C++编译无错 CAD非正常退出(附图)
<P>我的程序如下:</P><P>ads_point pt;<BR> int NodeNumCount; //定义节点数,即最大的节点编号数值</P>
<P> acedGetInt("请输入多边形顶点数:",&NodeNumCount);<BR> if(acedGetPoint(NULL,"\n请选择起始点:",pt)==RTNORM)<BR> {<BR> xpt.Format("%g",pt); <BR> ypt.Format("%g",pt);<BR> acutPrintf("\n起始点坐标为:%s,%s",xpt,ypt);<BR> }<BR> xco=atof(xpt);<BR> yco=atof(ypt);<BR> for(int i=0;i<NodeNumCount;i++)<BR> {<BR> if(acedGetPoint(NULL,"\n拾取下一点:",pt)==RTNORM)<BR> {<BR> xpt.Format("%g",pt); <BR> ypt.Format("%g",pt);<BR> acutPrintf("\n该点坐标为:%s,%s",xpt,ypt);<BR> }<BR> xco=atof(xpt);<BR> yco=atof(ypt);<BR>//pick点,连续画直线<BR> AcDbBlockTableRecord *pBlkTableRcd<BR> =new AcDbBlockTableRecord();//创建块表记录<BR> //以写方式得到当前块表的指针<BR> AcDbBlockTable *pBlkTable=NULL; <BR> acdbHostApplicationServices()->workingDatabase()<BR> ->getSymbolTable(pBlkTable, AcDb::kForWrite);<BR> //将新的块表记录加入块表中,并获得块表记录的ID<BR> AcDbObjectId Id;<BR> pBlkTable->add(Id, pBlkTableRcd);<BR> pBlkTable->close();<BR> //生成直线<BR> AcGePoint3d startPt(xco,yco,0.0);//定义直线起点<BR> AcGePoint3d endPt(xco,yco,0.0);//定义直线终点<BR> AcDbLine *pLine=new AcDbLine(startPt,endPt);<BR> AcDbBlockTable *pBlkTable2=NULL;<BR> acdbHostApplicationServices()->workingDatabase()<BR> ->getSymbolTable(pBlkTable2, AcDb::kForRead);<BR> <BR> pBlkTable2->getAt(ACDB_MODEL_SPACE, pBlkTableRcd,<BR> AcDb::kForWrite);<BR> pBlkTable2->close();<BR> <BR> AcDbObjectId lineId;<BR> pBlkTableRcd->appendAcDbEntity(lineId, pLine);<BR> // pLine->setLayer("Layer_Frame");//设置创建轮廓线的层为"Layer_Frame"<BR> <BR> pBlkTableRcd->close();<BR> pLine->close();<BR> }</P>
<P>如上是随点画n边形的一段代码,能画n边形,但是退出时会连续弹出两个对话框,</P>
<P>如下:(肯定是上面这段代码的问题,之前也有朋友问过类似的问题,望高手指教)</P>
<P>http://img151.photo.163.com/xueliang4321/16458053/396107286.jpg</P>http://img151.photo.163.com/xueliang4321/16458053/396107404.jpg 本帖最后由 作者 于 2005-9-20 22:36:50 编辑 <br /><br /> <P>现在应该搞定了吧^_^</P>
页:
[1]