为什么以Polyline为边界的填充图形不显示呢?
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT face="Times New Roman"> AcDbHatch *p_AcDbHatch;</FONT><P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT face="Times New Roman"> AcGeDoubleArray m_AcGeDoubleArray;</FONT>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT face="Times New Roman"> AcGePoint3d m_AcGepoint3d1;</FONT>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT face="Times New Roman"> AcGePoint3d m_AcGepoint3d2;</FONT>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT face="Times New Roman"> <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></FONT>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT face="Times New Roman"> double m_bulge; for(j=0;j<p_line_lunkuo->numVerts();j++) //</FONT>遍历<FONT face="Times New Roman">AcDbPolyline</FONT>各点
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT face="Times New Roman"> {</FONT>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT face="Times New Roman"> p_line_lunkuo->getPointAt(j,m_AcGepoint3d);</FONT>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT face="Times New Roman"> m_AcGepoint2d.x=m_AcGepoint3d.x;</FONT>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT face="Times New Roman"> m_AcGepoint2d.y=m_AcGepoint3d.y;</FONT>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT face="Times New Roman"> m_AcGePoint2dArray.append(m_AcGepoint2d);</FONT>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT face="Times New Roman"> p_line_lunkuo->getBulgeAt(j,m_bulge);</FONT>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT face="Times New Roman"> m_AcGeDoubleArray.append(m_bulge);</FONT>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT face="Times New Roman"> </FONT>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT face="Times New Roman"> }</FONT>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT face="Times New Roman"> <o:p></o:p></FONT>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT face="Times New Roman"> m_xdmianjilunkuoIdArray.append(p_line_lunkuo->objectId());</FONT>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT face="Times New Roman"> </FONT>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 63pt; TEXT-INDENT: 21pt"><FONT face="Times New Roman">p_AcDbHatch=new AcDbHatch();</FONT>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT face="Times New Roman"> p_AcDbHatch->setNormal(normal);</FONT>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT face="Times New Roman"> p_AcDbHatch->setElevation(0.0);</FONT>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT face="Times New Roman"> p_AcDbHatch->setAssociative(Adesk::kTrue);</FONT>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT face="Times New Roman"> p_AcDbHatch->setPatternScale(5);</FONT>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT face="Times New Roman"> p_AcDbHatch->setPattern(AcDbHatch::kPreDefined,"ANSI31");</FONT>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT face="Times New Roman"> p_AcDbHatch->setHatchStyle(AcDbHatch::kNormal);</FONT>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT face="Times New Roman"> p_AcDbHatch->evaluateHatch();</FONT>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT face="Times New Roman"> p_AcDbHatch->setColorIndex(3);</FONT>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT face="Times New Roman"> </FONT>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT face="Times New Roman"> p_AcDbHatch->appendLoop(AcDbHatch::kExternal,m_xdmianjilunkuoIdArray);//</FONT>用这句不行
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT face="Times New Roman"> p_AcDbHatch->appendLoop(AcDbHatch::kExternal,m_AcGePoint2dArray, m_AcGeDoubleArray);// /</FONT>用这句也不行
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT face="Times New Roman"> <o:p></o:p></FONT>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT face="Times New Roman"> addEntityToDbs_ACDB_MODEL_SPACE(p_AcDbHatch);//</FONT>这是一个将实体加入到数据库的函数
回复
<FONT face="Times New Roman">你加这句没有?</FONT><FONT face="Times New Roman">p_AcDbHatch->close();</FONT> <FONT face="Times New Roman">addEntityToDbs_ACDB_MODEL_SPACE(p_AcDbHatch);</FONT>函数中有将<FONT face="Times New Roman">p_AcDbHatch关闭的语句。</FONT> 测试一下<FONT face="Times New Roman">p_AcDbHatch->appendLoop的返回值,八成是边界有错误。</FONT> 你的函数中p_AcDbHatch->evaluateHatch();这一条语句是根据条模式来计算填充边界的.执行之前应该首先设置好填充边界和填充图案,<FONT face="Times New Roman"></FONT>
<FONT face="Times New Roman">p_AcDbHatch->appendLoop(AcDbHatch::kExternal,m_xdmianjilunkuoIdArray);</FONT>
<FONT face="Times New Roman">把这条语句移动前面,接着设置图案,就可以了</FONT> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT face="Times New Roman">p_AcDbHatch->appendLoop(AcDbHatch::kExternal,m_xdmianjilunkuoIdArray);</FONT>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT face="Times New Roman">p_AcDbHatch->evaluateHatch();</FONT>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT face="Times New Roman">addEntityToDbs_ACDB_MODEL_SPACE(p_AcDbHatch);//</FONT>这是一个将实体加入到数据库的函数
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt">
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt">这样改动多线段中是设置了填充图案,但是它不是立刻显示出来,而是将图形文件存盘后再读出,方显示出刚刚填充的图案。这我也是无意中发现的。因为代码照<A name=74017><FONT color=#000066><B>dipenghao</B></FONT></A>先生所说的改动之后,还是不能立刻显示出填充图案,我就将图形存盘,再次打开后却显示出填充图案。连续式了几次,均是这个结果。下一步我该如何做呢?
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"> 我运行的时候没有出现这个问题.我的函数给你你运新一下试试
有问题再告诉我 <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT face="Times New Roman"><A name=74220><FONT color=#000066><B>dipenghao</B></FONT></A>先生,比照您的函数,我也将所有的有关p_AcDbHatch调用作是否出错检查,发现p_AcDbHatch->evaluateHatch(false);出错,以至于造成了填充图形未能即可显示的结果。(存盘关闭后再取回访可显示)但是,由于我的什么原因造成p_AcDbHatch->evaluateHatch(false);的调用出错呢?</FONT>
页:
[1]