PickfirstSelectionSet选择集的问题?
<p>在VBA中使用PickfirstSelectionSet选择集的方法,在本论坛已经被讨论过了。在我的程序中因要利用PickfirstSelectionSet选择集,就按这些方法试了试。发现仅调用一次PickfirstSelectionSet选择集时,没有问题。但当多次调用PickfirstSelectionSet选择集时,还是有错误发生。不知道为什么?</p><p>程序如下:</p><p>Option Explicit<br/>Public Sub PFSS()</p><p> Dim ssetObj As AcadSelectionSet<br/> Dim obj As AcadObject<br/> Set ssetObj = PickFirstSSet<br/> If Not (ssetObj Is Nothing) Then<br/> For Each obj In ssetObj<br/> obj.Delete<br/> Next<br/> MsgBox ssetObj.Count & " object(s) deleted"<br/> End If<br/> <br/>End Sub<br/>Function PickFirstSSet() As AcadSelectionSet<br/> On Error Resume Next<br/> ThisDrawing.SelectionSets("PICKFIRST").Delete<br/> On Error GoTo 0<br/> Set PickFirstSSet = ThisDrawing.PickfirstSelectionSet<br/>End Function</p><p>'<br/>';;;下面是运行该VBA的LSP<br/>';;; Path of PickFirstSelectSet.dvb is supposed as "...\\AutoCAD\\"<br/>';;;<br/>'(defun c:ccVLA ()<br/>' (princ)<br/>' (setq envcmd (getvar "CMDECHO"))<br/>' (setvar "CMDECHO" 0)<br/>' (vl-load-com)<br/>' (vla-runmacro (vlax-get-acad-object) (strcat (vla-get-path (vlax-get-acad-object)) "<a href="file://\\PFSSet.dvb!PFSS">\\PFSSet.dvb!PFSS</a>"))<br/>' (setvar "CMDECHO" envcmd)<br/>' (princ)<br/>')<br/></p><p></p> <p>Not (ssetObj Is Nothing) </p><p>不知道用的对不对?</p><p>是不是要通过ssetObj.Count来限定一下?</p> <p>第二次调用时,错误发生在函数PickFirstSSet() 的</p><p> Set PickFirstSSet = ThisDrawing.PickfirstSelectionSet<br/>语句。</p><p>该函数引用站内mccad发的帖子</p>
页:
[1]