成功了
调试通过的代码:// ----- asdkDynRb._DYNRB command (do not rename)<BR> static void asdkDynRb_DYNRB(void)<BR> {<BR> // Add your code for command asdkDynRb._DYNRB here<BR> ads_point firstpt, pick, lastpt;<BR> int nRet;<BR> ads_name ss;<BR> struct resbuf *ptList = NULL;<BR> struct resbuf *rbTrav ;<BR> struct resbuf *newRb;<BR> Adesk::Boolean keepPicking = Adesk::kTrue;<BR> Adesk::Boolean firstPick = Adesk::kTrue;
while (keepPicking)<BR> {<BR> if (firstPick)<BR> {<BR> nRet = acedGetPoint(NULL, "\nPick first point: ", pick);<BR> acdbPointSet(pick, firstpt);<BR> firstPick = Adesk::kFalse;
newRb = acutNewRb(RTPOINT);<BR> newRb->resval.rpoint = pick;<BR> newRb->resval.rpoint = pick;<BR> newRb->resval.rpoint = pick;<BR> ptList = newRb;<BR> rbTrav = newRb;<BR> }<BR> else<BR> {<BR> acdbPointSet(pick, lastpt);<BR> nRet = acedGetPoint(pick, "\nPick next point - for exit: ", pick);<BR> <BR> if (nRet != RTNORM)<BR> {<BR> acedGrDraw(lastpt, firstpt, 1, 0);<BR> keepPicking = Adesk::kFalse;<BR> break;<BR> }
acedGrDraw(lastpt, pick, 1, 0);<BR> newRb = acutNewRb(RTPOINT);<BR> newRb->resval.rpoint = pick;<BR> newRb->resval.rpoint = pick;<BR> newRb->resval.rpoint = pick;<BR> rbTrav->rbnext = newRb;<BR> rbTrav = rbTrav->rbnext;<BR> <BR> }<BR> }// while<BR> <BR> // Clear out the grdraw drawn vectors<BR> //acedRedraw(NULL, 1);
rbTrav->rbnext = NULL;
<BR> nRet = acedSSGet("CP", ptList, NULL, NULL, ss);
if (nRet == RTNORM)<BR> {<BR> long nEnts;<BR> nRet = acedSSLength(ss, &nEnts);<BR> if (nRet == RTNORM) {<BR> CString str;<BR> str.Format("%d", nEnts);<BR> acedAlert(str);<BR> for (int i = 0; i < nEnts; i++) {<BR> ads_name eName;<BR> acedSSName(ss, i, eName);<BR> AcDbObjectId id;<BR> acdbGetObjectId(id, eName);<BR> AcDbObjectPointer<AcDbEntity> ent (id, AcDb::kForRead);<BR> if (ent.openStatus() == Acad::eOk) {<BR> ent->highlight();<BR> }<BR> }<BR> }<BR> }<BR> else<BR> acedAlert("选择失败");
if (ss)<BR> acedSSFree(ss);<BR> }
newRb = acutNewRb(RTPOINT);<BR> newRb->resval.rpoint = pick;<BR> newRb->resval.rpoint = pick;<BR> newRb->resval.rpoint = pick;<BR> rbTrav->rbnext = newRb;<BR>
改成
rbTrav->rbnext = acutBuildList(RTPOINT, pick, RTNONE);
试试看。
不行的话你把跟踪的结果告诉我。
回复
问题并不在那儿:rbTrav->rbnext = NULL;
相当于
newRb = acutNewRb(RTNONE);
这与你的 rbTrav->rbnext = acutBuildList(RTPOINT, pick, RTNONE); 中的RTNONE可能是冲突的.
总之现在可以了, 感谢<A name=54748><FONT color=#000066><B>zfbj</B></FONT></A>. 这样的讨论气氛挺好的.
回复
按你说的我试试. 不用客气,大家相互合作,互相提高吧。回复
试过了,rbTrav->rbnext = newRb;<BR> //rbTrav->rbnext = acutBuildList(RTPOINT, pick, RTNONE);
两种写法都可以,
//rbTrav->rbnext = NULL; 一句似乎也没起什么作用,
还是以前的建立链表代码有问题.
更改后的代码: // ----- asdkDynRb._DYNRB command (do not rename)<BR> static void asdkDynRb_DYNRB(void)<BR> {<BR> // Add your code for command asdkDynRb._DYNRB here<BR> ads_point firstpt, pick, lastpt;<BR> int nRet;<BR> ads_name ss;<BR> struct resbuf *ptList = NULL;<BR> struct resbuf *rbTrav ;<BR> Adesk::Boolean keepPicking = Adesk::kTrue;<BR> Adesk::Boolean firstPick = Adesk::kTrue; while (keepPicking)<BR> {<BR> if (firstPick)<BR> {<BR> nRet = acedGetPoint(NULL, "\nPick first point: ", pick);<BR> acdbPointSet(pick, firstpt);<BR> firstPick = Adesk::kFalse; ptList = acutBuildList(RTPOINT, pick, RTNONE);<BR> rbTrav = ptList;<BR> }<BR> else<BR> {<BR> acdbPointSet(pick, lastpt);<BR> nRet = acedGetPoint(pick, "\nPick next point - for exit: ", pick);<BR> <BR> if (nRet != RTNORM)<BR> {<BR> acedGrDraw(lastpt, firstpt, 1, 0);<BR> keepPicking = Adesk::kFalse;<BR> break;<BR> } acedGrDraw(lastpt, pick, 1, 0); rbTrav->rbnext = acutBuildList(RTPOINT, pick, RTNONE);<BR> rbTrav = rbTrav->rbnext;<BR> }<BR> }// while<BR> <BR> // Clear out the grdraw drawn vectors<BR> //acedRedraw(NULL, 1); nRet = acedSSGet("CP", ptList, NULL, NULL, ss); if (nRet == RTNORM)<BR> {<BR> long nEnts;<BR> nRet = acedSSLength(ss, &nEnts);<BR> if (nRet == RTNORM) {<BR> CString str;<BR> str.Format("%d", nEnts);<BR> acedAlert(str);<BR> for (int i = 0; i < nEnts; i++) {<BR> ads_name eName;<BR> acedSSName(ss, i, eName);<BR> AcDbObjectId id;<BR> acdbGetObjectId(id, eName);<BR> AcDbObjectPointer<AcDbEntity> ent (id, AcDb::kForRead);<BR> if (ent.openStatus() == Acad::eOk) {<BR> ent->highlight();<BR> }<BR> }<BR> }<BR> }<BR> else<BR> acedAlert("选择失败"); if (ss)<BR> acedSSFree(ss);<BR> }
newRb = acutNewRb(RTPOINT);<BR> newRb->resval.rpoint = pick;<BR> newRb->resval.rpoint = pick;<BR> newRb->resval.rpoint = pick;<BR> rbTrav->rbnext = newRb;<BR> rbTrav = rbTrav->rbnext;<BR>为何不行???
一定要这个么??rbTrav->rbnext = acutBuildList(RTPOINT, pick, RTNONE);<BR> 仔细看看上面的贴子.
newRb = acutNewRb(RTPOINT);<BR> newRb->resval.rpoint = pick;<BR> newRb->resval.rpoint = pick;<BR> newRb->resval.rpoint = pick;<BR> rbTrav->rbnext = newRb;<BR> rbTrav = rbTrav->rbnext;
也可以呀,
rbTrav->rbnext = acutBuildList(RTPOINT, pick, RTNONE);这是zfbj后来给出的方法. 你2楼的代码怎么通不过???
真奇怪!! 多谢<A name=55195><FONT color=#990000><B>easypower</B></FONT></A>
<TABLE cellPadding=4 cellSpacing=0 width="100%">
<TBODY>
<TR>
<TD style="FILTER: glow(color=#9898BA,strength=2)" vAlign=center width=*><A name=54829><FONT color=#990000><B>王咣生</B></FONT></A> <A name=54748><FONT color=#000066><B>zfbj</B></FONT></A> 三位, 尤其是zfbj,不愧为超级版主 ,</TD></TR></TBODY></TABLE>,我现在正在做二次开发方面的,以后还请三位多多指教,给三位送花 呵呵