yaobao 发表于 2004-6-6 11:29:00

有资求助!

本人要在CAD里面弄一个画缓和曲线的ARX程序,源代码已经有了。但是对于ARX及VC++不了解,所以想请哪为高手帮忙!最好是已经编译好的了。谢谢!


<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 24pt"><FONT face="Times New Roman">AcDbObjectId CreateArc(AcGePoint3d center,double r,double starangle,double endangle)<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></FONT>


<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt">{<o:p></o:p>


<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 24pt"><FONT face="Times New Roman">AcDbArc * Parc = new AcDbArc (center,r,starangle,endangle);<o:p></o:p></FONT>


<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 24pt"><FONT face="Times New Roman">AcDbBlockTable * pBlockTable;<o:p></o:p></FONT>


<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 24pt"><FONT face="Times New Roman">AcdbHostApplicationServices() - &gt; workingDatabase() - &gt; getSymbolTable(pBlockTable, AcDb::kForRead);<o:p></o:p></FONT>


<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 24pt"><FONT face="Times New Roman">AcDbBlockTableRecord* pBockTableRecord;<o:p></o:p></FONT>


<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 24pt"><FONT face="Times New Roman">pBlockTable- &gt; getAt(ACDB_MODEL_SPACE, pBockTableRecord,AcDb:: kForWrite);<o:p></o:p></FONT>


<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 24pt"><FONT face="Times New Roman">pBlockTable- &gt;close();<o:p></o:p></FONT>


<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 24pt"><FONT face="Times New Roman">AcDbObjectId ArcID;<o:p></o:p></FONT>


<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 24pt"><FONT face="Times New Roman">pBockTableRecord- &gt;appendAcDbEntity(ArcID,pArc);<o:p></o:p></FONT>


<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 24pt"><FONT face="Times New Roman">pBockTableRecord- &gt; close();<o:p></o:p></FONT>


<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 24pt"><FONT face="Times New Roman">pArc- &gt; close();<o:p></o:p></FONT>


<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 24pt"><FONT face="Times New Roman">Return ArcID;<o:p></o:p></FONT>


<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt">}<o:p></o:p>


<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 24.1pt; mso-char-indent-count: 2.0; mso-char-indent-size: 12.05pt"><B>用</B><B><FONT face="Times New Roman">SPLINE</FONT></B><B>线模拟缓和曲线:</B>在<FONT face="Times New Roman">ObjectARX</FONT>系统中,系统向二次开发程序员提供了类<FONT face="Times New Roman">AcDbSpline</FONT>,利用<FONT face="Times New Roman">AcDbSpline</FONT>可以较好地模拟缓和曲线。<o:p></o:p>


<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 24pt; mso-char-indent-count: 2.0; mso-char-indent-size: 12.0pt">首先根据工程设计的精度要求,确定在缓和曲线上没间隔多少距离计算一个加点才能模拟缓和曲线,利用式(<FONT face="Times New Roman">2</FONT>)将加点计算后存放在数组类<FONT face="Times New Roman">AcGePoint3dArray points</FONT>中,然后生成<FONT face="Times New Roman">SPLINE</FONT>线:<o:p></o:p>


<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT face="Times New Roman">AcDbObjectId CreateSPLINE</FONT>(<FONT face="Times New Roman">AcGePoint3dArray points</FONT>)<o:p></o:p>


<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt">{<o:p></o:p>


<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 24pt"><FONT face="Times New Roman">AcDbSpline * pSpline = new AcDbSpline(Points,4,0.0);<o:p></o:p></FONT>


<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 24pt"><FONT face="Times New Roman">AcDbBlockTable * pBlockTable;<o:p></o:p></FONT>


<P class=MsoBodyTextIndent style="MARGIN: 0cm 0cm 0pt auto"><FONT face="Times New Roman" size=3>AcdbHostApplicationServices() - &gt; workingDatabase() - &gt; getSymbolTable(pBlockTable, AcDb::kForRead);</FONT>


<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 24pt; mso-char-indent-count: 2.0; mso-char-indent-size: 12.0pt"><FONT face="Times New Roman">AcDbBlockTableRecord* pBockTableRecord;<o:p></o:p></FONT>


<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 24pt"><FONT face="Times New Roman">pBlockTable- &gt; getAt(ACDB_MODEL_SPACE, pBockTableRecord,AcDb:: kForWrite);<o:p></o:p></FONT>


<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 24pt; mso-char-indent-count: 2.0; mso-char-indent-size: 12.0pt"><FONT face="Times New Roman">pBlockTable- &gt;close();<o:p></o:p></FONT>


<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 24pt; mso-char-indent-count: 2.0; mso-char-indent-size: 12.0pt"><FONT face="Times New Roman">AcDbObjectId SplineId;<o:p></o:p></FONT>


<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 24pt; mso-char-indent-count: 2.0; mso-char-indent-size: 12.0pt"><FONT face="Times New Roman">pBockTableRecord- &gt;appendAcDbEntity(ArcId,pArc);<o:p></o:p></FONT>


<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 24pt; mso-char-indent-count: 2.0; mso-char-indent-size: 12.0pt"><FONT face="Times New Roman">pBockTableRecord- &gt; close();<o:p></o:p></FONT>


<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 24pt; mso-char-indent-count: 2.0; mso-char-indent-size: 12.0pt"><FONT face="Times New Roman">pArc- &gt; close();<o:p></o:p></FONT>


<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 24pt; mso-char-indent-count: 2.0; mso-char-indent-size: 12.0pt"><FONT face="Times New Roman">Return       SplineId;<o:p></o:p></FONT>


页: [1]
查看完整版本: 有资求助!