uusky 发表于 2005-9-23 09:17:00

关于文本标注 和 圆圈标注 的问题

本帖最后由 作者 于 2005-9-24 9:55:56 编辑 <br /><br /> <P>
<TABLE height="100%">
<TBODY>
<TR height="100%">
<TD vAlign=top><FONT face=宋体,verdana,arial,helvetica>:关于文本标注 和 圆圈标注 的问题?</B></FONT> </TD>
<TD vAlign=top align=right width="10%" nowarp><INPUT class=btn style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体" onclick="text1.style.fontSize='12pt';" type=button value=12号字><SELECT class=FormSelect style="FONT-SIZE: 9pt; VISIBILITY: visible; FONT-FAMILY: 宋体" onchange=text1.style.fontSize=this.value name=myfont> <OPTION value=9pt>9pt</OPTION> <OPTION value=10pt selected>10pt</OPTION> <OPTION value=11pt>11pt</OPTION> <OPTION value=12pt>12pt</OPTION> <OPTION value=13pt>13pt</OPTION> <OPTION value=15pt>15pt</OPTION></SELECT> </TD></TR>
<TR>
<TD colSpan=2><FONT id=text1 style="FONT-SIZE: 10pt" face="宋体,verdana, arial, helvetica">
<P><BR>/////////////////////////////////////////////////////<BR>在指定坐标点进行文本标注:<BR>AcDbBlockTable *pBlockTablew;<BR>acdbHostApplicationServices()-&gt;workingDatabase()<BR>-&gt;getSymbolTable(pBlockTablew, AcDb::kForRead);<BR>AcDbBlockTableRecord *pBlockTableRecorde;<BR>pBlockTablew-&gt;getAt(ACDB_MODEL_SPACE, <BR>pBlockTableRecorde, AcDb::kForWrite);<BR>pBlockTablew-&gt;close();//关闭块表<BR><BR>ads_point point;<BR>int ret; <BR>acutPrintf("\n请选中权属单位:“%s",CScaption);<BR>ret = acedGetPoint(NULL,"”标注的中心点:",point);<BR>ret= acedCommand(RTSTR, "boundary",RTPOINT ,point, RTSTR, "",0) ;<BR>acutPrintf("\n你选的点坐标为 x = %.3f y = %.3f",point,point);<BR>AcGePoint3d textPosition(point, point, 0.0);<BR>AcGePoint3d atextPosition(point, point, 0.0);<BR><BR>double textHeight = 10;<BR>double textWidthFactor = 0.8000;<BR>double textRotation = 0.0;<BR><BR>AcDbText *pText=new AcDbText(textPosition, CScaption, AcDbObjectId::kNull , <BR><BR>textHeight, textRotation);<BR>pText-&gt;setHorizontalMode(AcDb::kTextMid);<BR>pText-&gt;setAlignmentPoint(atextPosition);<BR>pText-&gt;setColorIndex (1); <BR><BR>AcDbObjectId textId;<BR>pBlockTableRecorde-&gt;appendAcDbEntity(textId, pText); //*<BR>pBlockTableRecorde-&gt;close();<BR>pText-&gt;close(); <BR><BR>/////////////////////////////////////////////////////////////////////////////////////////<BR>在指定坐标点进行画圆标注坐标点:<BR><BR>CString xpt;<BR>CString ypt;<BR>float xco;<BR>float yco;<BR>acedGetInt("\n请输入多边形顶点数:",&amp;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><BR>AcDbBlockTable *pBlockTablew;<BR>acdbHostApplicationServices()-&gt;workingDatabase()<BR>-&gt;getSymbolTable(pBlockTablew, AcDb::kForRead);<BR>AcDbBlockTableRecord *pBlockTableRecorde;<BR>pBlockTablew-&gt;getAt(ACDB_MODEL_SPACE, <BR><BR>pBlockTableRecorde,AcDb::kForWrite);<BR>pBlockTablew-&gt;close();<BR><BR>AcGeVector3d normal(0.0, 0.0, 1.0);<BR>AcGePoint3d startPt(xco,yco,0.0);//定义圈标注的中点<BR>AcDbCircle *pCirc1 = new AcDbCircle(startPt, normal, num); <BR><BR>AcDbObjectId circleId;<BR>pBlockTableRecorde-&gt;appendAcDbEntity(circleId, pCirc1);<BR>pBlockTableRecorde-&gt;close();<BR>pCirc1-&gt;close();<BR>///////////////////////////////////////////////////////////////<BR>以上两个功能函数均正确!! 以下是两个功能整合过()后的程序,编译无错,</P>
<P>但在CAD中会导致-致命错误!估计是定义坐标不一致而导致的,即:<BR>进行圈标注的点---AcGePoint3d startPt(xco,yco,0.0); //float型的<BR>不能做为数字标注的点---AcGePoint3d textPosition(point, point, 0.0);<BR>希望哪位高手给予指点,我在这里先谢过了!<BR>CString xpt;<BR>CString ypt;<BR>float xco;<BR>float yco; <BR>acedGetInt("\n请输入多边形顶点数:",&amp;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><BR>for(int n=0;n<NODENUMCOUNT;N++)<BR /> { <BR>AcGeVector3d normal(0.0, 0.0, 1.0);<BR>AcGePoint3d startPt(xco,yco,0.0);//定义直线点<BR>AcDbCircle *pCirc1 = new AcDbCircle(startPt, normal, num); <BR>AcDbBlockTable *pBlockTablee;<BR>acdbHostApplicationServices()-&gt;workingDatabase()<BR>-&gt;getSymbolTable(pBlockTablee, AcDb::kForRead);<BR>AcDbBlockTableRecord *pBlockTableRecorde;<BR>pBlockTablee-&gt;getAt(ACDB_MODEL_SPACE, pBlockTableRecorde,AcDb::kForWrite);<BR>pBlockTablee-&gt;close(); <BR>//AcGePoint3d textPosition(xco, yco, 0.0);//*<BR>//AcGePoint3d atextPosition(xco, yco, 0.0);//开始数字标注<BR>char s1;<BR>sprintf(s1, "%d", n);//强制转换类型 <BR>double textHeight = 10;<BR>double textWidthFactor = 0.8000;<BR>double textRotation = 0.0;<BR><BR>//AcDb::kTextLeft <BR>AcDbText *pText=new AcDbText(startPt,s1, AcDbObjectId::kNull , textHeight, textRotation);<BR>pText-&gt;setHorizontalMode(AcDb::kTextMid);<BR>pText-&gt;setAlignmentPoint(startPt);<BR>pText-&gt;setColorIndex(1); <BR><BR>AcDbObjectId textId;<BR>pBlockTableRecorde-&gt;appendAcDbEntity(textId, pText); <BR>////////////////////////////////////////////////////////////////////////// <BR>AcDbObjectId circleId;<BR>pBlockTableRecorde-&gt;appendAcDbEntity(circleId, pCirc1);<BR>pBlockTableRecorde-&gt;close();<BR>pCirc1-&gt;close();<BR>pText-&gt;close(); <BR><BR>}</FONT> </P></TD></TR></TBODY></TABLE></P>
<P>进行圈标注的点---AcGePoint3d startPt(xco,yco,0.0); 是float型的<BR>不能做为数字标注的点---AcGePoint3d textPosition(point, point, 0.0);是ads_point型的<BR>这两者怎么能达到统一,希望高手指点一下啊!</P>

hourui800720 发表于 2011-7-30 11:24:45

为什么在我的电脑上运行有问题

hourui800720 发表于 2011-7-30 11:38:10

为什么在我的电脑上运行有问题

hourui800720 发表于 2011-7-30 11:38:42

为什么在我的电脑上运行有问题为什么在我的电脑上运行有问题为什么在我的电脑上运行有问题为什么在我的电脑上运行有问题为什么在我的电脑上运行有问题为什么在我的电脑上运行有问题为什么在我的电脑上运行有问题

hourui800720 发表于 2011-7-30 11:39:28

为什么在我的电脑上运行有问题

hourui800720 发表于 2011-7-30 11:40:00

为什么在我的电脑上运行有问题为什么

hourui800720 发表于 2011-7-30 11:40:31

为什么在我的电脑上运行有问题为什么在我的电脑上运行有问题

hourui800720 发表于 2011-7-30 11:42:45

为什么在我的电脑上运行有问题

hourui800720 发表于 2011-7-30 11:43:20

为什么在我的电脑上运行有问题
页: [1]
查看完整版本: 关于文本标注 和 圆圈标注 的问题