<FONT style="BACKGROUND-COLOR: #f7f709">删除存在的选择集<BR>If ThisDrawing.SelectionSets.Count > 0 Then<BR> For i = 0 To ThisDrawing.SelectionSets.Count - 1<BR> ThisDrawing.SelectionSets.<FONT color=#f70968>Item(i).</FONT>Clear<BR> ThisDrawing.SelectionSets.<FONT color=#ee1169>Item(i).</FONT>Delete<BR> Next<BR>End If</FONT>
--------------------
上面的 <FONT color=#dd2292>item (i)</FONT> 中的 <FONT color=#e61abd>i </FONT>好象 要改成 常数 <FONT color=#2222dd>0 </FONT> 使用For i = ThisDrawing.SelectionSets.Count - 1 To 0就不需要。 <FONT face="Times New Roman" color=#000066 size=2><B><FONT style="BACKGROUND-COLOR: #ffff00" color=#f70909>efan2000: (13楼)使用For i = ThisDrawing.SelectionSets.Count - 1 To 0就不需要。</FONT><BR>------------------------------------------</B></FONT>
<FONT face="Times New Roman" size=2></FONT>
<FONT face="Times New Roman" color=#1111ee size=2>这行程序码不能省!</FONT> 是这样的,删除集合时,会引起集合中的数目变化。
For i = 0 To ThisDrawing.SelectionSets.Count - 1<BR> ThisDrawing.SelectionSets.Item(i).Clear<BR> ThisDrawing.SelectionSets.Item(i).Delete<BR>Next
比如:本来集合中的数目是5个,删除1个之后只有4个了,但计数器i的循环次数依然没有改变,是从0-4的,因而后面的就会出错,因为已经不存在了。
For i = ThisDrawing.SelectionSets.Count - 1 To 0 ThisDrawing.SelectionSets.Item(i).Clear<BR> ThisDrawing.SelectionSets.Item(i).Delete<BR>Next
计数器i的循环是从4-0的,所以没有影响。 vl
用get-area属性,vlax-curve系列很容易解决 做建筑的正需要这个。。谢了。。 mccad发表于2003-10-29 22:57:00static/image/common/back.gif注意程序需要加载VLAX类和CURVE类程序处理过程调用了(gc)来强制释放内存,不然会出错。Sub GetTolArea() ThisDrawing.SendCommand \"(vl-load-com)\" & vbCr
<p>此帖子必要认真研究一下。</p> <p>这个程序太好了,可以解决实际问题,如果再改进一点就更好了,</p><p>如果点在空处会出错,我真傻,明摆着要点框,我却去框选。</p><p>实际应用中,如果要多次框选,如何修改?</p>