快帮我看看这个有关"选择集"子程序怎么运行不了啊???
<P>下面编码先判断选择集是否存在再对其操作,可运行后老是弹出"未找到关键字"的错误信息.就是不知道问题出在哪里?请高手帮我看看!!!</P><P>Sub addrelativitylin()<BR> Dim lineSelection1 As AcadSelectionSet<BR> If Not IsNull(ThisDrawing.SelectionSets.Item("lineSelection1")) Then<BR> Set lineSelection1 = ThisDrawing.SelectionSets.Item("NewSelectionSet")<BR> selset.Delete<BR> End If<BR> Set lineSelection1 = ThisDrawing.SelectionSets.Add("NewSelectionSet")<BR> MsgBox "the new is" & lineSelection1.Name, vbInformation, "SelectionSets Example"<BR>End Sub</P> selset.Delete 改为lineSelection1.delete 试试 <P>不行啊,用楼上的方法还是出现弹出"未找到关键字"的错误信息. </P>
<P>调试的时候提示好象是" If Not IsNull(ThisDrawing.SelectionSets.Item("lineSelection1")) Then" 这里出了什么问题!</P>
<P> 可就是不知道在哪里出了问题</P>
<P> </P> <DIV>Function CreateSelectionSet(Optional SSetName As String = "mjtd") As AcadSelectionSet<BR> On Error Resume Next<BR> ThisDrawing.SelectionSets(SSetName).Delete<BR> Set CreateSelectionSet = ThisDrawing.SelectionSets.Add(SSetName)<BR>End Function</DIV>
<DIV>用这段试试</DIV> <P>用"On Error Resume Next" 可以了</P>
<P>谢谢楼上大哥了<BR></P> <P>我用Sset.SelectOnScreen给新建的选择集添加对象,可老是选不上对象,下面代码没反应,请高手们帮我看看把</P>
<P>Sub addrelativityline()<BR> Dim lineSelection1 As AcadSelectionSet<BR> On Error Resume Next<BR> ThisDrawing.SelectionSets("SSl").Delet<BR> Set lineSelection1 = ThisDrawing.SelectionSets.Add("SSl")<BR> Sset.SelectOnScreen<BR> ThisDrawing.ModelSpace.lineSelection1.Erase<BR>End Sub</P>
页:
[1]