2008-08-29

For my next trick...

OK. I spoke about it before, so now I will show how to make the entities disappear. No peeking... Oh, enough of that. Feed this SUB your selection set and tada. Presto change-o, it has disappeared. Stay tuned.


Public Sub MakeObjSsInvisible(ByRef acSS As AcadSelectionSet)
'------------------------------------------------------------------------------
'
'Arguments: AutoCAD selection set
'Returns: None
'Caveats: Must unlock the layer they reside on first or it does not work
'------------------------------------------------------------------------------
Dim sCurrLyr As String
Dim objLayer As Object ' AcadLayer
Dim objLayers As Object 'AcadLayers
Dim acEnt As AcadObject
'''''''''''''''''''''''''''''''''''''''
For Each acEnt In acSS
sCurrLyr = acEnt.layer
Set objLayer = objLayers.Item(sCurrLyr)
If objLayer.Lock Then
objLayer.Lock = False 'unlock it
acEnt.Visible = False
objLayer.Lock = True 'lock it back up
Else
acEnt.Visible = False
End If
acEnt.Update
Next

If Not acSS Is Nothing Then
acSS.Delete
End If

End Sub

No comments: