[请问]如何遍历一条多义线的顶点并将它加到一个resbuf中?
<p>[请问]如何遍历一条多义线的顶点并将它加到一个resbuf中?</p><p>我想让用户指定一条多义线,并将它作为acedSSGet("F")需要的内容。应该如何把顶点内容加到resbuf中呢?</p><p>谢谢!!</p> <p>应该和 <a href="http://bbs.mjtd.com/forum.php?mod=viewthread&tid=59270">http://bbs.mjtd.com/forum.php?mod=viewthread&tid=59270</a></p><p>这点里面讲的涵数一样的意思,. 但是我还不会,呵呵,会的朋友请贴个代码参考一下吧</p> <p>sample下关于扩展数据中有关于resbuf指针的详细用法,贴一下罢</p><p> addXdata() <br/>{<br/> AcDbObject* pObj = selectObject(AcDb::kForRead);<br/> if (!pObj) {<br/> acutPrintf("Error selecting object\n");<br/> return;<br/> }</p><p> <br/> // Get the application name and string to be added to<br/> // xdata.<br/> //<br/> char appName, resString;<br/> appName = resString = '\0';</p><p> acedGetString(NULL, "Enter application name: ",<br/> appName);<br/> acedGetString(NULL, "Enter string to be added: ",<br/> resString);</p><p> <br/> struct resbuf *pRb, *pTemp;<br/> <br/> pRb = pObj->xData(appName);</p><p> if (pRb != NULL) {</p><p> // If xdata is present, then walk to the<br/> // end of the list.<br/> //<br/> for (pTemp = pRb; pTemp->rbnext != NULL;<br/> pTemp = pTemp->rbnext)<br/> { ; }<br/> } else {<br/> // If xdata is not present, register the application<br/> // and add appName to the first resbuf in the list.<br/> // Notice that there is no -3 group as there is in<br/> // AutoLISP. This is ONLY the xdata so<br/> // the -3 xdata-start marker isn't needed.<br/> // <br/> acdbRegApp(appName);</p><p> pRb = acutNewRb(AcDb::kDxfRegAppName);<br/> pTemp = pRb;<br/> pTemp->resval.rstring<br/> = (char*) malloc(strlen(appName) + 1);<br/> strcpy(pTemp->resval.rstring, appName);<br/> }</p><p> // Add user-specified string to the xdata.<br/> //<br/> pTemp->rbnext = acutNewRb(AcDb::kDxfXdAsciiString);<br/> pTemp = pTemp->rbnext;<br/> pTemp->resval.rstring<br/> = (char*) malloc(strlen(resString) + 1);<br/> strcpy(pTemp->resval.rstring, resString);</p><p> // The following code shows the use of upgradeOpen()<br/> // to change the entity from read to write.<br/> //<br/> pObj->upgradeOpen();<br/> pObj->setXData(pRb);<br/> <br/> pObj->close();<br/> acutRelRb(pRb);<br/>}</p><p></p><p>当数据个数不确定时,用上面的方法,当数据个数确定时,用acutBuildList更方便</p> <p>谢谢!问题解决了!</p> <p>当数据个数不确定时,用acutBuildList也很方便</p><p> struct resbuf *pointlist;<br/> ads_point pt;</p><p>for(int i=1; i < n; i++){</p><p>pt=XXX;</p><p>pointlist= acutBuildList(RTRESBUF, pointlist, RTPOINT, pt, 0);</p><p>}</p> 哦,还能这样用,那用acutBuildList确实方便多了, liub1979 发表于 2008-4-7 21:03当数据个数不确定时,用acutBuildList也很方便 struct resbuf *pointlist; ads_point pt;for(int...
好像会有异常
页:
[1]