这样写代码为何无法隐藏选择的对象?
========================================================Public Sub HideSelect()
Dim SeleObjts As AcadSelectionSet
CreateSelectionSet SeleObjts, "Seleobjts": SeleObjts.SelectOnScreen
Dim Objt As AcadEntity
For Each Objt In SeleObjts
Objt.Visible = False
Next Objt
ThisDrawing.Regen acAllViewports
End Sub
========================================================
上述代码为何无法隐藏选择的对象?
尝试过,只显示选择的对象是可以的,呵呵,,,,
这里十分奇怪啊,,,,请高手指教。 如果你的CreateSelectionSet 没问题,这代码应该没问题 zzyong00 发表于 2019-6-7 12:48
如果你的CreateSelectionSet 没问题,这代码应该没问题
我已经尝试过,选择对象后,只显示是可以的,就是将其他对象的 visible 属性设置为 false。所以我选择对象这个自编函数应该是没有问题的。
现在就是“隐藏选择对象”不行,所以很奇怪。
我等下将所有代码都贴上来: zzyong00 发表于 2019-6-7 12:48
如果你的CreateSelectionSet 没问题,这代码应该没问题
Public Sub CreateSelectionSet(SeleObjects As AcadSelectionSet, Name As String)
On Error Resume Next
If Not IsNull(ThisDrawing.SelectionSets.Item(Name)) Then
Set SeleObjects = ThisDrawing.SelectionSets.Item(Name)
SeleObjects.Delete
End If
Set SeleObjects = ThisDrawing.SelectionSets.Add(Name)
End Sub
==========================================================
Public Sub HideSelect()
Dim SeleObjts As AcadSelectionSet
CreateSelectionSet SeleObjts, "Seleobjts": SeleObjts.SelectOnScreen
On Error Resume Next
Dim Objt As AcadEntity
For Each Objt In SeleObjts
Objt.Visible = False
Next Objt
ThisDrawing.Regen acAllViewports
End Sub
页:
[1]